diff --git a/MinecraftClient/ChatBots/Farmer.cs b/MinecraftClient/ChatBots/Farmer.cs
index 0892b855..7c5a91d3 100644
--- a/MinecraftClient/ChatBots/Farmer.cs
+++ b/MinecraftClient/ChatBots/Farmer.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
-using System.Runtime.CompilerServices;
using System.Threading;
using MinecraftClient.Inventory;
using MinecraftClient.Mapping;
diff --git a/MinecraftClient/ChatBots/ScriptScheduler.cs b/MinecraftClient/ChatBots/ScriptScheduler.cs
index 642d2223..6e977775 100644
--- a/MinecraftClient/ChatBots/ScriptScheduler.cs
+++ b/MinecraftClient/ChatBots/ScriptScheduler.cs
@@ -1,4 +1,5 @@
using System;
+using System.Xml.Linq;
using Tomlet.Attributes;
using static MinecraftClient.ChatBots.ScriptScheduler.Configs;
@@ -249,7 +250,7 @@ namespace MinecraftClient.ChatBots
task.Trigger_On_Login,
task.Trigger_On_Times.Enable,
task.Trigger_On_Interval.Enable,
- task.Trigger_On_Times.Times,
+ string.Join(", ", Array.ConvertAll(task.Trigger_On_Times.Times, time => time.ToString())),
task.Trigger_On_Interval.MinTime + '-' + task.Trigger_On_Interval.MaxTime,
task.Action
);
diff --git a/MinecraftClient/Commands/Enchant.cs b/MinecraftClient/Commands/Enchant.cs
index db7a9f18..ab8200b2 100644
--- a/MinecraftClient/Commands/Enchant.cs
+++ b/MinecraftClient/Commands/Enchant.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using System.Globalization;
using System.Linq;
using MinecraftClient.Inventory;
diff --git a/MinecraftClient/DefaultConfigResource.Designer.cs b/MinecraftClient/DefaultConfigResource.Designer.cs
index f7ec6226..5e7671c9 100644
--- a/MinecraftClient/DefaultConfigResource.Designer.cs
+++ b/MinecraftClient/DefaultConfigResource.Designer.cs
@@ -8,11 +8,10 @@
//
//------------------------------------------------------------------------------
-namespace MinecraftClient
-{
+namespace MinecraftClient {
using System;
-
-
+
+
///
/// A strongly-typed resource class, for looking up localized strings, etc.
///
@@ -23,52 +22,44 @@ namespace MinecraftClient
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class DefaultConfigResource
- {
-
+ internal class DefaultConfigResource {
+
private static global::System.Resources.ResourceManager resourceMan;
-
+
private static global::System.Globalization.CultureInfo resourceCulture;
-
+
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal DefaultConfigResource()
- {
+ internal DefaultConfigResource() {
}
-
+
///
/// Returns the cached ResourceManager instance used by this class.
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if (object.ReferenceEquals(resourceMan, null))
- {
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MinecraftClient.DefaultConfigResource", typeof(DefaultConfigResource).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
-
+
///
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
return resourceCulture;
}
- set
- {
+ set {
resourceCulture = value;
}
}
-
+
///
/// Looks up a localized string similar to ╔═════════════════════════════════════╗
///║ Brewing Stand ║
@@ -84,14 +75,12 @@ namespace MinecraftClient
///║║ 5 ║ 6 ║ 7 ║ 8 ║ 9 ║10 ║11 ║12 ║13 ║║
///║╠═══╬═══╬═══╬═══╬══ [rest of string was truncated]";.
///
- internal static string ContainerType_BrewingStand
- {
- get
- {
+ internal static string ContainerType_BrewingStand {
+ get {
return ResourceManager.GetString("ContainerType_BrewingStand", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to ╔═════════════════════════════════════╗
///║ Crafting ║
@@ -107,21 +96,33 @@ namespace MinecraftClient
///║║10 ║11 ║12 ║13 ║14 ║15 ║16 ║17 ║18 ║║
///║╠═══╬═══╬═══╬═══╬══ [rest of string was truncated]";.
///
- internal static string ContainerType_Crafting
- {
- get
- {
+ internal static string ContainerType_Crafting {
+ get {
return ResourceManager.GetString("ContainerType_Crafting", resourceCulture);
}
}
- internal static string ContainerType_EnchantingTable
- {
- get
- {
+
+ ///
+ /// Looks up a localized string similar to ╔═════════════════════════════════════╗
+ ///║ Enchant ║
+ ///║ ╔════════════════════╗ ║
+ ///║ ║ Top ║ ║
+ ///║ ╔═══╦═══╗ ╠════════════════════╣ ║
+ ///║ ║ 0 ║ 1 ║ ║ Middle ║ ║
+ ///║ ╚═══╩═══╝ ╠════════════════════╣ ║
+ ///║ ║ Bottom ║ ║
+ ///║ ╚════════════════════╝ ║
+ ///║ Inventory ║
+ ///║╔═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╗║
+ ///║║ 2 ║ 3 ║ 4 ║ 5 ║ 6 ║ 7 ║ 8 ║ 9 ║10 ║║
+ ///║╠═══╬═══╬═══╬═══╬══ [rest of string was truncated]";.
+ ///
+ internal static string ContainerType_EnchantingTable {
+ get {
return ResourceManager.GetString("ContainerType_EnchantingTable", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to ╔═════════════════════════════════════╗
///║ Container ║
@@ -137,14 +138,12 @@ namespace MinecraftClient
///║╔═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╗║
///║║ 3 ║ 4 ║ 5 ║ 6 ║ 7 [rest of string was truncated]";.
///
- internal static string ContainerType_Furnace
- {
- get
- {
+ internal static string ContainerType_Furnace {
+ get {
return ResourceManager.GetString("ContainerType_Furnace", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to ╔═════════════════════════════════════╗
///║ Container ║
@@ -160,14 +159,12 @@ namespace MinecraftClient
///║║ 9 ║10 ║11 ║12 ║13 ║14 ║15 ║16 ║17 ║║
///║╠═══╬═══╬═══╬═══╬══ [rest of string was truncated]";.
///
- internal static string ContainerType_Generic_3x3
- {
- get
- {
+ internal static string ContainerType_Generic_3x3 {
+ get {
return ResourceManager.GetString("ContainerType_Generic_3x3", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to ╔═════════════════════════════════════╗
///║ Container ║
@@ -183,14 +180,12 @@ namespace MinecraftClient
///║║27 ║28 ║29 ║30 ║31 ║32 ║33 ║34 ║35 ║║
///║╠═══╬═══╬═══╬═══╬══ [rest of string was truncated]";.
///
- internal static string ContainerType_Generic_9x3
- {
- get
- {
+ internal static string ContainerType_Generic_9x3 {
+ get {
return ResourceManager.GetString("ContainerType_Generic_9x3", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to ╔═════════════════════════════════════╗
///║ Container ║
@@ -206,14 +201,12 @@ namespace MinecraftClient
///║║36 ║37 ║38 ║39 ║40 ║41 ║42 ║43 ║44 ║║
///║╠═══╬═══╬═══╬═══╬══ [rest of string was truncated]";.
///
- internal static string ContainerType_Generic_9x6
- {
- get
- {
+ internal static string ContainerType_Generic_9x6 {
+ get {
return ResourceManager.GetString("ContainerType_Generic_9x6", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to ╔═════════════════════════════════════╗
///║ Repair & Disenchant ║
@@ -229,14 +222,12 @@ namespace MinecraftClient
///║ ╚══╝ ╚══╝ ║
///║ [rest of string was truncated]";.
///
- internal static string ContainerType_Grindstone
- {
- get
- {
+ internal static string ContainerType_Grindstone {
+ get {
return ResourceManager.GetString("ContainerType_Grindstone", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to ╔═════════════════════════════════════╗
///║ Container ║
@@ -252,14 +243,12 @@ namespace MinecraftClient
///║║23 ║24 ║25 ║26 ║27 ║28 ║29 ║30 ║31 ║║
///║╚═══╩═══╩═══╩═══╩══ [rest of string was truncated]";.
///
- internal static string ContainerType_Hopper
- {
- get
- {
+ internal static string ContainerType_Hopper {
+ get {
return ResourceManager.GetString("ContainerType_Hopper", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to ╔═════════════════════════════════════╗
///║╔═══╦═══════════╗ ║
@@ -275,14 +264,12 @@ namespace MinecraftClient
///║║ 9 ║10 ║11 ║12 ║13 ║14 ║15 ║16 ║17 ║║
///║╠═══╬═══╬═══╬═══╬══ [rest of string was truncated]";.
///
- internal static string ContainerType_PlayerInventory
- {
- get
- {
+ internal static string ContainerType_PlayerInventory {
+ get {
return ResourceManager.GetString("ContainerType_PlayerInventory", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to [mcc]
///# Messages from MCC itself
@@ -299,14 +286,12 @@ namespace MinecraftClient
///mcc.session_invalid=§8Gespeicherte Session ungültig oder abgelaufen.
///mcc.session_valid=§8Gespeicherte Ses [rest of string was truncated]";.
///
- internal static string Translation_de
- {
- get
- {
+ internal static string Translation_de {
+ get {
return ResourceManager.GetString("Translation_de", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to [mcc]
///# Messages from MCC itself
@@ -321,14 +306,12 @@ namespace MinecraftClient
///mcc.password_hidden=Password(invisible): {0}
///mcc.off [rest of string was truncated]";.
///
- internal static string Translation_en
- {
- get
- {
+ internal static string Translation_en {
+ get {
return ResourceManager.GetString("Translation_en", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to [mcc]
///# Messages from MCC itself
@@ -345,14 +328,12 @@ namespace MinecraftClient
///mcc.session_invalid=§8Le cache de la session est invalide ou a expiré.
///mcc.session_va [rest of string was truncated]";.
///
- internal static string Translation_fr
- {
- get
- {
+ internal static string Translation_fr {
+ get {
return ResourceManager.GetString("Translation_fr", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to [mcc]
///# Messages from MCC itself
@@ -369,14 +350,12 @@ namespace MinecraftClient
///mcc.session_invalid=§8Кэшированная сессия недействительна или истекла.
///mcc.session_valid=§8Кэшированная се [rest of string was truncated]";.
///
- internal static string Translation_ru
- {
- get
- {
+ internal static string Translation_ru {
+ get {
return ResourceManager.GetString("Translation_ru", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to [mcc]
///# Messages from MCC itself
@@ -394,14 +373,12 @@ namespace MinecraftClient
///mcc.session_valid=§8Phiên vẫn còn hợp lệ cho {0}.
///mcc.profile_ke [rest of string was truncated]";.
///
- internal static string Translation_vi
- {
- get
- {
+ internal static string Translation_vi {
+ get {
return ResourceManager.GetString("Translation_vi", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to [mcc]
///# Messages from MCC itself
@@ -420,14 +397,12 @@ namespace MinecraftClient
///mcc.profile_key_invalid=§8缓存的聊天签名密钥需要刷新。
///mcc.profile_key_valid=§8{0 [rest of string was truncated]";.
///
- internal static string Translation_zh_Hans
- {
- get
- {
+ internal static string Translation_zh_Hans {
+ get {
return ResourceManager.GetString("Translation_zh_Hans", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to [mcc]
///# Messages from MCC itself
@@ -446,10 +421,8 @@ namespace MinecraftClient
///mcc.profile_key_invalid=§8快取的聊天簽名金鑰需要重新整理。
///mcc.profile_key_valid [rest of string was truncated]";.
///
- internal static string Translation_zh_Hant
- {
- get
- {
+ internal static string Translation_zh_Hant {
+ get {
return ResourceManager.GetString("Translation_zh_Hant", resourceCulture);
}
}
diff --git a/MinecraftClient/Inventory/EnchantmentMapping.cs b/MinecraftClient/Inventory/EnchantmentMapping.cs
index 8b82f156..d7797cc9 100644
--- a/MinecraftClient/Inventory/EnchantmentMapping.cs
+++ b/MinecraftClient/Inventory/EnchantmentMapping.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using MinecraftClient.Commands;
using MinecraftClient.Protocol.Handlers;
namespace MinecraftClient.Inventory
diff --git a/MinecraftClient/McClient.cs b/MinecraftClient/McClient.cs
index f795c0b9..af7001ff 100644
--- a/MinecraftClient/McClient.cs
+++ b/MinecraftClient/McClient.cs
@@ -4,7 +4,6 @@ using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading;
-using System.Transactions;
using MinecraftClient.ChatBots;
using MinecraftClient.Inventory;
using MinecraftClient.Logger;
diff --git a/MinecraftClient/Program.cs b/MinecraftClient/Program.cs
index 42033a58..10c471dd 100644
--- a/MinecraftClient/Program.cs
+++ b/MinecraftClient/Program.cs
@@ -397,19 +397,19 @@ namespace MinecraftClient
//Asking the user to type in missing data such as Username and Password
bool useBrowser = Config.Main.General.AccountType == LoginType.microsoft && Config.Main.General.Method == LoginMethod.browser;
- if (string.IsNullOrEmpty(Config.Main.General.Account.Login) && !useBrowser)
+ if (string.IsNullOrEmpty(InternalConfig.Login) && !useBrowser)
{
ConsoleIO.WriteLine(ConsoleIO.BasicIO ? Translations.Get("mcc.login_basic_io") : Translations.Get("mcc.login"));
- Config.Main.General.Account.Login = ConsoleIO.ReadLine().Trim();
- if (string.IsNullOrEmpty(Config.Main.General.Account.Login))
+ InternalConfig.Login = ConsoleIO.ReadLine().Trim();
+ if (string.IsNullOrEmpty(InternalConfig.Login))
{
HandleFailure(Translations.Get("error.login.blocked"), false, ChatBot.DisconnectReason.LoginRejected);
return;
}
}
- InternalConfig.Username = Config.Main.General.Account.Login;
+ InternalConfig.Username = InternalConfig.Login;
if (string.IsNullOrEmpty(Config.Main.General.Account.Password) && !useBrowser &&
- (Config.Main.Advanced.SessionCache == CacheType.none || !SessionCache.Contains(Settings.ToLowerIfNeed(Config.Main.General.Account.Login))))
+ (Config.Main.Advanced.SessionCache == CacheType.none || !SessionCache.Contains(Settings.ToLowerIfNeed(InternalConfig.Login))))
{
RequestPassword();
}
@@ -427,7 +427,7 @@ namespace MinecraftClient
///
private static void RequestPassword()
{
- ConsoleIO.WriteLine(ConsoleIO.BasicIO ? Translations.Get("mcc.password_basic_io", Config.Main.General.Account.Login) + "\n" : Translations.Get("mcc.password"));
+ ConsoleIO.WriteLine(ConsoleIO.BasicIO ? Translations.Get("mcc.password_basic_io", InternalConfig.Login) + "\n" : Translations.Get("mcc.password"));
string? password = ConsoleIO.BasicIO ? Console.ReadLine() : ConsoleIO.ReadPassword();
if (password == null || password == string.Empty) { password = "-"; }
InternalConfig.Password = password;
@@ -445,7 +445,7 @@ namespace MinecraftClient
ProtocolHandler.LoginResult result = ProtocolHandler.LoginResult.LoginRequired;
- string loginLower = Settings.ToLowerIfNeed(Config.Main.General.Account.Login);
+ string loginLower = Settings.ToLowerIfNeed(InternalConfig.Login);
if (InternalConfig.Password == "-")
{
Translations.WriteLineFormatted("mcc.offline");
@@ -488,7 +488,7 @@ namespace MinecraftClient
if (result != ProtocolHandler.LoginResult.Success)
{
Translations.WriteLine("mcc.connecting", Config.Main.General.AccountType == LoginType.mojang ? "Minecraft.net" : "Microsoft");
- result = ProtocolHandler.GetLogin(Config.Main.General.Account.Login, InternalConfig.Password, Config.Main.General.AccountType, out session);
+ result = ProtocolHandler.GetLogin(InternalConfig.Login, InternalConfig.Password, Config.Main.General.AccountType, out session);
}
if (result == ProtocolHandler.LoginResult.Success && Config.Main.Advanced.SessionCache != CacheType.none)
diff --git a/MinecraftClient/Protocol/Handlers/DataTypes.cs b/MinecraftClient/Protocol/Handlers/DataTypes.cs
index 49751548..ecc86bce 100644
--- a/MinecraftClient/Protocol/Handlers/DataTypes.cs
+++ b/MinecraftClient/Protocol/Handlers/DataTypes.cs
@@ -446,9 +446,9 @@ namespace MinecraftClient.Protocol.Handlers
else
entityType = entityPalette.FromId(ReadNextByte(cache), living);
- Double entityX = ReadNextDouble(cache);
- Double entityY = ReadNextDouble(cache);
- Double entityZ = ReadNextDouble(cache);
+ double entityX = ReadNextDouble(cache);
+ double entityY = ReadNextDouble(cache);
+ double entityZ = ReadNextDouble(cache);
byte entityPitch = ReadNextByte(cache);
byte entityYaw = ReadNextByte(cache);
diff --git a/MinecraftClient/Protocol/Handlers/Protocol16.cs b/MinecraftClient/Protocol/Handlers/Protocol16.cs
index d3577358..1270f3c1 100644
--- a/MinecraftClient/Protocol/Handlers/Protocol16.cs
+++ b/MinecraftClient/Protocol/Handlers/Protocol16.cs
@@ -535,7 +535,7 @@ namespace MinecraftClient.Protocol.Handlers
{
session.ServerIDhash = serverIDhash;
session.ServerPublicKey = serverPublicKey;
- SessionCache.Store(Config.Main.General.Account.Login.ToLower(), session);
+ SessionCache.Store(InternalConfig.Login.ToLower(), session);
}
else
{
diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs
index bcff704b..f7ddda15 100644
--- a/MinecraftClient/Protocol/Handlers/Protocol18.cs
+++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs
@@ -1974,7 +1974,7 @@ namespace MinecraftClient.Protocol.Handlers
{
session.ServerIDhash = serverIDhash;
session.ServerPublicKey = serverPublicKey;
- SessionCache.Store(Config.Main.General.Account.Login.ToLower(), session);
+ SessionCache.Store(InternalConfig.Login.ToLower(), session);
}
else
{
diff --git a/MinecraftClient/Protocol/ProtocolHandler.cs b/MinecraftClient/Protocol/ProtocolHandler.cs
index 74a2fb5b..513c276c 100644
--- a/MinecraftClient/Protocol/ProtocolHandler.cs
+++ b/MinecraftClient/Protocol/ProtocolHandler.cs
@@ -603,7 +603,7 @@ namespace MinecraftClient.Protocol
session.PlayerID = profile.UUID;
session.ID = accessToken;
session.RefreshToken = msaResponse.RefreshToken;
- Config.Main.General.Account.Login = msaResponse.Email;
+ InternalConfig.Login = msaResponse.Email;
return LoginResult.Success;
}
else
diff --git a/MinecraftClient/Resources/lang/de.ini b/MinecraftClient/Resources/lang/de.ini
index c4ee32cc..391d6c49 100644
Binary files a/MinecraftClient/Resources/lang/de.ini and b/MinecraftClient/Resources/lang/de.ini differ
diff --git a/MinecraftClient/Resources/lang/en.ini b/MinecraftClient/Resources/lang/en.ini
index 10298512..1ed90b50 100644
--- a/MinecraftClient/Resources/lang/en.ini
+++ b/MinecraftClient/Resources/lang/en.ini
@@ -1,4 +1,4 @@
-[mcc]
+[mcc]
# Messages from MCC itself
mcc.help_us_translate=Help us translate MCC: {0}
mcc.run_with_default_settings=\nMCC is running with default settings.
diff --git a/MinecraftClient/Resources/lang/fr.ini b/MinecraftClient/Resources/lang/fr.ini
index a7514037..07d5617a 100644
Binary files a/MinecraftClient/Resources/lang/fr.ini and b/MinecraftClient/Resources/lang/fr.ini differ
diff --git a/MinecraftClient/Resources/lang/ru.ini b/MinecraftClient/Resources/lang/ru.ini
index 818441ec..38ff9168 100644
Binary files a/MinecraftClient/Resources/lang/ru.ini and b/MinecraftClient/Resources/lang/ru.ini differ
diff --git a/MinecraftClient/Resources/lang/vi.ini b/MinecraftClient/Resources/lang/vi.ini
index b1da5b23..3b992cd5 100644
Binary files a/MinecraftClient/Resources/lang/vi.ini and b/MinecraftClient/Resources/lang/vi.ini differ
diff --git a/MinecraftClient/Resources/lang/zh-Hans.ini b/MinecraftClient/Resources/lang/zh-Hans.ini
index 5f787397..201ba051 100644
Binary files a/MinecraftClient/Resources/lang/zh-Hans.ini and b/MinecraftClient/Resources/lang/zh-Hans.ini differ
diff --git a/MinecraftClient/Resources/lang/zh-Hant.ini b/MinecraftClient/Resources/lang/zh-Hant.ini
index e2f38710..ae5216d1 100644
Binary files a/MinecraftClient/Resources/lang/zh-Hant.ini and b/MinecraftClient/Resources/lang/zh-Hant.ini differ
diff --git a/MinecraftClient/Settings.cs b/MinecraftClient/Settings.cs
index 9f4d2f27..ee680ea2 100644
--- a/MinecraftClient/Settings.cs
+++ b/MinecraftClient/Settings.cs
@@ -45,6 +45,8 @@ namespace MinecraftClient
public static ushort ServerPort = 25565;
+ public static string Login = string.Empty;
+
public static string Username = string.Empty;
public static string Password = string.Empty;
@@ -243,7 +245,7 @@ namespace MinecraftClient
switch (positionalIndex)
{
case 0:
- Config.Main.General.Account.Login = argument;
+ InternalConfig.Login = argument;
break;
case 1:
InternalConfig.Password = argument;
@@ -360,6 +362,7 @@ namespace MinecraftClient
General.Account.Login ??= string.Empty;
General.Account.Password ??= string.Empty;
+ InternalConfig.Login = General.Account.Login;
General.Server.Host ??= string.Empty;
@@ -841,7 +844,7 @@ namespace MinecraftClient
switch (varname_lower)
{
case "username": result.Append(InternalConfig.Username); break;
- case "login": result.Append(Settings.Config.Main.General.Account.Login); break;
+ case "login": result.Append(InternalConfig.Login); break;
case "serverip": result.Append(InternalConfig.ServerIP); break;
case "serverport": result.Append(InternalConfig.ServerPort); break;
case "datetime":
diff --git a/MinecraftClient/Translations.cs b/MinecraftClient/Translations.cs
index c447a51b..c66554ac 100644
--- a/MinecraftClient/Translations.cs
+++ b/MinecraftClient/Translations.cs
@@ -659,17 +659,21 @@ namespace MinecraftClient
string[] transEn = DefaultConfigResource.ResourceManager.GetString("Translation_en")!
.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
- foreach (string lang in new string[] { "de", "fr", "ru", "vi", "zh_Hans", "zh_Hant" })
+ foreach (string lang in new string[] { "de", "fr", "ru", "vi", "zh-Hans", "zh-Hant" })
{
Dictionary trans = ParseTranslationContent(
- DefaultConfigResource.ResourceManager.GetString("Translation_" + lang)!
+ DefaultConfigResource.ResourceManager.GetString("Translation_" + lang.Replace('-', '_'), System.Globalization.CultureInfo.InvariantCulture)!
.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None)
);
string fileName = AppDomain.CurrentDomain.BaseDirectory + Path.DirectorySeparatorChar + translationFilePath + Path.DirectorySeparatorChar + lang + ".ini";
if (File.Exists(fileName))
{
string backupFilePath = Path.ChangeExtension(fileName, ".backup.ini");
- try { File.Copy(fileName, backupFilePath, true); }
+ try
+ {
+ File.Copy(fileName, backupFilePath, true);
+ File.Delete(fileName);
+ }
catch (Exception ex)
{
ConsoleIO.WriteLineFormatted(Translations.TryGet("config.backup.fail", backupFilePath));
@@ -677,7 +681,7 @@ namespace MinecraftClient
return;
}
}
- using FileStream file = File.OpenWrite(fileName);
+ StringBuilder sb = new();
int total = 0, translated = 0;
for (int i = 0; i < transEn.Length; ++i)
{
@@ -685,16 +689,15 @@ namespace MinecraftClient
int index = transEn[i].IndexOf('=');
if (line.Length < 3 || !char.IsLetterOrDigit(line[0]) || index == -1 || line.Length <= (index + 1))
{
- file.Write(Encoding.UTF8.GetBytes(line));
+ sb.Append(line);
}
else
{
string key = line[..index];
- file.Write(Encoding.UTF8.GetBytes(key));
- file.Write(Encoding.UTF8.GetBytes("="));
+ sb.Append(key).Append('=');
if (trans.TryGetValue(key, out string? value))
{
- file.Write(Encoding.UTF8.GetBytes(value.Replace("\n", "\\n")));
+ sb.Append(value.Replace("\n", "\\n"));
++total;
++translated;
}
@@ -703,8 +706,9 @@ namespace MinecraftClient
++total;
}
}
- file.Write(Encoding.UTF8.GetBytes(Environment.NewLine));
+ sb.AppendLine();
}
+ File.WriteAllText(fileName, sb.ToString(), Encoding.Unicode);
ConsoleIO.WriteLine(string.Format("Language {0}: Translated {1} of {2}, {3:0.00}%", lang, translated, total, 100.0 * (double)translated / total));
}
}
diff --git a/README-zh-Hans.md b/README-zh-Hans.md
index 57d68fe5..de1814ea 100644
--- a/README-zh-Hans.md
+++ b/README-zh-Hans.md
@@ -48,12 +48,13 @@
请查看:[如何为MCC添加或更新翻译](https://mccteam.github.io/guide/contibuting.html#translations)。
MCC 现在支持这些语言(按字母顺序排列):
- * `de.ini` : Deutsch - German
- * `en.ini` : English - English
- * `fr.ini` : Français (France) - French
- * `ru.ini` : Русский (Russkiy) - Russian
- * `vi.ini` : Tiếng Việt (Việt Nam) - Vietnamese
- * `zh-Hans.ini` : 简体中文(中国大陆) - Chinese Simplified (China; Mandarin)
+ * `de.ini`: Deutsch - German
+ * `en.ini`: English - English
+ * `fr.ini`: Français (France) - French
+ * `ru.ini`: Русский (Russkiy) - Russian
+ * `vi.ini`: Tiếng Việt (Việt Nam) - Vietnamese
+ * `zh-Hans.ini`: 简体中文 - Chinese Simplified
+ * `zh-Hant.ini`: 繁體中文 - Chinese Traditional
## 从源码构建 🏗️
diff --git a/README.md b/README.md
index 67bf7f97..9f9bad52 100644
--- a/README.md
+++ b/README.md
@@ -50,13 +50,13 @@ If you'd like to contribute to Minecraft Console Client, great, just fork the re
Check out: [How to update or add translations for MCC](https://mccteam.github.io/guide/contibuting.html#translations).
MCC now supports the following languages (Alphabetical order) :
- * `de.ini` (54.40% translated) : Deutsch - German
+ * `de.ini` (49.19% translated) : Deutsch - German
* `en.ini` : English - English
- * `fr.ini` (54.40% translated) : Français (France) - French
- * `ru.ini` (53.50% translated) : Русский (Russkiy) - Russian
- * `vi.ini` (53.50% translated) : Tiếng Việt (Việt Nam) - Vietnamese
- * `zh-Hans.ini` (100.00% translated) : 简体中文 - Chinese Simplified
- * `zh-Hant.ini` (100.00% translated) : 繁體中文 - Chinese Traditional
+ * `fr.ini` (49.19% translated) : Français (France) - French
+ * `ru.ini` (48.38% translated) : Русский (Russkiy) - Russian
+ * `vi.ini` (48.38% translated) : Tiếng Việt (Việt Nam) - Vietnamese
+ * `zh-Hans.ini` (90.43% translated) : 简体中文 - Chinese Simplified
+ * `zh-Hant.ini` (90.43% translated) : 繁體中文 - Chinese Traditional
## Building from the source 🏗️