diff --git a/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs b/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs index 5712eb2c6..50fc9f0e6 100644 --- a/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs +++ b/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs @@ -1028,15 +1028,14 @@ private void ApplyGameOptions(string sender, string message) } string mapName = parts[partIndex + 8]; - GameMode currentGameMode = GameMode; - Map currentMap = Map; + GameModeMap currentGameModeMap = GameModeMap; lastGameMode = gameMode; lastMapSHA1 = mapSHA1; lastMapName = mapName; - GameModeMap = GameModeMaps.Find(gmm => gmm.GameMode.UIName == gameMode); - if (GameMode == null) + GameModeMap = GameModeMaps.Find(gmm => gmm.GameMode.UIName == gameMode && gmm.Map.SHA1 == mapSHA1); + if (GameModeMap == null) { ChangeMap(null); @@ -1045,21 +1044,9 @@ private void ApplyGameOptions(string sender, string message) else ShowOfficialMapMissingMessage(mapSHA1); } - else + else if (GameModeMap != currentGameModeMap) { - GameModeMap = GameModeMaps.Find(gmm => gmm.Map.SHA1 == mapSHA1); - - if (Map == null) - { - ChangeMap(null); - - if (!isMapOfficial) - RequestMap(mapSHA1); - else - ShowOfficialMapMissingMessage(mapSHA1); - } - else if (GameMode != currentGameMode || Map != currentMap) - ChangeMap(GameModeMap); + ChangeMap(GameModeMap); } // By changing the game options after changing the map, we know which diff --git a/DXMainClient/Properties/AssemblyInfo.cs b/DXMainClient/Properties/AssemblyInfo.cs index 521c8adf8..66f71b9d5 100644 --- a/DXMainClient/Properties/AssemblyInfo.cs +++ b/DXMainClient/Properties/AssemblyInfo.cs @@ -32,4 +32,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.6.11.0")] -[assembly: AssemblyFileVersion("2.6.11.0")] +[assembly: AssemblyFileVersion("2.6.11.1")] diff --git a/DXMainClient/Startup.cs b/DXMainClient/Startup.cs index 21c707280..569e78cbf 100644 --- a/DXMainClient/Startup.cs +++ b/DXMainClient/Startup.cs @@ -14,6 +14,7 @@ using DTAClient.Online; using ClientCore.INIProcessing; using System.Threading.Tasks; +using System.Globalization; namespace DTAClient { @@ -47,6 +48,7 @@ public void Execute() Logger.Log("Operating system: " + Environment.OSVersion.VersionString); Logger.Log("Selected OS profile: " + MainClientConstants.OSId.ToString()); + Logger.Log("Current culture: " + CultureInfo.CurrentCulture?.ToString()); // The query in CheckSystemSpecifications takes lots of time, // so we'll do it in a separate thread to make startup faster @@ -91,7 +93,7 @@ public void Execute() if (CUpdater.CustomComponents != null) { Logger.Log("Removing partial custom component downloads."); - foreach (CustomComponent component in CUpdater.CustomComponents) + foreach (var component in CUpdater.CustomComponents) { try { @@ -133,7 +135,7 @@ private void PruneFiles(string directoryPath, DateTime pruneThresholdTime) { foreach (string fsEntry in Directory.EnumerateFileSystemEntries(directoryPath)) { - FileAttributes attr = File.GetAttributes(fsEntry); + var attr = File.GetAttributes(fsEntry); if ((attr & FileAttributes.Directory) == FileAttributes.Directory) PruneFiles(fsEntry, pruneThresholdTime); else @@ -220,37 +222,53 @@ private static void MigrateLogFiles(string currentDirectory, string newDirectory } /// - /// Writes processor and graphics card info to the log file. + /// Writes processor, graphics card and memory info to the log file. /// private void CheckSystemSpecifications() { + string cpu = string.Empty; + string videoController = string.Empty; + string memory = string.Empty; + + ManagementObjectSearcher searcher; + try { - string cpu = string.Empty; - string videoController = string.Empty; - string memory = string.Empty; - - ManagementObjectSearcher searcher = - new ManagementObjectSearcher("SELECT * FROM Win32_Processor"); + searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor"); foreach (var proc in searcher.Get()) { cpu = cpu + proc["Name"].ToString().Trim() + " (" + proc["NumberOfCores"] + " cores) "; } + } + catch + { + cpu = "CPU info not found"; + } + + try + { searcher = new ManagementObjectSearcher("SELECT * FROM Win32_VideoController"); foreach (ManagementObject mo in searcher.Get()) { - PropertyData currentBitsPerPixel = mo.Properties["CurrentBitsPerPixel"]; - PropertyData description = mo.Properties["Description"]; + var currentBitsPerPixel = mo.Properties["CurrentBitsPerPixel"]; + var description = mo.Properties["Description"]; if (currentBitsPerPixel != null && description != null) { if (currentBitsPerPixel.Value != null) videoController = videoController + "Video controller: " + description.Value.ToString().Trim() + " "; } } + } + catch + { + cpu = "Video controller info not found"; + } + try + { searcher = new ManagementObjectSearcher("Select * From Win32_PhysicalMemory"); ulong total = 0; @@ -261,14 +279,13 @@ private void CheckSystemSpecifications() if (total != 0) memory = "Total physical memory: " + (total >= 1073741824 ? total / 1073741824 + "GB" : total / 1048576 + "MB"); - - Logger.Log(string.Format("Hardware info: {0} | {1} | {2}", cpu.Trim(), videoController.Trim(), memory)); - } - catch (Exception ex) + catch { - Logger.Log("Checking system specifications failed. Message: " + ex.Message); + cpu = "Memory info not found"; } + + Logger.Log(string.Format("Hardware info: {0} | {1} | {2}", cpu.Trim(), videoController.Trim(), memory)); } @@ -289,7 +306,7 @@ private static void GenerateOnlineId() } ManagementObjectSearcher mos = new ManagementObjectSearcher("SELECT * FROM Win32_BaseBoard"); - ManagementObjectCollection moc = mos.Get(); + var moc = mos.Get(); string mbid = ""; foreach (ManagementObject mo in moc) {