mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatFIle, Utilities] More utility functions
This commit is contained in:
@@ -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 we are using tags from the DAT, set the proper input for split type unless overridden
|
||||||
if (useTags && splitType == SplitType.None)
|
if (useTags && splitType == SplitType.None)
|
||||||
{
|
{
|
||||||
switch (ForceMerging)
|
splitType = Utilities.GetSplitType(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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now we pre-process the DAT with the splitting/merging mode
|
// Now we pre-process the DAT with the splitting/merging mode
|
||||||
|
|||||||
@@ -362,6 +362,29 @@ namespace SabreTools.Library.Tools
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get ItemStatus value from input string
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="status">String to get value from</param>
|
||||||
|
/// <returns>ItemStatus value corresponding to the string</returns>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get MachineType value from input string
|
/// Get MachineType value from input string
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -386,25 +409,25 @@ namespace SabreTools.Library.Tools
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get ItemStatus value from input string
|
/// Get SplitType value from input ForceMerging
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="status">String to get value from</param>
|
/// <param name="forceMerging">ForceMerging to get value from</param>
|
||||||
/// <returns>ItemStatus value corresponding to the string</returns>
|
/// <returns>SplitType value corresponding to the string</returns>
|
||||||
public static ItemStatus GetItemStatus(string status)
|
public static SplitType GetSplitType(ForceMerging forceMerging)
|
||||||
{
|
{
|
||||||
switch (status?.ToLowerInvariant())
|
switch (forceMerging)
|
||||||
{
|
{
|
||||||
case "none":
|
case ForceMerging.None:
|
||||||
default:
|
default:
|
||||||
return ItemStatus.None;
|
return SplitType.None;
|
||||||
case "good":
|
case ForceMerging.Split:
|
||||||
return ItemStatus.Good;
|
return SplitType.Split;
|
||||||
case "baddump":
|
case ForceMerging.Merged:
|
||||||
return ItemStatus.BadDump;
|
return SplitType.Merged;
|
||||||
case "nodump":
|
case ForceMerging.NonMerged:
|
||||||
return ItemStatus.Nodump;
|
return SplitType.NonMerged;
|
||||||
case "verified":
|
case ForceMerging.Full:
|
||||||
return ItemStatus.Verified;
|
return SplitType.FullNonMerged;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user