mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatFile, NaturalComparer, Style] Fix current directory; fix sorting order
If we find stuff that's "identical" then we should really compare to see if it's ACTUALLY identical or not, or else this can make some things REALLY weird
This commit is contained in:
@@ -269,7 +269,7 @@ namespace SabreTools.Library.Dats
|
|||||||
DatFile diffData;
|
DatFile diffData;
|
||||||
|
|
||||||
// If we're in inplace mode, take the appropriate DatData object already stored
|
// If we're in inplace mode, take the appropriate DatData object already stored
|
||||||
if (inplace || !String.IsNullOrEmpty(outDir))
|
if (inplace || outDir != Environment.CurrentDirectory)
|
||||||
{
|
{
|
||||||
diffData = datHeaders[j];
|
diffData = datHeaders[j];
|
||||||
}
|
}
|
||||||
@@ -330,7 +330,7 @@ namespace SabreTools.Library.Dats
|
|||||||
{
|
{
|
||||||
path = Path.GetDirectoryName(inputs[j].Split('¬')[0]);
|
path = Path.GetDirectoryName(inputs[j].Split('¬')[0]);
|
||||||
}
|
}
|
||||||
else if (!String.IsNullOrEmpty(outDir))
|
else if (outDir != Environment.CurrentDirectory)
|
||||||
{
|
{
|
||||||
string[] split = inputs[j].Split('¬');
|
string[] split = inputs[j].Split('¬');
|
||||||
path = outDir + (split[0] == split[1]
|
path = outDir + (split[0] == split[1]
|
||||||
@@ -598,7 +598,7 @@ namespace SabreTools.Library.Dats
|
|||||||
innerDatdata.Filter(filter, trim, single, root);
|
innerDatdata.Filter(filter, trim, single, root);
|
||||||
|
|
||||||
// Try to output the file
|
// Try to output the file
|
||||||
innerDatdata.WriteToFile((realOutDir == "" ? Path.GetDirectoryName(inputFileName) : realOutDir), overwrite: (realOutDir != ""));
|
innerDatdata.WriteToFile((realOutDir == Environment.CurrentDirectory ? Path.GetDirectoryName(inputFileName) : realOutDir), overwrite: (realOutDir != Environment.CurrentDirectory));
|
||||||
}
|
}
|
||||||
else if (Directory.Exists(inputFileName))
|
else if (Directory.Exists(inputFileName))
|
||||||
{
|
{
|
||||||
@@ -621,8 +621,8 @@ namespace SabreTools.Library.Dats
|
|||||||
innerDatdata.Filter(filter, trim, single, root);
|
innerDatdata.Filter(filter, trim, single, root);
|
||||||
|
|
||||||
// Try to output the file
|
// Try to output the file
|
||||||
innerDatdata.WriteToFile((realOutDir == "" ? Path.GetDirectoryName(file) : realOutDir + Path.GetDirectoryName(file).Remove(0, inputFileName.Length - 1)),
|
innerDatdata.WriteToFile((realOutDir == Environment.CurrentDirectory ? Path.GetDirectoryName(file) : realOutDir + Path.GetDirectoryName(file).Remove(0, inputFileName.Length - 1)),
|
||||||
overwrite: (realOutDir != ""));
|
overwrite: (realOutDir != Environment.CurrentDirectory));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -285,10 +285,6 @@ namespace SabreTools.Library.Dats
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the proper output file name
|
// Get the proper output file name
|
||||||
if (String.IsNullOrEmpty(outDir))
|
|
||||||
{
|
|
||||||
outDir = Environment.CurrentDirectory;
|
|
||||||
}
|
|
||||||
if (String.IsNullOrEmpty(reportName))
|
if (String.IsNullOrEmpty(reportName))
|
||||||
{
|
{
|
||||||
reportName = "report";
|
reportName = "report";
|
||||||
|
|||||||
@@ -43,13 +43,13 @@ namespace NaturalSort
|
|||||||
if (!table.TryGetValue(x, out x1))
|
if (!table.TryGetValue(x, out x1))
|
||||||
{
|
{
|
||||||
//x1 = Regex.Split(x.Replace(" ", ""), "([0-9]+)");
|
//x1 = Regex.Split(x.Replace(" ", ""), "([0-9]+)");
|
||||||
x1 = Regex.Split(x, "([0-9]+)").Where(s => s != "").ToArray();
|
x1 = Regex.Split(x.ToLowerInvariant(), "([0-9]+)").Where(s => s != "").ToArray();
|
||||||
table.Add(x, x1);
|
table.Add(x, x1);
|
||||||
}
|
}
|
||||||
if (!table.TryGetValue(y, out y1))
|
if (!table.TryGetValue(y, out y1))
|
||||||
{
|
{
|
||||||
//y1 = Regex.Split(y.Replace(" ", ""), "([0-9]+)");
|
//y1 = Regex.Split(y.Replace(" ", ""), "([0-9]+)");
|
||||||
y1 = Regex.Split(y, "([0-9]+)").Where(s => s != "").ToArray();
|
y1 = Regex.Split(y.ToLowerInvariant(), "([0-9]+)").Where(s => s != "").ToArray();
|
||||||
table.Add(y, y1);
|
table.Add(y, y1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,13 +43,13 @@ namespace NaturalSort
|
|||||||
if (!table.TryGetValue(x, out x1))
|
if (!table.TryGetValue(x, out x1))
|
||||||
{
|
{
|
||||||
//x1 = Regex.Split(x.Replace(" ", ""), "([0-9]+)");
|
//x1 = Regex.Split(x.Replace(" ", ""), "([0-9]+)");
|
||||||
x1 = Regex.Split(x, "([0-9]+)").Where(s => s != "").ToArray();
|
x1 = Regex.Split(x.ToLowerInvariant(), "([0-9]+)").Where(s => s != "").ToArray();
|
||||||
table.Add(x, x1);
|
table.Add(x, x1);
|
||||||
}
|
}
|
||||||
if (!table.TryGetValue(y, out y1))
|
if (!table.TryGetValue(y, out y1))
|
||||||
{
|
{
|
||||||
//y1 = Regex.Split(y.Replace(" ", ""), "([0-9]+)");
|
//y1 = Regex.Split(y.Replace(" ", ""), "([0-9]+)");
|
||||||
y1 = Regex.Split(y, "([0-9]+)").Where(s => s != "").ToArray();
|
y1 = Regex.Split(y.ToLowerInvariant(), "([0-9]+)").Where(s => s != "").ToArray();
|
||||||
table.Add(y, y1);
|
table.Add(y, y1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user