diff --git a/SabreTools.Library/Tools/Utilities.cs b/SabreTools.Library/Tools/Utilities.cs index e2181ee1..d3485086 100644 --- a/SabreTools.Library/Tools/Utilities.cs +++ b/SabreTools.Library/Tools/Utilities.cs @@ -303,162 +303,6 @@ namespace SabreTools.Library.Tools return hash; } - /// - /// Get ForceMerging value from input string - /// - /// String to get value from - /// ForceMerging value corresponding to the string - public static ForceMerging GetForceMerging(string forcemerge) - { - switch (forcemerge?.ToLowerInvariant()) - { - case "none": - default: - return ForceMerging.None; - case "split": - return ForceMerging.Split; - case "full": - return ForceMerging.Full; - } - } - - /// - /// Get ForceNodump value from input string - /// - /// String to get value from - /// ForceNodump value corresponding to the string - public static ForceNodump GetForceNodump(string forcend) - { - switch (forcend?.ToLowerInvariant()) - { - case "none": - default: - return ForceNodump.None; - case "obsolete": - return ForceNodump.Obsolete; - case "required": - return ForceNodump.Required; - case "ignore": - return ForceNodump.Ignore; - } - } - - /// - /// Get ForcePacking value from input string - /// - /// String to get value from - /// ForcePacking value corresponding to the string - public static ForcePacking GetForcePacking(string forcepack) - { - switch (forcepack?.ToLowerInvariant()) - { - case "none": - default: - return ForcePacking.None; - case "zip": - return ForcePacking.Zip; - case "unzip": - return ForcePacking.Unzip; - } - } - - /// - /// Get ItemStatus value from input string - /// - /// String to get value from - /// ItemStatus value corresponding to the string - public static ItemStatus GetItemStatus(string status) - { - switch (status?.ToLowerInvariant()) - { - case "none": - case "no": - default: - return ItemStatus.None; - case "good": - return ItemStatus.Good; - case "baddump": - return ItemStatus.BadDump; - case "nodump": - case "yes": - return ItemStatus.Nodump; - case "verified": - return ItemStatus.Verified; - } - } - - /// - /// Get ItemType? value from input string - /// - /// String to get value from - /// ItemType? value corresponding to the string - public static ItemType? GetItemType(string itemType) - { - switch (itemType?.ToLowerInvariant()) - { - case "archive": - return ItemType.Archive; - case "biosset": - return ItemType.BiosSet; - case "disk": - return ItemType.Disk; - case "release": - return ItemType.Release; - case "rom": - return ItemType.Rom; - case "sample": - return ItemType.Sample; - default: - return null; - } - } - - /// - /// Get MachineType value from input string - /// - /// String to get value from - /// MachineType value corresponding to the string - public static MachineType GetMachineType(string gametype) - { - switch (gametype?.ToLowerInvariant()) - { - case "none": - default: - return MachineType.None; - case "bios": - return MachineType.Bios; - case "dev": - case "device": - return MachineType.Device; - case "mech": - case "mechanical": - return MachineType.Mechanical; - } - } - - /// - /// Get SplitType value from input ForceMerging - /// - /// ForceMerging to get value from - /// SplitType value corresponding to the string - public static SplitType GetSplitType(ForceMerging forceMerging) - { - switch (forceMerging) - { - case ForceMerging.None: - default: - return SplitType.None; - case ForceMerging.Split: - return SplitType.Split; - case ForceMerging.Merged: - return SplitType.Merged; - case ForceMerging.NonMerged: - return SplitType.NonMerged; - case ForceMerging.Full: - return SplitType.FullNonMerged; - } - } - /// /// Replace accented characters /// @@ -807,6 +651,162 @@ namespace SabreTools.Library.Tools } } + /// + /// Get ForceMerging value from input string + /// + /// String to get value from + /// ForceMerging value corresponding to the string + public static ForceMerging GetForceMerging(string forcemerge) + { + switch (forcemerge?.ToLowerInvariant()) + { + case "none": + default: + return ForceMerging.None; + case "split": + return ForceMerging.Split; + case "full": + return ForceMerging.Full; + } + } + + /// + /// Get ForceNodump value from input string + /// + /// String to get value from + /// ForceNodump value corresponding to the string + public static ForceNodump GetForceNodump(string forcend) + { + switch (forcend?.ToLowerInvariant()) + { + case "none": + default: + return ForceNodump.None; + case "obsolete": + return ForceNodump.Obsolete; + case "required": + return ForceNodump.Required; + case "ignore": + return ForceNodump.Ignore; + } + } + + /// + /// Get ForcePacking value from input string + /// + /// String to get value from + /// ForcePacking value corresponding to the string + public static ForcePacking GetForcePacking(string forcepack) + { + switch (forcepack?.ToLowerInvariant()) + { + case "none": + default: + return ForcePacking.None; + case "zip": + return ForcePacking.Zip; + case "unzip": + return ForcePacking.Unzip; + } + } + + /// + /// Get ItemStatus value from input string + /// + /// String to get value from + /// ItemStatus value corresponding to the string + public static ItemStatus GetItemStatus(string status) + { + switch (status?.ToLowerInvariant()) + { + case "none": + case "no": + default: + return ItemStatus.None; + case "good": + return ItemStatus.Good; + case "baddump": + return ItemStatus.BadDump; + case "nodump": + case "yes": + return ItemStatus.Nodump; + case "verified": + return ItemStatus.Verified; + } + } + + /// + /// Get ItemType? value from input string + /// + /// String to get value from + /// ItemType? value corresponding to the string + public static ItemType? GetItemType(string itemType) + { + switch (itemType?.ToLowerInvariant()) + { + case "archive": + return ItemType.Archive; + case "biosset": + return ItemType.BiosSet; + case "disk": + return ItemType.Disk; + case "release": + return ItemType.Release; + case "rom": + return ItemType.Rom; + case "sample": + return ItemType.Sample; + default: + return null; + } + } + + /// + /// Get MachineType value from input string + /// + /// String to get value from + /// MachineType value corresponding to the string + public static MachineType GetMachineType(string gametype) + { + switch (gametype?.ToLowerInvariant()) + { + case "none": + default: + return MachineType.None; + case "bios": + return MachineType.Bios; + case "dev": + case "device": + return MachineType.Device; + case "mech": + case "mechanical": + return MachineType.Mechanical; + } + } + + /// + /// Get SplitType value from input ForceMerging + /// + /// ForceMerging to get value from + /// SplitType value corresponding to the string + public static SplitType GetSplitType(ForceMerging forceMerging) + { + switch (forceMerging) + { + case ForceMerging.None: + default: + return SplitType.None; + case ForceMerging.Split: + return SplitType.Split; + case ForceMerging.Merged: + return SplitType.Merged; + case ForceMerging.NonMerged: + return SplitType.NonMerged; + case ForceMerging.Full: + return SplitType.FullNonMerged; + } + } + #endregion #region File Information