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:
@@ -41,21 +41,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 };
|
||||
@@ -69,11 +69,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
/// <param name="filename">Name of the file to be parsed</param>
|
||||
/// <param name="indexId">Index ID for the DAT</param>
|
||||
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
||||
#if NET48
|
||||
private void ConvertFiles(Models.ArchiveDotOrg.File[]? files, string filename, int indexId, bool statsOnly)
|
||||
#else
|
||||
private void ConvertFiles(Models.ArchiveDotOrg.File?[]? files, string filename, int indexId, bool statsOnly)
|
||||
#endif
|
||||
{
|
||||
// If the files array is missing, we can't do anything
|
||||
if (files == null || !files.Any())
|
||||
|
||||
Reference in New Issue
Block a user