Prefer Path.DirectorySeparatorChar. Remove unused deserializer

save-path-regex
Pat Hartl 2023-11-30 18:29:11 -06:00
parent 7c22aaa139
commit 745cf0cce6
1 changed files with 3 additions and 7 deletions

View File

@ -61,19 +61,15 @@ namespace LANCommander.SDK
ExtractFilesFromZip(tempFile, tempLocation);
var deserializer = new DeserializerBuilder()
.WithNamingConvention(new PascalCaseNamingConvention())
.Build();
#region Move files
foreach (var savePath in manifest.SavePaths.Where(sp => sp.Type == "File"))
{
bool inInstallDir = savePath.Path.StartsWith("{InstallDir}");
string tempSavePath = Path.Combine(tempLocation, savePath.Id.ToString());
var tempSavePathFile = Path.Combine(tempSavePath, savePath.Path.Replace('/', '\\').Replace("{InstallDir}\\", ""));
var tempSavePathFile = Path.Combine(tempSavePath, savePath.Path.Replace('/', Path.DirectorySeparatorChar).Replace("{InstallDir}\\", ""));
destination = Environment.ExpandEnvironmentVariables(savePath.Path.Replace('/', '\\').Replace("{InstallDir}", installDirectory));
destination = Environment.ExpandEnvironmentVariables(savePath.Path.Replace('/', Path.DirectorySeparatorChar).Replace("{InstallDir}", installDirectory));
if (File.Exists(tempSavePathFile))
{
@ -94,7 +90,7 @@ namespace LANCommander.SDK
if (inInstallDir)
{
// Files are in the game's install directory. Move them there from the save path.
destination = file.Replace(tempSavePath, savePath.Path.Replace('/', '\\').TrimEnd('\\').Replace("{InstallDir}", installDirectory));
destination = file.Replace(tempSavePath, savePath.Path.Replace('/', Path.DirectorySeparatorChar).TrimEnd(Path.DirectorySeparatorChar).Replace("{InstallDir}", installDirectory));
if (File.Exists(destination))
File.Delete(destination);