From e3dd4201fc6e0af215907c13b4d7b1ed6ae85880 Mon Sep 17 00:00:00 2001 From: Brett Hewitson Date: Wed, 1 Dec 2021 12:50:21 +1000 Subject: [PATCH] Data Directory changes 1.Added data directory check for desktop. 2. Set default data directory to root folder of installation path. --- src/ARKServerManager/App.xaml.cs | 12 ++++++++++-- src/ARKServerManager/Globalization/de-DE/de-DE.xaml | 4 ++-- src/ARKServerManager/Globalization/en-US/en-US.xaml | 5 +++-- src/ARKServerManager/Globalization/es-ES/es-ES.xaml | 4 ++-- src/ARKServerManager/Globalization/fr-FR/fr-FR.xaml | 4 ++-- src/ARKServerManager/Globalization/pt-BR/pt-BR.xaml | 4 ++-- src/ARKServerManager/Globalization/ru-RU/ru-RU.xaml | 4 ++-- src/ARKServerManager/Globalization/zh-CN/zh-CN.xaml | 4 ++-- src/ConanServerManager/App.xaml.cs | 12 ++++++++++-- .../Globalization/en-US/en-US.xaml | 5 +++-- 10 files changed, 38 insertions(+), 20 deletions(-) diff --git a/src/ARKServerManager/App.xaml.cs b/src/ARKServerManager/App.xaml.cs index 20e699c8..80da3fb6 100644 --- a/src/ARKServerManager/App.xaml.cs +++ b/src/ARKServerManager/App.xaml.cs @@ -419,6 +419,9 @@ namespace ServerManagerTool if (!installationFolder.EndsWith(@"\")) installationFolder += @"\"; + var desktopFolder1 = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); + var desktopFolder2 = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); + while (String.IsNullOrWhiteSpace(Config.Default.DataDir)) { var dialog = new CommonOpenFileDialog @@ -427,7 +430,7 @@ namespace ServerManagerTool IsFolderPicker = true, Multiselect = false, Title = _globalizer.GetResourceString("Application_DataDirectory_DialogTitle"), - InitialDirectory = installationFolder + InitialDirectory = Path.GetPathRoot(installationFolder) }; if (dialog.ShowDialog() != CommonFileDialogResult.Ok) @@ -445,7 +448,12 @@ namespace ServerManagerTool if (newDataFolder.StartsWith(installationFolder)) { confirm = MessageBoxResult.No; - MessageBox.Show(_globalizer.GetResourceString("Application_DataDirectory_WithinInstallFolderErrorLabel"), _globalizer.GetResourceString("Application_DataDirectory_WithinInstallFolderErrorTitle"), MessageBoxButton.OK, MessageBoxImage.Error); + MessageBox.Show(_globalizer.GetResourceString("Application_DataDirectory_DataDirectoryWithinInstallFolderErrorLabel"), _globalizer.GetResourceString("Application_DataDirectory_DataDirectoryFolderErrorTitle"), MessageBoxButton.OK, MessageBoxImage.Error); + } + else if (newDataFolder.StartsWith(desktopFolder1) || newDataFolder.StartsWith(desktopFolder2)) + { + confirm = MessageBoxResult.No; + MessageBox.Show(_globalizer.GetResourceString("Application_DataDirectory_DataDirectoryWithinDesktopFolderErrorLabel"), _globalizer.GetResourceString("Application_DataDirectory_DataDirectoryFolderErrorTitle"), MessageBoxButton.OK, MessageBoxImage.Error); } else { diff --git a/src/ARKServerManager/Globalization/de-DE/de-DE.xaml b/src/ARKServerManager/Globalization/de-DE/de-DE.xaml index e31fd211..b7dba195 100644 --- a/src/ARKServerManager/Globalization/de-DE/de-DE.xaml +++ b/src/ARKServerManager/Globalization/de-DE/de-DE.xaml @@ -65,8 +65,8 @@ Wähle ein Datenverzeichnis Bestätige Auswahl Der Server Manager speichert Profile und SteamCMD in den folgenden Verzeichnissen:\r\n\r\nProfile: {0}\r\nSteamCMD: {1}\r\n\r\nIst das in Ordnung? - Fehler bei Auswahl des Datenverzeichnisses - Das von Dir ausgewählte Verzeichnis befindet sich im Installationsordner des Server-Managers. Dies wird nicht empfohlen, bitte wähle einen anderen Ordner. + Fehler bei Auswahl des Datenverzeichnisses + Das von Dir ausgewählte Verzeichnis befindet sich im Installationsordner des Server-Managers. Dies wird nicht empfohlen, bitte wähle einen anderen Ordner. Profil konnte nicht gespeichert werden Profil konnte nicht gespeichert werden {0}. {1}\n{2} diff --git a/src/ARKServerManager/Globalization/en-US/en-US.xaml b/src/ARKServerManager/Globalization/en-US/en-US.xaml index 1b601aaf..e61444ff 100644 --- a/src/ARKServerManager/Globalization/en-US/en-US.xaml +++ b/src/ARKServerManager/Globalization/en-US/en-US.xaml @@ -72,8 +72,9 @@ Select a Data Directory Confirm location The server manager will store profiles and SteamCMD in the following directories:\r\n\r\nProfiles: {0}\r\nSteamCMD: {1}\r\n\r\nIs this ok? - Data Directory Selection Error - The directory you have chosen is within the server manager installation folder. This is not recommended, please choose another folder. + Data Directory Selection Error + The directory you have chosen is within the server manager installation folder. This is not recommended, please choose another folder. + The directory you have chosen is on the desktop. This is not recommended, please choose another folder. Failed to save profile Failed to save profile {0}. {1}\n{2} diff --git a/src/ARKServerManager/Globalization/es-ES/es-ES.xaml b/src/ARKServerManager/Globalization/es-ES/es-ES.xaml index 773b46d9..a55e4d64 100644 --- a/src/ARKServerManager/Globalization/es-ES/es-ES.xaml +++ b/src/ARKServerManager/Globalization/es-ES/es-ES.xaml @@ -65,8 +65,8 @@ Seleccionar un directorio de datos Confirmar ubicación El gestor de servidores almacenará los perfiles y SteamCMD en los siguientes directorios:\r\n\r\nPerfiles: {0}\r\nSteamCMD: {1}\r\n\r\n¿Es correcto? - Error de selección de directorio de datos - El directorio que has elegido está en la carpeta de instalación del gestor de servidores, lo que no se recomienda. Por favor elige otra carpeta. + Error de selección de directorio de datos + El directorio que has elegido está en la carpeta de instalación del gestor de servidores, lo que no se recomienda. Por favor elige otra carpeta. Fallo al guardar el perfil Falló el guardado del perfil {0}. {1}\n{2} diff --git a/src/ARKServerManager/Globalization/fr-FR/fr-FR.xaml b/src/ARKServerManager/Globalization/fr-FR/fr-FR.xaml index 88209455..e41141ba 100644 --- a/src/ARKServerManager/Globalization/fr-FR/fr-FR.xaml +++ b/src/ARKServerManager/Globalization/fr-FR/fr-FR.xaml @@ -66,8 +66,8 @@ Sélectionnez un répertoire de données Confirmer l'emplacement Ark Server Manager stockera les profils et SteamCMD dans les répertoires suivants:\r\n\r\n Profils:{0}\r\n SteamCMD:{1}\r\n\r\n Est-ce correct? - Erreur de sélection du répertoire de données - Le répertoire que vous avez choisi se trouve dans le dossier d'installation du gestionnaire du serveur. Ce n'est pas recommandé, veuillez choisir un autre dossier. + Erreur de sélection du répertoire de données + Le répertoire que vous avez choisi se trouve dans le dossier d'installation du gestionnaire du serveur. Ce n'est pas recommandé, veuillez choisir un autre dossier. Échec de l'enregistrement du profil Échec de l'enregistrement du profil {0}. {1}\n{2} diff --git a/src/ARKServerManager/Globalization/pt-BR/pt-BR.xaml b/src/ARKServerManager/Globalization/pt-BR/pt-BR.xaml index eab332a6..23c47a99 100644 --- a/src/ARKServerManager/Globalization/pt-BR/pt-BR.xaml +++ b/src/ARKServerManager/Globalization/pt-BR/pt-BR.xaml @@ -66,8 +66,8 @@ Selecione um diretório de dados Confirme a localização O Ark Server Manager armazenará os perfis e o SteamCMD nos seguintes diretórios:\r\n\r\nProfiles: {0}\r\nSteamCMD: {1}\r\n\r\n Está tudo bem? - Erro na seleção do diretório de dados - O diretório que você escolheu está dentro da pasta de instalação do gerenciador de servidor. Isso não é recomendado, escolha outra pasta. + Erro na seleção do diretório de dados + O diretório que você escolheu está dentro da pasta de instalação do gerenciador de servidor. Isso não é recomendado, escolha outra pasta. Não foi possível guardar o perfil Não foi possível guardar o perfil {0}. {1}\n{2} diff --git a/src/ARKServerManager/Globalization/ru-RU/ru-RU.xaml b/src/ARKServerManager/Globalization/ru-RU/ru-RU.xaml index e02b8ccd..6920adb2 100644 --- a/src/ARKServerManager/Globalization/ru-RU/ru-RU.xaml +++ b/src/ARKServerManager/Globalization/ru-RU/ru-RU.xaml @@ -66,8 +66,8 @@ Выберите каталог данных Подтвердить расположение Ark Server Manager будет хранить профили и SteamCMD в следующих каталогах:\r\n\r\nПрофили: {0}\r\nSteamCMD: {1}\r\n\r\nВы подтверждаете? - Выбор каталога данных ошибок - Каталог, который вы выбрали, находится в папке установки менеджера сервера. Это не рекомендуется, пожалуйста, выберите другую папку. + Выбор каталога данных ошибок + Каталог, который вы выбрали, находится в папке установки менеджера сервера. Это не рекомендуется, пожалуйста, выберите другую папку. Ошибка сохранения профиля Ошибка сохранения профиля {0}. {1}\n{2} diff --git a/src/ARKServerManager/Globalization/zh-CN/zh-CN.xaml b/src/ARKServerManager/Globalization/zh-CN/zh-CN.xaml index 7dc497ea..d383589f 100644 --- a/src/ARKServerManager/Globalization/zh-CN/zh-CN.xaml +++ b/src/ARKServerManager/Globalization/zh-CN/zh-CN.xaml @@ -73,8 +73,8 @@ 选择一个数据目录 确认位置 方舟服务器管理工具将存储配置文件和steamcmd以下目录:\r\n\r\n配置文件: {0}\r\nSteamCMD: {1}\r\n\r\n这样可以吗? - 数据目录选择错误 - 您选择的目录在服务器管理器安装文件夹中。 不建议这样做,请选择另一个文件夹。 + 数据目录选择错误 + 您选择的目录在服务器管理器安装文件夹中。 不建议这样做,请选择另一个文件夹。 保存配置文件失败 保存配置文件失败 {0}. {1}\n{2} diff --git a/src/ConanServerManager/App.xaml.cs b/src/ConanServerManager/App.xaml.cs index 5cc01d4b..5141328a 100644 --- a/src/ConanServerManager/App.xaml.cs +++ b/src/ConanServerManager/App.xaml.cs @@ -402,6 +402,9 @@ namespace ServerManagerTool if (!installationFolder.EndsWith(@"\")) installationFolder += @"\"; + var desktopFolder1 = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); + var desktopFolder2 = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); + while (String.IsNullOrWhiteSpace(Config.Default.DataPath)) { var dialog = new CommonOpenFileDialog @@ -410,7 +413,7 @@ namespace ServerManagerTool IsFolderPicker = true, Multiselect = false, Title = _globalizer.GetResourceString("Application_DataDirectory_DialogTitle"), - InitialDirectory = installationFolder + InitialDirectory = Path.GetPathRoot(installationFolder) }; if (dialog.ShowDialog() != CommonFileDialogResult.Ok) @@ -428,7 +431,12 @@ namespace ServerManagerTool if (newDataFolder.StartsWith(installationFolder)) { confirm = MessageBoxResult.No; - MessageBox.Show(_globalizer.GetResourceString("Application_DataDirectory_WithinInstallFolderErrorLabel"), _globalizer.GetResourceString("Application_DataDirectory_WithinInstallFolderErrorTitle"), MessageBoxButton.OK, MessageBoxImage.Error); + MessageBox.Show(_globalizer.GetResourceString("Application_DataDirectory_DataDirectoryWithinInstallFolderErrorLabel"), _globalizer.GetResourceString("Application_DataDirectory_DataDirectoryFolderErrorTitle"), MessageBoxButton.OK, MessageBoxImage.Error); + } + else if (newDataFolder.StartsWith(desktopFolder1) || newDataFolder.StartsWith(desktopFolder2)) + { + confirm = MessageBoxResult.No; + MessageBox.Show(_globalizer.GetResourceString("Application_DataDirectory_DataDirectoryWithinDesktopFolderErrorLabel"), _globalizer.GetResourceString("Application_DataDirectory_DataDirectoryFolderErrorTitle"), MessageBoxButton.OK, MessageBoxImage.Error); } else { diff --git a/src/ConanServerManager/Globalization/en-US/en-US.xaml b/src/ConanServerManager/Globalization/en-US/en-US.xaml index 412fc049..d0b5792b 100644 --- a/src/ConanServerManager/Globalization/en-US/en-US.xaml +++ b/src/ConanServerManager/Globalization/en-US/en-US.xaml @@ -97,8 +97,9 @@ Select a Data Directory Confirm location The server manager will store profiles and SteamCMD in the following directories:\r\n\r\nProfiles: {0}\r\nSteamCMD: {1}\r\n\r\nIs this ok? - Data Directory Selection Error - The directory you have chosen is within the server manager installation folder. This is not recommended, please choose another folder. + Data Directory Selection Error + The directory you have chosen is within the server manager installation folder. This is not recommended, please choose another folder. + The directory you have chosen is on the desktop. This is not recommended, please choose another folder. Failed to save profile Failed to save profile {0}. {1}\n{2}