mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatFile, FileTools] Only files in input folders should be sorted. Everything else has to keep order.
This commit is contained in:
@@ -825,9 +825,6 @@ namespace SabreTools.Helper.Dats
|
|||||||
// Make sure there are no folders in inputs
|
// Make sure there are no folders in inputs
|
||||||
List<string> newInputFileNames = FileTools.GetOnlyFilesFromInputs(inputPaths, maxDegreeOfParallelism, logger, appendparent: true);
|
List<string> newInputFileNames = FileTools.GetOnlyFilesFromInputs(inputPaths, maxDegreeOfParallelism, logger, appendparent: true);
|
||||||
|
|
||||||
// Sort the list first
|
|
||||||
newInputFileNames = Style.OrderByAlphaNumeric(newInputFileNames, s => s).ToList();
|
|
||||||
|
|
||||||
// If we're in inverse cascade, reverse the list
|
// If we're in inverse cascade, reverse the list
|
||||||
if ((diff & DiffMode.ReverseCascade) != 0)
|
if ((diff & DiffMode.ReverseCascade) != 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -371,51 +371,52 @@ namespace SabreTools.Helper.Tools
|
|||||||
public static List<string> GetOnlyFilesFromInputs(List<string> inputs, int maxDegreeOfParallelism, Logger logger, bool appendparent = false)
|
public static List<string> GetOnlyFilesFromInputs(List<string> inputs, int maxDegreeOfParallelism, Logger logger, bool appendparent = false)
|
||||||
{
|
{
|
||||||
List<string> outputs = new List<string>();
|
List<string> outputs = new List<string>();
|
||||||
Parallel.ForEach(inputs,
|
foreach (string input in inputs)
|
||||||
new ParallelOptions { MaxDegreeOfParallelism = maxDegreeOfParallelism, },
|
{
|
||||||
input =>
|
if (Directory.Exists(input))
|
||||||
{
|
{
|
||||||
if (Directory.Exists(input))
|
List<string> files = FileTools.RetrieveFiles(input, new List<string>());
|
||||||
{
|
|
||||||
List<string> files = FileTools.RetrieveFiles(input, new List<string>());
|
// Make sure the files in the directory are ordered correctly
|
||||||
foreach (string file in files)
|
files = Style.OrderByAlphaNumeric(files, s => s).ToList();
|
||||||
{
|
foreach (string file in files)
|
||||||
try
|
|
||||||
{
|
|
||||||
lock (outputs)
|
|
||||||
{
|
|
||||||
outputs.Add(Path.GetFullPath(file) + (appendparent ? "¬" + Path.GetFullPath(input) : ""));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (PathTooLongException)
|
|
||||||
{
|
|
||||||
logger.Warning("The path for " + file + " was too long");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
logger.Error(ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (File.Exists(input))
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
lock (outputs)
|
lock (outputs)
|
||||||
{
|
{
|
||||||
outputs.Add(Path.GetFullPath(input) + (appendparent ? "¬" + Path.GetFullPath(input) : ""));
|
outputs.Add(Path.GetFullPath(file) + (appendparent ? "¬" + Path.GetFullPath(input) : ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (PathTooLongException)
|
catch (PathTooLongException)
|
||||||
{
|
{
|
||||||
logger.Warning("The path for " + input + " was too long");
|
logger.Warning("The path for " + file + " was too long");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
logger.Error(ex.ToString());
|
logger.Error(ex.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
else if (File.Exists(input))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
lock (outputs)
|
||||||
|
{
|
||||||
|
outputs.Add(Path.GetFullPath(input) + (appendparent ? "¬" + Path.GetFullPath(input) : ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (PathTooLongException)
|
||||||
|
{
|
||||||
|
logger.Warning("The path for " + input + " was too long");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.Error(ex.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return outputs;
|
return outputs;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user