diff --git a/FASTER Maintenance/Program.cs b/FASTER Maintenance/Program.cs index 1c4eb94..386cc36 100644 --- a/FASTER Maintenance/Program.cs +++ b/FASTER Maintenance/Program.cs @@ -176,7 +176,7 @@ private static void MigrateTo17() } Console.WriteLine($"\tRead config from '{selected}\\user.config'"); - var servers = conf16.UserSettings.Settings.Setting.FirstOrDefault(s => s.Name == "Servers"); + var servers = conf16.UserSettings.Settings.Setting.Find(s => s.Name == "Servers"); conf16.UserSettings.Settings.Setting.Remove(servers); conf17.UserSettings = new Models._17Models.UserSettings { Settings = new Models._17Models.Settings { Setting = conf16.UserSettings.Settings.Setting } }; Console.WriteLine("\tConverted standard values to 1.7"); diff --git a/FASTER/FASTER.csproj b/FASTER/FASTER.csproj index 8e9ee5c..c9fa17a 100644 --- a/FASTER/FASTER.csproj +++ b/FASTER/FASTER.csproj @@ -9,7 +9,7 @@ true false true - 1.9.5.2 + 1.9.5.3 Keelah Fox FoxliCorp. Fox's Arma Server Tool Extended Rewrite diff --git a/FASTER/Models/ArmaMod.cs b/FASTER/Models/ArmaMod.cs index f458a90..d24a20f 100644 --- a/FASTER/Models/ArmaMod.cs +++ b/FASTER/Models/ArmaMod.cs @@ -275,7 +275,7 @@ internal async Task UpdateModAsync() break; case UpdateState.Success: Status = ArmaModStatus.UpToDate; - var nx = new DateTime(1970, 1, 1); + var nx = DateTime.UnixEpoch; var ts = DateTime.UtcNow - nx; LocalLastUpdated = (ulong) ts.TotalSeconds; diff --git a/FASTER/Models/ServerCfg.cs b/FASTER/Models/ServerCfg.cs index d96b2df..d5f14f3 100644 --- a/FASTER/Models/ServerCfg.cs +++ b/FASTER/Models/ServerCfg.cs @@ -207,7 +207,7 @@ public bool HeadlessClientEnabled { headlessClientEnabled = value; RaisePropertyChanged("HeadlessClientEnabled"); - if (value && !headlessClients.Any(e => e.Length > 0)) + if (value && !headlessClients.Exists(e => e.Length > 0)) { HeadlessClients = "127.0.0.1"; } } } @@ -733,7 +733,7 @@ public List Missions bool isEqual = _missions.Count == value.Count && !( from mission in value - let local = _missions.FirstOrDefault(m => m.Path == mission.Path) + let local = _missions.Find(m => m.Path == mission.Path) where local == null || local.MissionChecked != mission.MissionChecked select mission ).Any(); @@ -932,8 +932,8 @@ public string ProcessFile() + "\r\n" + "\r\n" + "// HEADLESS CLIENT\r\n" - + $"{(headlessClientEnabled && !headlessClients.Any(string.IsNullOrWhiteSpace) ? $"headlessClients[] = { "{\n\t\"" + string.Join("\",\n\t \"", headlessClients) + "\"\n}" };\r\n" : "")}" - + $"{(headlessClientEnabled && !localClient.Any(string.IsNullOrWhiteSpace)? $"localClient[] = { "{\n\t\"" + string.Join("\",\n\t \"", localClient) + "\"\n}" };" : "")}"; + + $"{(headlessClientEnabled && !headlessClients.Exists(string.IsNullOrWhiteSpace) ? $"headlessClients[] = { "{\n\t\"" + string.Join("\",\n\t \"", headlessClients) + "\"\n}" };\r\n" : "")}" + + $"{(headlessClientEnabled && !localClient.Exists(string.IsNullOrWhiteSpace)? $"localClient[] = { "{\n\t\"" + string.Join("\",\n\t \"", localClient) + "\"\n}" };" : "")}"; return output; } diff --git a/FASTER/Models/ServerProfile.cs b/FASTER/Models/ServerProfile.cs index b74a42c..9500c2b 100644 --- a/FASTER/Models/ServerProfile.cs +++ b/FASTER/Models/ServerProfile.cs @@ -447,7 +447,7 @@ public ServerProfile Clone() { p.GenerateNewId(); - if (p.Name.EndsWith(")") && p.Name.Contains('(') && int.TryParse(p.Name.Substring(p.Name.Length - 2, 1), out _)) + if (p.Name.EndsWith(')') && p.Name.Contains('(') && int.TryParse(p.Name.Substring(p.Name.Length - 2, 1), out _)) { var i = p.Name.IndexOf('('); var j = p.Name.Length; diff --git a/FASTER/ViewModel/ModsViewModel.cs b/FASTER/ViewModel/ModsViewModel.cs index 9e4aaf1..4070d03 100644 --- a/FASTER/ViewModel/ModsViewModel.cs +++ b/FASTER/ViewModel/ModsViewModel.cs @@ -80,9 +80,9 @@ public async Task AddLocalModAsync() return; var oldPaths = new List(); - if (!Path.GetFileName(localPath).StartsWith("@") && Directory.GetDirectories(localPath).Where((file) => Path.GetFileName(file).StartsWith("@")).ToList().Count > 0) + if (!Path.GetFileName(localPath).StartsWith('@') && Directory.GetDirectories(localPath).Where((file) => Path.GetFileName(file).StartsWith('@')).ToList().Count > 0) { - oldPaths = Directory.GetDirectories(localPath).Where((file) => Path.GetFileName(file).StartsWith("@")).ToList(); + oldPaths = Directory.GetDirectories(localPath).Where((file) => Path.GetFileName(file).StartsWith('@')).ToList(); } else { diff --git a/FASTER/ViewModel/ProfileViewModel.cs b/FASTER/ViewModel/ProfileViewModel.cs index 192e277..bfafd88 100644 --- a/FASTER/ViewModel/ProfileViewModel.cs +++ b/FASTER/ViewModel/ProfileViewModel.cs @@ -199,7 +199,7 @@ internal void DeleteProfile() { Directory.Delete(Path.Combine(Profile.ArmaPath, "Servers", Profile.Id), true); } Properties.Settings.Default.Profiles.Remove(Profile); Properties.Settings.Default.Save(); - MainWindow.Instance.ContentProfileViews.Remove(MainWindow.Instance.ContentProfileViews.FirstOrDefault(p => p.Profile.Id == Profile.Id)); + MainWindow.Instance.ContentProfileViews.Remove(MainWindow.Instance.ContentProfileViews.Find(p => p.Profile.Id == Profile.Id)); var menuItem = MainWindow.Instance.IServerProfilesMenu.Items.Cast().FirstOrDefault(p => p.Name == Profile.Id); if(menuItem != null) MainWindow.Instance.IServerProfilesMenu.Items.Remove(menuItem); @@ -302,7 +302,7 @@ internal void LoadModsFromFile() List notFound = new(); foreach (var extractedMod in extractedModList) { - var mod = Profile.ProfileMods.FirstOrDefault(m => m.Id == extractedMod.Id || ModUtilities.GetCompareString(extractedMod.Name) == ModUtilities.GetCompareString(m.Name)); + var mod = Profile.ProfileMods.Find(m => m.Id == extractedMod.Id || ModUtilities.GetCompareString(extractedMod.Name) == ModUtilities.GetCompareString(m.Name)); if (mod != null) { mod.ClientSideChecked = true; @@ -396,7 +396,7 @@ internal async Task ClearModKeys() { foreach (var keyFile in Directory.GetFiles(Path.Combine(Profile.ArmaPath, "keys"))) { - if (ignoredKeys.Any(keyFile.Contains)) + if (Array.Exists(ignoredKeys, x => keyFile.Contains(x))) continue; try { @@ -423,7 +423,7 @@ public void LoadData() var modlist = new List(); foreach(var mod in Properties.Settings.Default.armaMods.ArmaMods) { - ProfileMod existingMod = Profile.ProfileMods.FirstOrDefault(m => m.Id == mod.WorkshopId); + ProfileMod existingMod = Profile.ProfileMods.Find(m => m.Id == mod.WorkshopId); if (existingMod == null) { var newProfile = new ProfileMod { Name = mod.Name, Id = mod.WorkshopId, IsLocal = mod.IsLocal}; @@ -465,7 +465,7 @@ internal void LoadMissions() foreach (var mission in newMissions) { - ProfileMission existingMission = Profile.ServerCfg.Missions.FirstOrDefault(m => m.Path == mission); + ProfileMission existingMission = Profile.ServerCfg.Missions.Find(m => m.Path == mission); if (existingMission == null) { var newMission = new ProfileMission { Name = mission.Replace(".pbo", ""), Path = mission }; diff --git a/FASTER/ViewModel/SteamUpdaterViewModel.cs b/FASTER/ViewModel/SteamUpdaterViewModel.cs index 298a9c7..d6a231b 100644 --- a/FASTER/ViewModel/SteamUpdaterViewModel.cs +++ b/FASTER/ViewModel/SteamUpdaterViewModel.cs @@ -481,7 +481,7 @@ public async Task RunModsUpdater(ObservableCollection mods) sw.Stop(); mod.Status = ArmaModStatus.UpToDate; - var nx = new DateTime(1970, 1, 1); + var nx = DateTime.UnixEpoch; var ts = DateTime.UtcNow - nx; mod.LocalLastUpdated = (ulong) ts.TotalSeconds; diff --git a/FASTER_Version.xml b/FASTER_Version.xml index 3569db0..032bbed 100644 --- a/FASTER_Version.xml +++ b/FASTER_Version.xml @@ -1,6 +1,6 @@  - 1.9.5.2 + 1.9.5.3 https://github.com/Foxlider/FASTER/releases/latest/download/Release_x64.zip https://github.com/Foxlider/FASTER/releases true