Skip to content

Commit

Permalink
Merge pull request #160 from ChronosWS/BletchChanges
Browse files Browse the repository at this point in the history
ASM 319 Changes
  • Loading branch information
Bletch1971 authored Jan 23, 2018
2 parents 9f0d73f + 3c24a8c commit aed38cf
Show file tree
Hide file tree
Showing 11 changed files with 127 additions and 32 deletions.
4 changes: 2 additions & 2 deletions ARK Server Manager/ARK Server Manager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
<ProductName>Ark Server Manager</ProductName>
<PublisherName>Ark Server Manager</PublisherName>
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
<ApplicationRevision>5</ApplicationRevision>
<ApplicationVersion>1.0.318.%2a</ApplicationVersion>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>1.0.320.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>false</BootstrapperEnabled>
Expand Down
3 changes: 3 additions & 0 deletions ARK Server Manager/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,9 @@
<setting name="RCON_DownloadPlayerAvatars" serializeAs="String">
<value>True</value>
</setting>
<setting name="BackupPath" serializeAs="String">
<value />
</setting>
</ARK_Server_Manager.Config>
</userSettings>
</configuration>
12 changes: 12 additions & 0 deletions ARK Server Manager/Config.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions ARK Server Manager/Config.settings
Original file line number Diff line number Diff line change
Expand Up @@ -554,5 +554,8 @@
<Setting Name="ServerManagerCode" Type="System.String" Scope="Application">
<Value Profile="(Default)">ED89B8FA-0E0B-46CC-A90B-595E69AE9A7E</Value>
</Setting>
<Setting Name="BackupPath" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>
3 changes: 3 additions & 0 deletions ARK Server Manager/Globalization/en-US/en-US.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,10 @@
<sys:String x:Key="GlobalSettings_RunAsAdministratorLabel">Enable Run as Administrator Prompt on Startup</sys:String>
<sys:String x:Key="GlobalSettings_ManageFirewallLabel">Manage firewall settings automatically</sys:String>
<sys:String x:Key="GlobalSettings_DataDirectoryLabel">Data Directory:</sys:String>
<sys:String x:Key="GlobalSettings_BackupDirectoryLabel">Backup Directory:</sys:String>
<sys:String x:Key="GlobalSettings_SteamAPIKeyLabel">Steam WebApi Key:</sys:String>
<sys:String x:Key="GlobalSettings_SetLocationButtonLabel">Set Location...</sys:String>
<sys:String x:Key="GlobalSettings_ClearButtonLabel">Clear</sys:String>
<sys:String x:Key="GlobalSettings_SteamAPIKeyButtonLabel">Get WebApi Key...</sys:String>
<sys:String x:Key="GlobalSettings_SteamAPIKeyHelpButtonLabel">Help...</sys:String>
<sys:String x:Key="GlobalSettings_LanguageSelectionLabel">Language</sys:String>
Expand Down Expand Up @@ -358,6 +360,7 @@
<sys:String x:Key="GlobalSettings_DataDirectoryChange_FailedTitle">Failed to change data directory</sys:String>
<sys:String x:Key="GlobalSettings_DataDirectoryChange_FailedLabel">There was an error changing the data directory: {0}\r\nPlease correct the error and try again, or contact technical support for assistance.</sys:String>

<sys:String x:Key="GlobalSettings_DataDirectoryTitle">Select Backup Directory</sys:String>
<sys:String x:Key="GlobalSettings_CacheDirectoryTitle">Select Cache Directory</sys:String>
<sys:String x:Key="GlobalSettings_CacheDirectory_ErrorTitle">Invalid cache directory</sys:String>
<sys:String x:Key="GlobalSettings_CacheDirectory_ErrorLabel">The cache directory must specify a valid location or the cache update period must be 0.</sys:String>
Expand Down
5 changes: 4 additions & 1 deletion ARK Server Manager/Globalization/ru-RU/ru-RU.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,11 @@
<sys:String x:Key="GlobalSettings_ResetButtonTooltip">Это приведет к сбросу всех глобальных параметров пользователя в диспетчере сервера. Менеджер сервера будет закрыт, если сброс будет успешным.</sys:String>
<sys:String x:Key="GlobalSettings_RunAsAdministratorLabel">Запускать программу в режиме Администратора</sys:String>
<sys:String x:Key="GlobalSettings_ManageFirewallLabel">Управление параметрами брандмауэра автоматически</sys:String>
<sys:String x:Key="GlobalSettings_DataDirectoryLabel">Каталог данных:</sys:String>
<sys:String x:Key="GlobalSettings_DataDirectoryLabel">Каталог Данных:</sys:String>
<sys:String x:Key="GlobalSettings_BackupDirectoryLabel">Каталог Бекапов:</sys:String>
<sys:String x:Key="GlobalSettings_SteamAPIKeyLabel">Steam WebApi Key:</sys:String>
<sys:String x:Key="GlobalSettings_SetLocationButtonLabel">Указать папку...</sys:String>
<sys:String x:Key="GlobalSettings_ClearButtonLabel">Очистить</sys:String>
<sys:String x:Key="GlobalSettings_SteamAPIKeyButtonLabel">Получить WebApi Ключ...</sys:String>
<sys:String x:Key="GlobalSettings_SteamAPIKeyHelpButtonLabel">Помощь...</sys:String>
<sys:String x:Key="GlobalSettings_LanguageSelectionLabel">Языки</sys:String>
Expand Down Expand Up @@ -358,6 +360,7 @@
<sys:String x:Key="GlobalSettings_DataDirectoryChange_FailedTitle">Не удалось изменить каталог данных</sys:String>
<sys:String x:Key="GlobalSettings_DataDirectoryChange_FailedLabel">При изменении каталога данных произошла ошибка: {0}\r\nПожалуйста, исправьте ошибку и повторите попытку или обратитесь в службу технической поддержки.</sys:String>

<sys:String x:Key="GlobalSettings_DataDirectoryTitle">Выбрать Каталок Бекапов</sys:String>
<sys:String x:Key="GlobalSettings_CacheDirectoryTitle">Выберете директорию Авто-Обновления кеша</sys:String>
<sys:String x:Key="GlobalSettings_CacheDirectory_ErrorTitle">Недопустимый каталог кеша Авто-Обновления</sys:String>
<sys:String x:Key="GlobalSettings_CacheDirectory_ErrorLabel">Каталог кеша должен указывать допустимое расположение или период Авто-Обновления кеша должен быть 0.</sys:String>
Expand Down
2 changes: 2 additions & 0 deletions ARK Server Manager/Lib/Model/PublishedFileDetail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ public string Title
}


public bool IsOfficialMod => ModUtils.IsOfficialMod(ModId);

public bool IsValidModType => !ModTypeString.Equals(ModUtils.MODTYPENAME_UNKNOWN) && !ModTypeString.Equals(ModUtils.MODTYPENAME_NOTDOWNLOADED);

public string LastWriteTimeString => LastWriteTime == DateTime.MinValue ? string.Empty : LastWriteTime.ToString();
Expand Down
34 changes: 23 additions & 11 deletions ARK Server Manager/Lib/ServerApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,13 @@ private void BackupServer()
return;

// make a backup of the current profile and config files.
CreateProfileBackupArchiveFile();
CreateProfileBackupArchiveFile(_profile);

if (ExitCode != EXITCODE_NORMALEXIT)
return;

// make a backup of the current world file.
CreateServerBackupArchiveFile(emailMessage);
CreateServerBackupArchiveFile(emailMessage, _profile);

if (ExitCode != EXITCODE_NORMALEXIT)
return;
Expand Down Expand Up @@ -259,15 +259,15 @@ private void ShutdownServer(bool restartServer, bool updateServer, CancellationT
}

// make a backup of the current profile and config files.
CreateProfileBackupArchiveFile();
CreateProfileBackupArchiveFile(_profile);

if (ExitCode != EXITCODE_NORMALEXIT)
return;

if (BackupWorldFile)
{
// make a backup of the current world file.
CreateServerBackupArchiveFile(null);
CreateServerBackupArchiveFile(null, _profile);

if (ExitCode != EXITCODE_NORMALEXIT)
return;
Expand Down Expand Up @@ -1166,15 +1166,15 @@ private void UpdateFiles()
emailMessage.AppendLine($"Server Manager version: {App.Version}");

// make a backup of the current profile and config files.
CreateProfileBackupArchiveFile();
CreateProfileBackupArchiveFile(_profile);

if (ExitCode != EXITCODE_NORMALEXIT)
return;

if (BackupWorldFile)
{
// make a backup of the current world file.
CreateServerBackupArchiveFile(emailMessage);
CreateServerBackupArchiveFile(emailMessage, _profile);

if (ExitCode != EXITCODE_NORMALEXIT)
return;
Expand Down Expand Up @@ -1757,7 +1757,7 @@ public void CreateProfileBackupArchiveFile(ServerProfileSnapshot profile = null)
{
LogProfileMessage("Back up profile and config files started...");

var backupFolder = GetProfileBackupFolder();
var backupFolder = GetProfileBackupFolder(_profile.ProfileName);
var backupFileName = $"{_startTime.ToString("yyyyMMdd_HHmmss")}{Config.Default.BackupExtension}";
var backupFile = IOUtils.NormalizePath(Path.Combine(backupFolder, backupFileName));

Expand Down Expand Up @@ -1818,7 +1818,7 @@ public void CreateProfileBackupArchiveFile(ServerProfileSnapshot profile = null)
{
LogProfileMessage("Delete old profile backup files started...");

var backupFolder = GetProfileBackupFolder();
var backupFolder = GetProfileBackupFolder(_profile.ProfileName);
var backupFileFilter = $"*{Config.Default.BackupExtension}";
var backupDateFilter = DateTime.Now.AddDays(-BACKUP_DELETEINTERVAL);

Expand Down Expand Up @@ -1848,7 +1848,7 @@ public void CreateProfileBackupArchiveFile(ServerProfileSnapshot profile = null)
// cleanup any backup folders from old backup process
try
{
var backupFolder = GetProfileBackupFolder();
var backupFolder = GetProfileBackupFolder(_profile.ProfileName);

var oldBackupFolders = new DirectoryInfo(backupFolder).GetDirectories();
foreach (var oldBackupFolder in oldBackupFolders)
Expand Down Expand Up @@ -2142,7 +2142,13 @@ private List<string> GetModList()
return ModUtils.ValidateModList(modIdList);
}

private string GetProfileBackupFolder() => IOUtils.NormalizePath(Path.Combine(Config.Default.ConfigDirectory, Config.Default.BackupDir, _profile.ProfileName));
private static string GetProfileBackupFolder(string profileName)
{
if (string.IsNullOrWhiteSpace(Config.Default.BackupPath))
return IOUtils.NormalizePath(Path.Combine(Config.Default.ConfigDirectory, Config.Default.BackupDir, profileName));

return IOUtils.NormalizePath(Path.Combine(Config.Default.BackupPath, Config.Default.ProfilesDir, profileName));
}

private string GetProfileLogFile() => _profile != null ? IOUtils.NormalizePath(Path.Combine(SteamCmdUpdater.GetLogFolder(), _profile.ProfileName, _logPrefix, $"{_startTime.ToString("yyyyMMdd_HHmmss")}.log")) : GetLogFile();

Expand All @@ -2165,7 +2171,13 @@ public static string GetMutexName(string directory)
}
}

public static string GetServerBackupFolder(string profileName) => IOUtils.NormalizePath(Path.Combine(Config.Default.DataDir, Config.Default.ServersInstallDir, Config.Default.BackupDir, profileName));
public static string GetServerBackupFolder(string profileName)
{
if (string.IsNullOrWhiteSpace(Config.Default.BackupPath))
return IOUtils.NormalizePath(Path.Combine(Config.Default.DataDir, Config.Default.ServersInstallDir, Config.Default.BackupDir, profileName));

return IOUtils.NormalizePath(Path.Combine(Config.Default.BackupPath, Config.Default.ServersInstallDir, profileName));
}

private static string GetServerCacheTimeFile() => IOUtils.NormalizePath(Path.Combine(Config.Default.AutoUpdate_CacheDir, Config.Default.LastUpdatedTimeFile));

Expand Down
Loading

0 comments on commit aed38cf

Please sign in to comment.