using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Localization;
using UnityEngine.Localization.Settings;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Ashley.MeshSplitter")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("com.rlabrecque.steamworks.net")]
[assembly: IgnoresAccessChecksTo("Discord")]
[assembly: IgnoresAccessChecksTo("HBAO.Demo.Universal.Runtime")]
[assembly: IgnoresAccessChecksTo("HBAO.Runtime")]
[assembly: IgnoresAccessChecksTo("HBAO.Universal.Runtime")]
[assembly: IgnoresAccessChecksTo("MeshSplit")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("pworld")]
[assembly: IgnoresAccessChecksTo("sc.posteffects.runtime")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Modules.Unity.Addressables")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Modules.UnityLocalization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Tayx.Graphy")]
[assembly: IgnoresAccessChecksTo("Unity.Addressables")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InternalAPIEngineBridge.013")]
[assembly: IgnoresAccessChecksTo("Unity.Localization")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.PlayableGraphVisualizer")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipeline.Universal.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Universal.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Universal.Shaders")]
[assembly: IgnoresAccessChecksTo("Unity.ResourceManager")]
[assembly: IgnoresAccessChecksTo("Unity.ScriptableBuildPipeline")]
[assembly: IgnoresAccessChecksTo("Unity.Splines")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("Zorro.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Zorro.PhotonUtility")]
[assembly: IgnoresAccessChecksTo("Zorro.Recorder")]
[assembly: IgnoresAccessChecksTo("Zorro.Settings.Runtime")]
[assembly: IgnoresAccessChecksTo("Zorro.UI.Runtime")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Notest.LocaleLibrary")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+530d58c68794d4e79b607f183b38edf4a857f6b0")]
[assembly: AssemblyProduct("LocaleLibrary")]
[assembly: AssemblyTitle("Notest.LocaleLibrary")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.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 ItemLibrary
{
public static class LocalizationHandler
{
public static Dictionary<Locale, Dictionary<string, string>> LanguageDictionaries = new Dictionary<Locale, Dictionary<string, string>>();
public static Dictionary<string, string>? CurrentLanguageDictionary;
public static event Action<Locale>? LocaleAdded;
public static void AddKeyTranslationForLocale(Locale locale, Keys key, string translation)
{
if (!LanguageDictionaries.ContainsKey(locale))
{
LanguageDictionaries.Add(locale, new Dictionary<string, string>());
}
LanguageDictionaries[locale].TryAdd(((object)(Keys)(ref key)).ToString(), translation);
}
public static void AddKeyTranslationsForLocale(Locale locale, Dictionary<Keys, string> dictionary)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
Dictionary<string, string> dictionary2 = new Dictionary<string, string>();
foreach (KeyValuePair<Keys, string> item in dictionary)
{
Keys key = item.Key;
dictionary2.Add(((object)(Keys)(ref key)).ToString(), item.Value);
}
if (!LanguageDictionaries.ContainsKey(locale))
{
LanguageDictionaries.Add(locale, dictionary2);
return;
}
foreach (KeyValuePair<string, string> item2 in dictionary2)
{
LanguageDictionaries[locale].TryAdd(item2.Key, item2.Value);
}
}
public static void AddKeyTranslationForAllLocales(Keys key, string translation)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
foreach (Locale locale in LocalizationSettings.AvailableLocales.Locales)
{
AddKeyTranslationForLocale(locale, key, translation);
}
}
public static void AddKeyTranslationsForAllLocales(Dictionary<Keys, string> dictionary)
{
foreach (Locale locale in LocalizationSettings.AvailableLocales.Locales)
{
AddKeyTranslationsForLocale(locale, dictionary);
}
}
public static void SetKeyTranslationForLocale(Locale locale, Keys key, string translation)
{
if (!LanguageDictionaries.ContainsKey(locale))
{
LanguageDictionaries.Add(locale, new Dictionary<string, string>());
}
if (!LanguageDictionaries[locale].TryAdd(((object)(Keys)(ref key)).ToString(), translation))
{
LanguageDictionaries[locale][((object)(Keys)(ref key)).ToString()] = translation;
}
}
public static void SetKeyTranslationsForLocale(Locale locale, Dictionary<Keys, string> dictionary)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
foreach (KeyValuePair<Keys, string> item in dictionary)
{
SetKeyTranslationForLocale(locale, item.Key, item.Value);
}
}
public static void SetKeyTranslationForAllLocales(Keys key, string translation)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
foreach (Locale locale in LocalizationSettings.AvailableLocales.Locales)
{
SetKeyTranslationForLocale(locale, key, translation);
}
}
public static void SetKeyTranslationsForAllLocales(Dictionary<Keys, string> dictionary)
{
foreach (Locale locale in LocalizationSettings.AvailableLocales.Locales)
{
SetKeyTranslationsForLocale(locale, dictionary);
}
}
public static void SetKeyTranslationsDictionaryForLocale(Locale locale, Dictionary<Keys, string> dictionary)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
Dictionary<string, string> dictionary2 = new Dictionary<string, string>();
foreach (KeyValuePair<Keys, string> item in dictionary)
{
Keys key = item.Key;
dictionary2.Add(((object)(Keys)(ref key)).ToString(), item.Value);
}
if (!LanguageDictionaries.ContainsKey(locale))
{
LanguageDictionaries.Add(locale, dictionary2);
}
else
{
LanguageDictionaries[locale] = dictionary2;
}
}
public static string? GetLocalizedString(Keys key)
{
return GetLocalizedString(((object)(Keys)(ref key)).ToString());
}
public static void AddKeyTranslationForLocale(Locale locale, string key, string translation)
{
if (!LanguageDictionaries.ContainsKey(locale))
{
LanguageDictionaries.Add(locale, new Dictionary<string, string>());
}
LanguageDictionaries[locale].TryAdd(key, translation);
}
public static void AddKeyTranslationsForLocale(Locale locale, Dictionary<string, string> dictionary)
{
if (!LanguageDictionaries.ContainsKey(locale))
{
LanguageDictionaries.Add(locale, dictionary);
return;
}
foreach (KeyValuePair<string, string> item in dictionary)
{
LanguageDictionaries[locale].TryAdd(item.Key, item.Value);
}
}
public static void AddKeyTranslationForAllLocales(string key, string translation)
{
foreach (Locale locale in LocalizationSettings.AvailableLocales.Locales)
{
AddKeyTranslationForLocale(locale, key, translation);
}
}
public static void AddKeyTranslationsForAllLocales(Dictionary<string, string> dictionary)
{
foreach (Locale locale in LocalizationSettings.AvailableLocales.Locales)
{
AddKeyTranslationsForLocale(locale, dictionary);
}
}
public static void SetKeyTranslationForLocale(Locale locale, string key, string translation)
{
if (!LanguageDictionaries.ContainsKey(locale))
{
LanguageDictionaries.Add(locale, new Dictionary<string, string>());
}
if (!LanguageDictionaries[locale].TryAdd(key, translation))
{
LanguageDictionaries[locale][key] = translation;
}
}
public static void SetKeyTranslationsForLocale(Locale locale, Dictionary<string, string> dictionary)
{
foreach (KeyValuePair<string, string> item in dictionary)
{
SetKeyTranslationForLocale(locale, item.Key, item.Value);
}
}
public static void SetKeyTranslationForAllLocales(string key, string translation)
{
foreach (Locale locale in LocalizationSettings.AvailableLocales.Locales)
{
SetKeyTranslationForLocale(locale, key, translation);
}
}
public static void SetKeyTranslationsForAllLocales(Dictionary<string, string> dictionary)
{
foreach (Locale locale in LocalizationSettings.AvailableLocales.Locales)
{
SetKeyTranslationsForLocale(locale, dictionary);
}
}
public static void SetKeyTranslationsDictionaryForLocale(Locale locale, Dictionary<string, string> dictionary)
{
if (!LanguageDictionaries.ContainsKey(locale))
{
LanguageDictionaries.Add(locale, dictionary);
}
else
{
LanguageDictionaries[locale] = dictionary;
}
}
public static string? GetLocalizedString(string key)
{
if (CurrentLanguageDictionary != null && CurrentLanguageDictionary.TryGetValue(key.ToString(), out string value))
{
return value;
}
return null;
}
public static Locale GetCreateLocale(LocaleIdentifier localeIdentifier)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
ILocalesProvider availableLocales = LocalizationSettings.AvailableLocales;
Locale val = availableLocales.GetLocale(localeIdentifier);
if (!Object.op_Implicit((Object)(object)val))
{
val = Locale.CreateLocale(localeIdentifier);
availableLocales.AddLocale(val);
LocalizationHandler.LocaleAdded?.Invoke(val);
}
return val;
}
public static Locale GetCreateLocale(CultureInfo cultureInfo)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
LocaleIdentifier localeIdentifier = default(LocaleIdentifier);
((LocaleIdentifier)(ref localeIdentifier))..ctor(cultureInfo);
return GetCreateLocale(localeIdentifier);
}
}
}
namespace ItemLibrary.Patches
{
[HarmonyPatch(typeof(LocalizationKeys))]
internal class LocalizationKeysPatcher
{
[HarmonyPrefix]
[HarmonyPatch("OnLanguageSwitch")]
private static void OnLanguageSwitchPatch()
{
if (LocalizationHandler.LanguageDictionaries.TryGetValue(LocalizationSettings.SelectedLocale, out Dictionary<string, string> value))
{
LocalizationHandler.CurrentLanguageDictionary = value;
}
}
[HarmonyPrefix]
[HarmonyPatch("GetLocalizedString")]
private static bool GetLocalizedStringPatch(ref Keys key, ref string __result)
{
if (LocalizationHandler.CurrentLanguageDictionary != null && LocalizationHandler.CurrentLanguageDictionary.TryGetValue(((object)(Keys)(ref key)).ToString(), out __result))
{
return false;
}
return true;
}
}
}
namespace LocaleLibrary
{
[ContentWarningPlugin("Notest.LocaleLibrary", "1.0.0", true)]
[BepInPlugin("Notest.LocaleLibrary", "LocaleLibrary", "1.0.0")]
public class LocaleLibrary : BaseUnityPlugin
{
public static LocaleLibrary Instance { get; private set; }
internal static ManualLogSource Logger { get; private set; }
internal static Harmony? Harmony { get; set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
Patch();
Logger.LogInfo((object)"Notest.LocaleLibrary v1.0.0 has loaded!");
}
internal static void Patch()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
if (Harmony == null)
{
Harmony = new Harmony("Notest.LocaleLibrary");
}
Logger.LogDebug((object)"Patching...");
Harmony.PatchAll();
Logger.LogDebug((object)"Finished patching!");
}
internal static void Unpatch()
{
Logger.LogDebug((object)"Unpatching...");
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
Logger.LogDebug((object)"Finished unpatching!");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "Notest.LocaleLibrary";
public const string PLUGIN_NAME = "LocaleLibrary";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}