Skip to content

Commit

Permalink
Merge pull request #25 from Drommedhar/next-release
Browse files Browse the repository at this point in the history
# 2.0.5.2

* Fix crash if old stored game path no longer exists
* Fix saved library game path not being updated if changed
* Fix crash with version string being in invalid format
* Apply code style to whole code base
  • Loading branch information
Drommedhar authored Nov 10, 2024
2 parents 5aa8141 + 39095dc commit 4acbb09
Show file tree
Hide file tree
Showing 77 changed files with 3,428 additions and 2,632 deletions.
19 changes: 19 additions & 0 deletions DLSSUpdater.Tests/DLSSUpdater.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0-windows</TargetFrameworks>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\DlssUpdater\DLSSUpdater.csproj" />
</ItemGroup>

</Project>
87 changes: 87 additions & 0 deletions DLSSUpdater.Tests/Helpers/SafeVersionTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
using System;
using DLSSUpdater.Helpers;
using NUnit.Framework;

namespace DLSSUpdater.Tests.Helpers;

[TestFixture]
[TestOf(typeof(SafeVersion))]
public class SafeVersionTest
{
[Test]
public void StringToSafeVersion()
{
var version = "1.2.3.4";
var safeVersion = new SafeVersion(version);
Assert.That(safeVersion.ToString(), Is.EqualTo("1.2.3.4"));

version = "10.20.30.40";
safeVersion = new SafeVersion(version);
Assert.That(safeVersion.ToString(), Is.EqualTo("10.20.30.40"));

version = "1.2.3.4.u";
safeVersion = new SafeVersion(version);
Assert.That(safeVersion.ToString(), Is.EqualTo("1.2.3.4"));

version = "1-2-3-4";
safeVersion = new SafeVersion(version);
Assert.That(safeVersion.ToString(), Is.EqualTo("1.2.3.4"));

version = "1a2ab3ac4aa";
safeVersion = new SafeVersion(version);
Assert.That(safeVersion.ToString(), Is.EqualTo("1.2.3.4"));

version = "xx1a-2abx3ac*4aa+";
safeVersion = new SafeVersion(version);
Assert.That(safeVersion.ToString(), Is.EqualTo("1.2.3.4"));

version = "xx1a-2abx3ac*4aa+5rtuz;";
safeVersion = new SafeVersion(version);
Assert.That(safeVersion.ToString(), Is.EqualTo("1.2.3.4"));
}

[Test]
public void VersionToSafeVersion()
{
var version = new Version(1, 2, 3,4);
var safeVersion = new SafeVersion(version);
Assert.That((Version)safeVersion, Is.EqualTo(version));

version = new Version(1, 0, 0, 1);
safeVersion = new SafeVersion(version);
Assert.That((Version)safeVersion, Is.EqualTo(version));

version = new Version(1, 0);
safeVersion = new SafeVersion(version);
Assert.That((Version)safeVersion, Is.EqualTo(version));

version = new Version(1, 0, 0, 0);
safeVersion = new SafeVersion(version);
Assert.That((Version)safeVersion, Is.EqualTo(version));

version = new Version(1, 2, 3, 0);
safeVersion = new SafeVersion(version);
Assert.That((Version)safeVersion, Is.EqualTo(version));

version = new Version(1, 2, 3);
safeVersion = new SafeVersion(version);
Assert.That((Version)safeVersion, Is.EqualTo(version));

version = new Version(1, 2);
safeVersion = new SafeVersion(version);
Assert.That((Version)safeVersion, Is.EqualTo(version));
}

[Test]
public void CheckIfVersionIsSafe()
{
var safeVersion = new SafeVersion("1");
Assert.That(safeVersion.ToString(), Is.EqualTo("1.0.0.0"));

safeVersion = new SafeVersion("1.2");
Assert.That(safeVersion.ToString(), Is.EqualTo("1.2.0.0"));

safeVersion = new SafeVersion("1.2.3");
Assert.That(safeVersion.ToString(), Is.EqualTo("1.2.3.0"));
}
}
6 changes: 6 additions & 0 deletions DLSSUpdater.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ VisualStudioVersion = 17.9.34607.119
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DLSSUpdater", "DlssUpdater\DLSSUpdater.csproj", "{891674A2-74FE-4E71-A18E-859680E25E98}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DLSSUpdater.Tests", "DLSSUpdater.Tests\DLSSUpdater.Tests.csproj", "{43C6713F-2567-4400-A617-0684C22F987C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Expand All @@ -15,6 +17,10 @@ Global
{891674A2-74FE-4E71-A18E-859680E25E98}.Debug|x64.Build.0 = Debug|x64
{891674A2-74FE-4E71-A18E-859680E25E98}.Release|x64.ActiveCfg = Release|x64
{891674A2-74FE-4E71-A18E-859680E25E98}.Release|x64.Build.0 = Release|x64
{43C6713F-2567-4400-A617-0684C22F987C}.Debug|x64.ActiveCfg = Debug|Any CPU
{43C6713F-2567-4400-A617-0684C22F987C}.Debug|x64.Build.0 = Debug|Any CPU
{43C6713F-2567-4400-A617-0684C22F987C}.Release|x64.ActiveCfg = Release|Any CPU
{43C6713F-2567-4400-A617-0684C22F987C}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
18 changes: 18 additions & 0 deletions DLSSUpdater.sln.DotSettings.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAssert_002Ecs_002Fl_003AC_0021_003FUsers_003Fdomin_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F53539022a55f40bd95b3200c33b231c074e00_003F65_003F7669dcf3_003FAssert_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AEnumerable_002Ecs_002Fl_003AC_0021_003FUsers_003Fdomin_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fcca5cfb955e146648d91eb22ffe4627a84930_003Fa0_003Ff6ea3ed0_003FEnumerable_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFileSystemEnumerator_002EWindows_002Ecs_002Fl_003AC_0021_003FUsers_003Fdomin_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F422299c1e1233f1a20b8c0654281f74792424fe87e29abaf4ecfcd0cd64d718_003FFileSystemEnumerator_002EWindows_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AVersion_002Ecs_002Fl_003AC_0021_003FUsers_003Fdomin_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fbda1a8aceb88de87254065a2ded795c3953da7c42a269ae5bbb443973798b75_003FVersion_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:Boolean x:Key="/Default/Environment/UnitTesting/CreateUnitTestDialog/ShowAdvancedOptions/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/Environment/UnitTesting/CreateUnitTestDialog/TestProjectMapping/=891674A2_002D74FE_002D4E71_002DA18E_002D859680E25E98/@EntryIndexedValue">DLSSUpdater.Tests</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/CreateUnitTestDialog/TestTemplateMapping/=NUnit3x/@EntryIndexedValue">db4927dd-2e12-48a7-9a84-2b7e3e31b9c8</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=35466c2e_002Df322_002D4413_002D8d9b_002D0b19d0251add/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="StringToSafeVersion" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;TestAncestor&gt;&#xD;
&lt;TestId&gt;NUnit3x::43C6713F-2567-4400-A617-0684C22F987C::net8.0-windows::DLSSUpdater.Tests.Helpers.SafeVersionTest&lt;/TestId&gt;&#xD;
&lt;/TestAncestor&gt;&#xD;
&lt;/SessionState&gt;</s:String>




</wpf:ResourceDictionary>
Loading

0 comments on commit 4acbb09

Please sign in to comment.