diff --git a/RombaSharp/Features/Archive.cs b/RombaSharp/Features/Archive.cs index ae12f269..4a8253bd 100644 --- a/RombaSharp/Features/Archive.cs +++ b/RombaSharp/Features/Archive.cs @@ -20,7 +20,7 @@ namespace RombaSharp.Features public Archive() { Name = Value; - Flags = new List() { "archive" }; + Flags = ["archive"]; Description = "Adds ROM files from the specified directories to the ROM archive."; _featureType = ParameterType.Flag; LongDescription = @"Adds ROM files from the specified directories to the ROM archive. diff --git a/RombaSharp/Features/BaseFeature.cs b/RombaSharp/Features/BaseFeature.cs index 3fb2037a..af6c6a7f 100644 --- a/RombaSharp/Features/BaseFeature.cs +++ b/RombaSharp/Features/BaseFeature.cs @@ -552,9 +552,9 @@ CREATE TABLE IF NOT EXISTS dat ( { // Get a dictionary of filenames that actually exist in the DATRoot, logging which ones are not #if NET20 || NET35 - List datRootDats = Directory.GetFiles(_dats, "*").ToList(); + List datRootDats = Directory.GetFiles(_dats!, "*").ToList(); #else - List datRootDats = Directory.EnumerateFiles(_dats, "*", SearchOption.AllDirectories).ToList(); + List datRootDats = Directory.EnumerateFiles(_dats!, "*", SearchOption.AllDirectories).ToList(); #endif List lowerCaseDats = datRootDats.ConvertAll(i => Path.GetFileName(i).ToLowerInvariant()); Dictionary foundDats = []; @@ -785,7 +785,7 @@ CREATE TABLE IF NOT EXISTS dat ( internal void AddDatToDatabase(Rom dat, SqliteConnection dbc) { // Get the dat full path - string fullpath = Path.Combine(_dats, (dat.Machine.Name == "dats" ? string.Empty : dat.Machine.Name), dat.Name); + string fullpath = Path.Combine(_dats!, (dat.Machine.Name == "dats" ? string.Empty : dat.Machine.Name)!, dat.Name!); // Parse the Dat if possible logger.User($"Adding from '{dat.Name}'"); diff --git a/RombaSharp/Features/Build.cs b/RombaSharp/Features/Build.cs index 6e194a43..d52426b3 100644 --- a/RombaSharp/Features/Build.cs +++ b/RombaSharp/Features/Build.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; - using SabreTools.DatFiles; using SabreTools.DatTools; using SabreTools.FileTypes; @@ -17,7 +16,7 @@ namespace RombaSharp.Features public Build() { Name = Value; - Flags = new List() { "build" }; + Flags = ["build"]; Description = "For each specified DAT file it creates the torrentzip files."; _featureType = ParameterType.Flag; LongDescription = @"For each specified DAT file it creates the torrentzip files in the specified @@ -56,7 +55,7 @@ structure according to the original DAT master directory tree structure."; foreach (string key in foundDats.Keys) { // Get the DAT file associated with the key - DatFile datFile = Parser.CreateAndParse(Path.Combine(_dats, foundDats[key])); + DatFile datFile = Parser.CreateAndParse(Path.Combine(_dats!, foundDats[key])); // Set the depot values datFile.Header.InputDepot = new DepotInformation(true, 4); diff --git a/RombaSharp/Features/Cancel.cs b/RombaSharp/Features/Cancel.cs index 55ef5668..60a39624 100644 --- a/RombaSharp/Features/Cancel.cs +++ b/RombaSharp/Features/Cancel.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; - using SabreTools.Help; namespace RombaSharp.Features @@ -11,7 +10,7 @@ namespace RombaSharp.Features public Cancel() { Name = Value; - Flags = new List() { "cancel" }; + Flags = ["cancel"]; Description = "Cancels current long-running job"; _featureType = ParameterType.Flag; LongDescription = "Cancels current long-running job."; diff --git a/RombaSharp/Features/DatStats.cs b/RombaSharp/Features/DatStats.cs index 376c4d96..9493e51b 100644 --- a/RombaSharp/Features/DatStats.cs +++ b/RombaSharp/Features/DatStats.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.IO; - using SabreTools.DatTools; using SabreTools.Help; using SabreTools.Reports; @@ -14,7 +13,7 @@ namespace RombaSharp.Features public DatStats() { Name = Value; - Flags = new List() { "datstats" }; + Flags = ["datstats"]; Description = "Prints dat stats."; _featureType = ParameterType.Flag; LongDescription = "Print dat stats."; @@ -32,7 +31,7 @@ namespace RombaSharp.Features // If we have no inputs listed, we want to use datroot if (Inputs == null || Inputs.Count == 0) - Inputs = new List { Path.GetFullPath(_dats) }; + Inputs = new List { Path.GetFullPath(_dats!) }; // Now output the stats for all inputs var statistics = Statistics.CalculateStatistics(Inputs, single: true); diff --git a/RombaSharp/Features/DbStats.cs b/RombaSharp/Features/DbStats.cs index ee601a75..cf396a9c 100644 --- a/RombaSharp/Features/DbStats.cs +++ b/RombaSharp/Features/DbStats.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; - -using SabreTools.Help; using Microsoft.Data.Sqlite; +using SabreTools.Help; namespace RombaSharp.Features { @@ -12,7 +11,7 @@ namespace RombaSharp.Features public DbStats() { Name = Value; - Flags = new List() { "dbstats" }; + Flags = ["dbstats"]; Description = "Prints db stats."; _featureType = ParameterType.Flag; LongDescription = "Print db stats."; diff --git a/RombaSharp/Features/Diffdat.cs b/RombaSharp/Features/Diffdat.cs index 935d5c27..b1b01581 100644 --- a/RombaSharp/Features/Diffdat.cs +++ b/RombaSharp/Features/Diffdat.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.IO; - using SabreTools.DatFiles; using SabreTools.DatTools; using SabreTools.Help; @@ -15,7 +14,7 @@ namespace RombaSharp.Features public Diffdat() { Name = Value; - Flags = new List() { "diffdat" }; + Flags = ["diffdat"]; Description = "Creates a DAT file with those entries that are in -new DAT."; _featureType = ParameterType.Flag; LongDescription = @"Creates a DAT file with those entries that are in -new DAT file and not diff --git a/RombaSharp/Features/Dir2Dat.cs b/RombaSharp/Features/Dir2Dat.cs index 0f80b353..89d43365 100644 --- a/RombaSharp/Features/Dir2Dat.cs +++ b/RombaSharp/Features/Dir2Dat.cs @@ -16,7 +16,7 @@ namespace RombaSharp.Features public Dir2Dat() { Name = Value; - Flags = new List() { "dir2dat" }; + Flags = ["dir2dat"]; Description = "Creates a DAT file for the specified input directory and saves it to the -out filename."; _featureType = ParameterType.Flag; LongDescription = "Creates a DAT file for the specified input directory and saves it to the -out filename."; diff --git a/RombaSharp/Features/DisplayHelp.cs b/RombaSharp/Features/DisplayHelp.cs index 8e28e3c2..2597e25d 100644 --- a/RombaSharp/Features/DisplayHelp.cs +++ b/RombaSharp/Features/DisplayHelp.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; - -using SabreTools.Help; +using SabreTools.Help; namespace RombaSharp.Features { @@ -11,7 +9,7 @@ namespace RombaSharp.Features public DisplayHelp() { Name = Value; - Flags = new List() { "-?", "-h", "--help" }; + Flags = ["-?", "-h", "--help"]; Description = "Show this help"; _featureType = ParameterType.Flag; LongDescription = "Built-in to most of the programs is a basic help text."; diff --git a/RombaSharp/Features/DisplayHelpDetailed.cs b/RombaSharp/Features/DisplayHelpDetailed.cs index 9a647ec8..f794d1e5 100644 --- a/RombaSharp/Features/DisplayHelpDetailed.cs +++ b/RombaSharp/Features/DisplayHelpDetailed.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; - -using SabreTools.Help; +using SabreTools.Help; namespace RombaSharp.Features { @@ -11,7 +9,7 @@ namespace RombaSharp.Features public DisplayHelpDetailed() { Name = Value; - Flags = new List() { "-??", "-hd", "--help-detailed" }; + Flags = ["-??", "-hd", "--help-detailed"]; Description = "Show this detailed help"; _featureType = ParameterType.Flag; LongDescription = "Display a detailed help text to the screen."; diff --git a/RombaSharp/Features/EDiffdat.cs b/RombaSharp/Features/EDiffdat.cs index d2a81da1..b9f0458e 100644 --- a/RombaSharp/Features/EDiffdat.cs +++ b/RombaSharp/Features/EDiffdat.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.IO; - using SabreTools.DatFiles; using SabreTools.DatTools; using SabreTools.Help; @@ -15,7 +14,7 @@ namespace RombaSharp.Features public EDiffdat() { Name = Value; - Flags = new List() { "ediffdat" }; + Flags = ["ediffdat"]; Description = "Creates a DAT file with those entries that are in -new DAT."; _featureType = ParameterType.Flag; LongDescription = @"Creates a DAT file with those entries that are in -new DAT files and not in -old DAT files. Ignores those entries in -old that are not in -new."; diff --git a/RombaSharp/Features/Export.cs b/RombaSharp/Features/Export.cs index b929dd69..329ee023 100644 --- a/RombaSharp/Features/Export.cs +++ b/RombaSharp/Features/Export.cs @@ -1,8 +1,7 @@ using System.Collections.Generic; using System.IO; - -using SabreTools.Help; using Microsoft.Data.Sqlite; +using SabreTools.Help; namespace RombaSharp.Features { @@ -14,7 +13,7 @@ namespace RombaSharp.Features public Export() { Name = Value; - Flags = new List() { "export" }; + Flags = ["export"]; Description = "Exports db to export.csv"; _featureType = ParameterType.Flag; LongDescription = "Exports db to standardized export.csv"; diff --git a/RombaSharp/Features/Fixdat.cs b/RombaSharp/Features/Fixdat.cs index a3b94056..9d4128df 100644 --- a/RombaSharp/Features/Fixdat.cs +++ b/RombaSharp/Features/Fixdat.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; - using SabreTools.Help; namespace RombaSharp.Features @@ -11,7 +10,7 @@ namespace RombaSharp.Features public Fixdat() { Name = Value; - Flags = new List() { "fixdat" }; + Flags = ["fixdat"]; Description = "For each specified DAT file it creates a fix DAT."; _featureType = ParameterType.Flag; LongDescription = @"For each specified DAT file it creates a fix DAT with the missing entries for that DAT. If nothing is missing it doesn't create a fix DAT for that particular DAT."; diff --git a/RombaSharp/Features/Import.cs b/RombaSharp/Features/Import.cs index 02dbcba5..c65cad6b 100644 --- a/RombaSharp/Features/Import.cs +++ b/RombaSharp/Features/Import.cs @@ -1,10 +1,9 @@ using System.Collections.Generic; using System.IO; using System.Linq; - +using Microsoft.Data.Sqlite; using SabreTools.Help; using SabreTools.IO; -using Microsoft.Data.Sqlite; namespace RombaSharp.Features { @@ -16,7 +15,7 @@ namespace RombaSharp.Features public Import() { Name = Value; - Flags = new List() { "import" }; + Flags = ["import"]; Description = "Import a database from a formatted CSV file"; _featureType = ParameterType.Flag; LongDescription = "Import a database from a formatted CSV file"; diff --git a/RombaSharp/Features/Lookup.cs b/RombaSharp/Features/Lookup.cs index 27a6fa74..3636cc60 100644 --- a/RombaSharp/Features/Lookup.cs +++ b/RombaSharp/Features/Lookup.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; - using SabreTools.Core; using SabreTools.Help; using Microsoft.Data.Sqlite; @@ -13,7 +12,7 @@ namespace RombaSharp.Features public Lookup() { Name = Value; - Flags = new List() { "lookup" }; + Flags = ["lookup"]; Description = "For each specified hash it looks up any available information."; _featureType = ParameterType.Flag; LongDescription = "For each specified hash it looks up any available information (dat or rom)."; diff --git a/RombaSharp/Features/Memstats.cs b/RombaSharp/Features/Memstats.cs index 60918bde..c2a5315e 100644 --- a/RombaSharp/Features/Memstats.cs +++ b/RombaSharp/Features/Memstats.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; - using SabreTools.Help; namespace RombaSharp.Features @@ -11,7 +10,7 @@ namespace RombaSharp.Features public Memstats() { Name = Value; - Flags = new List() { "memstats" }; + Flags = ["memstats"]; Description = "Prints memory stats."; _featureType = ParameterType.Flag; LongDescription = "Print memory stats."; diff --git a/RombaSharp/Features/Merge.cs b/RombaSharp/Features/Merge.cs index 27980246..cc9e446d 100644 --- a/RombaSharp/Features/Merge.cs +++ b/RombaSharp/Features/Merge.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; - using SabreTools.Help; using SabreTools.IO; @@ -14,7 +13,7 @@ namespace RombaSharp.Features public Merge() { Name = Value; - Flags = new List() { "merge" }; + Flags = ["merge"]; Description = "Merges depot"; _featureType = ParameterType.Flag; LongDescription = "Merges specified depot into current depot."; diff --git a/RombaSharp/Features/Miss.cs b/RombaSharp/Features/Miss.cs index 1dbcba8f..2aaf0f3b 100644 --- a/RombaSharp/Features/Miss.cs +++ b/RombaSharp/Features/Miss.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.IO; - using SabreTools.DatFiles; using SabreTools.DatTools; using SabreTools.Help; @@ -16,7 +15,7 @@ namespace RombaSharp.Features public Miss() { Name = Value; - Flags = new List() { "miss" }; + Flags = ["miss"]; Description = "Create miss and have file"; _featureType = ParameterType.Flag; LongDescription = "For each specified DAT file, create miss and have file"; @@ -42,7 +41,7 @@ namespace RombaSharp.Features foreach (string key in foundDats.Keys) { // Get the DAT file associated with the key - DatFile datFile = Parser.CreateAndParse(Path.Combine(_dats, foundDats[key])); + DatFile datFile = Parser.CreateAndParse(Path.Combine(_dats!, foundDats[key])); // Now loop through and see if all of the hash combinations exist in the database /* ended here */ diff --git a/RombaSharp/Features/Progress.cs b/RombaSharp/Features/Progress.cs index bd62c2eb..d6d62d3e 100644 --- a/RombaSharp/Features/Progress.cs +++ b/RombaSharp/Features/Progress.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; - using SabreTools.Help; namespace RombaSharp.Features @@ -11,7 +10,7 @@ namespace RombaSharp.Features public Progress() { Name = Value; - Flags = new List() { "progress" }; + Flags = ["progress"]; Description = "Shows progress of the currently running command."; _featureType = ParameterType.Flag; LongDescription = "Shows progress of the currently running command."; diff --git a/RombaSharp/Features/PurgeBackup.cs b/RombaSharp/Features/PurgeBackup.cs index 277d20da..26775cc7 100644 --- a/RombaSharp/Features/PurgeBackup.cs +++ b/RombaSharp/Features/PurgeBackup.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; - using SabreTools.Help; namespace RombaSharp.Features @@ -11,7 +10,7 @@ namespace RombaSharp.Features public PurgeBackup() { Name = Value; - Flags = new List() { "purge-backup" }; + Flags = ["purge-backup"]; Description = "Moves DAT index entries for orphaned DATs."; _featureType = ParameterType.Flag; LongDescription = @"Deletes DAT index entries for orphaned DATs and moves ROM files that are no diff --git a/RombaSharp/Features/PurgeDelete.cs b/RombaSharp/Features/PurgeDelete.cs index c196ef62..b7928e03 100644 --- a/RombaSharp/Features/PurgeDelete.cs +++ b/RombaSharp/Features/PurgeDelete.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; - using SabreTools.Help; namespace RombaSharp.Features @@ -12,7 +11,7 @@ namespace RombaSharp.Features public PurgeDelete() { Name = Value; - Flags = new List() { "purge-delete" }; + Flags = ["purge-delete"]; Description = "Deletes DAT index entries for orphaned DATs"; _featureType = ParameterType.Flag; LongDescription = @"Deletes DAT index entries for orphaned DATs and moves ROM files that are no diff --git a/RombaSharp/Features/RefreshDats.cs b/RombaSharp/Features/RefreshDats.cs index 22898e70..e4d36ff0 100644 --- a/RombaSharp/Features/RefreshDats.cs +++ b/RombaSharp/Features/RefreshDats.cs @@ -20,7 +20,7 @@ namespace RombaSharp.Features public RefreshDats() { Name = Value; - Flags = new List() { "refresh-dats" }; + Flags = ["refresh-dats"]; Description = "Refreshes the DAT index from the files in the DAT master directory tree."; _featureType = ParameterType.Flag; LongDescription = @"Refreshes the DAT index from the files in the DAT master directory tree. @@ -74,8 +74,8 @@ contents of any changed dats."; datroot.Items.BucketBy(ItemKey.SHA1, DedupeType.None); // Create a List of dat hashes in the database (SHA-1) - List databaseDats = new List(); - List unneeded = new List(); + List databaseDats = []; + List unneeded = []; SqliteConnection dbc = new SqliteConnection(_connectionString); dbc.Open(); diff --git a/RombaSharp/Features/RescanDepots.cs b/RombaSharp/Features/RescanDepots.cs index 4d1a4a05..6ee33b08 100644 --- a/RombaSharp/Features/RescanDepots.cs +++ b/RombaSharp/Features/RescanDepots.cs @@ -20,7 +20,7 @@ namespace RombaSharp.Features public RescanDepots() { Name = Value; - Flags = new List() { "depot-rescan" }; + Flags = ["depot-rescan"]; Description = "Rescan a specific depot to get new information"; _featureType = ParameterType.Flag; LongDescription = "Rescan a specific depot to get new information"; @@ -59,7 +59,7 @@ namespace RombaSharp.Features dbc.Open(); // If we have it, then check for all hashes that are in that depot - List hashes = new List(); + List hashes = []; string query = $"SELECT sha1 FROM sha1 WHERE depot=\"{depotname}\""; SqliteCommand slc = new SqliteCommand(query, dbc); SqliteDataReader sldr = slc.ExecuteReader(); @@ -84,7 +84,7 @@ namespace RombaSharp.Features string md5sha1query = "INSERT OR IGNORE INTO md5sha1 (md5, sha1) VALUES"; // Once we have both, check for any new files - List dupehashes = new List(); + List dupehashes = []; IEnumerable keys = depot.Items.Keys; foreach (string key in keys) { @@ -94,12 +94,12 @@ namespace RombaSharp.Features foreach (Rom rom in roms) { - if (hashes.Contains(rom.SHA1)) + if (hashes.Contains(rom.SHA1!)) { - dupehashes.Add(rom.SHA1); - hashes.Remove(rom.SHA1); + dupehashes.Add(rom.SHA1!); + hashes.Remove(rom.SHA1!); } - else if (!dupehashes.Contains(rom.SHA1)) + else if (!dupehashes.Contains(rom.SHA1!)) { if (!string.IsNullOrWhiteSpace(rom.CRC)) crcquery += $" (\"{rom.CRC}\"),"; diff --git a/RombaSharp/Features/Shutdown.cs b/RombaSharp/Features/Shutdown.cs index 636b78f5..57ff001b 100644 --- a/RombaSharp/Features/Shutdown.cs +++ b/RombaSharp/Features/Shutdown.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; - using SabreTools.Help; namespace RombaSharp.Features @@ -11,7 +10,7 @@ namespace RombaSharp.Features public Shutdown() { Name = Value; - Flags = new List() { "shutdown" }; + Flags = ["shutdown"]; Description = "Gracefully shuts down server."; _featureType = ParameterType.Flag; LongDescription = "Gracefully shuts down server saving all the cached data."; diff --git a/RombaSharp/Features/Version.cs b/RombaSharp/Features/Version.cs index 587dcc1b..55512b53 100644 --- a/RombaSharp/Features/Version.cs +++ b/RombaSharp/Features/Version.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; - using SabreTools.Core; using SabreTools.Help; @@ -12,7 +11,7 @@ namespace RombaSharp.Features public Version() { Name = Value; - Flags = new List() { "version" }; + Flags = ["version"]; Description = "Prints version"; _featureType = ParameterType.Flag; LongDescription = "Prints current program version."; diff --git a/RombaSharp/Program.cs b/RombaSharp/Program.cs index fd4a1bec..1af86a20 100644 --- a/RombaSharp/Program.cs +++ b/RombaSharp/Program.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.IO; - using RombaSharp.Features; using SabreTools.Core; using SabreTools.Help; diff --git a/RombaSharp/RombaSharp.csproj b/RombaSharp/RombaSharp.csproj index 9e2c4a12..e98ca676 100644 --- a/RombaSharp/RombaSharp.csproj +++ b/RombaSharp/RombaSharp.csproj @@ -1,14 +1,24 @@  + Exe net6.0;net8.0 win-x86;win-x64;linux-x64;osx-x64 + false + false latest enable + true + true + 1.1.2 + + Matt Nadareski Copyright (c)2016-2024 Matt Nadareski + https://github.com/SabreTools/ MIT + git https://github.com/SabreTools/SabreTools