using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.Json; using BepInEx; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.Utils.Collections; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("Ukrainian_BigWalk")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Ukrainian Language for Big Walk")] [assembly: AssemblyTitle("Ukrainian_BigWalk")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MyFirstPlugin { [BepInPlugin("Ukrainian_BigWalk", "Ukrainian Language for Big Walk", "1.0.0")] public class Plugin : BasePlugin { internal static ManualLogSource Log; public override void Load() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown Log = ((BasePlugin)this).Log; ManualLogSource log = Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(11, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("Ukrainian_BigWalk"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!"); } log.LogInfo(val); ((BasePlugin)this).AddComponent(); } } public class TranslationLoader : MonoBehaviour { private void Start() { ((MonoBehaviour)this).StartCoroutine(CollectionExtensions.WrapToIl2Cpp(WaitForLocalization())); } private IEnumerator WaitForLocalization() { Plugin.Log.LogInfo((object)"Waiting for a LocalizationDataSet instance..."); LocalizationDataSet dataSet = null; while ((Object)(object)dataSet == (Object)null) { try { dataSet = LocalizationDataSet.instance; } catch { } yield return null; } ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(42, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Found a LocalizationDataSet with "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(((Il2CppArrayBase)(object)dataSet.items).Length); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" entries."); } log.LogInfo(val); Dictionary translations = LoadTranslations(); int replaced = 0; foreach (LocalizationEntry item in (Il2CppArrayBase)(object)dataSet.items) { if (translations.TryGetValue(item.key, out var translatedText)) { item.russian = translatedText; replaced++; } translatedText = null; } LocalizedText.RefreshAll(); ManualLogSource log2 = Plugin.Log; val = new BepInExInfoLogInterpolatedStringHandler(23, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Applied "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(replaced); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("/"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(translations.Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" translations."); } log2.LogInfo(val); } private Dictionary LoadTranslations() { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, "translations.json"); bool flag = default(bool); if (!File.Exists(text)) { ManualLogSource log = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(28, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Translation file not found: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(text); } log.LogWarning(val); return new Dictionary(); } try { string json = File.ReadAllText(text); return JsonSerializer.Deserialize>(json) ?? new Dictionary(); } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(34, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to load translations.json: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex); } log2.LogError(val2); return new Dictionary(); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Ukrainian_BigWalk"; public const string PLUGIN_NAME = "Ukrainian Language for Big Walk"; public const string PLUGIN_VERSION = "1.0.0"; } }