mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Handle known enumerable types better
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -532,7 +533,7 @@ namespace SabreTools.DatTools
|
||||
/// <param name="inputs">List of inputs to write out from</param>
|
||||
public static DatFile DiffDuplicates(DatFile datFile, List<string> inputs)
|
||||
{
|
||||
List<ParentablePath> paths = inputs.Select(i => new ParentablePath(i)).ToList();
|
||||
List<ParentablePath> paths = inputs.ConvertAll(i => new ParentablePath(i));
|
||||
return DiffDuplicates(datFile, paths);
|
||||
//return DiffDuplicatesDB(datFile, paths);
|
||||
}
|
||||
@@ -737,7 +738,7 @@ namespace SabreTools.DatTools
|
||||
/// <param name="inputs">List of inputs to write out from</param>
|
||||
public static List<DatFile> DiffIndividuals(DatFile datFile, List<string> inputs)
|
||||
{
|
||||
List<ParentablePath> paths = inputs.Select(i => new ParentablePath(i)).ToList();
|
||||
List<ParentablePath> paths = inputs.ConvertAll(i => new ParentablePath(i));
|
||||
return DiffIndividuals(datFile, paths);
|
||||
//return DiffIndividualsDB(datFile, paths);
|
||||
}
|
||||
@@ -967,7 +968,7 @@ namespace SabreTools.DatTools
|
||||
/// <param name="inputs">List of inputs to write out from</param>
|
||||
public static DatFile DiffNoDuplicates(DatFile datFile, List<string> inputs)
|
||||
{
|
||||
List<ParentablePath> paths = inputs.Select(i => new ParentablePath(i)).ToList();
|
||||
List<ParentablePath> paths = inputs.ConvertAll(i => new ParentablePath(i));
|
||||
return DiffNoDuplicates(datFile, paths);
|
||||
//return DiffNoDuplicatesDB(datFile, paths);
|
||||
}
|
||||
@@ -1171,7 +1172,7 @@ namespace SabreTools.DatTools
|
||||
/// <returns>List of DatHeader objects representing headers</returns>
|
||||
public static List<DatHeader> PopulateUserData(DatFile datFile, List<string> inputs)
|
||||
{
|
||||
List<ParentablePath> paths = inputs.Select(i => new ParentablePath(i)).ToList();
|
||||
List<ParentablePath> paths = inputs.ConvertAll(i => new ParentablePath(i));
|
||||
return PopulateUserData(datFile, paths);
|
||||
}
|
||||
|
||||
@@ -1216,7 +1217,7 @@ namespace SabreTools.DatTools
|
||||
|
||||
watch.Stop();
|
||||
|
||||
return [.. datFiles.Select(d => d.Header)];
|
||||
return [.. Array.ConvertAll(datFiles, d => d.Header)];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -46,10 +47,10 @@ namespace SabreTools.DatTools
|
||||
InternalStopwatch watch = new($"Splitting DAT by extension");
|
||||
|
||||
// Make sure all of the extensions don't have a dot at the beginning
|
||||
var newExtA = extA.Select(s => s.TrimStart('.').ToLowerInvariant()).ToArray();
|
||||
var newExtA = extA.ConvertAll(s => s.TrimStart('.').ToLowerInvariant()).ToArray();
|
||||
string newExtAString = string.Join(",", newExtA);
|
||||
|
||||
var newExtB = extB.Select(s => s.TrimStart('.').ToLowerInvariant()).ToArray();
|
||||
var newExtB = extB.ConvertAll(s => s.TrimStart('.').ToLowerInvariant()).ToArray();
|
||||
string newExtBString = string.Join(",", newExtB);
|
||||
|
||||
// Set all of the appropriate outputs for each of the subsets
|
||||
@@ -82,11 +83,11 @@ namespace SabreTools.DatTools
|
||||
|
||||
foreach (DatItem item in items)
|
||||
{
|
||||
if (newExtA.Contains((item.GetName() ?? string.Empty).GetNormalizedExtension()))
|
||||
if (Array.IndexOf(newExtA, (item.GetName() ?? string.Empty).GetNormalizedExtension()) > -1)
|
||||
{
|
||||
extADat.Items.Add(key, item);
|
||||
}
|
||||
else if (newExtB.Contains((item.GetName() ?? string.Empty).GetNormalizedExtension()))
|
||||
if (Array.IndexOf(newExtB, (item.GetName() ?? string.Empty).GetNormalizedExtension()) > -1)
|
||||
{
|
||||
extBDat.Items.Add(key, item);
|
||||
}
|
||||
@@ -123,10 +124,10 @@ namespace SabreTools.DatTools
|
||||
InternalStopwatch watch = new($"Splitting DAT by extension");
|
||||
|
||||
// Make sure all of the extensions don't have a dot at the beginning
|
||||
var newExtA = extA.Select(s => s.TrimStart('.').ToLowerInvariant()).ToArray();
|
||||
var newExtA = extA.ConvertAll(s => s.TrimStart('.').ToLowerInvariant()).ToArray();
|
||||
string newExtAString = string.Join(",", newExtA);
|
||||
|
||||
var newExtB = extB.Select(s => s.TrimStart('.').ToLowerInvariant()).ToArray();
|
||||
var newExtB = extB.ConvertAll(s => s.TrimStart('.').ToLowerInvariant()).ToArray();
|
||||
string newExtBString = string.Join(",", newExtB);
|
||||
|
||||
// Set all of the appropriate outputs for each of the subsets
|
||||
|
||||
Reference in New Issue
Block a user