diff --git a/SabreTools.Library/DatFiles/DatFile.cs b/SabreTools.Library/DatFiles/DatFile.cs index 181637c3..0d2e2226 100644 --- a/SabreTools.Library/DatFiles/DatFile.cs +++ b/SabreTools.Library/DatFiles/DatFile.cs @@ -2989,24 +2989,7 @@ namespace SabreTools.Library.DatFiles // If we are using tags from the DAT, set the proper input for split type unless overridden if (useTags && splitType == SplitType.None) { - switch (ForceMerging) - { - case ForceMerging.None: - // No-op - break; - case ForceMerging.Split: - splitType = SplitType.Split; - break; - case ForceMerging.Merged: - splitType = SplitType.Merged; - break; - case ForceMerging.NonMerged: - splitType = SplitType.NonMerged; - break; - case ForceMerging.Full: - splitType = SplitType.FullNonMerged; - break; - } + splitType = Utilities.GetSplitType(ForceMerging); } // Now we pre-process the DAT with the splitting/merging mode diff --git a/SabreTools.Library/Tools/Utilities.cs b/SabreTools.Library/Tools/Utilities.cs index dd3a1268..e4bcdd8a 100644 --- a/SabreTools.Library/Tools/Utilities.cs +++ b/SabreTools.Library/Tools/Utilities.cs @@ -362,6 +362,29 @@ namespace SabreTools.Library.Tools } } + /// + /// 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": + default: + return ItemStatus.None; + case "good": + return ItemStatus.Good; + case "baddump": + return ItemStatus.BadDump; + case "nodump": + return ItemStatus.Nodump; + case "verified": + return ItemStatus.Verified; + } + } + /// /// Get MachineType value from input string /// @@ -386,25 +409,25 @@ namespace SabreTools.Library.Tools } /// - /// Get ItemStatus value from input string + /// Get SplitType value from input ForceMerging /// - /// String to get value from - /// ItemStatus value corresponding to the string - public static ItemStatus GetItemStatus(string status) + /// ForceMerging to get value from + /// SplitType value corresponding to the string + public static SplitType GetSplitType(ForceMerging forceMerging) { - switch (status?.ToLowerInvariant()) + switch (forceMerging) { - case "none": + case ForceMerging.None: default: - return ItemStatus.None; - case "good": - return ItemStatus.Good; - case "baddump": - return ItemStatus.BadDump; - case "nodump": - return ItemStatus.Nodump; - case "verified": - return ItemStatus.Verified; + 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; } }