mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
IOUtils Changes
- added new NormalizeFolder method to format the path parameter, so that it is formed correctly. If the path is a local root path (eg. d:) then it must end with \\. If the path is not a root path, or is a Unc path, then any ending \\ must be removed. This fix was due to an issue with the previous code, as it kept appending a \ to the end when the path was a Unc path.
This commit is contained in:
parent
14cff018cd
commit
bbaad6099f
9 changed files with 210 additions and 222 deletions
|
|
@ -57,38 +57,22 @@ namespace ServerManagerTool
|
|||
|
||||
if (!string.IsNullOrWhiteSpace(Config.Default.DataDir))
|
||||
{
|
||||
var root = Path.GetPathRoot(Config.Default.DataDir);
|
||||
if (!root.EndsWith("\\"))
|
||||
{
|
||||
Config.Default.DataDir = Config.Default.DataDir.Replace(root, root + "\\");
|
||||
}
|
||||
Config.Default.DataDir = IOUtils.NormalizeFolder(Config.Default.DataDir);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Config.Default.ConfigDirectory))
|
||||
{
|
||||
var root = Path.GetPathRoot(Config.Default.ConfigDirectory);
|
||||
if (!root.EndsWith("\\"))
|
||||
{
|
||||
Config.Default.ConfigDirectory = Config.Default.ConfigDirectory.Replace(root, root + "\\");
|
||||
}
|
||||
Config.Default.ConfigDirectory = IOUtils.NormalizeFolder(Config.Default.ConfigDirectory);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Config.Default.BackupPath))
|
||||
{
|
||||
var root = Path.GetPathRoot(Config.Default.BackupPath);
|
||||
if (!root.EndsWith("\\"))
|
||||
{
|
||||
Config.Default.BackupPath = Config.Default.BackupPath.Replace(root, root + "\\");
|
||||
}
|
||||
Config.Default.BackupPath = IOUtils.NormalizeFolder(Config.Default.BackupPath);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Config.Default.AutoUpdate_CacheDir))
|
||||
{
|
||||
var root = Path.GetPathRoot(Config.Default.AutoUpdate_CacheDir);
|
||||
if (!root.EndsWith("\\"))
|
||||
{
|
||||
Config.Default.AutoUpdate_CacheDir = Config.Default.AutoUpdate_CacheDir.Replace(root, root + "\\");
|
||||
}
|
||||
Config.Default.AutoUpdate_CacheDir = IOUtils.NormalizeFolder(Config.Default.AutoUpdate_CacheDir);
|
||||
}
|
||||
|
||||
App.Instance = this;
|
||||
|
|
|
|||
|
|
@ -206,69 +206,60 @@ namespace ServerManagerTool
|
|||
dialog.InitialDirectory = Config.Default.DataDir;
|
||||
var result = dialog.ShowDialog(Window.GetWindow(this));
|
||||
|
||||
if (result == CommonFileDialogResult.Ok)
|
||||
if (result != CommonFileDialogResult.Ok)
|
||||
return;
|
||||
|
||||
if (string.Equals(dialog.FileName, Config.Default.DataDir, StringComparison.OrdinalIgnoreCase))
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
if (!string.Equals(dialog.FileName, Config.Default.DataDir))
|
||||
var newDataDirectory = IOUtils.NormalizeFolder(dialog.FileName);
|
||||
|
||||
// Set up the destination directories
|
||||
string newConfigDirectory = Path.Combine(newDataDirectory, Config.Default.ProfilesDir);
|
||||
string oldSteamDirectory = Path.Combine(Config.Default.DataDir, Config.Default.SteamCmdDir);
|
||||
string newSteamDirectory = Path.Combine(newDataDirectory, Config.Default.SteamCmdDir);
|
||||
|
||||
Directory.CreateDirectory(newConfigDirectory);
|
||||
Directory.CreateDirectory(newSteamDirectory);
|
||||
|
||||
// Copy the Profiles
|
||||
foreach (var file in Directory.EnumerateFiles(Config.Default.ConfigDirectory, "*.*", SearchOption.AllDirectories))
|
||||
{
|
||||
try
|
||||
string sourceWithoutRoot = file.Substring(Config.Default.ConfigDirectory.Length + 1);
|
||||
string destination = Path.Combine(newConfigDirectory, sourceWithoutRoot);
|
||||
if (!File.Exists(destination))
|
||||
{
|
||||
var newDataDirectory = dialog.FileName;
|
||||
if (!string.IsNullOrWhiteSpace(newDataDirectory))
|
||||
{
|
||||
var root = Path.GetPathRoot(newDataDirectory);
|
||||
if (!root.EndsWith("\\"))
|
||||
{
|
||||
newDataDirectory = newDataDirectory.Replace(root, root + "\\");
|
||||
}
|
||||
}
|
||||
|
||||
// Set up the destination directories
|
||||
string newConfigDirectory = Path.Combine(newDataDirectory, Config.Default.ProfilesDir);
|
||||
string oldSteamDirectory = Path.Combine(Config.Default.DataDir, Config.Default.SteamCmdDir);
|
||||
string newSteamDirectory = Path.Combine(newDataDirectory, Config.Default.SteamCmdDir);
|
||||
|
||||
Directory.CreateDirectory(newConfigDirectory);
|
||||
Directory.CreateDirectory(newSteamDirectory);
|
||||
|
||||
// Copy the Profiles
|
||||
foreach (var file in Directory.EnumerateFiles(Config.Default.ConfigDirectory, "*.*", SearchOption.AllDirectories))
|
||||
{
|
||||
string sourceWithoutRoot = file.Substring(Config.Default.ConfigDirectory.Length + 1);
|
||||
string destination = Path.Combine(newConfigDirectory, sourceWithoutRoot);
|
||||
if (!File.Exists(destination))
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(destination));
|
||||
File.Copy(file, destination);
|
||||
}
|
||||
}
|
||||
|
||||
// Copy the SteamCMD files
|
||||
foreach (var file in Directory.EnumerateFiles(oldSteamDirectory, "*.*", SearchOption.AllDirectories))
|
||||
{
|
||||
string sourceWithoutRoot = file.Substring(oldSteamDirectory.Length + 1);
|
||||
string destination = Path.Combine(newSteamDirectory, sourceWithoutRoot);
|
||||
if (!File.Exists(destination))
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(destination));
|
||||
File.Copy(file, destination);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the old directories
|
||||
Directory.Delete(Config.Default.ConfigDirectory, true);
|
||||
Directory.Delete(oldSteamDirectory, true);
|
||||
|
||||
// Update the config
|
||||
Config.Default.DataDir = newDataDirectory;
|
||||
Config.Default.ConfigDirectory = newConfigDirectory;
|
||||
App.ReconfigureLogging();
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(destination));
|
||||
File.Copy(file, destination);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(String.Format(_globalizer.GetResourceString("GlobalSettings_DataDirectoryChange_FailedLabel"), ex.Message), _globalizer.GetResourceString("GlobalSettings_DataDirectoryChange_FailedTitle"), MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Copy the SteamCMD files
|
||||
foreach (var file in Directory.EnumerateFiles(oldSteamDirectory, "*.*", SearchOption.AllDirectories))
|
||||
{
|
||||
string sourceWithoutRoot = file.Substring(oldSteamDirectory.Length + 1);
|
||||
string destination = Path.Combine(newSteamDirectory, sourceWithoutRoot);
|
||||
if (!File.Exists(destination))
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(destination));
|
||||
File.Copy(file, destination);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the old directories
|
||||
Directory.Delete(Config.Default.ConfigDirectory, true);
|
||||
Directory.Delete(oldSteamDirectory, true);
|
||||
|
||||
// Update the config
|
||||
Config.Default.DataDir = newDataDirectory;
|
||||
Config.Default.ConfigDirectory = newConfigDirectory;
|
||||
App.ReconfigureLogging();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(String.Format(_globalizer.GetResourceString("GlobalSettings_DataDirectoryChange_FailedLabel"), ex.Message), _globalizer.GetResourceString("GlobalSettings_DataDirectoryChange_FailedTitle"), MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -296,22 +287,13 @@ namespace ServerManagerTool
|
|||
dialog.InitialDirectory = Config.Default.BackupPath;
|
||||
var result = dialog.ShowDialog(Window.GetWindow(this));
|
||||
|
||||
if (result == CommonFileDialogResult.Ok)
|
||||
{
|
||||
if (!string.Equals(dialog.FileName, Config.Default.BackupPath))
|
||||
{
|
||||
Config.Default.BackupPath = dialog.FileName;
|
||||
if (result != CommonFileDialogResult.Ok)
|
||||
return;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Config.Default.BackupPath))
|
||||
{
|
||||
var root = Path.GetPathRoot(Config.Default.BackupPath);
|
||||
if (!root.EndsWith("\\"))
|
||||
{
|
||||
Config.Default.BackupPath = Config.Default.BackupPath.Replace(root, root + "\\");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (string.Equals(dialog.FileName, Config.Default.BackupPath, StringComparison.OrdinalIgnoreCase))
|
||||
return;
|
||||
|
||||
Config.Default.BackupPath = IOUtils.NormalizeFolder(dialog.FileName);
|
||||
}
|
||||
|
||||
private void ClearBackupDir_Click(object sender, RoutedEventArgs e)
|
||||
|
|
@ -327,22 +309,13 @@ namespace ServerManagerTool
|
|||
dialog.InitialDirectory = Config.Default.DataDir;
|
||||
var result = dialog.ShowDialog(Window.GetWindow(this));
|
||||
|
||||
if (result == CommonFileDialogResult.Ok)
|
||||
{
|
||||
if (!string.Equals(dialog.FileName, Config.Default.AutoUpdate_CacheDir))
|
||||
{
|
||||
Config.Default.AutoUpdate_CacheDir = dialog.FileName;
|
||||
if (result != CommonFileDialogResult.Ok)
|
||||
return;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Config.Default.AutoUpdate_CacheDir))
|
||||
{
|
||||
var root = Path.GetPathRoot(Config.Default.AutoUpdate_CacheDir);
|
||||
if (!root.EndsWith("\\"))
|
||||
{
|
||||
Config.Default.AutoUpdate_CacheDir = Config.Default.AutoUpdate_CacheDir.Replace(root, root + "\\");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (string.Equals(dialog.FileName, Config.Default.AutoUpdate_CacheDir, StringComparison.OrdinalIgnoreCase))
|
||||
return;
|
||||
|
||||
Config.Default.AutoUpdate_CacheDir = IOUtils.NormalizeFolder(dialog.FileName);
|
||||
}
|
||||
|
||||
private void SteamAPIKeyHelp_Click(object sender, RoutedEventArgs e)
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
<entry>
|
||||
<id>urn:uuid:2C48A585-72D2-43FB-8987-6B5F0B3E460F</id>
|
||||
<title>1.1.425 (1.1.425.6)</title>
|
||||
<summary>1.1.425.6</summary>
|
||||
<title>1.1.425 (1.1.425.7)</title>
|
||||
<summary>1.1.425.7</summary>
|
||||
<link href="" />
|
||||
<updated>2022-05-08T00:00:00Z</updated>
|
||||
<content type="xhtml">
|
||||
|
|
@ -19,6 +19,7 @@
|
|||
<u style="font-size: .9em;">BUGFIX</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>Fixed an issue with the path normalization, where it would add extra '\' characters to the end of the path, when the path was a Unc path.</li>
|
||||
<li>World Save Backup - fixed the backup of the files.</li>
|
||||
</ul>
|
||||
<u style="font-size: .9em;">CHANGE</u>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,29 @@
|
|||
<link href="http://arkservermanager.freeforums.net/" />
|
||||
<updated>2022-05-08T00:00:00Z</updated>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:6F7A6BDA-891F-4446-B889-3FC218D207D6</id>
|
||||
<title>1.1.425 (1.1.425.7)</title>
|
||||
<summary>1.1.425.7</summary>
|
||||
<link href="" />
|
||||
<updated>2022-05-08T00:00:00Z</updated>
|
||||
<content type="xhtml">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
|
||||
<p>
|
||||
<u style="font-size: .9em;">BUGFIX</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>Fixed an issue with the path normalization, where it would add extra '\' characters to the end of the path, when the path was a Unc path.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</content>
|
||||
<author>
|
||||
<name>bletch</name>
|
||||
<email>bletch1971@hotmail.com</email>
|
||||
</author>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:973E001F-223C-4B57-89F7-8B8040900A7C</id>
|
||||
<title>1.1.425 (1.1.425.6)</title>
|
||||
|
|
|
|||
|
|
@ -56,38 +56,22 @@ namespace ServerManagerTool
|
|||
|
||||
if (!string.IsNullOrWhiteSpace(Config.Default.DataPath))
|
||||
{
|
||||
var root = Path.GetPathRoot(Config.Default.DataPath);
|
||||
if (!root.EndsWith("\\"))
|
||||
{
|
||||
Config.Default.DataPath = Config.Default.DataPath.Replace(root, root + "\\");
|
||||
}
|
||||
Config.Default.DataPath = IOUtils.NormalizeFolder(Config.Default.DataPath);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Config.Default.ConfigPath))
|
||||
{
|
||||
var root = Path.GetPathRoot(Config.Default.ConfigPath);
|
||||
if (!root.EndsWith("\\"))
|
||||
{
|
||||
Config.Default.ConfigPath = Config.Default.ConfigPath.Replace(root, root + "\\");
|
||||
}
|
||||
Config.Default.ConfigPath = IOUtils.NormalizeFolder(Config.Default.ConfigPath);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Config.Default.BackupPath))
|
||||
{
|
||||
var root = Path.GetPathRoot(Config.Default.BackupPath);
|
||||
if (!root.EndsWith("\\"))
|
||||
{
|
||||
Config.Default.BackupPath = Config.Default.BackupPath.Replace(root, root + "\\");
|
||||
}
|
||||
Config.Default.BackupPath = IOUtils.NormalizeFolder(Config.Default.BackupPath);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Config.Default.AutoUpdate_CacheDir))
|
||||
{
|
||||
var root = Path.GetPathRoot(Config.Default.AutoUpdate_CacheDir);
|
||||
if (!root.EndsWith("\\"))
|
||||
{
|
||||
Config.Default.AutoUpdate_CacheDir = Config.Default.AutoUpdate_CacheDir.Replace(root, root + "\\");
|
||||
}
|
||||
Config.Default.AutoUpdate_CacheDir = IOUtils.NormalizeFolder(Config.Default.AutoUpdate_CacheDir);
|
||||
}
|
||||
|
||||
App.Instance = this;
|
||||
|
|
|
|||
|
|
@ -209,69 +209,60 @@ namespace ServerManagerTool
|
|||
dialog.InitialDirectory = Config.Default.DataPath;
|
||||
var result = dialog.ShowDialog(Window.GetWindow(this));
|
||||
|
||||
if (result == CommonFileDialogResult.Ok)
|
||||
if (result != CommonFileDialogResult.Ok)
|
||||
return;
|
||||
|
||||
if (string.Equals(dialog.FileName, Config.Default.DataPath, StringComparison.OrdinalIgnoreCase))
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
if (!string.Equals(dialog.FileName, Config.Default.DataPath))
|
||||
var newDataDirectory = IOUtils.NormalizeFolder(dialog.FileName);
|
||||
|
||||
// Set up the destination directories
|
||||
string newConfigDirectory = Path.Combine(newDataDirectory, Config.Default.ProfilesRelativePath);
|
||||
string oldSteamDirectory = Path.Combine(Config.Default.DataPath, CommonConfig.Default.SteamCmdRelativePath);
|
||||
string newSteamDirectory = Path.Combine(newDataDirectory, CommonConfig.Default.SteamCmdRelativePath);
|
||||
|
||||
Directory.CreateDirectory(newConfigDirectory);
|
||||
Directory.CreateDirectory(newSteamDirectory);
|
||||
|
||||
// Copy the Profiles
|
||||
foreach (var file in Directory.EnumerateFiles(Config.Default.ConfigPath, "*.*", SearchOption.AllDirectories))
|
||||
{
|
||||
try
|
||||
string sourceWithoutRoot = file.Substring(Config.Default.ConfigPath.Length + 1);
|
||||
string destination = Path.Combine(newConfigDirectory, sourceWithoutRoot);
|
||||
if (!File.Exists(destination))
|
||||
{
|
||||
var newDataDirectory = dialog.FileName;
|
||||
if (!string.IsNullOrWhiteSpace(newDataDirectory))
|
||||
{
|
||||
var root = Path.GetPathRoot(newDataDirectory);
|
||||
if (!root.EndsWith("\\"))
|
||||
{
|
||||
newDataDirectory = newDataDirectory.Replace(root, root + "\\");
|
||||
}
|
||||
}
|
||||
|
||||
// Set up the destination directories
|
||||
string newConfigDirectory = Path.Combine(newDataDirectory, Config.Default.ProfilesRelativePath);
|
||||
string oldSteamDirectory = Path.Combine(Config.Default.DataPath, CommonConfig.Default.SteamCmdRelativePath);
|
||||
string newSteamDirectory = Path.Combine(newDataDirectory, CommonConfig.Default.SteamCmdRelativePath);
|
||||
|
||||
Directory.CreateDirectory(newConfigDirectory);
|
||||
Directory.CreateDirectory(newSteamDirectory);
|
||||
|
||||
// Copy the Profiles
|
||||
foreach (var file in Directory.EnumerateFiles(Config.Default.ConfigPath, "*.*", SearchOption.AllDirectories))
|
||||
{
|
||||
string sourceWithoutRoot = file.Substring(Config.Default.ConfigPath.Length + 1);
|
||||
string destination = Path.Combine(newConfigDirectory, sourceWithoutRoot);
|
||||
if (!File.Exists(destination))
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(destination));
|
||||
File.Copy(file, destination);
|
||||
}
|
||||
}
|
||||
|
||||
// Copy the SteamCMD files
|
||||
foreach (var file in Directory.EnumerateFiles(oldSteamDirectory, "*.*", SearchOption.AllDirectories))
|
||||
{
|
||||
string sourceWithoutRoot = file.Substring(oldSteamDirectory.Length + 1);
|
||||
string destination = Path.Combine(newSteamDirectory, sourceWithoutRoot);
|
||||
if (!File.Exists(destination))
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(destination));
|
||||
File.Copy(file, destination);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the old directories
|
||||
Directory.Delete(Config.Default.ConfigPath, true);
|
||||
Directory.Delete(oldSteamDirectory, true);
|
||||
|
||||
// Update the config
|
||||
Config.Default.DataPath = newDataDirectory;
|
||||
Config.Default.ConfigPath = newConfigDirectory;
|
||||
App.ReconfigureLogging();
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(destination));
|
||||
File.Copy(file, destination);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(String.Format(_globalizer.GetResourceString("GlobalSettings_DataDirectoryChange_FailedLabel"), ex.Message), _globalizer.GetResourceString("GlobalSettings_DataDirectoryChange_FailedTitle"), MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Copy the SteamCMD files
|
||||
foreach (var file in Directory.EnumerateFiles(oldSteamDirectory, "*.*", SearchOption.AllDirectories))
|
||||
{
|
||||
string sourceWithoutRoot = file.Substring(oldSteamDirectory.Length + 1);
|
||||
string destination = Path.Combine(newSteamDirectory, sourceWithoutRoot);
|
||||
if (!File.Exists(destination))
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(destination));
|
||||
File.Copy(file, destination);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the old directories
|
||||
Directory.Delete(Config.Default.ConfigPath, true);
|
||||
Directory.Delete(oldSteamDirectory, true);
|
||||
|
||||
// Update the config
|
||||
Config.Default.DataPath = newDataDirectory;
|
||||
Config.Default.ConfigPath = newConfigDirectory;
|
||||
App.ReconfigureLogging();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(String.Format(_globalizer.GetResourceString("GlobalSettings_DataDirectoryChange_FailedLabel"), ex.Message), _globalizer.GetResourceString("GlobalSettings_DataDirectoryChange_FailedTitle"), MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -299,22 +290,13 @@ namespace ServerManagerTool
|
|||
dialog.InitialDirectory = Config.Default.BackupPath;
|
||||
var result = dialog.ShowDialog(Window.GetWindow(this));
|
||||
|
||||
if (result == CommonFileDialogResult.Ok)
|
||||
{
|
||||
if (!string.Equals(dialog.FileName, Config.Default.BackupPath))
|
||||
{
|
||||
Config.Default.BackupPath = dialog.FileName;
|
||||
if (result != CommonFileDialogResult.Ok)
|
||||
return;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Config.Default.BackupPath))
|
||||
{
|
||||
var root = Path.GetPathRoot(Config.Default.BackupPath);
|
||||
if (!root.EndsWith("\\"))
|
||||
{
|
||||
Config.Default.BackupPath = Config.Default.BackupPath.Replace(root, root + "\\");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (string.Equals(dialog.FileName, Config.Default.BackupPath, StringComparison.OrdinalIgnoreCase))
|
||||
return;
|
||||
|
||||
Config.Default.BackupPath = IOUtils.NormalizeFolder(dialog.FileName);
|
||||
}
|
||||
|
||||
private void ClearBackupDir_Click(object sender, RoutedEventArgs e)
|
||||
|
|
@ -330,22 +312,13 @@ namespace ServerManagerTool
|
|||
dialog.InitialDirectory = Config.Default.DataPath;
|
||||
var result = dialog.ShowDialog(Window.GetWindow(this));
|
||||
|
||||
if (result == CommonFileDialogResult.Ok)
|
||||
{
|
||||
if (!string.Equals(dialog.FileName, Config.Default.AutoUpdate_CacheDir))
|
||||
{
|
||||
Config.Default.AutoUpdate_CacheDir = dialog.FileName;
|
||||
if (result != CommonFileDialogResult.Ok)
|
||||
return;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Config.Default.AutoUpdate_CacheDir))
|
||||
{
|
||||
var root = Path.GetPathRoot(Config.Default.AutoUpdate_CacheDir);
|
||||
if (!root.EndsWith("\\"))
|
||||
{
|
||||
Config.Default.AutoUpdate_CacheDir = Config.Default.AutoUpdate_CacheDir.Replace(root, root + "\\");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (string.Equals(dialog.FileName, Config.Default.AutoUpdate_CacheDir, StringComparison.OrdinalIgnoreCase))
|
||||
return;
|
||||
|
||||
Config.Default.AutoUpdate_CacheDir = IOUtils.NormalizeFolder(dialog.FileName);
|
||||
}
|
||||
|
||||
private void SteamAPIKeyHelp_Click(object sender, RoutedEventArgs e)
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
<entry>
|
||||
<id>urn:uuid:AD8ABBB5-093A-4FDB-B473-FCED2DB46781</id>
|
||||
<title>1.1.69 (1.1.69.6)</title>
|
||||
<summary>1.1.69.6</summary>
|
||||
<title>1.1.69 (1.1.69.7)</title>
|
||||
<summary>1.1.69.7</summary>
|
||||
<link href="" />
|
||||
<updated>2022-05-08T00:00:00Z</updated>
|
||||
<content type="xhtml">
|
||||
|
|
@ -20,6 +20,7 @@
|
|||
<br/>
|
||||
<ul>
|
||||
<li>Fixed an issue that would not send through the auto process messages via RCON using the correct mode selected in the global settings.</li>
|
||||
<li>Fixed an issue with the path normalization, where it would add extra '\' characters to the end of the path, when the path was a Unc path.</li>
|
||||
<li>World Save Backup - fixed the backup of the files.</li>
|
||||
</ul>
|
||||
<u style="font-size: .9em;">CHANGE</u>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,29 @@
|
|||
<link href="http://servermanagers.freeforums.net/" />
|
||||
<updated>2022-05-08T00:00:00Z</updated>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:3DDB3838-5020-4CA3-A054-423479FFB667</id>
|
||||
<title>1.1.69 (1.1.69.7)</title>
|
||||
<summary>1.1.69.7</summary>
|
||||
<link href="" />
|
||||
<updated>2022-05-08T00:00:00Z</updated>
|
||||
<content type="xhtml">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
|
||||
<p>
|
||||
<u style="font-size: .9em;">BUGFIX</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>Fixed an issue with the path normalization, where it would add extra '\' characters to the end of the path, when the path was a Unc path.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</content>
|
||||
<author>
|
||||
<name>bletch</name>
|
||||
<email>bletch1971@hotmail.com</email>
|
||||
</author>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:72CA1005-0061-41A3-9883-F826B8F9F27F</id>
|
||||
<title>1.1.69 (1.1.69.6)</title>
|
||||
|
|
|
|||
|
|
@ -10,11 +10,37 @@ namespace ServerManagerTool.Common.Utils
|
|||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
private static extern bool DeleteFile(string name);
|
||||
|
||||
public static bool IsUnc(string path) => new Uri(path).IsUnc;
|
||||
|
||||
public static string NormalizeFolder(string path)
|
||||
{
|
||||
var newPath = path.TrimEnd('\\') + "\\";
|
||||
|
||||
if (IsUnc(newPath))
|
||||
{
|
||||
return newPath.TrimEnd('\\');
|
||||
}
|
||||
|
||||
var root = Path.GetPathRoot(newPath);
|
||||
if (!root.EndsWith("\\"))
|
||||
root += "\\";
|
||||
|
||||
if (!string.Equals(root, newPath, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
newPath = newPath.TrimEnd('\\');
|
||||
}
|
||||
|
||||
return newPath;
|
||||
}
|
||||
|
||||
public static string NormalizePath(string path) =>
|
||||
Path.GetFullPath(new Uri(path).LocalPath)
|
||||
.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar)
|
||||
.ToLowerInvariant();
|
||||
|
||||
public static bool Unblock(string fileName)
|
||||
{
|
||||
return DeleteFile(fileName + ":Zone.Identifier");
|
||||
}
|
||||
|
||||
public static string NormalizePath(string path) => Path.GetFullPath(new Uri(path).LocalPath).TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar).ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue