mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
Added additional validation when setting directories in the global setting, to ensure they are rooted correctly.
This commit is contained in:
parent
7d6859915d
commit
6a46155463
8 changed files with 200 additions and 20 deletions
|
|
@ -49,7 +49,45 @@ namespace ServerManagerTool
|
|||
public App()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(Config.Default.ASMUniqueKey))
|
||||
{
|
||||
Config.Default.ASMUniqueKey = Guid.NewGuid().ToString();
|
||||
}
|
||||
|
||||
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 + "\\");
|
||||
}
|
||||
}
|
||||
|
||||
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 + "\\");
|
||||
}
|
||||
}
|
||||
|
||||
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.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 + "\\");
|
||||
}
|
||||
}
|
||||
|
||||
App.Instance = this;
|
||||
ApplicationStarted = false;
|
||||
|
|
|
|||
|
|
@ -148,14 +148,24 @@ namespace ServerManagerTool
|
|||
|
||||
if (result == CommonFileDialogResult.Ok)
|
||||
{
|
||||
if (!String.Equals(dialog.FileName, Config.Default.DataDir))
|
||||
if (!string.Equals(dialog.FileName, Config.Default.DataDir))
|
||||
{
|
||||
try
|
||||
{
|
||||
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(dialog.FileName, Config.Default.ProfilesDir);
|
||||
string newConfigDirectory = Path.Combine(newDataDirectory, Config.Default.ProfilesDir);
|
||||
string oldSteamDirectory = Path.Combine(Config.Default.DataDir, Config.Default.SteamCmdDir);
|
||||
string newSteamDirectory = Path.Combine(dialog.FileName, Config.Default.SteamCmdDir);
|
||||
string newSteamDirectory = Path.Combine(newDataDirectory, Config.Default.SteamCmdDir);
|
||||
|
||||
Directory.CreateDirectory(newConfigDirectory);
|
||||
Directory.CreateDirectory(newSteamDirectory);
|
||||
|
|
@ -189,7 +199,7 @@ namespace ServerManagerTool
|
|||
Directory.Delete(oldSteamDirectory, true);
|
||||
|
||||
// Update the config
|
||||
Config.Default.DataDir = dialog.FileName;
|
||||
Config.Default.DataDir = newDataDirectory;
|
||||
Config.Default.ConfigDirectory = newConfigDirectory;
|
||||
App.ReconfigureLogging();
|
||||
}
|
||||
|
|
@ -228,9 +238,18 @@ namespace ServerManagerTool
|
|||
|
||||
if (result == CommonFileDialogResult.Ok)
|
||||
{
|
||||
if (!String.Equals(dialog.FileName, Config.Default.BackupPath))
|
||||
if (!string.Equals(dialog.FileName, Config.Default.BackupPath))
|
||||
{
|
||||
Config.Default.BackupPath = dialog.FileName;
|
||||
|
||||
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 + "\\");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -250,9 +269,18 @@ namespace ServerManagerTool
|
|||
|
||||
if (result == CommonFileDialogResult.Ok)
|
||||
{
|
||||
if (!String.Equals(dialog.FileName, Config.Default.AutoUpdate_CacheDir))
|
||||
if (!string.Equals(dialog.FileName, Config.Default.AutoUpdate_CacheDir))
|
||||
{
|
||||
Config.Default.AutoUpdate_CacheDir = dialog.FileName;
|
||||
|
||||
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 + "\\");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
<entry>
|
||||
<id>urn:uuid:18276A38-2C71-4BB8-9A83-96D5EBFE9C87</id>
|
||||
<title>1.1.412 (1.1.412.2)</title>
|
||||
<summary>1.1.412.2</summary>
|
||||
<title>1.1.412 (1.1.412.3)</title>
|
||||
<summary>1.1.412.3</summary>
|
||||
<link href="" />
|
||||
<updated>2021-12-15T00:00:00Z</updated>
|
||||
<content type="xhtml">
|
||||
|
|
@ -20,7 +20,8 @@
|
|||
<br/>
|
||||
<ul>
|
||||
<li>Fixed a bug with the Server Shutdown when the CheckForOnlinePlayers option not selected.</li>
|
||||
<li>Fixed a bug when the backup path was a root directory that caused a 'Invalid URI: A Dos path must be rooted, for example' crash.</li>
|
||||
<li>Fixed a bug when the backup path was a root directory that caused a 'Invalid URI: A Dos path must be rooted' crash.</li>
|
||||
<li>Added additional validation when setting directories in the global setting, to ensure they are rooted correctly.</li>
|
||||
</ul>
|
||||
<u style="font-size: .9em;">CHANGE</u>
|
||||
<br/>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,29 @@
|
|||
<link href="http://arkservermanager.freeforums.net/" />
|
||||
<updated>2021-12-15T00:00:00Z</updated>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:B7DE873D-4FC3-4A7B-A531-3146B4D8639A</id>
|
||||
<title>1.1.412 (1.1.412.3)</title>
|
||||
<summary>1.1.412.3</summary>
|
||||
<link href="" />
|
||||
<updated>2021-12-15T00: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>Added additional validation when setting directories in the global setting, to ensure they are rooted correctly.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</content>
|
||||
<author>
|
||||
<name>bletch</name>
|
||||
<email>bletch1971@hotmail.com</email>
|
||||
</author>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:B2056A54-0063-43A9-8E8E-8AD411FFC377</id>
|
||||
<title>1.1.412 (1.1.412.2)</title>
|
||||
|
|
@ -43,7 +66,7 @@
|
|||
<br/>
|
||||
<ul>
|
||||
<li>Fixed a bug with the Server Shutdown when the CheckForOnlinePlayers option not selected.</li>
|
||||
<li>Fixed a bug when the backup path was a root directory that caused a 'Invalid URI: A Dos path must be rooted, for example' crash.</li>
|
||||
<li>Fixed a bug when the backup path was a root directory that caused a 'Invalid URI: A Dos path must be rooted' crash.</li>
|
||||
</ul>
|
||||
<u style="font-size: .9em;">CHANGE</u>
|
||||
<br/>
|
||||
|
|
|
|||
|
|
@ -48,7 +48,45 @@ namespace ServerManagerTool
|
|||
public App()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(Config.Default.ServerManagerUniqueKey))
|
||||
{
|
||||
Config.Default.ServerManagerUniqueKey = Guid.NewGuid().ToString();
|
||||
}
|
||||
|
||||
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 + "\\");
|
||||
}
|
||||
}
|
||||
|
||||
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 + "\\");
|
||||
}
|
||||
}
|
||||
|
||||
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.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 + "\\");
|
||||
}
|
||||
}
|
||||
|
||||
App.Instance = this;
|
||||
ApplicationStarted = false;
|
||||
|
|
|
|||
|
|
@ -158,14 +158,24 @@ namespace ServerManagerTool
|
|||
|
||||
if (result == CommonFileDialogResult.Ok)
|
||||
{
|
||||
if (!String.Equals(dialog.FileName, Config.Default.DataPath))
|
||||
if (!string.Equals(dialog.FileName, Config.Default.DataPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
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(dialog.FileName, Config.Default.ProfilesRelativePath);
|
||||
string newConfigDirectory = Path.Combine(newDataDirectory, Config.Default.ProfilesRelativePath);
|
||||
string oldSteamDirectory = Path.Combine(Config.Default.DataPath, CommonConfig.Default.SteamCmdRelativePath);
|
||||
string newSteamDirectory = Path.Combine(dialog.FileName, CommonConfig.Default.SteamCmdRelativePath);
|
||||
string newSteamDirectory = Path.Combine(newDataDirectory, CommonConfig.Default.SteamCmdRelativePath);
|
||||
|
||||
Directory.CreateDirectory(newConfigDirectory);
|
||||
Directory.CreateDirectory(newSteamDirectory);
|
||||
|
|
@ -199,7 +209,7 @@ namespace ServerManagerTool
|
|||
Directory.Delete(oldSteamDirectory, true);
|
||||
|
||||
// Update the config
|
||||
Config.Default.DataPath = dialog.FileName;
|
||||
Config.Default.DataPath = newDataDirectory;
|
||||
Config.Default.ConfigPath = newConfigDirectory;
|
||||
App.ReconfigureLogging();
|
||||
}
|
||||
|
|
@ -238,9 +248,18 @@ namespace ServerManagerTool
|
|||
|
||||
if (result == CommonFileDialogResult.Ok)
|
||||
{
|
||||
if (!String.Equals(dialog.FileName, Config.Default.BackupPath))
|
||||
if (!string.Equals(dialog.FileName, Config.Default.BackupPath))
|
||||
{
|
||||
Config.Default.BackupPath = dialog.FileName;
|
||||
|
||||
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 + "\\");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -260,9 +279,18 @@ namespace ServerManagerTool
|
|||
|
||||
if (result == CommonFileDialogResult.Ok)
|
||||
{
|
||||
if (!String.Equals(dialog.FileName, Config.Default.AutoUpdate_CacheDir))
|
||||
if (!string.Equals(dialog.FileName, Config.Default.AutoUpdate_CacheDir))
|
||||
{
|
||||
Config.Default.AutoUpdate_CacheDir = dialog.FileName;
|
||||
|
||||
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 + "\\");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
<entry>
|
||||
<id>urn:uuid:6383E79A-C31F-462B-9730-B26B28DC5EFF</id>
|
||||
<title>1.1.57 (1.1.57.1)</title>
|
||||
<summary>1.1.57.1</summary>
|
||||
<title>1.1.57 (1.1.57.2)</title>
|
||||
<summary>1.1.57.2</summary>
|
||||
<link href="" />
|
||||
<updated>2021-12-15T00:00:00Z</updated>
|
||||
<content type="xhtml">
|
||||
|
|
@ -20,7 +20,8 @@
|
|||
<br/>
|
||||
<ul>
|
||||
<li>Fixed a bug with the Server Shutdown when the CheckForOnlinePlayers option not selected.</li>
|
||||
<li>Fixed a bug when the backup path was a root directory that caused a 'Invalid URI: A Dos path must be rooted, for example' crash.</li>
|
||||
<li>Fixed a bug when the backup path was a root directory that caused a 'Invalid URI: A Dos path must be rooted' crash.</li>
|
||||
<li>Added additional validation when setting directories in the global setting, to ensure they are rooted correctly.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,29 @@
|
|||
<link href="http://servermanagers.freeforums.net/" />
|
||||
<updated>2021-12-15T00:00:00Z</updated>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:6383E79A-C31F-462B-9730-B26B28DC5EFF</id>
|
||||
<title>1.1.57 (1.1.57.2)</title>
|
||||
<summary>1.1.57.2</summary>
|
||||
<link href="" />
|
||||
<updated>2021-12-15T00: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>Added additional validation when setting directories in the global setting, to ensure they are rooted correctly.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</content>
|
||||
<author>
|
||||
<name>bletch</name>
|
||||
<email>bletch1971@hotmail.com</email>
|
||||
</author>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:6383E79A-C31F-462B-9730-B26B28DC5EFF</id>
|
||||
<title>1.1.57 (1.1.57.1)</title>
|
||||
|
|
@ -20,7 +43,7 @@
|
|||
<br/>
|
||||
<ul>
|
||||
<li>Fixed a bug with the Server Shutdown when the CheckForOnlinePlayers option not selected.</li>
|
||||
<li>Fixed a bug when the backup path was a root directory that caused a 'Invalid URI: A Dos path must be rooted, for example' crash.</li>
|
||||
<li>Fixed a bug when the backup path was a root directory that caused a 'Invalid URI: A Dos path must be rooted' crash.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue