Skip to content

Commit

Permalink
Chinese support
Browse files Browse the repository at this point in the history
Update Goldberg Emulator to 475342f0
  • Loading branch information
oureveryday committed May 13, 2023
1 parent 1c95493 commit 5317123
Show file tree
Hide file tree
Showing 18 changed files with 1,610 additions and 105 deletions.
38 changes: 38 additions & 0 deletions SteamAutoCrack.Core/Config/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
using Serilog.Events;
using SteamAutoCrack.Core.Utils;
using SteamAutoCrack.Core.Utils.SteamAutoCrack.Core.Utils;
using System.ComponentModel;
using System.DirectoryServices.ActiveDirectory;
using System.Globalization;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;

namespace SteamAutoCrack.Core.Config
{
Expand Down Expand Up @@ -92,6 +95,11 @@ public static bool EnableDebugLog
/// Output log to file.
/// </summary>
public static bool LogToFile { get; set; } = false;
/// <summary>
/// Program Language.
/// </summary>
public enum Languages { [Description("English")] en_US , [Description("中文")] zh_CN }
public static Languages Language { get; set; } = GetDefaultLanguage();

private static bool CheckConfigFile()
{
Expand Down Expand Up @@ -140,6 +148,7 @@ public static void ResettoDefaultAll()
TempPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TEMP");
EnableDebugLog = false;
LogToFile = false;
Language = GetDefaultLanguage();
ResettoDefaultConfigs();
}
public static void ResettoDefaultConfigs()
Expand Down Expand Up @@ -174,6 +183,7 @@ public static void SaveConfig()
ProcessConfigs = ProcessConfigs,
EnableDebugLog = EnableDebugLog,
LogToFile = LogToFile,
Language = Language,
}, options);
File.WriteAllText(ConfigPath, jsonString);
return;
Expand All @@ -200,6 +210,7 @@ public static bool LoadConfig()
ProcessConfigs = configs.ProcessConfigs ?? ProcessConfigs;
EnableDebugLog = configs.EnableDebugLog;
LogToFile = configs.LogToFile;
Language = configs.Language;
}
_log.Information("Config loaded.");
return true;
Expand All @@ -211,6 +222,32 @@ public static bool LoadConfig()
return false;
}
}

public static Languages GetDefaultLanguage()
{
var language = EMUConfig.Languages.english;
string culture = CultureInfo.InstalledUICulture.Name;
switch (culture.Substring(0, 2))
{
case "zh":
return Languages.zh_CN;
default:
return Languages.en_US;
}
}

public static string GetLanguage()
{
switch (Language)
{
case Languages.en_US:
return "en-US";
case Languages.zh_CN:
return "zh-CN";
default:
return "en-US";
}
}
}

public class Configs
Expand All @@ -223,6 +260,7 @@ public class Configs
public ProcessConfigs? ProcessConfigs { get; set; }
public bool EnableDebugLog { get; set; }
public bool LogToFile { get; set; }
public Config.Languages Language { get; set; }
}
public class EMUApplyConfigs
{
Expand Down
4 changes: 4 additions & 0 deletions SteamAutoCrack.sln.DotSettings.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=SteamAutoCrack_002FProperties_002FResources/@EntryIndexedValue">True</s:Boolean>

<s:Boolean x:Key="/Default/ResxEditorPersonal/Initialized/@EntryValue">True</s:Boolean></wpf:ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<History>True|2023-04-28T11:45:33.6232308Z;True|2023-01-22T14:49:09.3172933+08:00;True|2023-01-21T10:38:13.5056723+08:00;True|2023-01-19T11:40:56.1167329+08:00;False|2023-01-19T10:14:28.0125070+08:00;False|2023-01-19T10:14:02.5839273+08:00;False|2023-01-19T10:12:28.5929122+08:00;False|2023-01-19T10:11:35.0398980+08:00;False|2023-01-19T10:10:25.6270989+08:00;False|2023-01-19T10:09:57.6411735+08:00;True|2023-01-18T20:55:16.8701589+08:00;True|2023-01-18T20:44:53.9234235+08:00;True|2023-01-18T20:37:53.6315432+08:00;True|2023-01-18T20:23:35.4870326+08:00;True|2023-01-18T15:31:04.9590250+08:00;True|2023-01-01T10:46:11.7203269+08:00;True|2022-12-31T21:31:49.2098801+08:00;True|2022-12-31T21:18:47.7546398+08:00;True|2022-12-31T13:48:44.1620930+08:00;True|2022-12-31T13:47:09.7358791+08:00;True|2022-12-31T13:25:31.2322802+08:00;True|2022-12-31T13:11:49.0976180+08:00;True|2022-12-31T13:07:01.3156436+08:00;True|2022-12-31T13:01:06.8924132+08:00;True|2022-12-31T12:58:47.3923475+08:00;True|2022-12-30T15:28:26.6913932+08:00;True|2022-12-28T17:43:38.7766759+08:00;True|2022-12-28T17:39:42.1733300+08:00;True|2022-12-25T20:58:13.3870816+08:00;True|2022-12-25T17:39:52.9867113+08:00;</History>
<History>True|2023-05-13T18:23:23.2010617Z;True|2023-04-28T19:45:33.6232308+08:00;True|2023-01-22T14:49:09.3172933+08:00;True|2023-01-21T10:38:13.5056723+08:00;True|2023-01-19T11:40:56.1167329+08:00;False|2023-01-19T10:14:28.0125070+08:00;False|2023-01-19T10:14:02.5839273+08:00;False|2023-01-19T10:12:28.5929122+08:00;False|2023-01-19T10:11:35.0398980+08:00;False|2023-01-19T10:10:25.6270989+08:00;False|2023-01-19T10:09:57.6411735+08:00;True|2023-01-18T20:55:16.8701589+08:00;True|2023-01-18T20:44:53.9234235+08:00;True|2023-01-18T20:37:53.6315432+08:00;True|2023-01-18T20:23:35.4870326+08:00;True|2023-01-18T15:31:04.9590250+08:00;True|2023-01-01T10:46:11.7203269+08:00;True|2022-12-31T21:31:49.2098801+08:00;True|2022-12-31T21:18:47.7546398+08:00;True|2022-12-31T13:48:44.1620930+08:00;True|2022-12-31T13:47:09.7358791+08:00;True|2022-12-31T13:25:31.2322802+08:00;True|2022-12-31T13:11:49.0976180+08:00;True|2022-12-31T13:07:01.3156436+08:00;True|2022-12-31T13:01:06.8924132+08:00;True|2022-12-31T12:58:47.3923475+08:00;True|2022-12-30T15:28:26.6913932+08:00;True|2022-12-28T17:43:38.7766759+08:00;True|2022-12-28T17:39:42.1733300+08:00;True|2022-12-25T20:58:13.3870816+08:00;True|2022-12-25T17:39:52.9867113+08:00;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
Loading

0 comments on commit 5317123

Please sign in to comment.