Decompiled source of TranslatedWarning v1.0.1

TranslatedWarning.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using DefaultNamespace.ContentEvents;
using Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour.HookGen;
using On;
using Photon.Realtime;
using TMPro;
using TranslatedWarning.Patches;
using UnityEngine;
using UnityEngine.Localization.Components;
using UnityEngine.Localization.PropertyVariants;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using Zorro.Core;
using Zorro.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ascdragonite.TranslatedWarning")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+47c2ae53dcf3bb581fefe30a92f163c98a445bda")]
[assembly: AssemblyProduct("TranslatedWarning")]
[assembly: AssemblyTitle("ascdragonite.TranslatedWarning")]
[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 TranslatedWarning
{
	[ContentWarningPlugin("ascdragonite.TranslatedWarning", "1.0.0", true)]
	[BepInPlugin("ascdragonite.TranslatedWarning", "TranslatedWarning", "1.0.0")]
	public class TranslatedWarning : BaseUnityPlugin
	{
		private string plan = InjectTranslation.assemblyPath + "\\plan.png";

		private string title = InjectTranslation.assemblyPath + "\\title.png";

		public List<string> commentList = new List<string>();

		private string[] values = new string[50];

		private string[] upgradeTranslations = new string[5] { "WATER", "BIOS SYSTEM COOKIES", "GREAT PODCAST", "TOURISM SERVICES", "A MILITARY BASE" };

		public static Texture2D? translatedPlan;

		public static Texture2D? titleTexture;

		public static Sprite? titleTranslated;

		public static List<string> seenList = new List<string>();

		public static TranslatedWarning Instance { get; private set; } = null;


		internal static ManualLogSource Logger { get; private set; } = null;


		private void Start()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			translatedPlan = new Texture2D(1024, 512, (TextureFormat)5, false);
			titleTexture = new Texture2D(1024, 348, (TextureFormat)5, false);
			byte[] array = File.ReadAllBytes(plan);
			byte[] array2 = File.ReadAllBytes(title);
			ImageConversion.LoadImage(translatedPlan, array);
			ImageConversion.LoadImage(titleTexture, array2);
			titleTranslated = Sprite.Create(titleTexture, new Rect(0f, 0f, (float)((Texture)titleTexture).width, (float)((Texture)titleTexture).height), new Vector2(0.5f, 0.5f), 100f);
		}

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			HookAll();
			Logger.LogInfo((object)"ascdragonite.TranslatedWarning v1.0.0 has loaded!");
			SceneManager.sceneLoaded += OnSceneLoaded;
		}

		internal void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			if (((Scene)(ref scene)).name == "SurfaceScene")
			{
				((MonoBehaviour)this).StartCoroutine(Surface());
			}
			if (((Scene)(ref scene)).name == "NewMainMenu")
			{
				Debug.Log((object)"CLEARING LIST");
				seenList.Clear();
			}
		}

		private IEnumerator MainMenu()
		{
			yield return null;
			foreach (object things in GameObject.Find("Canvas").transform)
			{
				Debug.Log(things);
			}
			Transform buttonsList = GameObject.Find("Canvas").transform.GetChild(0).GetChild(3);
			foreach (Transform item in buttonsList)
			{
				Transform button = item;
				InjectTranslation.TranslateText(button);
			}
			Transform settings = GameObject.Find("Canvas").transform.GetChild(3).GetChild(2);
			InjectTranslation.TranslateText(settings.GetChild(0));
			InjectTranslation.TranslateText(settings.GetChild(1), ((Object)((Component)settings).gameObject).name);
			Transform tabs = settings.GetChild(2).GetChild(0);
			foreach (Transform item2 in tabs)
			{
				Transform tab = item2;
				InjectTranslation.TranslateText(tab);
			}
		}

		private IEnumerator Surface()
		{
			yield return 0;
			GameObject addons = GameObject.Find("Addons");
			int i = 0;
			foreach (Transform item in addons.transform)
			{
				Transform upgradeTransform = item;
				if (i == 5)
				{
					break;
				}
				Transform upgrade = upgradeTransform;
				Transform locked = upgrade.GetChild(1);
				Component[] objects = ((Component)locked).GetComponentsInChildren<Component>(true);
				GameObject title = new GameObject();
				Component[] array = objects;
				foreach (Component thing in array)
				{
					if (((Object)thing.gameObject).name == "Title")
					{
						title = thing.gameObject;
						break;
					}
				}
				TMP_Text TMP = (TMP_Text)(object)title.GetComponent<TextMeshPro>();
				Debug.Log((object)TMP.text);
				TMP.text = upgradeTranslations[i];
				Debug.Log((object)TMP.text);
				i++;
			}
		}

		internal static void HookAll()
		{
			Logger.LogDebug((object)"Hooking...");
			InjectTranslation.Init();
			Logger.LogDebug((object)"Finished Hooking!");
		}

		public static void Delete(Component component)
		{
			Object.Destroy((Object)(object)component);
		}

		internal static void UnhookAll()
		{
			Logger.LogDebug((object)"Unhooking...");
			HookEndpointManager.RemoveAllOwnedBy((object)Assembly.GetExecutingAssembly());
			Logger.LogDebug((object)"Finished Unhooking!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "ascdragonite.TranslatedWarning";

		public const string PLUGIN_NAME = "TranslatedWarning";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace TranslatedWarning.Patches
{
	public class DialogRipper
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_GetLocalizedString <0>__LocalizationKeys_GetLocalizedString;

			public static hook_GenerateComment <1>__PlayerEmoteContentEvent_GenerateComment;

			public static hook_TryGetItemFromID <2>__ItemDatabase_TryGetItemFromID;

			public static hook_Awake <3>__MainMenuMainPage_Awake;

			public static hook_Awake <4>__MainMenuSettingsPage_Awake;

			public static hook_Awake <5>__ShopHandler_Awake;

			public static hook_Awake <6>__HatDatabase_Awake;
		}

		private static bool isWritten = false;

		private static bool isWrittenItem = false;

		public static Dictionary<string, string> commentList = new Dictionary<string, string>();

		private static string[] values = new string[50];

		public static string prevName = "";

		public static Dictionary<string, string> uiDict = new Dictionary<string, string>();

		public static Hat[]? hatList;

		private static bool isWrittenButtons2 = false;

		private static bool isWrittenButtons = false;

		internal static void Init()
		{
			//IL_0011: 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)
			//IL_001c: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			object obj = <>O.<0>__LocalizationKeys_GetLocalizedString;
			if (obj == null)
			{
				hook_GetLocalizedString val = LocalizationKeys_GetLocalizedString;
				<>O.<0>__LocalizationKeys_GetLocalizedString = val;
				obj = (object)val;
			}
			LocalizationKeys.GetLocalizedString += (hook_GetLocalizedString)obj;
			object obj2 = <>O.<1>__PlayerEmoteContentEvent_GenerateComment;
			if (obj2 == null)
			{
				hook_GenerateComment val2 = PlayerEmoteContentEvent_GenerateComment;
				<>O.<1>__PlayerEmoteContentEvent_GenerateComment = val2;
				obj2 = (object)val2;
			}
			PlayerEmoteContentEvent.GenerateComment += (hook_GenerateComment)obj2;
			object obj3 = <>O.<2>__ItemDatabase_TryGetItemFromID;
			if (obj3 == null)
			{
				hook_TryGetItemFromID val3 = ItemDatabase_TryGetItemFromID;
				<>O.<2>__ItemDatabase_TryGetItemFromID = val3;
				obj3 = (object)val3;
			}
			ItemDatabase.TryGetItemFromID += (hook_TryGetItemFromID)obj3;
			object obj4 = <>O.<3>__MainMenuMainPage_Awake;
			if (obj4 == null)
			{
				hook_Awake val4 = MainMenuMainPage_Awake;
				<>O.<3>__MainMenuMainPage_Awake = val4;
				obj4 = (object)val4;
			}
			MainMenuMainPage.Awake += (hook_Awake)obj4;
			object obj5 = <>O.<4>__MainMenuSettingsPage_Awake;
			if (obj5 == null)
			{
				hook_Awake val5 = MainMenuSettingsPage_Awake;
				<>O.<4>__MainMenuSettingsPage_Awake = val5;
				obj5 = (object)val5;
			}
			MainMenuSettingsPage.Awake += (hook_Awake)obj5;
			object obj6 = <>O.<5>__ShopHandler_Awake;
			if (obj6 == null)
			{
				hook_Awake val6 = ShopHandler_Awake;
				<>O.<5>__ShopHandler_Awake = val6;
				obj6 = (object)val6;
			}
			ShopHandler.Awake += (hook_Awake)obj6;
			object obj7 = <>O.<6>__HatDatabase_Awake;
			if (obj7 == null)
			{
				hook_Awake val7 = HatDatabase_Awake;
				<>O.<6>__HatDatabase_Awake = val7;
				obj7 = (object)val7;
			}
			HatDatabase.Awake += (hook_Awake)obj7;
			DataCollection();
			Print("//COMMENTS", "", append: false);
			foreach (KeyValuePair<string, string> comment in commentList)
			{
				Print(comment.Key, comment.Value);
			}
			PropContent[] objects = ((DatabaseAsset<PropContentDatabase, PropContent>)(object)SingletonAsset<PropContentDatabase>.Instance).Objects;
			Print("//PROP");
			PropContent[] array = objects;
			foreach (PropContent val8 in array)
			{
				Debug.Log((object)(((Object)val8).name ?? ""));
				int num = 0;
				string[] comments = val8.comments;
				foreach (string value in comments)
				{
					Print(((Object)val8).name + "." + num, value);
					num++;
				}
			}
		}

		private static void HatDatabase_Awake(orig_Awake orig, HatDatabase self)
		{
			orig.Invoke(self);
			hatList = self.hats;
			Print("//HATS");
			if (hatList == null)
			{
				return;
			}
			Hat[] array = hatList;
			foreach (Hat val in array)
			{
				string[] comments = val.comments;
				foreach (string value in comments)
				{
					Print(((Object)val).name, value, append: true, log: true);
				}
			}
		}

		private static void ShopHandler_Awake(orig_Awake orig, ShopHandler self)
		{
			Transform transform = ((Component)self).gameObject.transform;
			string text = ((TMP_Text)((Component)transform.GetChild(0).GetChild(0)).GetComponent<TextMeshPro>()).text;
			Debug.Log((object)text);
			uiDict.Add(((Object)transform).name, text);
			orig.Invoke(self);
		}

		private static void MainMenuSettingsPage_Awake(orig_Awake orig, MainMenuSettingsPage self)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			if (!isWrittenButtons2)
			{
				GrabButtonText(self.backButton);
				isWrittenButtons2 = true;
			}
			Transform parent = ((Component)self.backButton).transform.parent;
			string text = ((TMP_Text)((Component)parent.GetChild(1)).GetComponent<TextMeshProUGUI>()).text;
			uiDict.Add(((Object)((Component)parent).gameObject).name, text);
			Transform child = parent.GetChild(2).GetChild(0);
			foreach (Transform item in child)
			{
				Transform val = item;
				Debug.Log((object)("LOOKING IN " + ((Object)((Component)val).gameObject).name + "!!!!!!!!!!!"));
				string text2 = ((TMP_Text)((Component)val.GetChild(1)).GetComponent<TextMeshProUGUI>()).text;
				uiDict.Add(((Object)((Component)val).gameObject).name, text2);
			}
			orig.Invoke(self);
		}

		private static void MainMenuMainPage_Awake(orig_Awake orig, MainMenuMainPage self)
		{
			if (!isWrittenButtons)
			{
				GrabButtonText(self.hostButton);
				GrabButtonText(self.joinButton);
				GrabButtonText(self.settingsButton);
				GrabButtonText(self.creditsButton);
				GrabButtonText(self.quitButton);
				isWrittenButtons = true;
			}
			orig.Invoke(self);
		}

		public static void GrabButtonText(Button button)
		{
			TextMeshProUGUI componentInChildren = ((Component)button).gameObject.GetComponentInChildren<TextMeshProUGUI>();
			Debug.Log((object)(((Object)((Component)button).gameObject).name + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"));
			if ((Object)(object)componentInChildren != (Object)null)
			{
				Debug.Log((object)("FOUND TextMeshProUGUI IN " + ((Object)((Component)button).gameObject).name + " IT SAYS " + ((TMP_Text)componentInChildren).text + " !!!!!!!!!!"));
				Debug.Log((object)("Key: " + ((Object)((Component)button).gameObject).name));
				Debug.Log((object)("Value: " + ((TMP_Text)componentInChildren).text));
				uiDict.Add(((Object)((Component)button).gameObject).name, ((TMP_Text)componentInChildren).text);
			}
		}

		private static bool ItemDatabase_TryGetItemFromID(orig_TryGetItemFromID orig, byte id, out Item item)
		{
			if (isWrittenItem)
			{
				return orig.Invoke(id, ref item);
			}
			Item[] objects = ((DatabaseAsset<ItemDatabase, Item>)(object)SingletonAsset<ItemDatabase>.Instance).Objects;
			Print("//EMOTE");
			Item[] array = objects;
			foreach (Item val in array)
			{
				int num = 0;
				string[] comments = val.emoteInfo.comments;
				foreach (string value in comments)
				{
					Print(((Object)val).name + "." + num, value);
					num++;
				}
			}
			isWrittenItem = true;
			return orig.Invoke(id, ref item);
		}

		public static void Print(string key, string value = "", bool append = true, bool log = false)
		{
			using StreamWriter streamWriter = new StreamWriter("D:\\repos\\TranslatedWarning\\TranslatedWarning\\Dialog.txt", append);
			if (Utility.IsNullOrWhiteSpace(value))
			{
				if (log)
				{
					Debug.Log((object)key);
				}
				streamWriter.WriteLine(key);
				return;
			}
			if (log)
			{
				Debug.Log((object)("Key: " + key));
				Debug.Log((object)("Key: " + value));
			}
			streamWriter.WriteLine("-" + key + "\n+" + value + "\n");
		}

		private static Comment PlayerEmoteContentEvent_GenerateComment(orig_GenerateComment orig, PlayerEmoteContentEvent self)
		{
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Expected O, but got Unknown
			orig.Invoke(self);
			if (self.item.emoteInfo.comments != null)
			{
				int num = 1;
				string displayName = self.item.emoteInfo.displayName;
				Debug.Log((object)("emote comments found for " + displayName + " !!!!!!!!"));
				string[] comments = self.item.emoteInfo.comments;
				foreach (string value in comments)
				{
					Print(displayName, value);
					num++;
				}
			}
			else
			{
				Debug.Log((object)"emote comments does not EXIST!!!!!!!!");
			}
			List<string> list = new List<string>();
			list.AddRange(self.item.emoteInfo.comments);
			return new Comment(self.item.emoteInfo.comments[0]);
		}

		private static void DataCollection()
		{
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Expected O, but got Unknown
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Expected O, but got Unknown
			//IL_09e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e6: Expected O, but got Unknown
			Debug.Log((object)"DATA COLLECTION IS RUNNING");
			int num = 0;
			string[] nORMAL_COMMENTS = BarnacleBallContentEvent.NORMAL_COMMENTS;
			foreach (string value in nORMAL_COMMENTS)
			{
				commentList.Add("BarnacleBallContentEvent." + num, value);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS2 = BigSlapAgroContentEvent.NORMAL_COMMENTS;
			foreach (string value2 in nORMAL_COMMENTS2)
			{
				commentList.Add("BigSlapAgroContentEvent." + num, value2);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS3 = BigSlapPeacefulContentEvent.NORMAL_COMMENTS;
			foreach (string value3 in nORMAL_COMMENTS3)
			{
				commentList.Add("BigSlapPeacefulContentEvent." + num, value3);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS4 = BlackHoleBotContentEvent.NORMAL_COMMENTS;
			foreach (string value4 in nORMAL_COMMENTS4)
			{
				commentList.Add("BlackHoleBotContentEvent." + num, value4);
				num++;
			}
			num = 0;
			commentList.Add("BombContentEvent", "omg <playername> is holding the bomb!");
			string[] nORMAL_COMMENTS5 = BombsContentEvent.NORMAL_COMMENTS;
			foreach (string value5 in nORMAL_COMMENTS5)
			{
				commentList.Add("BombsContentEvent." + num, value5);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS6 = CamCreepContentEvent.NORMAL_COMMENTS;
			foreach (string value6 in nORMAL_COMMENTS6)
			{
				commentList.Add("CamCreepContentEvent." + num, value6);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS7 = DogContentEvent.NORMAL_COMMENTS;
			foreach (string value7 in nORMAL_COMMENTS7)
			{
				commentList.Add("DogContentEvent." + num, value7);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS8 = EarContentEvent.NORMAL_COMMENTS;
			foreach (string value8 in nORMAL_COMMENTS8)
			{
				commentList.Add("EarContentEvent." + num, value8);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS9 = EyeGuyContentEvent.NORMAL_COMMENTS;
			foreach (string value9 in nORMAL_COMMENTS9)
			{
				commentList.Add("EyeGuyContentEvent." + num, value9);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS10 = FireMonsterContentEvent.NORMAL_COMMENTS;
			foreach (string value10 in nORMAL_COMMENTS10)
			{
				commentList.Add("FireMonsterContentEvent." + num, value10);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS11 = FlickerContentEvent.NORMAL_COMMENTS;
			foreach (string value11 in nORMAL_COMMENTS11)
			{
				commentList.Add("FlickerContentEvent." + num, value11);
				num++;
			}
			num = 0;
			GoodCatchContentEvent val = new GoodCatchContentEvent();
			string[] gOOD_CATCH_COMMENTS = val.GOOD_CATCH_COMMENTS;
			foreach (string value12 in gOOD_CATCH_COMMENTS)
			{
				commentList.Add("GoodCatchContentEvent." + num, value12);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS12 = HarpoonerContentEvent.NORMAL_COMMENTS;
			foreach (string value13 in nORMAL_COMMENTS12)
			{
				commentList.Add("HarpoonerContentEvent." + num, value13);
				num++;
			}
			num = 0;
			InterviewEvent val2 = new InterviewEvent();
			string[] iNTERVIEW_COMMENTS = val2.INTERVIEW_COMMENTS;
			foreach (string value14 in iNTERVIEW_COMMENTS)
			{
				commentList.Add(((object)val2).GetType().ToString(), value14);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS13 = JelloContentEvent.NORMAL_COMMENTS;
			foreach (string value15 in nORMAL_COMMENTS13)
			{
				commentList.Add("JelloContentEvent." + num, value15);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS14 = KnifoContentEvent.NORMAL_COMMENTS;
			foreach (string value16 in nORMAL_COMMENTS14)
			{
				commentList.Add("KnifoContentEvent." + num, value16);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS15 = LarvaContentEvent.NORMAL_COMMENTS;
			foreach (string value17 in nORMAL_COMMENTS15)
			{
				commentList.Add("LarvaContentEvent." + num, value17);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS16 = MimeContentEvent.NORMAL_COMMENTS;
			foreach (string value18 in nORMAL_COMMENTS16)
			{
				commentList.Add("MimeContentEvent." + num, value18);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS17 = MouthContentEvent.NORMAL_COMMENTS;
			foreach (string value19 in nORMAL_COMMENTS17)
			{
				commentList.Add("MouthContentEvent." + num, value19);
				num++;
			}
			num = 0;
			commentList.Add("MultiMonsterContentEvent", "I saw a bunch of monsters in this video! It was really cool!");
			string[] nORMAL_COMMENTS18 = PlayerContentEvent.NORMAL_COMMENTS;
			foreach (string value20 in nORMAL_COMMENTS18)
			{
				commentList.Add("PlayerContentEvent." + num, value20);
				num++;
			}
			num = 0;
			string[] dEAD_COMMENTS = PlayerDeadContentEvent.DEAD_COMMENTS;
			foreach (string value21 in dEAD_COMMENTS)
			{
				commentList.Add("PlayerDeadContentEvent." + num, value21);
				num++;
			}
			num = 0;
			string[] bIG_FALL_COMMENTS = PlayerFallingContentEvent.BIG_FALL_COMMENTS;
			foreach (string value22 in bIG_FALL_COMMENTS)
			{
				commentList.Add("PlayerFallingContentEvent.BIG." + num, value22);
				num++;
			}
			num = 0;
			string[] sMALL_FALL_COMMENTS = PlayerFallingContentEvent.SMALL_FALL_COMMENTS;
			foreach (string value23 in sMALL_FALL_COMMENTS)
			{
				commentList.Add("PlayerFallingContentEvent.SMALL." + num, value23);
				num++;
			}
			num = 0;
			string[] hOLDING_MIC_COMMENTS = PlayerHoldingMicContentEvent.HOLDING_MIC_COMMENTS;
			foreach (string value24 in hOLDING_MIC_COMMENTS)
			{
				commentList.Add("PlayerHoldingMicContentEvent." + num, value24);
				num++;
			}
			num = 0;
			string[] rAGDOLL_COMMENTS = PlayerRagdollContentEvent.RAGDOLL_COMMENTS;
			foreach (string value25 in rAGDOLL_COMMENTS)
			{
				commentList.Add("PlayerRagdollContentEvent." + num, value25);
				num++;
			}
			num = 0;
			string[] tOOK_DMG_COMMENTS = PlayerTookDamageContentEvent.TOOK_DMG_COMMENTS;
			foreach (string value26 in tOOK_DMG_COMMENTS)
			{
				commentList.Add("PlayerTookDamageContentEvent." + num, value26);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS19 = PuffoContentEvent.NORMAL_COMMENTS;
			foreach (string value27 in nORMAL_COMMENTS19)
			{
				commentList.Add("PuffoContentEvent." + num, value27);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS20 = RobotButtonContentEvent.NORMAL_COMMENTS;
			foreach (string value28 in nORMAL_COMMENTS20)
			{
				commentList.Add("RobotButtonContentEvent." + num, value28);
				num++;
			}
			num = 0;
			foreach (string comment in PlayerShroomContentEvent.comments)
			{
				commentList.Add("PlayerShroomContentEvent." + num, comment);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS21 = SlurperContentEvent.NORMAL_COMMENTS;
			foreach (string value29 in nORMAL_COMMENTS21)
			{
				commentList.Add("SlurperContentEvent." + num, value29);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS22 = SnailSpawnerContentEvent.NORMAL_COMMENTS;
			foreach (string value30 in nORMAL_COMMENTS22)
			{
				commentList.Add("SnailSpawnerContentEvent." + num, value30);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS23 = SnatchoContentEvent.NORMAL_COMMENTS;
			foreach (string value31 in nORMAL_COMMENTS23)
			{
				commentList.Add("SnatchoContentEvent." + num, value31);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS24 = SpiderContentEvent.NORMAL_COMMENTS;
			foreach (string value32 in nORMAL_COMMENTS24)
			{
				commentList.Add("SpiderContentEvent." + num, value32);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS25 = StreamerContentEvent.NORMAL_COMMENTS;
			foreach (string value33 in nORMAL_COMMENTS25)
			{
				commentList.Add("StreamerContentEvent." + num, value33);
				num++;
			}
			num = 0;
			TauntEvent val3 = new TauntEvent();
			string[] iNTERVIEW_COMMENTS2 = val3.INTERVIEW_COMMENTS;
			foreach (string value34 in iNTERVIEW_COMMENTS2)
			{
				commentList.Add("TauntEvent" + num, value34);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS26 = ToolkitWhiskContentEvent.NORMAL_COMMENTS;
			foreach (string value35 in nORMAL_COMMENTS26)
			{
				commentList.Add("ToolkitWhiskContentEvent." + num, value35);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS27 = WalloContentEvent.NORMAL_COMMENTS;
			foreach (string value36 in nORMAL_COMMENTS27)
			{
				commentList.Add("WalloContentEvent." + num, value36);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS28 = WeepingContentEvent.NORMAL_COMMENTS;
			foreach (string value37 in nORMAL_COMMENTS28)
			{
				commentList.Add("WeepingContentEvent." + num, value37);
				num++;
			}
			num = 0;
			string[] cAPTURED_COMMENTS = WeepingContentEventCaptured.CAPTURED_COMMENTS;
			foreach (string value38 in cAPTURED_COMMENTS)
			{
				commentList.Add("WeepingContentEventCaptured." + num, value38);
				num++;
			}
			num = 0;
			string[] fAIL_COMMENTS = WeepingContentEventFail.FAIL_COMMENTS;
			foreach (string value39 in fAIL_COMMENTS)
			{
				commentList.Add("WeepingContentEventFail." + num, value39);
				num++;
			}
			num = 0;
			string[] sUCCESS_COMMENTS = WeepingContentEventSuccess.SUCCESS_COMMENTS;
			foreach (string value40 in sUCCESS_COMMENTS)
			{
				commentList.Add("WeepingContentEventSuccess." + num, value40);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS29 = WormContentEvent.NORMAL_COMMENTS;
			foreach (string value41 in nORMAL_COMMENTS29)
			{
				commentList.Add("WormContentEvent." + num, value41);
				num++;
			}
			num = 0;
			string[] nORMAL_COMMENTS30 = ZombieContentEvent.NORMAL_COMMENTS;
			foreach (string value42 in nORMAL_COMMENTS30)
			{
				commentList.Add("ZombieContentEvent." + num, value42);
				num++;
			}
		}

		private static string LocalizationKeys_GetLocalizedString(orig_GetLocalizedString orig, Keys key)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(key);
			if (!isWritten)
			{
				using (StreamWriter streamWriter = new StreamWriter("D:\\repos\\TranslatedWarning\\TranslatedWarning\\Dialog.txt", append: true))
				{
					Debug.Log((object)"//MAIN");
					streamWriter.WriteLine("//MAIN\n");
				}
				foreach (KeyValuePair<Keys, string> item in LocalizationKeys.m_StringDictionary)
				{
					using StreamWriter streamWriter2 = new StreamWriter("D:\\repos\\TranslatedWarning\\TranslatedWarning\\Dialog.txt", append: true);
					streamWriter2.WriteLine($"-{item.Key}\n+{item.Value}\n");
				}
				isWritten = true;
			}
			return LocalizationKeys.m_StringDictionary[key];
		}
	}
	public class InjectTranslation
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_GetLocalizedString <0>__LocalizationKeys_GetLocalizedString;

			public static hook_OnTransistionedToPage <1>__MainMenuUIHandler_OnTransistionedToPage;

			public static hook_GenerateComments <2>__ContentBuffer_GenerateComments;

			public static hook_Awake <3>__PlayerCustomizer_Awake;

			public static hook_LocalizeMe <4>__ThePlanLocalizer_LocalizeMe;

			public static hook_Start <5>__VideoCamera_Start;

			public static hook_InitShopHandler <6>__ShopHandler_InitShopHandler;

			public static hook_Start <7>__DivingBell_Start;

			public static hook_Awake <8>__ExtractVideoMachine_Awake;

			public static hook_Awake <9>__UploadVideoStation_Awake;

			public static hook_Awake <10>__EscapeMenuMainPage_Awake;

			public static hook_Awake <11>__EscapeMenuSettingsPage_Awake;

			public static hook_Setup <12>__EscapePlayerCellUI_Setup;

			public static hook_KickClicked <13>__EscapePlayerCellUI_KickClicked;

			public static hook_OnKickNotifactionReceived <14>__GameHandler_OnKickNotifactionReceived;

			public static hook_Start <15>__IntroScreenAnimator_Start;

			public static hook_GenerateComment <16>__PlayerWearingHatContentEvent_GenerateComment;

			public static hook_GenerateComment <17>__PlayerEmoteContentEvent_GenerateComment;

			public static hook_GenerateComment <18>__PlayerDeadContentEvent_GenerateComment;

			public static hook_GenerateComment <19>__PlayerFallingContentEvent_GenerateComment;

			public static hook_GenerateComment <20>__PlayerHoldingMicContentEvent_GenerateComment;

			public static hook_GenerateComment <21>__PlayerRagdollContentEvent_GenerateComment;

			public static hook_GenerateComment <22>__PlayerTookDamageContentEvent_GenerateComment;

			public static hook_GenerateComment <23>__GoodCatchContentEvent_GenerateComment;

			public static hook_GenerateComment <24>__PlayerContentEvent_GenerateComment;
		}

		public static string assemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

		private static string path = assemblyPath + "\\DialogTranslated.txt";

		public static Dictionary<string, string> translatedDict = new Dictionary<string, string>();

		private static int keyAssign;

		public static List<Type> excludedEvents = new List<Type>(9)
		{
			typeof(PlayerWearingHatContentEvent),
			typeof(PlayerEmoteContentEvent),
			typeof(PlayerDeadContentEvent),
			typeof(PlayerFallingContentEvent),
			typeof(PlayerHoldingMicContentEvent),
			typeof(PlayerRagdollContentEvent),
			typeof(PlayerTookDamageContentEvent),
			typeof(GoodCatchContentEvent),
			typeof(PlayerContentEvent)
		};

		private static bool m_MadeLocaleStrings = false;

		internal static void Init()
		{
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Expected O, but got Unknown
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Expected O, but got Unknown
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Expected O, but got Unknown
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Expected O, but got Unknown
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Expected O, but got Unknown
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Expected O, but got Unknown
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Expected O, but got Unknown
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Expected O, but got Unknown
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Expected O, but got Unknown
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Expected O, but got Unknown
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Expected O, but got Unknown
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Expected O, but got Unknown
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Expected O, but got Unknown
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Expected O, but got Unknown
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Expected O, but got Unknown
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Expected O, but got Unknown
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Expected O, but got Unknown
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Expected O, but got Unknown
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Expected O, but got Unknown
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Expected O, but got Unknown
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0374: Expected O, but got Unknown
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Expected O, but got Unknown
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b6: Expected O, but got Unknown
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d7: Expected O, but got Unknown
			Debug.Log((object)("ASSEMBLY IS IN " + assemblyPath));
			string[] array = File.ReadAllLines(path);
			Debug.Log((object)"====== DICTIONARY BEGIN ======");
			for (int i = 0; i < array.Length; i++)
			{
				string text = array[i];
				if (text.StartsWith("-"))
				{
					keyAssign = i;
				}
				if (text.StartsWith("+"))
				{
					translatedDict.Add(array[keyAssign].Substring(1).Trim(), text.Substring(1).Trim());
				}
			}
			Debug.Log((object)"====== DICTIONARY END ======");
			object obj = <>O.<0>__LocalizationKeys_GetLocalizedString;
			if (obj == null)
			{
				hook_GetLocalizedString val = LocalizationKeys_GetLocalizedString;
				<>O.<0>__LocalizationKeys_GetLocalizedString = val;
				obj = (object)val;
			}
			LocalizationKeys.GetLocalizedString += (hook_GetLocalizedString)obj;
			object obj2 = <>O.<1>__MainMenuUIHandler_OnTransistionedToPage;
			if (obj2 == null)
			{
				hook_OnTransistionedToPage val2 = MainMenuUIHandler_OnTransistionedToPage;
				<>O.<1>__MainMenuUIHandler_OnTransistionedToPage = val2;
				obj2 = (object)val2;
			}
			MainMenuUIHandler.OnTransistionedToPage += (hook_OnTransistionedToPage)obj2;
			object obj3 = <>O.<2>__ContentBuffer_GenerateComments;
			if (obj3 == null)
			{
				hook_GenerateComments val3 = ContentBuffer_GenerateComments;
				<>O.<2>__ContentBuffer_GenerateComments = val3;
				obj3 = (object)val3;
			}
			ContentBuffer.GenerateComments += (hook_GenerateComments)obj3;
			object obj4 = <>O.<3>__PlayerCustomizer_Awake;
			if (obj4 == null)
			{
				hook_Awake val4 = PlayerCustomizer_Awake;
				<>O.<3>__PlayerCustomizer_Awake = val4;
				obj4 = (object)val4;
			}
			PlayerCustomizer.Awake += (hook_Awake)obj4;
			object obj5 = <>O.<4>__ThePlanLocalizer_LocalizeMe;
			if (obj5 == null)
			{
				hook_LocalizeMe val5 = ThePlanLocalizer_LocalizeMe;
				<>O.<4>__ThePlanLocalizer_LocalizeMe = val5;
				obj5 = (object)val5;
			}
			ThePlanLocalizer.LocalizeMe += (hook_LocalizeMe)obj5;
			object obj6 = <>O.<5>__VideoCamera_Start;
			if (obj6 == null)
			{
				hook_Start val6 = VideoCamera_Start;
				<>O.<5>__VideoCamera_Start = val6;
				obj6 = (object)val6;
			}
			VideoCamera.Start += (hook_Start)obj6;
			object obj7 = <>O.<6>__ShopHandler_InitShopHandler;
			if (obj7 == null)
			{
				hook_InitShopHandler val7 = ShopHandler_InitShopHandler;
				<>O.<6>__ShopHandler_InitShopHandler = val7;
				obj7 = (object)val7;
			}
			ShopHandler.InitShopHandler += (hook_InitShopHandler)obj7;
			object obj8 = <>O.<7>__DivingBell_Start;
			if (obj8 == null)
			{
				hook_Start val8 = DivingBell_Start;
				<>O.<7>__DivingBell_Start = val8;
				obj8 = (object)val8;
			}
			DivingBell.Start += (hook_Start)obj8;
			object obj9 = <>O.<8>__ExtractVideoMachine_Awake;
			if (obj9 == null)
			{
				hook_Awake val9 = ExtractVideoMachine_Awake;
				<>O.<8>__ExtractVideoMachine_Awake = val9;
				obj9 = (object)val9;
			}
			ExtractVideoMachine.Awake += (hook_Awake)obj9;
			object obj10 = <>O.<9>__UploadVideoStation_Awake;
			if (obj10 == null)
			{
				hook_Awake val10 = UploadVideoStation_Awake;
				<>O.<9>__UploadVideoStation_Awake = val10;
				obj10 = (object)val10;
			}
			UploadVideoStation.Awake += (hook_Awake)obj10;
			object obj11 = <>O.<10>__EscapeMenuMainPage_Awake;
			if (obj11 == null)
			{
				hook_Awake val11 = EscapeMenuMainPage_Awake;
				<>O.<10>__EscapeMenuMainPage_Awake = val11;
				obj11 = (object)val11;
			}
			EscapeMenuMainPage.Awake += (hook_Awake)obj11;
			object obj12 = <>O.<11>__EscapeMenuSettingsPage_Awake;
			if (obj12 == null)
			{
				hook_Awake val12 = EscapeMenuSettingsPage_Awake;
				<>O.<11>__EscapeMenuSettingsPage_Awake = val12;
				obj12 = (object)val12;
			}
			EscapeMenuSettingsPage.Awake += (hook_Awake)obj12;
			object obj13 = <>O.<12>__EscapePlayerCellUI_Setup;
			if (obj13 == null)
			{
				hook_Setup val13 = EscapePlayerCellUI_Setup;
				<>O.<12>__EscapePlayerCellUI_Setup = val13;
				obj13 = (object)val13;
			}
			EscapePlayerCellUI.Setup += (hook_Setup)obj13;
			object obj14 = <>O.<13>__EscapePlayerCellUI_KickClicked;
			if (obj14 == null)
			{
				hook_KickClicked val14 = EscapePlayerCellUI_KickClicked;
				<>O.<13>__EscapePlayerCellUI_KickClicked = val14;
				obj14 = (object)val14;
			}
			EscapePlayerCellUI.KickClicked += (hook_KickClicked)obj14;
			object obj15 = <>O.<14>__GameHandler_OnKickNotifactionReceived;
			if (obj15 == null)
			{
				hook_OnKickNotifactionReceived val15 = GameHandler_OnKickNotifactionReceived;
				<>O.<14>__GameHandler_OnKickNotifactionReceived = val15;
				obj15 = (object)val15;
			}
			GameHandler.OnKickNotifactionReceived += (hook_OnKickNotifactionReceived)obj15;
			object obj16 = <>O.<15>__IntroScreenAnimator_Start;
			if (obj16 == null)
			{
				hook_Start val16 = IntroScreenAnimator_Start;
				<>O.<15>__IntroScreenAnimator_Start = val16;
				obj16 = (object)val16;
			}
			IntroScreenAnimator.Start += (hook_Start)obj16;
			object obj17 = <>O.<16>__PlayerWearingHatContentEvent_GenerateComment;
			if (obj17 == null)
			{
				hook_GenerateComment val17 = PlayerWearingHatContentEvent_GenerateComment;
				<>O.<16>__PlayerWearingHatContentEvent_GenerateComment = val17;
				obj17 = (object)val17;
			}
			PlayerWearingHatContentEvent.GenerateComment += (hook_GenerateComment)obj17;
			object obj18 = <>O.<17>__PlayerEmoteContentEvent_GenerateComment;
			if (obj18 == null)
			{
				hook_GenerateComment val18 = PlayerEmoteContentEvent_GenerateComment;
				<>O.<17>__PlayerEmoteContentEvent_GenerateComment = val18;
				obj18 = (object)val18;
			}
			PlayerEmoteContentEvent.GenerateComment += (hook_GenerateComment)obj18;
			object obj19 = <>O.<18>__PlayerDeadContentEvent_GenerateComment;
			if (obj19 == null)
			{
				hook_GenerateComment val19 = PlayerDeadContentEvent_GenerateComment;
				<>O.<18>__PlayerDeadContentEvent_GenerateComment = val19;
				obj19 = (object)val19;
			}
			PlayerDeadContentEvent.GenerateComment += (hook_GenerateComment)obj19;
			object obj20 = <>O.<19>__PlayerFallingContentEvent_GenerateComment;
			if (obj20 == null)
			{
				hook_GenerateComment val20 = PlayerFallingContentEvent_GenerateComment;
				<>O.<19>__PlayerFallingContentEvent_GenerateComment = val20;
				obj20 = (object)val20;
			}
			PlayerFallingContentEvent.GenerateComment += (hook_GenerateComment)obj20;
			object obj21 = <>O.<20>__PlayerHoldingMicContentEvent_GenerateComment;
			if (obj21 == null)
			{
				hook_GenerateComment val21 = PlayerHoldingMicContentEvent_GenerateComment;
				<>O.<20>__PlayerHoldingMicContentEvent_GenerateComment = val21;
				obj21 = (object)val21;
			}
			PlayerHoldingMicContentEvent.GenerateComment += (hook_GenerateComment)obj21;
			object obj22 = <>O.<21>__PlayerRagdollContentEvent_GenerateComment;
			if (obj22 == null)
			{
				hook_GenerateComment val22 = PlayerRagdollContentEvent_GenerateComment;
				<>O.<21>__PlayerRagdollContentEvent_GenerateComment = val22;
				obj22 = (object)val22;
			}
			PlayerRagdollContentEvent.GenerateComment += (hook_GenerateComment)obj22;
			object obj23 = <>O.<22>__PlayerTookDamageContentEvent_GenerateComment;
			if (obj23 == null)
			{
				hook_GenerateComment val23 = PlayerTookDamageContentEvent_GenerateComment;
				<>O.<22>__PlayerTookDamageContentEvent_GenerateComment = val23;
				obj23 = (object)val23;
			}
			PlayerTookDamageContentEvent.GenerateComment += (hook_GenerateComment)obj23;
			object obj24 = <>O.<23>__GoodCatchContentEvent_GenerateComment;
			if (obj24 == null)
			{
				hook_GenerateComment val24 = GoodCatchContentEvent_GenerateComment;
				<>O.<23>__GoodCatchContentEvent_GenerateComment = val24;
				obj24 = (object)val24;
			}
			GoodCatchContentEvent.GenerateComment += (hook_GenerateComment)obj24;
			object obj25 = <>O.<24>__PlayerContentEvent_GenerateComment;
			if (obj25 == null)
			{
				hook_GenerateComment val25 = PlayerContentEvent_GenerateComment;
				<>O.<24>__PlayerContentEvent_GenerateComment = val25;
				obj25 = (object)val25;
			}
			PlayerContentEvent.GenerateComment += (hook_GenerateComment)obj25;
		}

		private static void IntroScreenAnimator_Start(orig_Start orig, IntroScreenAnimator self)
		{
			orig.Invoke(self);
			Image component = ((Component)((Component)self).gameObject.transform.GetChild(1)).GetComponent<Image>();
			component.sprite = TranslatedWarning.titleTranslated;
			TranslateText(((Component)self).gameObject.transform.GetChild(3).GetChild(0), "MadeBy");
			TranslateText(((Component)self).gameObject.transform.GetChild(3).GetChild(1), "People");
		}

		private static void GameHandler_OnKickNotifactionReceived(orig_OnKickNotifactionReceived orig, GameHandler self, KickPlayerNotificationPackage obj)
		{
			Modal.ShowError(translatedDict["Kicked"], translatedDict["KickBody"]);
			RetrievableSingleton<ConnectionStateHandler>.Instance.Disconnect();
			SceneManager.LoadScene("NewMainMenu");
		}

		private static void EscapePlayerCellUI_KickClicked(orig_KickClicked orig, EscapePlayerCellUI self)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			Modal.Show(translatedDict["Kick"] + " " + self.m_player.NickName, translatedDict["AreYouSure"], (ModalOption[])(object)new ModalOption[2]
			{
				new ModalOption(translatedDict["YES"], (Action)self.KickPlayer),
				new ModalOption(translatedDict["CANCEL"], (Action)null)
			}, (Action)null);
		}

		private static void EscapePlayerCellUI_Setup(orig_Setup orig, EscapePlayerCellUI self, Player player)
		{
			orig.Invoke(self, player);
			TranslateText(((Component)self.kickButton).gameObject.transform);
			TranslateText(((Component)self).gameObject.transform.GetChild(3), "VOL");
		}

		private static void EscapeMenuSettingsPage_Awake(orig_Awake orig, EscapeMenuSettingsPage self)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			orig.Invoke(self);
			Transform child = ((Component)self).transform.GetChild(0);
			TranslateText(child.GetChild(0));
			TranslateText(child.GetChild(1), ((Object)((Component)child).gameObject).name);
			Transform child2 = child.GetChild(2).GetChild(0);
			foreach (Transform item in child2)
			{
				Transform textObject = item;
				TranslateText(textObject);
			}
		}

		private static void EscapeMenuMainPage_Awake(orig_Awake orig, EscapeMenuMainPage self)
		{
			orig.Invoke(self);
			TranslateText(((Component)self).gameObject.transform.GetChild(0), "CONTENTWARNING");
			TranslateText(((Component)self.settingsButton).gameObject.transform);
			TranslateText(((Component)self.exitButton).gameObject.transform);
			TranslateText(((Component)self.resumeButton).gameObject.transform);
			TranslateText(((Component)self.inviteButton).gameObject.transform);
		}

		private static void UploadVideoStation_Awake(orig_Awake orig, UploadVideoStation self)
		{
			orig.Invoke(self);
			Transform val = ((Component)self).gameObject.transform.Find("McScreen");
			if ((Object)(object)val != (Object)null)
			{
				TranslateText(val.GetChild(0).GetChild(0).GetChild(0)
					.GetChild(0)
					.GetChild(0));
				TranslateText(val.GetChild(0).GetChild(0).GetChild(0)
					.GetChild(1));
				Transform child = val.GetChild(1);
				TranslateText(child.GetChild(0).GetChild(0).GetChild(0), "UploadVideo");
				TranslateText(child.GetChild(0).GetChild(0).GetChild(2), "InsertDisc");
				TranslateText(child.GetChild(1));
				TranslateText(child.GetChild(2));
				TranslateText(child.GetChild(3).GetChild(1), "ShowVideoState");
				TranslateText(child.GetChild(3).GetChild(0).GetChild(2)
					.GetChild(1), "SaveVideo.text");
				TranslateText(child.GetChild(3).GetChild(0).GetChild(2)
					.GetChild(2));
				TranslateText(child.GetChild(3).GetChild(0).GetChild(2)
					.GetChild(3));
			}
		}

		private static void ExtractVideoMachine_Awake(orig_Awake orig, ExtractVideoMachine self)
		{
			orig.Invoke(self);
			Transform child = ((Component)self).gameObject.transform.GetChild(2);
			for (int i = 1; i < 4; i++)
			{
				TranslateText(child.GetChild(i));
			}
		}

		private static void DivingBell_Start(orig_Start orig, DivingBell self)
		{
			orig.Invoke(self);
			Transform child = ((Component)self).gameObject.transform.GetChild(2).GetChild(2).GetChild(0)
				.GetChild(1);
			for (int i = 0; i < 3; i++)
			{
				TranslateText(child.GetChild(i));
			}
		}

		private static void ShopHandler_InitShopHandler(orig_InitShopHandler orig, ShopHandler self)
		{
			orig.Invoke(self);
			TranslateText(((Component)self).gameObject.transform, "", ugui: false);
			TranslateText(((Component)self).gameObject.transform.GetChild(1).GetChild(8).GetChild(2), "Order");
			TranslateText(((Component)self).gameObject.transform.GetChild(1).GetChild(8).GetChild(3), "Clear");
		}

		private static void VideoCamera_Start(orig_Start orig, VideoCamera self)
		{
			orig.Invoke(self);
			TranslateText(self.m_recordingUI.gameObject.transform);
		}

		private static void ThePlanLocalizer_LocalizeMe(orig_LocalizeMe orig, ThePlanLocalizer self)
		{
			if ((Object)(object)TranslatedWarning.translatedPlan != (Object)null)
			{
				((Renderer)self.m_PlanRenderer).material.SetTexture("_Variation", (Texture)(object)TranslatedWarning.translatedPlan);
			}
		}

		private static void PlayerCustomizer_Awake(orig_Awake orig, PlayerCustomizer self)
		{
			orig.Invoke(self);
			TranslateText(((Component)self.applyButton).gameObject.transform.GetParent());
			TranslateText(((Component)self.quitButton).gameObject.transform.GetParent());
			TranslateText(((Component)self.clearHatButton).gameObject.transform);
			TranslateText(((Component)self.hatNameText).gameObject.transform);
			Transform child = ((Component)self).gameObject.transform.GetChild(0).GetChild(0);
			TranslateText(child.GetChild(9), "PlayerCustomizerMachine");
			TranslateText(child.GetChild(2));
		}

		private static Comment PlayerContentEvent_GenerateComment(orig_GenerateComment orig, PlayerContentEvent self)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			string text = FindTranslation(((object)self).GetType().ToString());
			return new Comment(((PlayerBaseEvent)self).FixPlayerName(text));
		}

		private static Comment GoodCatchContentEvent_GenerateComment(orig_GenerateComment orig, GoodCatchContentEvent self)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			string text = FindTranslation(((object)self).GetType().ToString());
			return new Comment(((PlayerBaseEvent)self).FixPlayerName(text));
		}

		private static Comment PlayerTookDamageContentEvent_GenerateComment(orig_GenerateComment orig, PlayerTookDamageContentEvent self)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			string text = FindTranslation(((object)self).GetType().ToString());
			return new Comment(((PlayerBaseEvent)self).FixPlayerName(text));
		}

		private static Comment PlayerRagdollContentEvent_GenerateComment(orig_GenerateComment orig, PlayerRagdollContentEvent self)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			string text = FindTranslation(((object)self).GetType().ToString());
			return new Comment(((PlayerBaseEvent)self).FixPlayerName(text));
		}

		private static Comment PlayerHoldingMicContentEvent_GenerateComment(orig_GenerateComment orig, PlayerHoldingMicContentEvent self)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			string text = FindTranslation(((object)self).GetType().ToString());
			return new Comment(((PlayerBaseEvent)self).FixPlayerName(text));
		}

		private static Comment PlayerFallingContentEvent_GenerateComment(orig_GenerateComment orig, PlayerFallingContentEvent self)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			string pattern = (self.IsBigFall ? (((object)self).GetType().ToString() + ".BIG") : (((object)self).GetType().ToString() + ".SMALL"));
			string text = FindTranslation(pattern);
			return new Comment(((PlayerBaseEvent)self).FixPlayerName(text));
		}

		private static Comment PlayerDeadContentEvent_GenerateComment(orig_GenerateComment orig, PlayerDeadContentEvent self)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			string text = FindTranslation(((object)self).GetType().ToString());
			return new Comment(((PlayerBaseEvent)self).FixPlayerName(text));
		}

		private static Comment PlayerEmoteContentEvent_GenerateComment(orig_GenerateComment orig, PlayerEmoteContentEvent self)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			string text = FindTranslation(((Object)self.item).name);
			return new Comment(((PlayerBaseEvent)self).FixPlayerName(text));
		}

		private static Comment PlayerWearingHatContentEvent_GenerateComment(orig_GenerateComment orig, PlayerWearingHatContentEvent self)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			string text = FindTranslation(((Object)self.hatInDatabase).name);
			return new Comment(((PlayerBaseEvent)self).FixPlayerName(text));
		}

		private static List<Comment> ContentBuffer_GenerateComments(orig_GenerateComments orig, ContentBuffer self)
		{
			try
			{
				List<Comment> list = new List<Comment>();
				foreach (BufferedContent item in self.buffer)
				{
					ContentEvent contentEvent = item.frame.contentEvent;
					Comment val = contentEvent.GenerateComment();
					if (!excludedEvents.Contains(((object)contentEvent).GetType()))
					{
						val.Text = TranslateComment(contentEvent);
					}
					val.Likes = BigNumbers.GetScoreToViews((float)Mathf.RoundToInt(item.score), GameAPI.CurrentDay);
					val.Time = item.frame.time;
					val.Face = FaceDatabase.GetRandomFaceIndex();
					val.FaceColor = FaceDatabase.GetRandomColorIndex();
					list.Add(val);
				}
				list.Sort((Comment c1, Comment c2) => c1.Time.CompareTo(c2.Time));
				return list;
			}
			catch (Exception)
			{
				return orig.Invoke(self);
			}
		}

		public static string TranslateComment(ContentEvent content)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			string pattern;
			if (((object)content).GetType() == typeof(PropContentEvent))
			{
				PropContentEvent val = (PropContentEvent)content;
				pattern = ((Object)val.content).name;
			}
			else if (((object)content).GetType() == typeof(ArtifactContentEvent))
			{
				ArtifactContentEvent val2 = (ArtifactContentEvent)content;
				pattern = ((Object)((PropContentEvent)val2).content).name;
			}
			else
			{
				pattern = ((object)content).GetType().ToString();
			}
			return FindTranslation(pattern);
		}

		public static string FindTranslation(string pattern)
		{
			string pattern2 = pattern;
			string[] array = (from kvp in translatedDict
				where kvp.Key.Contains(pattern2)
				select kvp.Value).ToArray();
			Random random = new Random();
			int num = random.Next(0, array.Length);
			string text = array[num];
			return array[num];
		}

		private static void MainMenuUIHandler_OnTransistionedToPage(orig_OnTransistionedToPage orig, MainMenuUIHandler self, UIPage newPage)
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Expected O, but got Unknown
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Expected O, but got Unknown
			orig.Invoke(self, newPage);
			string text = ((object)newPage).GetType().ToString();
			switch (text)
			{
			case "MainMenuMainPage":
			{
				if (TranslatedWarning.seenList.Contains(text))
				{
					break;
				}
				Transform child3 = ((Component)newPage).gameObject.transform.GetChild(3);
				foreach (Transform item in child3)
				{
					Transform textObject2 = item;
					TranslateText(textObject2);
				}
				TranslatedWarning.seenList.Add(text);
				Transform child4 = ((Component)newPage).gameObject.transform.GetChild(2);
				Image component = ((Component)child4).GetComponent<Image>();
				component.sprite = TranslatedWarning.titleTranslated;
				break;
			}
			case "MainMenuSettingsPage":
			{
				if (TranslatedWarning.seenList.Contains(text))
				{
					break;
				}
				Debug.Log((object)"CASE SETTINGS!!!!!!!!");
				Transform child = ((Component)newPage).transform.GetChild(2);
				TranslateText(child.GetChild(0));
				TranslateText(child.GetChild(1), ((Object)((Component)child).gameObject).name);
				Transform child2 = child.GetChild(2).GetChild(0);
				foreach (Transform item2 in child2)
				{
					Transform textObject = item2;
					TranslateText(textObject);
				}
				TranslatedWarning.seenList.Add(text);
				break;
			}
			case "MainMenuHostPage":
			{
				if (TranslatedWarning.seenList.Contains(text))
				{
					break;
				}
				Transform transform = ((Component)newPage).gameObject.transform;
				TranslateText(transform.GetChild(2), "CW.HostPage");
				TranslateText(transform.GetChild(3), "CW (1).HostPage");
				foreach (Transform item3 in transform.GetChild(4))
				{
					Transform val = item3;
					TranslateText(val.GetChild(3), ((Object)((Component)val).gameObject).name);
					TranslateText(val.GetChild(4).GetChild(0), "SaveCell." + ((Object)((Component)val.GetChild(4)).gameObject).name);
				}
				TranslateText(transform.GetChild(5));
				TranslateText(transform.GetChild(6), "HostButton");
				break;
			}
			}
		}

		private static string LocalizationKeys_GetLocalizedString(orig_GetLocalizedString orig, Keys key)
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			if (!m_MadeLocaleStrings)
			{
				LocalizationKeys.MakeLocaleStrings();
				m_MadeLocaleStrings = true;
			}
			if (translatedDict == null || !translatedDict.ContainsKey(((object)(Keys)(ref key)).ToString()))
			{
				Debug.LogError((object)("Cant find TRANSLATED key for: " + ((object)(Keys)(ref key)).ToString()));
				return orig.Invoke(key);
			}
			return translatedDict[((object)(Keys)(ref key)).ToString()];
		}

		public static void TranslateText(Transform textObject, string key = "", bool ugui = true)
		{
			TMP_Text val = null;
			val = (TMP_Text)((!ugui) ? ((object)((Component)textObject).gameObject.GetComponentInChildren<TextMeshPro>()) : ((object)((Component)textObject).gameObject.GetComponentInChildren<TextMeshProUGUI>()));
			if (!((Object)(object)val != (Object)null))
			{
				return;
			}
			try
			{
				if (Utility.IsNullOrWhiteSpace(key))
				{
					key = ((Object)((Component)textObject).gameObject).name;
				}
				val.text = translatedDict[key];
				Component[] components = ((Component)val).gameObject.GetComponents<Component>();
				Component[] array = components;
				foreach (Component val2 in array)
				{
					if (((object)val2).GetType() == typeof(LocalizeStringEvent) || ((object)val2).GetType() == typeof(GameObjectLocalizer))
					{
						TranslatedWarning.Delete(val2);
					}
				}
			}
			catch (Exception ex)
			{
				if (ex is KeyNotFoundException)
				{
					Debug.LogError((object)("TRANSLATION KEY " + key + " NOT FOUND!!!!!"));
					return;
				}
				Debug.LogError((object)"EPIC FAILL!!!!!!!!!!!!!!!");
				Debug.LogError((object)ex.ToString());
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}