diff --git a/RombaSharp/Partials/RombaSharp_Helpers.cs b/RombaSharp/Partials/RombaSharp_Helpers.cs
index e8c5b7be..8656b938 100644
--- a/RombaSharp/Partials/RombaSharp_Helpers.cs
+++ b/RombaSharp/Partials/RombaSharp_Helpers.cs
@@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
+using System.Linq;
using System.Xml;
namespace SabreTools
@@ -435,6 +436,33 @@ namespace SabreTools
}
}
+ ///
+ /// Gets all valid DATs that match in the DAT root
+ ///
+ /// List of input strings to check for, presumably file names
+ /// Dictionary of hash/full path for each of the valid DATs
+ private static Dictionary GetValidDats(List inputs)
+ {
+ // Get a dictionary of filenames that actually exist in the DATRoot, logging which ones are not
+ List datRootDats = Directory.EnumerateFiles(_dats, "*", SearchOption.AllDirectories).ToList().ConvertAll(i => i.ToLowerInvariant());
+ Dictionary foundDats = new Dictionary();
+ foreach (string input in inputs)
+ {
+ if (datRootDats.Contains(input.ToLowerInvariant()))
+ {
+ string fullpath = Path.GetFullPath(datRootDats[datRootDats.IndexOf(input.ToLowerInvariant())]);
+ string sha1 = FileTools.GetSingleFileInfo(fullpath).HashData.SHA1;
+ foundDats.Add(sha1, fullpath);
+ }
+ else
+ {
+ _logger.Warning("The file '" + input + "' could not be found in the DAT root");
+ }
+ }
+
+ return foundDats;
+ }
+
#endregion
}
}
diff --git a/RombaSharp/Partials/RombaSharp_Inits.cs b/RombaSharp/Partials/RombaSharp_Inits.cs
index 446d1379..6cdd4d9f 100644
--- a/RombaSharp/Partials/RombaSharp_Inits.cs
+++ b/RombaSharp/Partials/RombaSharp_Inits.cs
@@ -16,6 +16,11 @@ namespace SabreTools
private static void InitArchive(List inputs, bool onlyNeeded)
{
_logger.User("This feature is not yet implemented: archive");
+
+ // This should use the same thing as something like in SimpleSort, as in scan the archive and scan the files inside equally
+ // Either during or after, we then check against the database to see if there's any matches. If there's no match and
+ // we say onlyNeeded, then don't add it. If there's no match and not onlyNeeded, add it with no DAT hash. If there's a match,
+ // and it doesn't say exists, add it and change the flag. If there's a match and says exists, skip it.
}
///
@@ -25,6 +30,12 @@ namespace SabreTools
private static void InitBuild(List inputs)
{
_logger.User("This feature is not yet implemented: build");
+
+ // Verify the filenames
+ Dictionary foundDats = GetValidDats(inputs);
+
+ // Now that we have the dictionary, we can loop through and output to a new folder for each
+
}
///
@@ -34,6 +45,9 @@ namespace SabreTools
private static void InitDiffDat(string newdat)
{
_logger.User("This feature is not yet implemented: diffdat");
+
+ // First, we want to read in the DAT. Then for each file listed in the DAT, we check if it's in there or not.
+ // If it is in there, we add it to an output DAT. If it's not, we skip. Then we output the DAT.
}
///
@@ -63,6 +77,9 @@ namespace SabreTools
private static void InitFixdat(List inputs)
{
_logger.User("This feature is not yet implemented: fixdat");
+
+ // Verify the filenames
+ Dictionary foundDats = GetValidDats(inputs);
}
///
@@ -81,6 +98,9 @@ namespace SabreTools
private static void InitMiss(List inputs)
{
_logger.User("This feature is not yet implemented: miss");
+
+ // Verify the filenames
+ Dictionary foundDats = GetValidDats(inputs);
}
#endregion