diff --git a/CS2GSI.sln.DotSettings.user b/CS2GSI.sln.DotSettings.user new file mode 100644 index 0000000..3b9541c --- /dev/null +++ b/CS2GSI.sln.DotSettings.user @@ -0,0 +1,4 @@ + + True + + True \ No newline at end of file diff --git a/CS2GSI/CS2GSI.cs b/CS2GSI/CS2GSI.cs index 226ad5e..c3eff4a 100644 --- a/CS2GSI/CS2GSI.cs +++ b/CS2GSI/CS2GSI.cs @@ -11,11 +11,12 @@ public class CS2GSI private CS2GameState? _lastLocalGameState = null; private readonly ILogger? _logger; public bool IsRunning => this._gsiServer.IsRunning; + public CS2GameState? CurrentGameState => _lastLocalGameState; public CS2GSI(ILogger? logger = null) { this._logger = logger; - this._logger?.Log(LogLevel.Information, "Installing GSI-Configfile..."); + this._logger?.Log(LogLevel.Information, Resources.Installing_GSI_File); try { GsiConfigInstaller.InstallGsi(); @@ -23,7 +24,7 @@ public class CS2GSI catch (Exception e) { this._logger?.Log(LogLevel.Error, e.StackTrace); - this._logger?.Log(LogLevel.Critical, "Could not install GSI-Configfile. Exiting."); + this._logger?.Log(LogLevel.Critical, Resources.Installing_GSI_File_Failed); return; } this._gsiServer = new GSIServer(3000, logger); @@ -34,7 +35,7 @@ public class CS2GSI { JObject jsonObject = JObject.Parse(messageJson); CS2GameState newState = CS2GameState.ParseFromJObject(jsonObject); - this._logger?.Log(LogLevel.Debug, $"Received State:\n{newState.ToString()}"); + this._logger?.Log(LogLevel.Debug, $"{Resources.Received_State}:\n{newState.ToString()}"); if (_lastLocalGameState is not null && _allGameStates.Count > 0) { @@ -43,7 +44,7 @@ public class CS2GSI InvokeEvents(generatedEvents); } this._lastLocalGameState = newState.UpdateGameStateForLocal(_lastLocalGameState); - this._logger?.Log(LogLevel.Debug, $"\nUpdated Local State:\n{_lastLocalGameState}"); + this._logger?.Log(LogLevel.Debug, $"\n{Resources.Updated_Local_State}:\n{_lastLocalGameState}"); _allGameStates.Add(newState); } @@ -90,7 +91,7 @@ public class CS2GSI CS2Event.OnBombExploded => this.OnBombExploded, CS2Event.AnyEvent => this.AnyEvent, CS2Event.AnyMessage => this.AnyMessage, - _ => throw new ArgumentException("Unknown Event", nameof(cs2Event)) + _ => throw new ArgumentException(Resources.Unknown_Event, nameof(cs2Event)) }; } diff --git a/CS2GSI/CS2GSI.csproj b/CS2GSI/CS2GSI.csproj index 436bab4..da57e69 100644 --- a/CS2GSI/CS2GSI.csproj +++ b/CS2GSI/CS2GSI.csproj @@ -4,7 +4,7 @@ net7.0 enable enable - 1.0.7 + 1.0.8 CS2GSI Glax https://github.com/C9Glax/CS2GSI diff --git a/CS2GSI/CS2GSI.csproj.DotSettings.user b/CS2GSI/CS2GSI.csproj.DotSettings.user new file mode 100644 index 0000000..f32145b --- /dev/null +++ b/CS2GSI/CS2GSI.csproj.DotSettings.user @@ -0,0 +1,2 @@ + + F2272524-6CDD-4ACD-8CFF-64B9AF98D54A/f:Resources.resx \ No newline at end of file diff --git a/CS2GSI/GSIConfigInstaller.cs b/CS2GSI/GSIConfigInstaller.cs index f6b008f..a3a4153 100644 --- a/CS2GSI/GSIConfigInstaller.cs +++ b/CS2GSI/GSIConfigInstaller.cs @@ -42,8 +42,8 @@ internal static class GsiConfigInstaller path = "~/.local/share/Steam/steamapps/libraryfolders.vdf"; else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) path = "~/Library/Application Support/Steam/steamapps/libraryfolders.vdf"; - else throw new Exception("Could not get Installation FolderPath"); - return path ?? throw new FileNotFoundException("No libraryfolders.vdf found"); + else throw new Exception(Resources.No_Installation_Folderpath); + return path ?? throw new FileNotFoundException(Resources.No_Libraryfolders_vdf); } [SupportedOSPlatform("windows")] @@ -51,7 +51,7 @@ internal static class GsiConfigInstaller { string steamInstallation = (string)(Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\Valve\Steam", "SteamPath", null) ?? - throw new DirectoryNotFoundException("No Steam Installation found.")); + throw new DirectoryNotFoundException(Resources.No_Steam)); return Path.Combine(steamInstallation, "steamapps\\libraryfolders.vdf"); } } \ No newline at end of file diff --git a/CS2GSI/Resources.Designer.cs b/CS2GSI/Resources.Designer.cs index d80d7af..acda32c 100644 --- a/CS2GSI/Resources.Designer.cs +++ b/CS2GSI/Resources.Designer.cs @@ -89,5 +89,77 @@ namespace CS2GSI { return ResourceManager.GetString("GSI_CFG_Content", resourceCulture); } } + + /// + /// Looks up a localized string similar to Installing GSI-Configfile.... + /// + internal static string Installing_GSI_File { + get { + return ResourceManager.GetString("Installing_GSI_File", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not install GSI-Configfile. Exiting.. + /// + internal static string Installing_GSI_File_Failed { + get { + return ResourceManager.GetString("Installing_GSI_File_Failed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not get Steam-Installation FolderPath. + /// + internal static string No_Installation_Folderpath { + get { + return ResourceManager.GetString("No_Installation_Folderpath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No libraryfolders.vdf found. + /// + internal static string No_Libraryfolders_vdf { + get { + return ResourceManager.GetString("No_Libraryfolders_vdf", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No Steam Installation found.. + /// + internal static string No_Steam { + get { + return ResourceManager.GetString("No_Steam", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Received State. + /// + internal static string Received_State { + get { + return ResourceManager.GetString("Received_State", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unknown Event. + /// + internal static string Unknown_Event { + get { + return ResourceManager.GetString("Unknown_Event", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Updated Local State. + /// + internal static string Updated_Local_State { + get { + return ResourceManager.GetString("Updated_Local_State", resourceCulture); + } + } } } diff --git a/CS2GSI/Resources.de.resx b/CS2GSI/Resources.de.resx new file mode 100644 index 0000000..e4038a4 --- /dev/null +++ b/CS2GSI/Resources.de.resx @@ -0,0 +1,38 @@ + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Installiere GSI-Konfigurationsdatei... + + + GSI-Konfigurationsdatei nicht installiert. + + + Steam-Installationspfad konnte nicht gefunden werden. + + + libraryfolders.vdf nicht gefunden + + + Keine Steam Installation gefunden. + + + Erhaltener Zustand + + + Unbekanntes Ereignis + + + Erneuerter Lokaler Zustand + + \ No newline at end of file diff --git a/CS2GSI/Resources.resx b/CS2GSI/Resources.resx index 6c843e9..25a679e 100644 --- a/CS2GSI/Resources.resx +++ b/CS2GSI/Resources.resx @@ -21,4 +21,29 @@ gamestate_integration_cs2gsi.cfg;System.String, mscorlib, Version=4.0.0.0, Culture=neutral + + Unknown Event + Event is not defined + + + Installing GSI-Configfile... + + + Could not install GSI-Configfile. Exiting. + + + Received State + + + Updated Local State + + + Could not get Steam-Installation FolderPath + + + No libraryfolders.vdf found + + + No Steam Installation found. + \ No newline at end of file