Decompiled source of StickFight RuText v1.1.1

StickFightRusText.dll

Decompiled 4 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Steamworks;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("StickFightRusText")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("StickFightRusText")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("69448c5f-1545-41a3-8fb3-a4ff8c76da22")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace StickFightRusText;

[HarmonyPatch]
public class Patches
{
	[HarmonyPatch(typeof(ChatManager), "Start")]
	[HarmonyPostfix]
	private static void ChatAwakePatch(ChatManager __instance)
	{
		if (((Behaviour)__instance).enabled && ((Component)__instance).GetComponentInParent<NetworkPlayer>().HasLocalControl)
		{
			Plugin.GlobalInjectHandlerQ();
		}
	}

	[HarmonyPatch(typeof(MatchmakingHandler), "Disconnect")]
	[HarmonyPostfix]
	private static void ResetTags(MatchmakingHandler __instance, bool showScreen = true)
	{
		Plugin.taggedRussian = 0;
		Plugin.haveTheMod = 0;
	}

	[HarmonyPatch(typeof(ChatManager), "SendChatMessage")]
	[HarmonyPrefix]
	private static bool Commands(ChatManager __instance, string message)
	{
		if (((Component)__instance).GetComponentInParent<NetworkPlayer>().HasLocalControl)
		{
			if (message == "#rutext_toggletrans")
			{
				Plugin.translateBrokenRussian = !Plugin.translateBrokenRussian;
				__instance.Talk($"Переключен перевод Translit. (Теперь {Plugin.translateBrokenRussian})");
				return false;
			}
			if (message == "#rutext_toggleprefix")
			{
				if (Plugin.prefix.Length < 5)
				{
					Plugin.prefix = "[RuText Mod] ";
				}
				else
				{
					Plugin.prefix = "[R: ";
				}
				__instance.Talk($"Переключен полный префикс. (Теперь {Plugin.prefix.Length > 5})");
				return false;
			}
			if (message.StartsWith("#") && message.EndsWith("rus"))
			{
				char c = message[1];
				byte b = Plugin.colorPowerOfTwo[c.ToString()];
				Plugin.taggedRussian ^= b;
				__instance.Talk(c switch
				{
					'r' => "Красный", 
					'b' => "Синий", 
					'y' => "Жёлтый", 
					_ => "Зелёный", 
				} + " теперь помечен как " + (((Plugin.taggedRussian & b) == b) ? "" : "не ") + "русский!");
				return false;
			}
			if (message.StartsWith("#") && message.EndsWith("rutxt"))
			{
				char c2 = message[1];
				byte b2 = Plugin.colorPowerOfTwo[c2.ToString()];
				Plugin.haveTheMod ^= b2;
				__instance.Talk(c2 switch
				{
					'r' => "Красный", 
					'b' => "Синий", 
					'y' => "Жёлтый", 
					_ => "Зелёный", 
				} + " теперь считается " + (((Plugin.haveTheMod & b2) == b2) ? "с" : "без") + " RuText Mod!");
				return false;
			}
			if (message == "#rutext_resettags")
			{
				Plugin.taggedRussian = 0;
				Plugin.haveTheMod = 0;
				__instance.Talk("Сброшены пометки русских.");
				return false;
			}
		}
		return true;
	}

	[HarmonyPatch(typeof(ChatManager), "Talk")]
	[HarmonyPrefix]
	private static bool TranslateTranslit(ChatManager __instance, string t)
	{
		if (Plugin.dontProcessNextTalk)
		{
			Plugin.dontProcessNextTalk = false;
			return true;
		}
		NetworkPlayer componentInParent = ((Component)__instance).GetComponentInParent<NetworkPlayer>();
		byte b = Plugin.colorPowerOfTwo.Values.ToArray()[componentInParent.NetworkSpawnID];
		Plugin.InjectHandler(__instance);
		if (!componentInParent.HasLocalControl && Plugin.translateBrokenRussian && (Plugin.taggedRussian & b) == b)
		{
			bool flag = false;
			char[] array = t.ToCharArray();
			foreach (char c in array)
			{
				int num = c;
				if (num == 168 || num == 184 || num > 191)
				{
					flag = true;
					break;
				}
			}
			if (!flag)
			{
				Plugin.dontProcessNextTalk = true;
				__instance.Talk(Plugin.TranslateBrokenRussianSentence(t));
				return false;
			}
		}
		return true;
	}

	[HarmonyPatch(typeof(P2PPackageHandler), "SendP2PPacketToUser", new Type[]
	{
		typeof(CSteamID),
		typeof(byte[]),
		typeof(MsgType),
		typeof(EP2PSend),
		typeof(int)
	})]
	[HarmonyPrefix]
	private static bool NotifyRuTextMod(P2PPackageHandler __instance, CSteamID clientID, byte[] data, MsgType messageType, EP2PSend sendMethod = (EP2PSend)2, int channel = 0)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Invalid comparison between Unknown and I4
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: Unknown result type (might be due to invalid IL or missing references)
		if ((int)messageType == 12 && data.Length > 1 && data[0] != 91 && data[1] != 82)
		{
			int num = -1;
			for (int i = 0; i < GameManager.Instance.mMultiplayerManager.ConnectedClients.Length; i++)
			{
				ConnectedClientData val = GameManager.Instance.mMultiplayerManager.ConnectedClients[i];
				if (val != null && val.ClientID == clientID)
				{
					num = i;
					break;
				}
			}
			if (num == -1 || num == GameManager.Instance.mMultiplayerManager.LocalPlayerIndex)
			{
				return true;
			}
			byte b = Plugin.colorPowerOfTwo.Values.ToArray()[num];
			if ((Plugin.haveTheMod & b) != b)
			{
				string text = Encoding.UTF8.GetString(data);
				bool flag = false;
				char[] array = text.ToCharArray();
				foreach (char c in array)
				{
					int num2 = c;
					if (num2 == 168 || num2 == 184 || num2 > 191)
					{
						flag = true;
						break;
					}
				}
				if (flag)
				{
					byte[] bytes = Encoding.UTF8.GetBytes(Plugin.prefix + Plugin.BreakRussianText(text));
					__instance.SendP2PPacketToUser(clientID, bytes, messageType, sendMethod, channel);
					return false;
				}
			}
		}
		return true;
	}

	[HarmonyPatch(typeof(OnlinePlayerUI), "Awake")]
	[HarmonyPostfix]
	private static void RussifyPlayerNames(OnlinePlayerUI __instance)
	{
		if ((Object)(object)Plugin.rusHandleFont == (Object)null)
		{
			Plugin.onlinePlayerUIPendingChange = true;
			return;
		}
		TextMeshProUGUI[] array = (TextMeshProUGUI[])Plugin.playerTextsField.GetValue(__instance);
		for (int i = 0; i < array.Length; i++)
		{
			if ((Object)(object)((TMP_Text)array[i]).linkedTextComponent != (Object)null)
			{
				((TMP_Text)array[i]).linkedTextComponent.font = Plugin.rusHandleFont;
			}
			((TMP_Text)array[i]).font = Plugin.rusHandleFont;
		}
	}
}
[BepInPlugin("exmagikguy.stickfightthegame.rutext", "Rus Text", "1.1.1")]
[BepInProcess("StickFight.exe")]
public class Plugin : BaseUnityPlugin
{
	public static Plugin mevar;

	public static TMP_FontAsset rusHandleFont = null;

	public static FieldInfo localChatManagerField = typeof(NetworkPlayer).GetField("mLocalChatManager", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);

	public static FieldInfo chatFieldField = typeof(ChatManager).GetField("chatField", BindingFlags.Instance | BindingFlags.NonPublic);

	public static FieldInfo textField = typeof(ChatManager).GetField("text", BindingFlags.Instance | BindingFlags.NonPublic);

	public static FieldInfo playerTextsField = typeof(OnlinePlayerUI).GetField("mPlayerTexts", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	public const string Guid = "exmagikguy.stickfightthegame.rutext";

	public const string VersionNumber = "1.1.1";

	public static Texture2D rusFontAtlas = null;

	public static byte taggedRussian = 0;

	public static byte haveTheMod = 0;

	public static bool translateBrokenRussian = true;

	public static bool dontProcessNextTalk = false;

	public static bool onlinePlayerUIPendingChange = true;

	public static string prefix = "[RuText Mod] ";

	public static Dictionary<string, byte> colorPowerOfTwo = new Dictionary<string, byte>
	{
		{ "y", 1 },
		{ "b", 2 },
		{ "r", 4 },
		{ "g", 8 }
	};

	public static List<string> englishWords = new List<string>
	{
		"cool", "hi", "mega", "awesome", "yellow", "blue", "green", "red", "weapon", "hp",
		"lobby", "spawn", "map", ":d", ":c", ":o", "always", "eng", "english", "xd"
	};

	private void Awake()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Expected O, but got Unknown
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		mevar = this;
		Log(0, "By downloading this mod you confirm that you are RUSSIAN!!");
		Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
		using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("StickFightRusText.RusFont.png"))
		{
			if (stream == null)
			{
				return;
			}
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			val.LoadImage(array);
		}
		rusFontAtlas = val;
		new Harmony("exmagikguy.stickfightthegame.rutext").PatchAll();
		Log(0, "By downloading this mod you confirm that you are RUSSIAN!!!");
	}

	public static void MakeRusFont(TMP_FontAsset original)
	{
		rusHandleFont = Object.Instantiate<TMP_FontAsset>(original);
		rusHandleFont.atlas = rusFontAtlas;
		((TMP_Asset)rusHandleFont).material.mainTexture = (Texture)(object)rusFontAtlas;
		rusHandleFont.fontInfo.AtlasHeight = 2324f;
		rusHandleFont.fontInfo.Name = "StickFight RUS Text";
		List<TMP_Glyph> list = new List<TMP_Glyph>();
		list.AddRange(rusHandleFont.characterDictionary.Values.ToArray());
		list.Add(NewGlyph(1040, 343, 1238, 113, 128, 5f, 115f, 1f, 110f));
		list.Add(NewGlyph(1041, 15, 1566, 86, 128, 0f, 115f, 1f, 85f));
		list.Add(NewGlyph(1042, 254, 1234, 79, 128, 0f, 115f, 1f, 85f));
		list.Add(NewGlyph(1043, 639, 1049, 79, 128, 0f, 115f, 1f, 85f));
		list.Add(NewGlyph(1044, 898, 1226, 112, 163, 0f, 135f, 1f, 115f));
		list.Add(NewGlyph(1045, 443, 1053, 70, 119, 0f, 112f, 1f, 85f));
		list.Add(NewGlyph(1025, 582, 2157, 70, 143, 0f, 135f, 1f, 85f));
		list.Add(NewGlyph(1046, 13, 1435, 123, 121, 0f, 115f, 1f, 120f));
		list.Add(NewGlyph(1047, 434, 2172, 79, 129, 0f, 115f, 1f, 85f));
		list.Add(NewGlyph(1048, 698, 1437, 92, 118, 0f, 115f, 1f, 110f));
		list.Add(NewGlyph(1049, 3, 1022, 90, 149, 0f, 140f, 1f, 110f));
		list.Add(NewGlyph(1050, 349, 1053, 76, 120, 0f, 115f, 1f, 85f));
		list.Add(NewGlyph(1051, 783, 1240, 95, 127, 0f, 115f, 1f, 105f));
		list.Add(NewGlyph(1052, 559, 1436, 114, 120, 0f, 115f, 1f, 120f));
		list.Add(NewGlyph(1053, 529, 1052, 91, 120, 0f, 115f, 1f, 95f));
		list.Add(NewGlyph(1054, 664, 1236, 109, 127, 0f, 115f, 1f, 110f));
		list.Add(NewGlyph(1055, 463, 1240, 93, 120, 0f, 115f, 1f, 95f));
		list.Add(NewGlyph(1056, 581, 1240, 75, 120, 0f, 115f, 1f, 85f));
		list.Add(NewGlyph(1057, 443, 1429, 95, 128, 0f, 115f, 1f, 100f));
		list.Add(NewGlyph(1058, 805, 1437, 99, 117, 0f, 120f, 1f, 110f));
		list.Add(NewGlyph(1059, 236, 1052, 100, 122, 0f, 115f, 1f, 105f));
		list.Add(NewGlyph(1060, 9, 1240, 108, 121, 0f, 115f, 1f, 115f));
		list.Add(NewGlyph(1061, 686, 2098, 97, 118, 0f, 115f, 1f, 105f));
		list.Add(NewGlyph(1062, 122, 1054, 104, 142, 0f, 130f, 1f, 115f));
		list.Add(NewGlyph(1063, 340, 1438, 81, 116, 0f, 115f, 1f, 90f));
		list.Add(NewGlyph(1064, 730, 1055, 122, 116, 0f, 115f, 1f, 120f));
		list.Add(NewGlyph(1065, 879, 1055, 137, 141, 0f, 120f, 1f, 125f));
		list.Add(NewGlyph(1066, 807, 2180, 101, 116, 0f, 115f, 1f, 105f));
		list.Add(NewGlyph(1067, 130, 1238, 109, 123, 0f, 115f, 1f, 110f));
		list.Add(NewGlyph(1068, 920, 1438, 70, 116, 0f, 115f, 1f, 85f));
		list.Add(NewGlyph(1069, 147, 1433, 81, 124, 0f, 115f, 1f, 90f));
		list.Add(NewGlyph(1070, 113, 1569, 131, 122, 0f, 115f, 1f, 140f));
		list.Add(NewGlyph(1071, 238, 1438, 82, 116, 0f, 115f, 1f, 90f));
		list.Add(NewGlyph(1072, 748, 1796, 77, 89, 0f, 85f, 1f, 80f));
		list.Add(NewGlyph(1073, 174, 2146, 79, 129, 0f, 115f, 1f, 85f));
		list.Add(NewGlyph(1074, 672, 1798, 60, 85, 0f, 85f, 1f, 70f));
		list.Add(NewGlyph(1075, 833, 1603, 62, 85, 0f, 85f, 1f, 70f));
		list.Add(NewGlyph(1076, 203, 1993, 95, 104, 0f, 100f, 1f, 100f));
		list.Add(NewGlyph(1077, 638, 1601, 69, 89, 0f, 85f, 1f, 85f));
		list.Add(NewGlyph(1105, 921, 2128, 70, 116, 0f, 115f, 1f, 85f));
		list.Add(NewGlyph(1078, 309, 1992, 109, 86, 0f, 85f, 1f, 115f));
		list.Add(NewGlyph(1079, 154, 1796, 61, 89, 0f, 85f, 1f, 85f));
		list.Add(NewGlyph(1080, 881, 1993, 69, 85, 0f, 85f, 1f, 85f));
		list.Add(NewGlyph(1081, 267, 1565, 69, 123, 0f, 115f, 1f, 85f));
		list.Add(NewGlyph(1082, 558, 1603, 62, 85, 0f, 85f, 1f, 70f));
		list.Add(NewGlyph(1083, 106, 1993, 76, 85, 0f, 85f, 1f, 85f));
		list.Add(NewGlyph(1084, 765, 1993, 85, 85, 0f, 85f, 1f, 95f));
		list.Add(NewGlyph(1085, 733, 1603, 69, 85, 0f, 85f, 1f, 85f));
		list.Add(NewGlyph(1086, 14, 1991, 81, 89, 0f, 85f, 1f, 90f));
		list.Add(NewGlyph(1087, 844, 1798, 69, 85, 0f, 85f, 1f, 80f));
		list.Add(NewGlyph(1088, 944, 1796, 77, 118, 0f, 85f, 1f, 85f));
		list.Add(NewGlyph(1089, 677, 1991, 66, 89, 0f, 85f, 1f, 85f));
		list.Add(NewGlyph(1090, 6, 2188, 77, 85, 0f, 85f, 1f, 85f));
		list.Add(NewGlyph(1091, 460, 1603, 82, 116, 0f, 85f, 0.7f, 85f));
		list.Add(NewGlyph(1092, 422, 1767, 109, 147, 0f, 125f, 1f, 115f));
		list.Add(NewGlyph(1093, 231, 1798, 84, 85, 0f, 85f, 1f, 85f));
		list.Add(NewGlyph(1094, 364, 1603, 84, 104, 0f, 100f, 1f, 85f));
		list.Add(NewGlyph(1095, 590, 1993, 62, 85, 0f, 85f, 1f, 85f));
		list.Add(NewGlyph(1096, 912, 1603, 105, 85, 0f, 85f, 1f, 115f));
		list.Add(NewGlyph(1097, 20, 1798, 120, 104, 0f, 100f, 1f, 125f));
		list.Add(NewGlyph(1098, 324, 1798, 81, 85, 0f, 85f, 1f, 85f));
		list.Add(NewGlyph(1099, 556, 1798, 84, 85, 0f, 85f, 1f, 95f));
		list.Add(NewGlyph(1100, 100, 2188, 58, 85, 0f, 85f, 1f, 85f));
		list.Add(NewGlyph(1101, 428, 1991, 66, 89, 0f, 90f, 1f, 85f));
		list.Add(NewGlyph(1102, 275, 2186, 106, 89, 0f, 85f, 1f, 120f));
		list.Add(NewGlyph(1103, 506, 1993, 63, 85, 0f, 85f, 1f, 85f));
		rusHandleFont.AddGlyphInfo(list.ToArray());
		rusHandleFont.ReadFontDefinition();
	}

	public static TMP_Glyph NewGlyph(int id, int x, int y, int w, int h, float xo = 0f, float yo = 0f, float sc = 1f, float th = 1f)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		TMP_Glyph val = new TMP_Glyph();
		((TMP_TextElement)val).x = x;
		((TMP_TextElement)val).y = y;
		((TMP_TextElement)val).width = w;
		((TMP_TextElement)val).height = h;
		((TMP_TextElement)val).scale = sc;
		((TMP_TextElement)val).xOffset = xo;
		((TMP_TextElement)val).yOffset = yo;
		((TMP_TextElement)val).id = id;
		((TMP_TextElement)val).xAdvance = th;
		return val;
	}

	public static void InjectHandler(ChatManager chatManager)
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Expected O, but got Unknown
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)rusHandleFont == (Object)null)
		{
			MakeRusFont(((TMP_InputField)chatFieldField.GetValue((object?)(ChatManager)localChatManagerField.GetValue(null))).textComponent.font);
		}
		if (onlinePlayerUIPendingChange)
		{
			OnlinePlayerUI[] array = Object.FindObjectsOfType<OnlinePlayerUI>();
			foreach (OnlinePlayerUI obj in array)
			{
				try
				{
					TextMeshProUGUI[] array2 = (TextMeshProUGUI[])playerTextsField.GetValue(obj);
					for (int j = 0; j < array2.Length; j++)
					{
						if ((Object)(object)((TMP_Text)array2[j]).linkedTextComponent != (Object)null)
						{
							((TMP_Text)array2[j]).linkedTextComponent.font = rusHandleFont;
						}
						((TMP_Text)array2[j]).font = rusHandleFont;
					}
				}
				catch
				{
				}
			}
			onlinePlayerUIPendingChange = false;
		}
		((TMP_InputField)chatFieldField.GetValue(chatManager)).textComponent.font = rusHandleFont;
		((TMP_Text)(TextMeshPro)textField.GetValue(chatManager)).font = rusHandleFont;
	}

	public static void GlobalInjectHandlerQ()
	{
		((MonoBehaviour)mevar).Invoke("GlobalInjectHandler", 0.2f);
	}

	private void GlobalInjectHandler()
	{
		ChatManager[] array = Object.FindObjectsOfType<ChatManager>();
		foreach (ChatManager val in array)
		{
			if (((Behaviour)val).enabled)
			{
				InjectHandler(val);
			}
		}
	}

	public static void Log(LogLevel level, object log)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		((BaseUnityPlugin)mevar).Logger.Log(level, log);
	}

	public static void Log(int level, object log)
	{
		((BaseUnityPlugin)mevar).Logger.Log((LogLevel)(level switch
		{
			1 => 4, 
			0 => 16, 
			_ => 2, 
		}), log);
	}

	private void LateUpdate()
	{
		dontProcessNextTalk = false;
	}

	public static string TranslateBrokenRussianWord(string source)
	{
		string text = source;
		text = text.Replace("bI", "ы");
		text = text.ToLower();
		text = text.Replace("uy", "й");
		text = text.Replace("iy", "й");
		text = text.Replace("sh", "ш");
		text = text.Replace("ya", "я");
		text = text.Replace("ch", "ч");
		text = text.Replace("zel", "зел");
		text = text.Replace("zes", "жёс");
		text = text.Replace("ze", "ж");
		text = text.Replace("pycc", "русс");
		text = text.Replace("y", "у");
		text = text.Replace("u", "у");
		text = text.Replace("i", "и");
		text = text.Replace("j", "ж");
		text = text.Replace("e", "е");
		text = text.Replace("o", "о");
		text = text.Replace("b", "б");
		text = text.Replace("a", "а");
		text = text.Replace("c", "ц");
		text = text.Replace("v", "в");
		text = text.Replace("k", "к");
		text = text.Replace("p", "п");
		text = text.Replace("r", "р");
		text = text.Replace("s", "с");
		text = text.Replace("d", "д");
		text = text.Replace("f", "ф");
		text = text.Replace("g", "г");
		text = text.Replace("h", "х");
		text = text.Replace("l", "л");
		text = text.Replace("z", "з");
		text = text.Replace("n", "н");
		text = text.Replace("m", "м");
		text = text.Replace("t", "т");
		return text.Replace("x", "х");
	}

	public static string BreakRussianText(string source)
	{
		string text = source.ToLower();
		text = text.Replace("й", "iy");
		text = text.Replace("ц", "c");
		text = text.Replace("у", "u");
		text = text.Replace("к", "k");
		text = text.Replace("е", "e");
		text = text.Replace("н", "n");
		text = text.Replace("г", "g");
		text = text.Replace("ш", "sh");
		text = text.Replace("щ", "sh");
		text = text.Replace("з", "z");
		text = text.Replace("х", "h");
		text = text.Replace("ъ", "");
		text = text.Replace("ф", "f");
		text = text.Replace("ы", "bI");
		text = text.Replace("в", "v");
		text = text.Replace("а", "a");
		text = text.Replace("п", "p");
		text = text.Replace("р", "r");
		text = text.Replace("о", "o");
		text = text.Replace("л", "l");
		text = text.Replace("д", "d");
		text = text.Replace("ж", "j");
		text = text.Replace("э", "e");
		text = text.Replace("я", "ya");
		text = text.Replace("ч", "ch");
		text = text.Replace("с", "s");
		text = text.Replace("м", "m");
		text = text.Replace("и", "i");
		text = text.Replace("т", "t");
		text = text.Replace("ь", "");
		text = text.Replace("б", "b");
		return text.Replace("ю", "iu");
	}

	public static string TranslateBrokenRussianSentence(string source)
	{
		string[] array = source.Split(new char[1] { ' ' });
		string text = "";
		bool flag = false;
		string[] array2 = array;
		foreach (string text2 in array2)
		{
			if (!englishWords.Contains(text2.ToLower()))
			{
				text += TranslateBrokenRussianWord(text2);
				flag = true;
			}
			else
			{
				text += text2;
			}
			text += " ";
		}
		if (!flag)
		{
			return source;
		}
		string text3 = "";
		bool flag2 = true;
		char[] array3 = text.ToCharArray();
		for (int j = 0; j < array3.Length; j++)
		{
			char c = array3[j];
			if (flag2)
			{
				text3 += c.ToString().ToUpper();
				flag2 = false;
			}
			else
			{
				text3 += c;
			}
		}
		return text3;
	}
}