Skip to content

Commit

Permalink
Merge pull request #304 from CnCNet/develop
Browse files Browse the repository at this point in the history
Hotfix 2.6.11.1
  • Loading branch information
Metadorius authored Feb 1, 2022
2 parents 92efae2 + 3873ee4 commit 6f495b2
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 36 deletions.
23 changes: 5 additions & 18 deletions DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion DXMainClient/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
51 changes: 34 additions & 17 deletions DXMainClient/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using DTAClient.Online;
using ClientCore.INIProcessing;
using System.Threading.Tasks;
using System.Globalization;

namespace DTAClient
{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -220,37 +222,53 @@ private static void MigrateLogFiles(string currentDirectory, string newDirectory
}

/// <summary>
/// Writes processor and graphics card info to the log file.
/// Writes processor, graphics card and memory info to the log file.
/// </summary>
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;

Expand All @@ -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));
}


Expand All @@ -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)
{
Expand Down

0 comments on commit 6f495b2

Please sign in to comment.