diff --git a/SabreTools.Helper/Dats/DatFile.cs b/SabreTools.Helper/Dats/DatFile.cs
index 78b2bc91..d1681b0e 100644
--- a/SabreTools.Helper/Dats/DatFile.cs
+++ b/SabreTools.Helper/Dats/DatFile.cs
@@ -5260,7 +5260,7 @@ namespace SabreTools.Helper.Dats
foreach (string key in keys)
{
// Here, the key is the name of the game to be used for comparison
- if (tempDat.Name != null && tempDat.Name != Path.GetDirectoryName(key))
+ if (tempDat.Name != null && tempDat.Name != Style.GetDirectoryName(key))
{
// Get the path that the file will be written out to
string path = HttpUtility.HtmlDecode(String.IsNullOrEmpty(tempDat.Name)
@@ -5303,7 +5303,7 @@ namespace SabreTools.Helper.Dats
}
// Then set the DAT name to be the parent directory name
- tempDat.Name = Path.GetDirectoryName(key);
+ tempDat.Name = Style.GetDirectoryName(key);
}
// Then we write the last DAT out since it would be skipped otherwise
diff --git a/SabreTools.Helper/Tools/Style.cs b/SabreTools.Helper/Tools/Style.cs
index a158e236..532e2a83 100644
--- a/SabreTools.Helper/Tools/Style.cs
+++ b/SabreTools.Helper/Tools/Style.cs
@@ -398,6 +398,74 @@ namespace SabreTools.Helper.Tools
#endregion
+ #region System.IO.Path Replacements
+
+ ///
+ /// Replacement for System.IO.Path.GetDirectoryName
+ ///
+ /// Path to get directory name out of
+ /// Directory name from path
+ public static string GetDirectoryName(string s)
+ {
+ if (s == null)
+ {
+ return "";
+ }
+
+ if (s.Contains(Path.AltDirectorySeparatorChar.ToString()))
+ {
+ string[] tempkey = s.Split(Path.AltDirectorySeparatorChar);
+ return String.Join(Path.AltDirectorySeparatorChar.ToString(), tempkey.Take(tempkey.Length - 1));
+ }
+ else if (s.Contains(Path.DirectorySeparatorChar.ToString()))
+ {
+ string[] tempkey = s.Split(Path.DirectorySeparatorChar);
+ return String.Join(Path.DirectorySeparatorChar.ToString(), tempkey.Take(tempkey.Length - 1));
+ }
+
+ return "";
+ }
+
+ ///
+ /// Replacement for System.IO.Path.GetFileName
+ ///
+ /// Path to get file name out of
+ /// File name from path
+ public static string GetFileName(string s)
+ {
+ if (s == null)
+ {
+ return "";
+ }
+
+ if (s.Contains(Path.AltDirectorySeparatorChar.ToString()))
+ {
+ string[] tempkey = s.Split(Path.AltDirectorySeparatorChar);
+ return tempkey.Last();
+ }
+ else if (s.Contains(Path.DirectorySeparatorChar.ToString()))
+ {
+ string[] tempkey = s.Split(Path.DirectorySeparatorChar);
+ return tempkey.Last();
+ }
+
+ return s;
+ }
+
+ ///
+ /// Replacement for System.IO.Path.GetFileNameWithoutExtension
+ ///
+ /// Path to get file name out of
+ /// File name without extension from path
+ public static string GetFileNameWithoutExtension(string s)
+ {
+ s = GetFileName(s);
+ string[] tempkey = s.Split('.');
+ return String.Join(".", tempkey.Take(tempkey.Length - 1));
+ }
+
+ #endregion
+
#region WoD-based String Cleaning
///