Decompiled source of DeputyRU v1.0.2

DeputyTranslationMod.dll

Decompiled 7 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Deputy.Components;
using Microsoft.CodeAnalysis;
using R2API;
using Skillstates.Deputy;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("DeputyTranslationMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DeputyTranslationMod")]
[assembly: AssemblyTitle("DeputyTranslationMod")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace DeputyTranslationMod
{
	[BepInPlugin("Lecarde17.DeputyRU", "DeputyRU", "1.0.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Main : BaseUnityPlugin
	{
		public const string PluginGUID = "Lecarde17.DeputyRU";

		public const string PluginAuthor = "Lecarde17";

		public const string PluginName = "DeputyRU";

		public const string PluginVersion = "1.0.2";

		public void Awake()
		{
			string text = "BOG";
			string text2 = text + "_DEPUTY_BODY_";
			string text3 = "<style=cShrine>Modder's Note:</style> <style=cUserSetting>Thank you for showing interest in <color=#e1c100>The Deputy</color>! For feedback and bug reports, please contact <style=cIsUtility>Bog#4770</style> on Discord.</style>";
			string text4 = "Делегат - агрессивная лихачка, восстанавлиющая справедливость на поле битвы с помощью парных револьверов и смертоносных ударов ногами.<color=#CCD3E0>" + Environment.NewLine + Environment.NewLine;
			text4 = text4 + "< ! > Спусковой крючок обладает превосходной точностью и стабильно растущим уроном, но его дальность ограничена в сравнении с другими дальнобойными Выжившими." + Environment.NewLine + Environment.NewLine;
			text4 = text4 + "< ! > Револьверы, брошенные Оружейной пращей, всегда будут целиться в ближайшего к себе врага." + Environment.NewLine + Environment.NewLine;
			text4 = text4 + "< ! > Палящая звезда может быть направлена вверх, если вы поднимете голову." + Environment.NewLine + Environment.NewLine;
			text4 = text4 + "< ! > Звёздное столкновение может наносить невероятный взрывной урон при больших значениях скорости передвижения. Используйте свои пушки, чтобы накопить заряды Неотступного преследования, а затем сделать из врагов решето." + Environment.NewLine + Environment.NewLine + Environment.NewLine;
			text4 += text3;
			string text5 = "";
			string text6 = "..и она ушла, под грохот аплодисментов.";
			string text7 = "..и она исчезла, её бравада трагически закончилась.";
			LanguageAPI.Add(text2 + "NAME", "Делегат", "RU");
			LanguageAPI.Add(text2 + "DESCRIPTION", text4, "RU");
			LanguageAPI.Add(text2 + "SUBTITLE", "Роковая красотка", "RU");
			LanguageAPI.Add(text2 + "LORE", text5, "RU");
			LanguageAPI.Add(text2 + "OUTRO_FLAVOR", text6, "RU");
			LanguageAPI.Add(text2 + "OUTRO_FAILURE", text7, "RU");
			LanguageAPI.Add(text2 + "DEFAULT_SKIN_NAME", "По умолчанию", "RU");
			LanguageAPI.Add(text2 + "MASTERY_SKIN_NAME", "", "RU");
			LanguageAPI.Add(text2 + "PASSIVE_NAME", "Неотступное преследование", "RU");
			LanguageAPI.Add(text2 + "PASSIVE_DESCRIPTION", "Делегат может бегать в любом направлении. Поражение врагов навыками даёт вам накапливающуюся прибавку к <style=cIsUtility>скорости передвижения</style>.", "RU");
			LanguageAPI.Add(text2 + "PRIMARY_SHOOT_NAME", "Спусковой крючок", "RU");
			LanguageAPI.Add(text2 + "PRIMARY_SHOOT_DESCRIPTION", "<style=cIsUtility>Подвижность</style>. Выстрелите из револьверов средней дальности и нанесите " + $"<style=cIsDamage>{TriggerTap.damageCoefficient * 100f}% урона</style>.", "RU");
			LanguageAPI.Add(text2 + "SECONDARY_SLING_NAME", "Оружейная праща", "RU");
			LanguageAPI.Add(text2 + "SECONDARY_SLING_DESCRIPTION", "<style=cIsUtility>Подвижность</style>. Выкидывает два крутящихся револьвера.  " + $"Каждый револьвер стреляет по ближайшим врагам, нанося им по <style=cIsDamage>6x{RevolverProjectileBehavior.bulletDamage * 100f}%</style> урона</style> за пулю, " + $"а затем взрывается, нанося <style=cIsDamage>{RevolverProjectileBehavior.blastDamage * 100f}% урона</style>.", "RU");
			LanguageAPI.Add(text2 + "UTILITY_SHOOTINGSTAR_NAME", "Палящая звезда", "RU");
			LanguageAPI.Add(text2 + "UTILITY_SHOOTINGSTAR_DESCRIPTION", "<style=cIsDamage>Оглушение</style>. Делегат прыгает вперёд и начинает отстреливать врагов под собой, нанося " + $"<style=cIsDamage>{ShootingStar.maxShots}x{ShootingStar.damageCoefficient * 100f}% урона</style>.", "RU");
			LanguageAPI.Add(text2 + "SPECIAL_SKULLBREAKER_NAME", "Звёздное столкновение", "RU");
			LanguageAPI.Add(text2 + "SPECIAL_SKULLBREAKER_DESCRIPTION", "<style=cIsUtility>Пробивание</style>. Делегат совершает <style=cIsUtility>рывок</style> вперёд и отскакивает от врага, нанося ему " + $"<style=cIsDamage>{CometDash.damageCoefficient * 100f}% урона</style>. <style=cIsUtility>Убийства обнуляют перезарядку вашего " + "вспомогательного навыка</style>.", "RU");
			LanguageAPI.Add(text2 + "SPECIAL_BULLETHEAVEN_NAME", "Пулевой рай", "RU");
			LanguageAPI.Add(text2 + "SPECIAL_BULLETHEAVEN_DESCRIPTION", "Прыгните высоко в воздух, а затем начните бешено отстреливать врагов под собой, нанося им по " + $"<style=cIsDamage>{BulletHeaven.damageCoefficient * 100f}% урона</style> за пулю. Количество выстрелов растёт вместе с вашей скоростью атаки.", "RU");
			LanguageAPI.Add(text2 + "MASTERYUNLOCKABLE_ACHIEVEMENT_NAME", "Делегат: мастерство", "RU");
			LanguageAPI.Add(text2 + "MASTERYUNLOCKABLE_ACHIEVEMENT_DESC", "Играя за Делегата, пройдите игру или уничтожьтесь на уровне сложности «Сезон дождей».", "RU");
			LanguageAPI.Add(text2 + "MASTERYUNLOCKABLE_UNLOCKABLE_NAME", "Делегат: мастерство", "RU");
		}
	}
}

R2API.Language.dll

Decompiled 7 months ago
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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 BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API.AutoVersionGen;
using RoR2;
using SimpleJSON;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("R2API.Language")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("R2API.Language")]
[assembly: AssemblyTitle("R2API.Language")]
[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 System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
}
namespace R2API
{
	[AutoVersion]
	public static class LanguageAPI
	{
		public class LanguageOverlay
		{
			public readonly ReadOnlyCollection<OverlayTokenData> readOnlyOverlays;

			private readonly List<OverlayTokenData> overlayTokenDatas;

			internal LanguageOverlay(List<OverlayTokenData> data)
			{
				overlayTokenDatas = data;
				readOnlyOverlays = overlayTokenDatas.AsReadOnly();
				temporaryOverlays.Add(this);
				Add();
			}

			private void Add()
			{
				foreach (OverlayTokenData readOnlyOverlay in readOnlyOverlays)
				{
					if (!OverlayLanguage.ContainsKey(readOnlyOverlay.lang))
					{
						OverlayLanguage.Add(readOnlyOverlay.lang, new Dictionary<string, string>());
					}
					OverlayLanguage[readOnlyOverlay.lang][readOnlyOverlay.key] = readOnlyOverlay.value;
				}
			}

			public void Remove()
			{
				SetHooks();
				temporaryOverlays.Remove(this);
				OverlayLanguage.Clear();
				foreach (LanguageOverlay temporaryOverlay in temporaryOverlays)
				{
					temporaryOverlay.Add();
				}
			}
		}

		public struct OverlayTokenData
		{
			public string key;

			public string value;

			public string lang;

			public bool isGeneric;

			internal OverlayTokenData(string _key, string _value, string _lang)
			{
				key = _key;
				value = _value;
				if (_lang == "generic")
				{
					isGeneric = true;
				}
				else
				{
					isGeneric = false;
				}
				lang = _lang;
			}

			internal OverlayTokenData(string _key, string _value)
			{
				key = _key;
				value = _value;
				lang = "generic";
				isGeneric = true;
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_GetLocalizedStringByToken <0>__Language_GetLocalizedStringByToken;

			public static hook_TokenIsRegistered <1>__Language_TokenIsRegistered;
		}

		public const string PluginGUID = "com.bepis.r2api.language";

		public const string PluginName = "R2API.Language";

		private static readonly Dictionary<string, Dictionary<string, string>> CustomLanguage = new Dictionary<string, Dictionary<string, string>>(StringComparer.OrdinalIgnoreCase);

		private static readonly Dictionary<string, Dictionary<string, string>> OverlayLanguage = new Dictionary<string, Dictionary<string, string>>(StringComparer.OrdinalIgnoreCase);

		private static readonly List<LanguageOverlay> temporaryOverlays = new List<LanguageOverlay>();

		private const string genericLanguage = "generic";

		private static bool _hooksEnabled = false;

		public const string PluginVersion = "1.0.0";

		[Obsolete("All submodules are automatically loaded and this property is now unused")]
		public static bool Loaded => true;

		internal static void SetHooks()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			if (!_hooksEnabled)
			{
				_hooksEnabled = true;
				LoadLanguageFilesFromPluginFolder();
				_hooksEnabled = false;
				object obj = <>O.<0>__Language_GetLocalizedStringByToken;
				if (obj == null)
				{
					hook_GetLocalizedStringByToken val = Language_GetLocalizedStringByToken;
					<>O.<0>__Language_GetLocalizedStringByToken = val;
					obj = (object)val;
				}
				Language.GetLocalizedStringByToken += (hook_GetLocalizedStringByToken)obj;
				object obj2 = <>O.<1>__Language_TokenIsRegistered;
				if (obj2 == null)
				{
					hook_TokenIsRegistered val2 = Language_TokenIsRegistered;
					<>O.<1>__Language_TokenIsRegistered = val2;
					obj2 = (object)val2;
				}
				Language.TokenIsRegistered += (hook_TokenIsRegistered)obj2;
				_hooksEnabled = true;
			}
		}

		private static void LoadLanguageFilesFromPluginFolder()
		{
			string[] files = Directory.GetFiles(Paths.PluginPath, "*.language", SearchOption.AllDirectories);
			for (int i = 0; i < files.Length; i++)
			{
				AddPath(files[i]);
			}
		}

		internal static void UnsetHooks()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			object obj = <>O.<0>__Language_GetLocalizedStringByToken;
			if (obj == null)
			{
				hook_GetLocalizedStringByToken val = Language_GetLocalizedStringByToken;
				<>O.<0>__Language_GetLocalizedStringByToken = val;
				obj = (object)val;
			}
			Language.GetLocalizedStringByToken -= (hook_GetLocalizedStringByToken)obj;
			object obj2 = <>O.<1>__Language_TokenIsRegistered;
			if (obj2 == null)
			{
				hook_TokenIsRegistered val2 = Language_TokenIsRegistered;
				<>O.<1>__Language_TokenIsRegistered = val2;
				obj2 = (object)val2;
			}
			Language.TokenIsRegistered -= (hook_TokenIsRegistered)obj2;
			_hooksEnabled = false;
		}

		private static bool Language_TokenIsRegistered(orig_TokenIsRegistered orig, Language self, string token)
		{
			string name = self.name;
			if (OverlayLanguage.ContainsKey(name) && OverlayLanguage[name].ContainsKey(token))
			{
				return true;
			}
			if (OverlayLanguage.ContainsKey("generic") && OverlayLanguage["generic"].ContainsKey(token))
			{
				return true;
			}
			if (CustomLanguage.ContainsKey(name) && CustomLanguage[name].ContainsKey(token))
			{
				return true;
			}
			if (CustomLanguage.ContainsKey("generic") && CustomLanguage["generic"].ContainsKey(token))
			{
				return true;
			}
			return orig.Invoke(self, token);
		}

		private static string Language_GetLocalizedStringByToken(orig_GetLocalizedStringByToken orig, Language self, string token)
		{
			string name = self.name;
			if (OverlayLanguage.ContainsKey(name) && OverlayLanguage[name].ContainsKey(token))
			{
				return OverlayLanguage[name][token];
			}
			if (OverlayLanguage.ContainsKey("generic") && OverlayLanguage["generic"].ContainsKey(token))
			{
				return OverlayLanguage["generic"][token];
			}
			if (CustomLanguage.ContainsKey(name) && CustomLanguage[name].ContainsKey(token))
			{
				return CustomLanguage[name][token];
			}
			if (CustomLanguage.ContainsKey("generic") && CustomLanguage["generic"].ContainsKey(token))
			{
				return CustomLanguage["generic"][token];
			}
			return orig.Invoke(self, token);
		}

		private static Dictionary<string, Dictionary<string, string>>? LoadFile(string fileContent)
		{
			Dictionary<string, Dictionary<string, string>> dictionary = new Dictionary<string, Dictionary<string, string>>();
			try
			{
				JSONNode val = JSON.Parse(fileContent);
				if (val == (object)null)
				{
					return null;
				}
				foreach (string key in val.Keys)
				{
					JSONNode val2 = val[key];
					if (val2 == (object)null)
					{
						continue;
					}
					string text = key;
					if (text == "strings")
					{
						text = "generic";
					}
					if (!dictionary.ContainsKey(text))
					{
						dictionary.Add(text, new Dictionary<string, string>());
					}
					Dictionary<string, string> dictionary2 = dictionary[text];
					foreach (string key2 in val2.Keys)
					{
						dictionary2.Add(key2, val2[key2].Value);
					}
				}
			}
			catch (Exception ex)
			{
				Debug.LogFormat("Parsing error in language file , Error: {0}", new object[1] { ex });
				return null;
			}
			if (dictionary.Count == 0)
			{
				return null;
			}
			return dictionary;
		}

		public static void Add(string? key, string? value)
		{
			SetHooks();
			if (key == null)
			{
				throw new NullReferenceException("param key is null");
			}
			if (value == null)
			{
				throw new NullReferenceException("param value is null");
			}
			Add(key, value, "generic");
		}

		public static void Add(string? key, string? value, string? language)
		{
			SetHooks();
			if (key == null)
			{
				throw new NullReferenceException("param key is null");
			}
			if (value == null)
			{
				throw new NullReferenceException("param value is null");
			}
			if (language == null)
			{
				throw new NullReferenceException("param language is null");
			}
			if (!CustomLanguage.ContainsKey(language))
			{
				CustomLanguage.Add(language, new Dictionary<string, string>());
			}
			Dictionary<string, string> dictionary = CustomLanguage[language];
			if (!dictionary.ContainsKey(key))
			{
				dictionary.Add(key, value);
			}
		}

		public static void AddPath(string? path)
		{
			SetHooks();
			if (path == null)
			{
				throw new NullReferenceException("param path is null");
			}
			Add(File.ReadAllText(path));
		}

		public static void Add(string? file)
		{
			SetHooks();
			if (file == null)
			{
				throw new NullReferenceException("param file is null");
			}
			Dictionary<string, Dictionary<string, string>> dictionary = LoadFile(file);
			if (dictionary != null)
			{
				Add(dictionary);
			}
		}

		public static void Add(Dictionary<string, string?>? tokenDictionary)
		{
			SetHooks();
			Add(tokenDictionary, "generic");
		}

		public static void Add(Dictionary<string, string?>? tokenDictionary, string? language)
		{
			SetHooks();
			if (tokenDictionary == null)
			{
				throw new NullReferenceException("param tokenDictionary is null");
			}
			foreach (KeyValuePair<string, string> item in tokenDictionary)
			{
				if (item.Value != null)
				{
					Add(item.Key, item.Value, language);
				}
			}
		}

		public static void Add(Dictionary<string, Dictionary<string, string?>?>? languageDictionary)
		{
			SetHooks();
			if (languageDictionary == null)
			{
				throw new NullReferenceException("param languageDictionary is null");
			}
			foreach (KeyValuePair<string, Dictionary<string, string>> item in languageDictionary)
			{
				Add(item.Value, item.Key);
			}
		}

		public static LanguageOverlay AddOverlay(string? key, string? value)
		{
			SetHooks();
			if (key == null)
			{
				throw new NullReferenceException("param key is null");
			}
			if (value == null)
			{
				throw new NullReferenceException("param value is null");
			}
			return AddOverlay(key, value, "generic");
		}

		public static LanguageOverlay AddOverlay(string? key, string? value, string? lang)
		{
			SetHooks();
			if (key == null)
			{
				throw new NullReferenceException("param key is null");
			}
			if (value == null)
			{
				throw new NullReferenceException("param value is null");
			}
			if (lang == null)
			{
				throw new NullReferenceException("param lang is null");
			}
			return new LanguageOverlay(new List<OverlayTokenData>(1)
			{
				new OverlayTokenData(key, value, lang)
			});
		}

		public static LanguageOverlay? AddOverlayPath(string? path)
		{
			SetHooks();
			if (path == null)
			{
				throw new NullReferenceException("param path is null");
			}
			string text = File.ReadAllText(path);
			if (text == null)
			{
				return null;
			}
			return AddOverlay(text);
		}

		public static LanguageOverlay? AddOverlay(string? file)
		{
			SetHooks();
			if (file == null)
			{
				throw new NullReferenceException("param file is null");
			}
			Dictionary<string, Dictionary<string, string>> dictionary = LoadFile(file);
			if (dictionary == null)
			{
				return null;
			}
			return AddOverlay(dictionary);
		}

		public static LanguageOverlay AddOverlay(Dictionary<string, string?>? tokenDictionary)
		{
			SetHooks();
			if (tokenDictionary == null)
			{
				throw new NullReferenceException("param tokenDictionary is null");
			}
			return AddOverlay(tokenDictionary, "generic");
		}

		public static LanguageOverlay AddOverlay(Dictionary<string, string?>? tokenDictionary, string? language)
		{
			SetHooks();
			if (tokenDictionary == null)
			{
				throw new NullReferenceException("param tokenDictionary is null");
			}
			if (language == null)
			{
				throw new NullReferenceException("param language is null");
			}
			List<OverlayTokenData> list = new List<OverlayTokenData>(tokenDictionary.Count);
			foreach (KeyValuePair<string, string> item in tokenDictionary)
			{
				if (item.Value != null)
				{
					list.Add(new OverlayTokenData(item.Key, item.Value, language));
				}
			}
			return new LanguageOverlay(list);
		}

		public static LanguageOverlay AddOverlay(Dictionary<string, Dictionary<string, string?>?>? languageDictionary)
		{
			SetHooks();
			if (languageDictionary == null)
			{
				throw new NullReferenceException("param languageDictionary is null");
			}
			List<OverlayTokenData> list = new List<OverlayTokenData>();
			foreach (KeyValuePair<string, Dictionary<string, string>> item in languageDictionary)
			{
				if (item.Value == null)
				{
					continue;
				}
				foreach (KeyValuePair<string, string> item2 in item.Value)
				{
					if (item2.Value != null)
					{
						list.Add(new OverlayTokenData(item.Key, item2.Key, item2.Value));
					}
				}
			}
			return new LanguageOverlay(list);
		}
	}
	[BepInPlugin("com.bepis.r2api.language", "R2API.Language", "1.0.0")]
	public sealed class LanguagePlugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger { get; set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
		}

		private void OnEnable()
		{
			LanguageAPI.SetHooks();
		}

		private void OnDisable()
		{
			LanguageAPI.UnsetHooks();
		}
	}
}
namespace R2API.AutoVersionGen
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	internal class AutoVersionAttribute : Attribute
	{
	}
}