diff --git a/Onova.Tests/Extracting/NugetPackageSpecs.cs b/Onova.Tests/Extracting/NugetPackageSpecs.cs index 2eb6c57..e196b38 100644 --- a/Onova.Tests/Extracting/NugetPackageSpecs.cs +++ b/Onova.Tests/Extracting/NugetPackageSpecs.cs @@ -41,12 +41,12 @@ public async Task ExtractPackageAsync_Test() // Arrange var entries = new Dictionary { - ["File1.bin"] = new byte[] { 1, 2, 3 }, - ["File2.bin"] = new byte[] { 4, 5, 6 }, - ["SubDir1/"] = new byte[0], - ["SubDir1/File3.bin"] = new byte[] { 7, 8, 9 }, - ["SubDir1/SubDir2/"] = new byte[0], - ["SubDir1/SubDir2/File4.bin"] = new byte[] { 10, 11, 12 } + ["File1.bin"] = [1, 2, 3], + ["File2.bin"] = [4, 5, 6], + ["SubDir1/"] = [], + ["SubDir1/File3.bin"] = [7, 8, 9], + ["SubDir1/SubDir2/"] = [], + ["SubDir1/SubDir2/File4.bin"] = [10, 11, 12], }; var packageFilePath = Path.Combine(TempDirPath, "Package.nupkg"); diff --git a/Onova.Tests/Extracting/ZipPackageSpecs.cs b/Onova.Tests/Extracting/ZipPackageSpecs.cs index 6ca3b90..e0a1971 100644 --- a/Onova.Tests/Extracting/ZipPackageSpecs.cs +++ b/Onova.Tests/Extracting/ZipPackageSpecs.cs @@ -37,12 +37,12 @@ public async Task I_can_configure_packages_to_be_treated_as_zip_archives() // Arrange var entries = new Dictionary { - ["File1.bin"] = new byte[] { 1, 2, 3 }, - ["File2.bin"] = new byte[] { 4, 5, 6 }, - ["SubDir1/"] = new byte[0], - ["SubDir1/File3.bin"] = new byte[] { 7, 8, 9 }, - ["SubDir1/SubDir2/"] = new byte[0], - ["SubDir1/SubDir2/File4.bin"] = new byte[] { 10, 11, 12 } + ["File1.bin"] = [1, 2, 3], + ["File2.bin"] = [4, 5, 6], + ["SubDir1/"] = [], + ["SubDir1/File3.bin"] = [7, 8, 9], + ["SubDir1/SubDir2/"] = [], + ["SubDir1/SubDir2/File4.bin"] = [10, 11, 12], }; var packageFilePath = Path.Combine(TempDirPath, "Package.zip"); diff --git a/Onova.Tests/Resolving/AggregateSourceSpecs.cs b/Onova.Tests/Resolving/AggregateSourceSpecs.cs index 9685787..d66c75d 100644 --- a/Onova.Tests/Resolving/AggregateSourceSpecs.cs +++ b/Onova.Tests/Resolving/AggregateSourceSpecs.cs @@ -71,9 +71,9 @@ public async Task I_can_use_multiple_different_package_sources_at_once() // Arrange var availablePackages = new Dictionary { - [Version.Parse("1.0")] = new byte[] { 1, 2, 3 }, - [Version.Parse("2.0")] = new byte[] { 4, 5, 6 }, - [Version.Parse("3.0")] = new byte[] { 7, 8, 9 } + [Version.Parse("1.0")] = [1, 2, 3], + [Version.Parse("2.0")] = [4, 5, 6], + [Version.Parse("3.0")] = [7, 8, 9], }; var resolver = CreateAggregatePackageResolver(availablePackages); @@ -97,7 +97,7 @@ public async Task When_using_multiple_different_package_sources_at_once_packages { Version.Parse("1.0"), Version.Parse("2.0"), - Version.Parse("3.0") + Version.Parse("3.0"), }; var resolver = CreateAggregatePackageResolver(availableVersions); diff --git a/Onova.Tests/Resolving/LocalSourceSpecs.cs b/Onova.Tests/Resolving/LocalSourceSpecs.cs index cae2aea..b4d6109 100644 --- a/Onova.Tests/Resolving/LocalSourceSpecs.cs +++ b/Onova.Tests/Resolving/LocalSourceSpecs.cs @@ -46,9 +46,9 @@ public async Task I_can_use_a_local_directory_as_a_package_source() // Arrange var availablePackages = new Dictionary { - [Version.Parse("1.0")] = new byte[] { 1, 2, 3 }, - [Version.Parse("2.0")] = new byte[] { 4, 5, 6 }, - [Version.Parse("3.0")] = new byte[] { 7, 8, 9 } + [Version.Parse("1.0")] = [1, 2, 3], + [Version.Parse("2.0")] = [4, 5, 6], + [Version.Parse("3.0")] = [7, 8, 9], }; var resolver = CreateLocalPackageResolver(availablePackages); @@ -72,7 +72,7 @@ public async Task When_using_a_local_directory_as_a_package_source_packages_are_ { Version.Parse("1.0"), Version.Parse("2.0"), - Version.Parse("3.0") + Version.Parse("3.0"), }; var resolver = CreateLocalPackageResolver(availableVersions); diff --git a/Onova.Tests/UpdateSpecs.cs b/Onova.Tests/UpdateSpecs.cs index e57ed51..5671275 100644 --- a/Onova.Tests/UpdateSpecs.cs +++ b/Onova.Tests/UpdateSpecs.cs @@ -65,7 +65,7 @@ public async Task I_can_check_for_updates_and_get_a_higher_version_if_it_is_avai { Version.Parse("1.0"), Version.Parse("2.0"), - Version.Parse("3.0") + Version.Parse("3.0"), }; using var updateManager = new UpdateManager( @@ -106,7 +106,7 @@ public async Task I_can_check_for_updates_and_get_nothing_if_there_is_no_higher_ { Version.Parse("1.0"), Version.Parse("2.0"), - Version.Parse("3.0") + Version.Parse("3.0"), }; using var updateManager = new UpdateManager( @@ -183,7 +183,7 @@ public async Task I_can_prepare_an_update_so_that_it_can_be_installed() { Version.Parse("1.0"), Version.Parse("2.0"), - Version.Parse("3.0") + Version.Parse("3.0"), }; using var updateManager = new UpdateManager( @@ -224,7 +224,7 @@ public async Task I_can_get_a_list_of_updates_which_are_already_prepared_to_inst { Version.Parse("1.0"), Version.Parse("2.0"), - Version.Parse("3.0") + Version.Parse("3.0"), }; using var manager = new UpdateManager( @@ -257,7 +257,7 @@ public async Task I_can_install_an_update_after_preparing_it() { Version.Parse("1.0.0.0"), Version.Parse("2.0.0.0"), - Version.Parse("3.0.0.0") + Version.Parse("3.0.0.0"), }; var expectedFinalVersion = Version.Parse("3.0.0.0"); @@ -292,7 +292,7 @@ public async Task I_can_install_an_update_after_preparing_it_and_have_the_applic { Version.Parse("1.0.0.0"), Version.Parse("2.0.0.0"), - Version.Parse("3.0.0.0") + Version.Parse("3.0.0.0"), }; var expectedFinalVersion = Version.Parse("3.0.0.0"); diff --git a/Onova.Tests/Utils/DummyEnvironment.cs b/Onova.Tests/Utils/DummyEnvironment.cs index 696b145..ade1956 100644 --- a/Onova.Tests/Utils/DummyEnvironment.cs +++ b/Onova.Tests/Utils/DummyEnvironment.cs @@ -104,7 +104,7 @@ public void Setup(Version baseVersion, IReadOnlyList availableVersions) public string[] GetLastRunArguments(Version version) { var filePath = Path.Combine(rootDirPath, $"lastrun-{version}.txt"); - return File.Exists(filePath) ? File.ReadAllLines(filePath) : Array.Empty(); + return File.Exists(filePath) ? File.ReadAllLines(filePath) : []; } public string GetLastUpdaterLogs() diff --git a/Onova.Updater/Updater.cs b/Onova.Updater/Updater.cs index 5fc9159..b6718e1 100644 --- a/Onova.Updater/Updater.cs +++ b/Onova.Updater/Updater.cs @@ -73,7 +73,7 @@ private void StartUpdatee() WorkingDirectory = Path.GetDirectoryName(updateeFilePath), Arguments = routedArgs, // Don't let the child process inherit the current console window - UseShellExecute = true + UseShellExecute = true, }; // If the updatee is an .exe file, start it directly. diff --git a/Onova.Updater/Utils/Extensions/DisposableExtensions.cs b/Onova.Updater/Utils/Extensions/DisposableExtensions.cs index 56a74ff..f365b9d 100644 --- a/Onova.Updater/Utils/Extensions/DisposableExtensions.cs +++ b/Onova.Updater/Utils/Extensions/DisposableExtensions.cs @@ -18,7 +18,7 @@ public static void DisposeAll(this IEnumerable disposables) } catch (Exception ex) { - exceptions ??= new List(); + exceptions ??= []; exceptions.Add(ex); } } diff --git a/Onova/UpdateManager.cs b/Onova/UpdateManager.cs index 87d9fd8..3379525 100644 --- a/Onova/UpdateManager.cs +++ b/Onova/UpdateManager.cs @@ -270,7 +270,7 @@ public void LaunchUpdater(Version version, bool restart, string restartArguments // in case the application is running inside a console window host. // Also required to run with elevated privileges. UseShellExecute = true, - Verb = isElevated ? "runas" : "" + Verb = isElevated ? "runas" : "", }; updaterProcess.Start();