private async Task LoadModsFromProfile() { // build a list of mods to be processed var modIdList = new List <string>(); var serverMapModId = ServerProfile.GetProfileMapModId(_profile); if (!string.IsNullOrWhiteSpace(serverMapModId)) { modIdList.Add(serverMapModId); } if (!string.IsNullOrWhiteSpace(_profile.TotalConversionModId)) { modIdList.Add(_profile.TotalConversionModId); } modIdList.AddRange(ModUtils.GetModIdList(_profile.ServerModIds)); modIdList = ModUtils.ValidateModList(modIdList); var response = await Task.Run(() => SteamUtils.GetSteamModDetails(modIdList)); var workshopFiles = WorkshopFiles; var modsRootFolder = Path.Combine(_profile.InstallDirectory, Config.Default.ServerModsRelativePath); var modDetails = ModDetailList.GetModDetails(modIdList, modsRootFolder, workshopFiles, response); UpdateModDetailsList(modDetails); ModDetailsStatusMessage = modDetails.Count > 0 && response?.publishedfiledetails == null?_globalizer.GetResourceString("ModDetails_ModDetailFetchFailed_Label") : string.Empty; ModDetailsChanged = false; }
private async Task LoadModsFromProfile() { // build a list of mods to be processed var modIdList = new List <string>(); var serverMapModId = ServerProfile.GetProfileMapModId(_profile); if (!string.IsNullOrWhiteSpace(serverMapModId)) { modIdList.Add(serverMapModId); } if (!string.IsNullOrWhiteSpace(_profile.TotalConversionModId)) { modIdList.Add(_profile.TotalConversionModId); } modIdList.AddRange(ModUtils.GetModIdList(_profile.ServerModIds)); modIdList = ModUtils.ValidateModList(modIdList); var response = await GetModDetails(modIdList); var modDetails = ModDetailList.GetModDetails(response, Path.Combine(_profile.InstallDirectory, Config.Default.ServerModsRelativePath), modIdList); UpdateModDetailsList(modDetails); ModDetailsChanged = false; }
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, ServerPeerPort = profile.ServerPeerPort, QueryPort = profile.QueryPort, RCONEnabled = profile.RCONEnabled, RCONPort = profile.RCONPort, ServerMap = ServerProfile.GetProfileMapName(profile), ServerMapModId = ServerProfile.GetProfileMapModId(profile), TotalConversionModId = profile.TotalConversionModId ?? string.Empty, ServerModIds = ModUtils.GetModIdList(profile.ServerModIds), MOTD = profile.MOTD, MotDDuration = Math.Max(profile.MOTDDuration, 10), MOTDIntervalEnabled = profile.MOTDInterval.HasValue && !string.IsNullOrWhiteSpace(profile.MOTD), MOTDInterval = Math.Max(1, Math.Min(int.MaxValue, profile.MOTDInterval.Value)), 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(), LastStarted = profile.LastStarted, }); }
public static ServerProfileSnapshot Create(ServerProfile profile) { return(new ServerProfileSnapshot { ProfileId = profile.ProfileID, ProfileName = profile.ProfileName, ServerName = profile.ServerName, InstallDirectory = profile.InstallDirectory, GameFile = profile.GetServerWorldFile(), AdminPassword = profile.AdminPassword, ServerIP = string.IsNullOrWhiteSpace(profile.ServerIP) ? IPAddress.Loopback.ToString() : profile.ServerIP.Trim(), ServerPort = profile.ServerPort, ServerPeerPort = profile.ServerPeerPort, QueryPort = profile.QueryPort, ServerMap = ServerProfile.GetProfileMapName(profile), ServerModIds = ModUtils.GetModIdList(profile.ServerModIds), RconEnabled = profile.RconEnabled, RconPort = profile.RconPort, RconPassword = profile.RconPassword, MaxPlayerCount = profile.MaxPlayers, MOTD = profile.MOTD, MOTDIntervalEnabled = profile.MOTDIntervalEnabled && !string.IsNullOrWhiteSpace(profile.MOTD), MOTDInterval = Math.Max(1, Math.Min(int.MaxValue, profile.MOTDInterval)), 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, ServerUpdated = false, LastInstalledVersion = profile.LastInstalledVersion ?? new Version(0, 0).ToString(), LastStarted = profile.LastStarted, }); }