mirror of
https://github.com/tribufu/ServerManagers
synced 2026-06-01 09:42:39 +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))
|
if (!string.IsNullOrWhiteSpace(Config.Default.DataDir))
|
||||||
{
|
{
|
||||||
var root = Path.GetPathRoot(Config.Default.DataDir);
|
Config.Default.DataDir = IOUtils.NormalizeFolder(Config.Default.DataDir);
|
||||||
if (!root.EndsWith("\\"))
|
|
||||||
{
|
|
||||||
Config.Default.DataDir = Config.Default.DataDir.Replace(root, root + "\\");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(Config.Default.ConfigDirectory))
|
if (!string.IsNullOrWhiteSpace(Config.Default.ConfigDirectory))
|
||||||
{
|
{
|
||||||
var root = Path.GetPathRoot(Config.Default.ConfigDirectory);
|
Config.Default.ConfigDirectory = IOUtils.NormalizeFolder(Config.Default.ConfigDirectory);
|
||||||
if (!root.EndsWith("\\"))
|
|
||||||
{
|
|
||||||
Config.Default.ConfigDirectory = Config.Default.ConfigDirectory.Replace(root, root + "\\");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(Config.Default.BackupPath))
|
if (!string.IsNullOrWhiteSpace(Config.Default.BackupPath))
|
||||||
{
|
{
|
||||||
var root = Path.GetPathRoot(Config.Default.BackupPath);
|
Config.Default.BackupPath = IOUtils.NormalizeFolder(Config.Default.BackupPath);
|
||||||
if (!root.EndsWith("\\"))
|
|
||||||
{
|
|
||||||
Config.Default.BackupPath = Config.Default.BackupPath.Replace(root, root + "\\");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(Config.Default.AutoUpdate_CacheDir))
|
if (!string.IsNullOrWhiteSpace(Config.Default.AutoUpdate_CacheDir))
|
||||||
{
|
{
|
||||||
var root = Path.GetPathRoot(Config.Default.AutoUpdate_CacheDir);
|
Config.Default.AutoUpdate_CacheDir = IOUtils.NormalizeFolder(Config.Default.AutoUpdate_CacheDir);
|
||||||
if (!root.EndsWith("\\"))
|
|
||||||
{
|
|
||||||
Config.Default.AutoUpdate_CacheDir = Config.Default.AutoUpdate_CacheDir.Replace(root, root + "\\");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
App.Instance = this;
|
App.Instance = this;
|
||||||
|
|
|
||||||
|
|
@ -206,21 +206,15 @@ namespace ServerManagerTool
|
||||||
dialog.InitialDirectory = Config.Default.DataDir;
|
dialog.InitialDirectory = Config.Default.DataDir;
|
||||||
var result = dialog.ShowDialog(Window.GetWindow(this));
|
var result = dialog.ShowDialog(Window.GetWindow(this));
|
||||||
|
|
||||||
if (result == CommonFileDialogResult.Ok)
|
if (result != CommonFileDialogResult.Ok)
|
||||||
{
|
return;
|
||||||
if (!string.Equals(dialog.FileName, Config.Default.DataDir))
|
|
||||||
{
|
if (string.Equals(dialog.FileName, Config.Default.DataDir, StringComparison.OrdinalIgnoreCase))
|
||||||
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var newDataDirectory = dialog.FileName;
|
var newDataDirectory = IOUtils.NormalizeFolder(dialog.FileName);
|
||||||
if (!string.IsNullOrWhiteSpace(newDataDirectory))
|
|
||||||
{
|
|
||||||
var root = Path.GetPathRoot(newDataDirectory);
|
|
||||||
if (!root.EndsWith("\\"))
|
|
||||||
{
|
|
||||||
newDataDirectory = newDataDirectory.Replace(root, root + "\\");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set up the destination directories
|
// Set up the destination directories
|
||||||
string newConfigDirectory = Path.Combine(newDataDirectory, Config.Default.ProfilesDir);
|
string newConfigDirectory = Path.Combine(newDataDirectory, Config.Default.ProfilesDir);
|
||||||
|
|
@ -267,9 +261,6 @@ namespace ServerManagerTool
|
||||||
{
|
{
|
||||||
MessageBox.Show(String.Format(_globalizer.GetResourceString("GlobalSettings_DataDirectoryChange_FailedLabel"), ex.Message), _globalizer.GetResourceString("GlobalSettings_DataDirectoryChange_FailedTitle"), MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
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;
|
dialog.InitialDirectory = Config.Default.BackupPath;
|
||||||
var result = dialog.ShowDialog(Window.GetWindow(this));
|
var result = dialog.ShowDialog(Window.GetWindow(this));
|
||||||
|
|
||||||
if (result == CommonFileDialogResult.Ok)
|
if (result != CommonFileDialogResult.Ok)
|
||||||
{
|
return;
|
||||||
if (!string.Equals(dialog.FileName, Config.Default.BackupPath))
|
|
||||||
{
|
|
||||||
Config.Default.BackupPath = dialog.FileName;
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(Config.Default.BackupPath))
|
if (string.Equals(dialog.FileName, Config.Default.BackupPath, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
return;
|
||||||
var root = Path.GetPathRoot(Config.Default.BackupPath);
|
|
||||||
if (!root.EndsWith("\\"))
|
Config.Default.BackupPath = IOUtils.NormalizeFolder(dialog.FileName);
|
||||||
{
|
|
||||||
Config.Default.BackupPath = Config.Default.BackupPath.Replace(root, root + "\\");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ClearBackupDir_Click(object sender, RoutedEventArgs e)
|
private void ClearBackupDir_Click(object sender, RoutedEventArgs e)
|
||||||
|
|
@ -327,22 +309,13 @@ namespace ServerManagerTool
|
||||||
dialog.InitialDirectory = Config.Default.DataDir;
|
dialog.InitialDirectory = Config.Default.DataDir;
|
||||||
var result = dialog.ShowDialog(Window.GetWindow(this));
|
var result = dialog.ShowDialog(Window.GetWindow(this));
|
||||||
|
|
||||||
if (result == CommonFileDialogResult.Ok)
|
if (result != CommonFileDialogResult.Ok)
|
||||||
{
|
return;
|
||||||
if (!string.Equals(dialog.FileName, Config.Default.AutoUpdate_CacheDir))
|
|
||||||
{
|
|
||||||
Config.Default.AutoUpdate_CacheDir = dialog.FileName;
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(Config.Default.AutoUpdate_CacheDir))
|
if (string.Equals(dialog.FileName, Config.Default.AutoUpdate_CacheDir, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
return;
|
||||||
var root = Path.GetPathRoot(Config.Default.AutoUpdate_CacheDir);
|
|
||||||
if (!root.EndsWith("\\"))
|
Config.Default.AutoUpdate_CacheDir = IOUtils.NormalizeFolder(dialog.FileName);
|
||||||
{
|
|
||||||
Config.Default.AutoUpdate_CacheDir = Config.Default.AutoUpdate_CacheDir.Replace(root, root + "\\");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SteamAPIKeyHelp_Click(object sender, RoutedEventArgs e)
|
private void SteamAPIKeyHelp_Click(object sender, RoutedEventArgs e)
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
<entry>
|
<entry>
|
||||||
<id>urn:uuid:2C48A585-72D2-43FB-8987-6B5F0B3E460F</id>
|
<id>urn:uuid:2C48A585-72D2-43FB-8987-6B5F0B3E460F</id>
|
||||||
<title>1.1.425 (1.1.425.6)</title>
|
<title>1.1.425 (1.1.425.7)</title>
|
||||||
<summary>1.1.425.6</summary>
|
<summary>1.1.425.7</summary>
|
||||||
<link href="" />
|
<link href="" />
|
||||||
<updated>2022-05-08T00:00:00Z</updated>
|
<updated>2022-05-08T00:00:00Z</updated>
|
||||||
<content type="xhtml">
|
<content type="xhtml">
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
<u style="font-size: .9em;">BUGFIX</u>
|
<u style="font-size: .9em;">BUGFIX</u>
|
||||||
<br/>
|
<br/>
|
||||||
<ul>
|
<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>
|
<li>World Save Backup - fixed the backup of the files.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<u style="font-size: .9em;">CHANGE</u>
|
<u style="font-size: .9em;">CHANGE</u>
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,29 @@
|
||||||
<link href="http://arkservermanager.freeforums.net/" />
|
<link href="http://arkservermanager.freeforums.net/" />
|
||||||
<updated>2022-05-08T00:00:00Z</updated>
|
<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>
|
<entry>
|
||||||
<id>urn:uuid:973E001F-223C-4B57-89F7-8B8040900A7C</id>
|
<id>urn:uuid:973E001F-223C-4B57-89F7-8B8040900A7C</id>
|
||||||
<title>1.1.425 (1.1.425.6)</title>
|
<title>1.1.425 (1.1.425.6)</title>
|
||||||
|
|
|
||||||
|
|
@ -56,38 +56,22 @@ namespace ServerManagerTool
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(Config.Default.DataPath))
|
if (!string.IsNullOrWhiteSpace(Config.Default.DataPath))
|
||||||
{
|
{
|
||||||
var root = Path.GetPathRoot(Config.Default.DataPath);
|
Config.Default.DataPath = IOUtils.NormalizeFolder(Config.Default.DataPath);
|
||||||
if (!root.EndsWith("\\"))
|
|
||||||
{
|
|
||||||
Config.Default.DataPath = Config.Default.DataPath.Replace(root, root + "\\");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(Config.Default.ConfigPath))
|
if (!string.IsNullOrWhiteSpace(Config.Default.ConfigPath))
|
||||||
{
|
{
|
||||||
var root = Path.GetPathRoot(Config.Default.ConfigPath);
|
Config.Default.ConfigPath = IOUtils.NormalizeFolder(Config.Default.ConfigPath);
|
||||||
if (!root.EndsWith("\\"))
|
|
||||||
{
|
|
||||||
Config.Default.ConfigPath = Config.Default.ConfigPath.Replace(root, root + "\\");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(Config.Default.BackupPath))
|
if (!string.IsNullOrWhiteSpace(Config.Default.BackupPath))
|
||||||
{
|
{
|
||||||
var root = Path.GetPathRoot(Config.Default.BackupPath);
|
Config.Default.BackupPath = IOUtils.NormalizeFolder(Config.Default.BackupPath);
|
||||||
if (!root.EndsWith("\\"))
|
|
||||||
{
|
|
||||||
Config.Default.BackupPath = Config.Default.BackupPath.Replace(root, root + "\\");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(Config.Default.AutoUpdate_CacheDir))
|
if (!string.IsNullOrWhiteSpace(Config.Default.AutoUpdate_CacheDir))
|
||||||
{
|
{
|
||||||
var root = Path.GetPathRoot(Config.Default.AutoUpdate_CacheDir);
|
Config.Default.AutoUpdate_CacheDir = IOUtils.NormalizeFolder(Config.Default.AutoUpdate_CacheDir);
|
||||||
if (!root.EndsWith("\\"))
|
|
||||||
{
|
|
||||||
Config.Default.AutoUpdate_CacheDir = Config.Default.AutoUpdate_CacheDir.Replace(root, root + "\\");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
App.Instance = this;
|
App.Instance = this;
|
||||||
|
|
|
||||||
|
|
@ -209,21 +209,15 @@ namespace ServerManagerTool
|
||||||
dialog.InitialDirectory = Config.Default.DataPath;
|
dialog.InitialDirectory = Config.Default.DataPath;
|
||||||
var result = dialog.ShowDialog(Window.GetWindow(this));
|
var result = dialog.ShowDialog(Window.GetWindow(this));
|
||||||
|
|
||||||
if (result == CommonFileDialogResult.Ok)
|
if (result != CommonFileDialogResult.Ok)
|
||||||
{
|
return;
|
||||||
if (!string.Equals(dialog.FileName, Config.Default.DataPath))
|
|
||||||
{
|
if (string.Equals(dialog.FileName, Config.Default.DataPath, StringComparison.OrdinalIgnoreCase))
|
||||||
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var newDataDirectory = dialog.FileName;
|
var newDataDirectory = IOUtils.NormalizeFolder(dialog.FileName);
|
||||||
if (!string.IsNullOrWhiteSpace(newDataDirectory))
|
|
||||||
{
|
|
||||||
var root = Path.GetPathRoot(newDataDirectory);
|
|
||||||
if (!root.EndsWith("\\"))
|
|
||||||
{
|
|
||||||
newDataDirectory = newDataDirectory.Replace(root, root + "\\");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set up the destination directories
|
// Set up the destination directories
|
||||||
string newConfigDirectory = Path.Combine(newDataDirectory, Config.Default.ProfilesRelativePath);
|
string newConfigDirectory = Path.Combine(newDataDirectory, Config.Default.ProfilesRelativePath);
|
||||||
|
|
@ -270,9 +264,6 @@ namespace ServerManagerTool
|
||||||
{
|
{
|
||||||
MessageBox.Show(String.Format(_globalizer.GetResourceString("GlobalSettings_DataDirectoryChange_FailedLabel"), ex.Message), _globalizer.GetResourceString("GlobalSettings_DataDirectoryChange_FailedTitle"), MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
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;
|
dialog.InitialDirectory = Config.Default.BackupPath;
|
||||||
var result = dialog.ShowDialog(Window.GetWindow(this));
|
var result = dialog.ShowDialog(Window.GetWindow(this));
|
||||||
|
|
||||||
if (result == CommonFileDialogResult.Ok)
|
if (result != CommonFileDialogResult.Ok)
|
||||||
{
|
return;
|
||||||
if (!string.Equals(dialog.FileName, Config.Default.BackupPath))
|
|
||||||
{
|
|
||||||
Config.Default.BackupPath = dialog.FileName;
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(Config.Default.BackupPath))
|
if (string.Equals(dialog.FileName, Config.Default.BackupPath, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
return;
|
||||||
var root = Path.GetPathRoot(Config.Default.BackupPath);
|
|
||||||
if (!root.EndsWith("\\"))
|
Config.Default.BackupPath = IOUtils.NormalizeFolder(dialog.FileName);
|
||||||
{
|
|
||||||
Config.Default.BackupPath = Config.Default.BackupPath.Replace(root, root + "\\");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ClearBackupDir_Click(object sender, RoutedEventArgs e)
|
private void ClearBackupDir_Click(object sender, RoutedEventArgs e)
|
||||||
|
|
@ -330,22 +312,13 @@ namespace ServerManagerTool
|
||||||
dialog.InitialDirectory = Config.Default.DataPath;
|
dialog.InitialDirectory = Config.Default.DataPath;
|
||||||
var result = dialog.ShowDialog(Window.GetWindow(this));
|
var result = dialog.ShowDialog(Window.GetWindow(this));
|
||||||
|
|
||||||
if (result == CommonFileDialogResult.Ok)
|
if (result != CommonFileDialogResult.Ok)
|
||||||
{
|
return;
|
||||||
if (!string.Equals(dialog.FileName, Config.Default.AutoUpdate_CacheDir))
|
|
||||||
{
|
|
||||||
Config.Default.AutoUpdate_CacheDir = dialog.FileName;
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(Config.Default.AutoUpdate_CacheDir))
|
if (string.Equals(dialog.FileName, Config.Default.AutoUpdate_CacheDir, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
return;
|
||||||
var root = Path.GetPathRoot(Config.Default.AutoUpdate_CacheDir);
|
|
||||||
if (!root.EndsWith("\\"))
|
Config.Default.AutoUpdate_CacheDir = IOUtils.NormalizeFolder(dialog.FileName);
|
||||||
{
|
|
||||||
Config.Default.AutoUpdate_CacheDir = Config.Default.AutoUpdate_CacheDir.Replace(root, root + "\\");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SteamAPIKeyHelp_Click(object sender, RoutedEventArgs e)
|
private void SteamAPIKeyHelp_Click(object sender, RoutedEventArgs e)
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
<entry>
|
<entry>
|
||||||
<id>urn:uuid:AD8ABBB5-093A-4FDB-B473-FCED2DB46781</id>
|
<id>urn:uuid:AD8ABBB5-093A-4FDB-B473-FCED2DB46781</id>
|
||||||
<title>1.1.69 (1.1.69.6)</title>
|
<title>1.1.69 (1.1.69.7)</title>
|
||||||
<summary>1.1.69.6</summary>
|
<summary>1.1.69.7</summary>
|
||||||
<link href="" />
|
<link href="" />
|
||||||
<updated>2022-05-08T00:00:00Z</updated>
|
<updated>2022-05-08T00:00:00Z</updated>
|
||||||
<content type="xhtml">
|
<content type="xhtml">
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
<br/>
|
<br/>
|
||||||
<ul>
|
<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 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>
|
<li>World Save Backup - fixed the backup of the files.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<u style="font-size: .9em;">CHANGE</u>
|
<u style="font-size: .9em;">CHANGE</u>
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,29 @@
|
||||||
<link href="http://servermanagers.freeforums.net/" />
|
<link href="http://servermanagers.freeforums.net/" />
|
||||||
<updated>2022-05-08T00:00:00Z</updated>
|
<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>
|
<entry>
|
||||||
<id>urn:uuid:72CA1005-0061-41A3-9883-F826B8F9F27F</id>
|
<id>urn:uuid:72CA1005-0061-41A3-9883-F826B8F9F27F</id>
|
||||||
<title>1.1.69 (1.1.69.6)</title>
|
<title>1.1.69 (1.1.69.6)</title>
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,37 @@ namespace ServerManagerTool.Common.Utils
|
||||||
[return: MarshalAs(UnmanagedType.Bool)]
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
private static extern bool DeleteFile(string name);
|
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)
|
public static bool Unblock(string fileName)
|
||||||
{
|
{
|
||||||
return DeleteFile(fileName + ":Zone.Identifier");
|
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