private void AttachToProfileCore(ServerProfile profile) { UnregisterForUpdates(); this.ProfileSnapshot = new RuntimeProfileSnapshot { ProfileName = profile.ProfileName, InstallDirectory = profile.InstallDirectory, AltSaveDirectoryName = profile.AltSaveDirectoryName, AdminPassword = profile.AdminPassword, ServerName = profile.ServerName, ServerArgs = profile.GetServerArgs(), ServerIP = String.IsNullOrWhiteSpace(profile.ServerIP) ? IPAddress.Loopback.ToString() : profile.ServerIP, ServerConnectionPort = profile.ServerConnectionPort, QueryPort = profile.ServerPort, UseRawSockets = profile.UseRawSockets, RCONEnabled = profile.RCONEnabled, RCONPort = profile.RCONPort, SotFServer = profile.SOTF_Enabled, ServerMap = ServerProfile.GetProfileMapName(profile), ServerMapModId = ServerProfile.GetProfileMapModId(profile), TotalConversionModId = profile.TotalConversionModId ?? string.Empty, ServerModIds = ModUtils.GetModIdList(profile.ServerModIds), LastInstalledVersion = string.IsNullOrWhiteSpace(profile.LastInstalledVersion) ? new Version(0, 0).ToString() : profile.LastInstalledVersion, }; Version lastInstalled; if (Version.TryParse(profile.LastInstalledVersion, out lastInstalled)) { this.Version = lastInstalled; } RegisterForUpdates(); }
public static ServerProfileSnapshot Create(ServerProfile profile) { return(new ServerProfileSnapshot { ProfileId = profile.ProfileID, ProfileName = profile.ProfileName, InstallDirectory = profile.InstallDirectory, AltSaveDirectoryName = profile.AltSaveDirectoryName, PGM_Enabled = profile.PGM_Enabled, PGM_Name = profile.PGM_Name, AdminPassword = profile.AdminPassword, ServerName = profile.ServerName, ServerArgs = profile.GetServerArgs(), ServerIP = string.IsNullOrWhiteSpace(profile.ServerIP) ? IPAddress.Loopback.ToString() : profile.ServerIP.Trim(), ServerPort = profile.ServerPort, QueryPort = profile.QueryPort, UseRawSockets = profile.UseRawSockets, RCONEnabled = profile.RCONEnabled, RCONPort = profile.RCONPort, ServerMap = ServerProfile.GetProfileMapName(profile), ServerMapModId = ServerProfile.GetProfileMapModId(profile), TotalConversionModId = profile.TotalConversionModId ?? string.Empty, ServerModIds = ModUtils.GetModIdList(profile.ServerModIds), MotDDuration = Math.Max(profile.MOTDDuration, 10), ForceRespawnDinos = profile.ForceRespawnDinos, BranchName = profile.BranchName, BranchPassword = profile.BranchPassword, SchedulerKey = profile.GetProfileKey(), EnableAutoBackup = profile.EnableAutoBackup, EnableAutoUpdate = profile.EnableAutoUpdate, EnableAutoShutdown1 = profile.EnableAutoShutdown1, RestartAfterShutdown1 = profile.RestartAfterShutdown1, UpdateAfterShutdown1 = profile.UpdateAfterShutdown1, EnableAutoShutdown2 = profile.EnableAutoShutdown2, RestartAfterShutdown2 = profile.RestartAfterShutdown2, UpdateAfterShutdown2 = profile.UpdateAfterShutdown2, AutoRestartIfShutdown = profile.AutoRestartIfShutdown, SotFEnabled = profile.SOTF_Enabled, MaxPlayerCount = profile.MaxPlayers, ServerUpdated = false, LastInstalledVersion = profile.LastInstalledVersion ?? new Version(0, 0).ToString(), }); }