From b3a1d4ec9f1aa00d8afcd212b30aaa7390143a95 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 17 May 2024 13:24:39 -0300 Subject: [PATCH 1/3] fix: Use Invariant Culture for object to string conversion --- MyceliumNetworkingForCW/MyceliumNetwork.cs | 11 +++++++---- .../MyceliumNetworkingForCW.csproj | 10 +++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/MyceliumNetworkingForCW/MyceliumNetwork.cs b/MyceliumNetworkingForCW/MyceliumNetwork.cs index f8e7d9a..8bc885d 100644 --- a/MyceliumNetworkingForCW/MyceliumNetwork.cs +++ b/MyceliumNetworkingForCW/MyceliumNetwork.cs @@ -1,6 +1,7 @@ using Steamworks; using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Reflection; using System.Runtime.InteropServices; @@ -372,7 +373,9 @@ public static void SetLobbyData(string key, object value) RugLogger.LogWarning($"Accessing lobby data for unregistered key '{key}'. This might not exist."); } - if(!SteamMatchmaking.SetLobbyData(Lobby, key, value.ToString())) + + + if (!SteamMatchmaking.SetLobbyData(Lobby, key, (string)Convert.ChangeType(value, typeof(string), CultureInfo.InvariantCulture))) { RugLogger.LogError("Error setting lobby data."); } @@ -424,7 +427,7 @@ public static T GetLobbyData(string key) try { - return (T)Convert.ChangeType(value, typeof(T)); + return (T)Convert.ChangeType(value, typeof(T), CultureInfo.InvariantCulture); } catch(Exception ex) { @@ -452,7 +455,7 @@ public static void SetPlayerData(string key, object value) RugLogger.LogWarning($"Accessing player data for unregistered key '{key}'. This might not exist."); } - SteamMatchmaking.SetLobbyMemberData(Lobby, key.ToString(), value.ToString()); + SteamMatchmaking.SetLobbyMemberData(Lobby, key.ToString(), (string)Convert.ChangeType(value, typeof(string), CultureInfo.InvariantCulture)); } /// @@ -503,7 +506,7 @@ public static T GetPlayerData(CSteamID player, string key) { try { - return (T)Convert.ChangeType(value, typeof(T)); + return (T)Convert.ChangeType(value, typeof(T), CultureInfo.InvariantCulture); } catch(Exception ex) { diff --git a/MyceliumNetworkingForCW/MyceliumNetworkingForCW.csproj b/MyceliumNetworkingForCW/MyceliumNetworkingForCW.csproj index 7415551..95eb877 100644 --- a/MyceliumNetworkingForCW/MyceliumNetworkingForCW.csproj +++ b/MyceliumNetworkingForCW/MyceliumNetworkingForCW.csproj @@ -91,11 +91,11 @@ - - $(ManagedDirectory)Assembly-CSharp.dll - - - $(ManagedDirectory)com.rlabrecque.steamworks.net.dll + + $(CW_References)Assembly-CSharp.dll + + + $(CW_References)com.rlabrecque.steamworks.net.dll From c68dc539c0927a65f4e604562504424f585f9e92 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 17 May 2024 13:31:26 -0300 Subject: [PATCH 2/3] style: remove double spaces --- MyceliumNetworkingForCW/MyceliumNetwork.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/MyceliumNetworkingForCW/MyceliumNetwork.cs b/MyceliumNetworkingForCW/MyceliumNetwork.cs index 8bc885d..9858faf 100644 --- a/MyceliumNetworkingForCW/MyceliumNetwork.cs +++ b/MyceliumNetworkingForCW/MyceliumNetwork.cs @@ -373,8 +373,6 @@ public static void SetLobbyData(string key, object value) RugLogger.LogWarning($"Accessing lobby data for unregistered key '{key}'. This might not exist."); } - - if (!SteamMatchmaking.SetLobbyData(Lobby, key, (string)Convert.ChangeType(value, typeof(string), CultureInfo.InvariantCulture))) { RugLogger.LogError("Error setting lobby data."); From 4eca57ecb79b06b9b4d3f62567a7ae71b0d54782 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 17 May 2024 13:37:25 -0300 Subject: [PATCH 3/3] build: revert csproj changes --- .../MyceliumNetworkingForCW.csproj | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/MyceliumNetworkingForCW/MyceliumNetworkingForCW.csproj b/MyceliumNetworkingForCW/MyceliumNetworkingForCW.csproj index 95eb877..152bdcf 100644 --- a/MyceliumNetworkingForCW/MyceliumNetworkingForCW.csproj +++ b/MyceliumNetworkingForCW/MyceliumNetworkingForCW.csproj @@ -91,12 +91,12 @@ - - $(CW_References)Assembly-CSharp.dll - - - $(CW_References)com.rlabrecque.steamworks.net.dll - + + $(ManagedDirectory)Assembly-CSharp.dll + + + $(ManagedDirectory)com.rlabrecque.steamworks.net.dll +