diff --git a/RedumpTool/Features/QueryFeature.cs b/RedumpTool/Features/QueryFeature.cs index 3eedf43..ad11840 100644 --- a/RedumpTool/Features/QueryFeature.cs +++ b/RedumpTool/Features/QueryFeature.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; using SabreTools.CommandLine.Inputs; -using SabreTools.RedumpLib.Data; using SabreTools.RedumpLib.Web; namespace RedumpTool.Features @@ -53,32 +52,6 @@ namespace RedumpTool.Features Add(ForceDownloadInput); Add(ForceContinueInput); - // Discs Path - Add(AntiModchipInput); - Add(BarcodeInput); - Add(CategoryInput); - Add(CommentsInput); - Add(ContentsInput); - Add(DiscTypeInput); - Add(DumperInput); - Add(EdcInput); - Add(EditionInput); - Add(ErrorsInput); - Add(LanguageInput); - Add(LetterInput); - Add(LibCryptInput); - Add(MediaInput); - Add(OffsetInput); - Add(ProtectionInput); - Add(QuickSearchInput); - Add(RegionInput); - Add(RingcodeInput); - Add(SortInput); - Add(SortDirInput); - Add(StatusInput); - Add(SystemInput); - Add(TracksInput); - // Specific Add(QueryInput); Add(QuickQueryName); @@ -99,47 +72,6 @@ namespace RedumpTool.Features bool forceDownload = ForceDownloadInput.Value; bool forceContinue = ForceContinueInput.Value; - // Get discs path values - bool? antiModchip = AntiModchipInput.Value; - bool barcode = BarcodeInput.Value; - string? categoryString = CategoryInput.Value; - DiscCategory? category = categoryString.ToDiscCategory(); - bool comments = CommentsInput.Value; - bool contents = ContentsInput.Value; - string? discTypeString = DiscTypeInput.Value; - DiscType? discType = discTypeString.ToDiscType(); - string? dumper = DumperInput.Value; - bool? edc = EdcInput.Value; - string? edition = EditionInput.Value; - string? errors = ErrorsInput.Value; - string? languageString = LanguageInput.Value; - Language? language = languageString.ToLanguage(); - char? letter = string.IsNullOrEmpty(LetterInput.Value) - ? null - : LetterInput.Value![0]; - bool? libcrypt = LibCryptInput.Value; - MediaType? media = MediaInput.Value?.ToLowerInvariant() switch - { - "cd" => MediaType.CDROM, - "dvd" => MediaType.DVD, - _ => null, - }; - int? offset = OffsetInput.Value; - bool protection = ProtectionInput.Value; - string? quicksearch = QuickSearchInput.Value; - string? regionString = RegionInput.Value; - Region? region = regionString.ToRegion(); - string? ringcode = RingcodeInput.Value; - string? sortString = SortInput.Value; - SortCategory? sort = sortString.ToSortCategory(); - string? sortDirString = SortDirInput.Value; - SortDirection? sortDir = sortDirString.ToSortDirection(); - string? statusString = StatusInput.Value; - DumpStatus? status = statusString.ToDumpStatus(); - string? systemString = SystemInput.Value; - RedumpSystem? system = systemString.ToRedumpSystem(); - int? tracks = TracksInput.Value; - // Get specific values bool onlyList = ListInput.Value; string? queryString = QueryInput.Value; diff --git a/RedumpTool/Features/SiteFeature.cs b/RedumpTool/Features/SiteFeature.cs index 26202f3..550e07f 100644 --- a/RedumpTool/Features/SiteFeature.cs +++ b/RedumpTool/Features/SiteFeature.cs @@ -96,7 +96,7 @@ namespace RedumpTool.Features bool forceContinue = ForceContinueInput.Value; // Get discs path values - bool? antiModchip = AntiModchipInput.Value; + bool? antimodchip = AntiModchipInput.Value; bool barcode = BarcodeInput.Value; string? categoryString = CategoryInput.Value; DiscCategory? category = categoryString.ToDiscCategory(); @@ -105,7 +105,8 @@ namespace RedumpTool.Features string? discTypeString = DiscTypeInput.Value; DiscType? discType = discTypeString.ToDiscType(); string? dumper = DumperInput.Value; - bool? edc = EdcInput.Value; + bool? edcBool = EdcInput.Value; + YesNo? edc = edcBool?.ToYesNo(); string? edition = EditionInput.Value; string? errors = ErrorsInput.Value; string? languageString = LanguageInput.Value; @@ -146,13 +147,6 @@ namespace RedumpTool.Features if (!ValidateAndCreateOutputDirectory(outDir)) return false; - // Range verification - if (!onlyNew && (minId < 0 || maxId < 0)) - { - Console.WriteLine("Please enter a valid range of Redump IDs"); - return false; - } - // Update client properties _client.Debug = DebugInput.Value; if (attemptCount != null && attemptCount > 0) @@ -168,9 +162,42 @@ namespace RedumpTool.Features // Start the processing Task> processingTask; if (onlyNew) + { processingTask = _client.DownloadLastModified(outDir, limit); - else + } + else if (minId >= 0 && maxId >= 0) + { processingTask = _client.DownloadSiteRange(outDir, minId, maxId); + } + else + { + processingTask = _client.DownloadDiscsResults(outDir, + antimodchip, + barcode, + category, + discType, + dumper, + edc, + edition, + errors, + language, + letter, + libcrypt, + media, + offset, + quicksearch, + region, + ringcode, + sort, + sortDir, + status, + system, + tracks, + comments, + contents, + protection, + limit); + } // Retrieve the result processingTask.Wait(); diff --git a/RedumpTool/Features/UserFeature.cs b/RedumpTool/Features/UserFeature.cs index 074a242..51bdc97 100644 --- a/RedumpTool/Features/UserFeature.cs +++ b/RedumpTool/Features/UserFeature.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; using SabreTools.CommandLine.Inputs; -using SabreTools.RedumpLib.Data; using SabreTools.RedumpLib.Web; namespace RedumpTool.Features @@ -47,32 +46,6 @@ namespace RedumpTool.Features Add(ForceDownloadInput); Add(ForceContinueInput); - // Discs Path - Add(AntiModchipInput); - Add(BarcodeInput); - Add(CategoryInput); - Add(CommentsInput); - Add(ContentsInput); - Add(DiscTypeInput); - Add(DumperInput); - Add(EdcInput); - Add(EditionInput); - Add(ErrorsInput); - Add(LanguageInput); - Add(LetterInput); - Add(LibCryptInput); - Add(MediaInput); - Add(OffsetInput); - Add(ProtectionInput); - Add(QuickSearchInput); - Add(RegionInput); - Add(RingcodeInput); - Add(SortInput); - Add(SortDirInput); - Add(StatusInput); - Add(SystemInput); - Add(TracksInput); - // Specific Add(OnlyNewInput); Add(ListInput); @@ -91,47 +64,6 @@ namespace RedumpTool.Features bool forceDownload = ForceDownloadInput.Value; bool forceContinue = ForceContinueInput.Value; - // Get discs path values - bool? antiModchip = AntiModchipInput.Value; - bool barcode = BarcodeInput.Value; - string? categoryString = CategoryInput.Value; - DiscCategory? category = categoryString.ToDiscCategory(); - bool comments = CommentsInput.Value; - bool contents = ContentsInput.Value; - string? discTypeString = DiscTypeInput.Value; - DiscType? discType = discTypeString.ToDiscType(); - string? dumper = DumperInput.Value; - bool? edc = EdcInput.Value; - string? edition = EditionInput.Value; - string? errors = ErrorsInput.Value; - string? languageString = LanguageInput.Value; - Language? language = languageString.ToLanguage(); - char? letter = string.IsNullOrEmpty(LetterInput.Value) - ? null - : LetterInput.Value![0]; - bool? libcrypt = LibCryptInput.Value; - MediaType? media = MediaInput.Value?.ToLowerInvariant() switch - { - "cd" => MediaType.CDROM, - "dvd" => MediaType.DVD, - _ => null, - }; - int? offset = OffsetInput.Value; - bool protection = ProtectionInput.Value; - string? quicksearch = QuickSearchInput.Value; - string? regionString = RegionInput.Value; - Region? region = regionString.ToRegion(); - string? ringcode = RingcodeInput.Value; - string? sortString = SortInput.Value; - SortCategory? sort = sortString.ToSortCategory(); - string? sortDirString = SortDirInput.Value; - SortDirection? sortDir = sortDirString.ToSortDirection(); - string? statusString = StatusInput.Value; - DumpStatus? status = statusString.ToDumpStatus(); - string? systemString = SystemInput.Value; - RedumpSystem? system = systemString.ToRedumpSystem(); - int? tracks = TracksInput.Value; - // Get specific values bool onlyNew = OnlyNewInput.Value; bool onlyList = ListInput.Value; diff --git a/SabreTools.RedumpLib/Data/Extensions.cs b/SabreTools.RedumpLib/Data/Extensions.cs index df47c5f..7cd1b18 100644 --- a/SabreTools.RedumpLib/Data/Extensions.cs +++ b/SabreTools.RedumpLib/Data/Extensions.cs @@ -2138,6 +2138,20 @@ namespace SabreTools.RedumpLib.Data public static string LongName(this YesNo? yesno) => AttributeHelper.GetAttribute(yesno)?.LongName ?? "Yes/No"; + /// + /// Get the YesNo enum value for a given nullable boolean + /// + /// Nullable boolean value to convert + /// YesNo represented by the nullable boolean, if possible + public static YesNo ToYesNo(this bool yesno) + { + return yesno switch + { + false => YesNo.No, + true => YesNo.Yes, + }; + } + /// /// Get the YesNo enum value for a given nullable boolean ///