mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Support ancient .NET in DatFiles
This commit is contained in:
@@ -63,21 +63,21 @@ namespace SabreTools.DatFiles.Formats
|
||||
private static (Machine?, string?) DeriveMachine(string? filename)
|
||||
{
|
||||
// If the filename is missing, we can't do anything
|
||||
if (string.IsNullOrWhiteSpace(filename))
|
||||
if (string.IsNullOrEmpty(filename))
|
||||
return (null, null);
|
||||
|
||||
string machineName = Path.GetFileNameWithoutExtension(filename);
|
||||
if (filename.Contains('/'))
|
||||
{
|
||||
string[] split = filename.Split('/');
|
||||
string[] split = filename!.Split('/');
|
||||
machineName = split[0];
|
||||
filename = filename[(machineName.Length + 1)..];
|
||||
filename = filename.Substring(machineName.Length + 1);
|
||||
}
|
||||
else if (filename.Contains('\\'))
|
||||
{
|
||||
string[] split = filename.Split('\\');
|
||||
string[] split = filename!.Split('\\');
|
||||
machineName = split[0];
|
||||
filename = filename[(machineName.Length + 1)..];
|
||||
filename = filename.Substring(machineName.Length + 1);
|
||||
}
|
||||
|
||||
var machine = new Machine { Name = machineName };
|
||||
@@ -92,11 +92,11 @@ namespace SabreTools.DatFiles.Formats
|
||||
private static ItemType DeriveItemType(string? filename)
|
||||
{
|
||||
// If the filename is missing, we can't do anything
|
||||
if (string.IsNullOrWhiteSpace(filename))
|
||||
if (string.IsNullOrEmpty(filename))
|
||||
return ItemType.NULL;
|
||||
|
||||
// If we end in the CHD extension
|
||||
if (filename.EndsWith(".chd", StringComparison.OrdinalIgnoreCase))
|
||||
if (filename!.EndsWith(".chd", StringComparison.OrdinalIgnoreCase))
|
||||
return ItemType.Disk;
|
||||
|
||||
// If we end in an Aaruformat extension
|
||||
|
||||
Reference in New Issue
Block a user