Decompiled source of UltraNet v0.0.6

UltraNet.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Sockets;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
using BepInEx;
using HarmonyLib;
using Jaket.Sam;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json.Linq;
using TMPro;
using ULTRAKILL.Cheats;
using UltraNet;
using UltraNet.Canvas;
using UltraNet.Classes;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;

[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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("UltraNet")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Description")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1+4996a0b960fe699e13910cd24b9d0e78f1e04c75")]
[assembly: AssemblyProduct("UltraNet")]
[assembly: AssemblyTitle("UltraNet")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.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;
		}
	}
}
public class BundlesManager : MonoBehaviour
{
	public static AssetBundle netBundle;

	public void Awake()
	{
		Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		string text = "UltraNet.Assets.ultranet.bundle";
		using Stream stream = executingAssembly.GetManifestResourceStream(text);
		if (stream == null)
		{
			Plugin.LogError("Embedded resource '" + text + "' not found!");
			return;
		}
		byte[] array = new byte[stream.Length];
		stream.Read(array, 0, array.Length);
		netBundle = AssetBundle.LoadFromMemory(array);
		if ((Object)(object)netBundle != (Object)null)
		{
			Plugin.LogInfo("Loaded embedded AssetBundle!");
		}
		else
		{
			Plugin.LogError("Failed to load AssetBundle from memory!");
		}
	}

	public void OnDestroy()
	{
		AssetBundle obj = netBundle;
		if (obj != null)
		{
			obj.Unload(false);
		}
	}
}
namespace Jaket.Sam
{
	public class Buffer
	{
		private List<int> data = new List<int>();

		private int lastTimeTableIndex;

		public int Position;

		public void Set(int pos, int value)
		{
			while (pos >= data.Count)
			{
				data.Add(0);
			}
			data[pos] = value;
		}

		public void WriteArray(int index, int[] array)
		{
			Position += Constants.TimeTable[lastTimeTableIndex, index];
			lastTimeTableIndex = index;
			for (int i = 0; i < 5; i++)
			{
				Set(Position / 50 + i, array[i]);
			}
		}

		public void Write(int index, int v)
		{
			WriteArray(index, new int[5] { v, v, v, v, v });
		}

		public float[] GetFloats()
		{
			float[] array = new float[data.Count];
			for (int i = 0; i < data.Count; i++)
			{
				array[i] = (float)(data[i] - 127) / 255f;
			}
			return array;
		}
	}
	public class Constants
	{
		public static readonly Dictionary<char, string> ISO9 = new Dictionary<char, string>
		{
			{ 'А', "A" },
			{ 'Б', "B" },
			{ 'В', "V" },
			{ 'Г', "G" },
			{ 'Д', "D" },
			{ 'Е', "EE" },
			{ 'Ё', "Ë" },
			{ 'Ж', "ZH" },
			{ 'З', "Z" },
			{ 'И', "IE" },
			{ 'Й', "Y" },
			{ 'К', "K" },
			{ 'Л', "L" },
			{ 'М', "M" },
			{ 'Н', "N" },
			{ 'О', "O" },
			{ 'П', "P" },
			{ 'Р', "R" },
			{ 'С', "S" },
			{ 'Т', "T" },
			{ 'У', "OO" },
			{ 'Ф', "F" },
			{ 'Х', "H" },
			{ 'Ц', "TS" },
			{ 'Ч', "CH" },
			{ 'Ш', "SH" },
			{ 'Щ', "SHCH" },
			{ 'Ъ', "'" },
			{ 'Ы', "Y'" },
			{ 'Ь', "'" },
			{ 'Э', "EH" },
			{ 'Ю', "YU" },
			{ 'Я', "YA" }
		};

		public static readonly int[] RulesSet1 = new int[4076]
		{
			93, 193, 32, 40, 65, 46, 41, 61, 69, 72,
			52, 89, 46, 160, 40, 65, 41, 32, 61, 65,
			200, 32, 40, 65, 82, 69, 41, 32, 61, 65,
			65, 210, 32, 40, 65, 82, 41, 79, 61, 65,
			88, 210, 40, 65, 82, 41, 35, 61, 69, 72,
			52, 210, 32, 94, 40, 65, 83, 41, 35, 61,
			69, 89, 52, 211, 40, 65, 41, 87, 65, 61,
			65, 216, 40, 65, 87, 41, 61, 65, 79, 181,
			32, 58, 40, 65, 78, 89, 41, 61, 69, 72,
			52, 78, 73, 217, 40, 65, 41, 94, 43, 35,
			61, 69, 89, 181, 35, 58, 40, 65, 76, 76,
			89, 41, 61, 85, 76, 73, 217, 32, 40, 65,
			76, 41, 35, 61, 85, 204, 40, 65, 71, 65,
			73, 78, 41, 61, 65, 88, 71, 69, 72, 52,
			206, 35, 58, 40, 65, 71, 41, 69, 61, 73,
			72, 202, 40, 65, 41, 94, 37, 61, 69, 217,
			40, 65, 41, 94, 43, 58, 35, 61, 65, 197,
			32, 58, 40, 65, 41, 94, 43, 32, 61, 69,
			89, 180, 32, 40, 65, 82, 82, 41, 61, 65,
			88, 210, 40, 65, 82, 82, 41, 61, 65, 69,
			52, 210, 32, 94, 40, 65, 82, 41, 32, 61,
			65, 65, 53, 210, 40, 65, 82, 41, 61, 65,
			65, 53, 210, 40, 65, 73, 82, 41, 61, 69,
			72, 52, 210, 40, 65, 73, 41, 61, 69, 89,
			180, 40, 65, 89, 41, 61, 69, 89, 181, 40,
			65, 85, 41, 61, 65, 79, 180, 35, 58, 40,
			65, 76, 41, 32, 61, 85, 204, 35, 58, 40,
			65, 76, 83, 41, 32, 61, 85, 76, 218, 40,
			65, 76, 75, 41, 61, 65, 79, 52, 203, 40,
			65, 76, 41, 94, 61, 65, 79, 204, 32, 58,
			40, 65, 66, 76, 69, 41, 61, 69, 89, 52,
			66, 85, 204, 40, 65, 66, 76, 69, 41, 61,
			65, 88, 66, 85, 204, 40, 65, 41, 86, 79,
			61, 69, 89, 180, 40, 65, 78, 71, 41, 43,
			61, 69, 89, 52, 78, 202, 40, 65, 84, 65,
			82, 73, 41, 61, 65, 72, 84, 65, 65, 52,
			82, 73, 217, 40, 65, 41, 84, 79, 77, 61,
			65, 197, 40, 65, 41, 84, 84, 73, 61, 65,
			197, 32, 40, 65, 84, 41, 32, 61, 65, 69,
			212, 32, 40, 65, 41, 84, 61, 65, 200, 40,
			65, 41, 61, 65, 197, 93, 194, 32, 40, 66,
			41, 32, 61, 66, 73, 89, 180, 32, 40, 66,
			69, 41, 94, 35, 61, 66, 73, 200, 40, 66,
			69, 73, 78, 71, 41, 61, 66, 73, 89, 52,
			73, 72, 78, 216, 32, 40, 66, 79, 84, 72,
			41, 32, 61, 66, 79, 87, 52, 84, 200, 32,
			40, 66, 85, 83, 41, 35, 61, 66, 73, 72,
			52, 218, 40, 66, 82, 69, 65, 75, 41, 61,
			66, 82, 69, 89, 53, 203, 40, 66, 85, 73,
			76, 41, 61, 66, 73, 72, 52, 204, 40, 66,
			41, 61, 194, 93, 195, 32, 40, 67, 41, 32,
			61, 83, 73, 89, 180, 32, 40, 67, 72, 41,
			94, 61, 203, 94, 69, 40, 67, 72, 41, 61,
			203, 40, 67, 72, 65, 41, 82, 35, 61, 75,
			69, 72, 181, 40, 67, 72, 41, 61, 67, 200,
			32, 83, 40, 67, 73, 41, 35, 61, 83, 65,
			89, 180, 40, 67, 73, 41, 65, 61, 83, 200,
			40, 67, 73, 41, 79, 61, 83, 200, 40, 67,
			73, 41, 69, 78, 61, 83, 200, 40, 67, 73,
			84, 89, 41, 61, 83, 73, 72, 84, 73, 217,
			40, 67, 41, 43, 61, 211, 40, 67, 75, 41,
			61, 203, 40, 67, 79, 77, 77, 79, 68, 79,
			82, 69, 41, 61, 75, 65, 65, 52, 77, 65,
			72, 68, 79, 72, 210, 40, 67, 79, 77, 41,
			61, 75, 65, 72, 205, 40, 67, 85, 73, 84,
			41, 61, 75, 73, 72, 212, 40, 67, 82, 69,
			65, 41, 61, 75, 82, 73, 89, 69, 217, 40,
			67, 41, 61, 203, 93, 196, 32, 40, 68, 41,
			32, 61, 68, 73, 89, 180, 32, 40, 68, 82,
			46, 41, 32, 61, 68, 65, 65, 52, 75, 84,
			69, 210, 35, 58, 40, 68, 69, 68, 41, 32,
			61, 68, 73, 72, 196, 46, 69, 40, 68, 41,
			32, 61, 196, 35, 58, 94, 69, 40, 68, 41,
			32, 61, 212, 32, 40, 68, 69, 41, 94, 35,
			61, 68, 73, 200, 32, 40, 68, 79, 41, 32,
			61, 68, 85, 215, 32, 40, 68, 79, 69, 83,
			41, 61, 68, 65, 72, 218, 40, 68, 79, 78,
			69, 41, 32, 61, 68, 65, 72, 53, 206, 40,
			68, 79, 73, 78, 71, 41, 61, 68, 85, 87,
			52, 73, 72, 78, 216, 32, 40, 68, 79, 87,
			41, 61, 68, 65, 215, 35, 40, 68, 85, 41,
			65, 61, 74, 85, 215, 35, 40, 68, 85, 41,
			94, 35, 61, 74, 65, 216, 40, 68, 41, 61,
			196, 93, 197, 32, 40, 69, 41, 32, 61, 73,
			89, 73, 89, 180, 35, 58, 40, 69, 41, 32,
			189, 39, 58, 94, 40, 69, 41, 32, 189, 32,
			58, 40, 69, 41, 32, 61, 73, 217, 35, 40,
			69, 68, 41, 32, 61, 196, 35, 58, 40, 69,
			41, 68, 32, 189, 40, 69, 86, 41, 69, 82,
			61, 69, 72, 52, 214, 40, 69, 41, 94, 37,
			61, 73, 89, 180, 40, 69, 82, 73, 41, 35,
			61, 73, 89, 52, 82, 73, 217, 40, 69, 82,
			73, 41, 61, 69, 72, 52, 82, 73, 200, 35,
			58, 40, 69, 82, 41, 35, 61, 69, 210, 40,
			69, 82, 82, 79, 82, 41, 61, 69, 72, 52,
			82, 79, 72, 210, 40, 69, 82, 65, 83, 69,
			41, 61, 73, 72, 82, 69, 89, 53, 211, 40,
			69, 82, 41, 35, 61, 69, 72, 210, 40, 69,
			82, 41, 61, 69, 210, 32, 40, 69, 86, 69,
			78, 41, 61, 73, 89, 86, 69, 72, 206, 35,
			58, 40, 69, 41, 87, 189, 64, 40, 69, 87,
			41, 61, 85, 215, 40, 69, 87, 41, 61, 89,
			85, 215, 40, 69, 41, 79, 61, 73, 217, 35,
			58, 38, 40, 69, 83, 41, 32, 61, 73, 72,
			218, 35, 58, 40, 69, 41, 83, 32, 189, 35,
			58, 40, 69, 76, 89, 41, 32, 61, 76, 73,
			217, 35, 58, 40, 69, 77, 69, 78, 84, 41,
			61, 77, 69, 72, 78, 212, 40, 69, 70, 85,
			76, 41, 61, 70, 85, 72, 204, 40, 69, 69,
			41, 61, 73, 89, 180, 40, 69, 65, 82, 78,
			41, 61, 69, 82, 53, 206, 32, 40, 69, 65,
			82, 41, 94, 61, 69, 82, 181, 40, 69, 65,
			68, 41, 61, 69, 72, 196, 35, 58, 40, 69,
			65, 41, 32, 61, 73, 89, 65, 216, 40, 69,
			65, 41, 83, 85, 61, 69, 72, 181, 40, 69,
			65, 41, 61, 73, 89, 181, 40, 69, 73, 71,
			72, 41, 61, 69, 89, 180, 40, 69, 73, 41,
			61, 73, 89, 180, 32, 40, 69, 89, 69, 41,
			61, 65, 89, 180, 40, 69, 89, 41, 61, 73,
			217, 40, 69, 85, 41, 61, 89, 85, 87, 181,
			40, 69, 81, 85, 65, 76, 41, 61, 73, 89,
			52, 75, 87, 85, 204, 40, 69, 41, 61, 69,
			200, 93, 198, 32, 40, 70, 41, 32, 61, 69,
			72, 52, 198, 40, 70, 85, 76, 41, 61, 70,
			85, 72, 204, 40, 70, 82, 73, 69, 78, 68,
			41, 61, 70, 82, 69, 72, 53, 78, 196, 40,
			70, 65, 84, 72, 69, 82, 41, 61, 70, 65,
			65, 52, 68, 72, 69, 210, 40, 70, 41, 70,
			189, 40, 70, 41, 61, 198, 93, 199, 32, 40,
			71, 41, 32, 61, 74, 73, 89, 180, 40, 71,
			73, 86, 41, 61, 71, 73, 72, 53, 214, 32,
			40, 71, 41, 73, 94, 61, 199, 40, 71, 69,
			41, 84, 61, 71, 69, 72, 181, 83, 85, 40,
			71, 71, 69, 83, 41, 61, 71, 74, 69, 72,
			52, 211, 40, 71, 71, 41, 61, 199, 32, 66,
			35, 40, 71, 41, 61, 199, 40, 71, 41, 43,
			61, 202, 40, 71, 82, 69, 65, 84, 41, 61,
			71, 82, 69, 89, 52, 212, 40, 71, 79, 78,
			41, 69, 61, 71, 65, 79, 53, 206, 35, 40,
			71, 72, 41, 189, 32, 40, 71, 78, 41, 61,
			206, 40, 71, 41, 61, 199, 93, 200, 32, 40,
			72, 41, 32, 61, 69, 89, 52, 67, 200, 32,
			40, 72, 65, 86, 41, 61, 47, 72, 65, 69,
			54, 214, 32, 40, 72, 69, 82, 69, 41, 61,
			47, 72, 73, 89, 210, 32, 40, 72, 79, 85,
			82, 41, 61, 65, 87, 53, 69, 210, 40, 72,
			79, 87, 41, 61, 47, 72, 65, 215, 40, 72,
			41, 35, 61, 47, 200, 40, 72, 41, 189, 93,
			201, 32, 40, 73, 78, 41, 61, 73, 72, 206,
			32, 40, 73, 41, 32, 61, 65, 89, 180, 40,
			73, 41, 32, 61, 65, 217, 40, 73, 78, 41,
			68, 61, 65, 89, 53, 206, 83, 69, 77, 40,
			73, 41, 61, 73, 217, 32, 65, 78, 84, 40,
			73, 41, 61, 65, 217, 40, 73, 69, 82, 41,
			61, 73, 89, 69, 210, 35, 58, 82, 40, 73,
			69, 68, 41, 32, 61, 73, 89, 196, 40, 73,
			69, 68, 41, 32, 61, 65, 89, 53, 196, 40,
			73, 69, 78, 41, 61, 73, 89, 69, 72, 206,
			40, 73, 69, 41, 84, 61, 65, 89, 52, 69,
			200, 40, 73, 39, 41, 61, 65, 89, 181, 32,
			58, 40, 73, 41, 94, 37, 61, 65, 89, 181,
			32, 58, 40, 73, 69, 41, 32, 61, 65, 89,
			180, 40, 73, 41, 37, 61, 73, 217, 40, 73,
			69, 41, 61, 73, 89, 180, 32, 40, 73, 68,
			69, 65, 41, 61, 65, 89, 68, 73, 89, 53,
			65, 200, 40, 73, 41, 94, 43, 58, 35, 61,
			73, 200, 40, 73, 82, 41, 35, 61, 65, 89,
			210, 40, 73, 90, 41, 37, 61, 65, 89, 218,
			40, 73, 83, 41, 37, 61, 65, 89, 218, 73,
			94, 40, 73, 41, 94, 35, 61, 73, 200, 43,
			94, 40, 73, 41, 94, 43, 61, 65, 217, 35,
			58, 94, 40, 73, 41, 94, 43, 61, 73, 200,
			40, 73, 41, 94, 43, 61, 65, 217, 40, 73,
			82, 41, 61, 69, 210, 40, 73, 71, 72, 41,
			61, 65, 89, 180, 40, 73, 76, 68, 41, 61,
			65, 89, 53, 76, 196, 32, 40, 73, 71, 78,
			41, 61, 73, 72, 71, 206, 40, 73, 71, 78,
			41, 32, 61, 65, 89, 52, 206, 40, 73, 71,
			78, 41, 94, 61, 65, 89, 52, 206, 40, 73,
			71, 78, 41, 37, 61, 65, 89, 52, 206, 40,
			73, 67, 82, 79, 41, 61, 65, 89, 52, 75,
			82, 79, 200, 40, 73, 81, 85, 69, 41, 61,
			73, 89, 52, 203, 40, 73, 41, 61, 73, 200,
			93, 202, 32, 40, 74, 41, 32, 61, 74, 69,
			89, 180, 40, 74, 41, 61, 202, 93, 203, 32,
			40, 75, 41, 32, 61, 75, 69, 89, 180, 32,
			40, 75, 41, 78, 189, 40, 75, 41, 61, 203,
			93, 204, 32, 40, 76, 41, 32, 61, 69, 72,
			52, 204, 40, 76, 79, 41, 67, 35, 61, 76,
			79, 215, 76, 40, 76, 41, 189, 35, 58, 94,
			40, 76, 41, 37, 61, 85, 204, 40, 76, 69,
			65, 68, 41, 61, 76, 73, 89, 196, 32, 40,
			76, 65, 85, 71, 72, 41, 61, 76, 65, 69,
			52, 198, 40, 76, 41, 61, 204, 93, 205, 32,
			40, 77, 41, 32, 61, 69, 72, 52, 205, 32,
			40, 77, 82, 46, 41, 32, 61, 77, 73, 72,
			52, 83, 84, 69, 210, 32, 40, 77, 83, 46,
			41, 61, 77, 73, 72, 53, 218, 32, 40, 77,
			82, 83, 46, 41, 32, 61, 77, 73, 72, 52,
			83, 73, 88, 218, 40, 77, 79, 86, 41, 61,
			77, 85, 87, 52, 214, 40, 77, 65, 67, 72,
			73, 78, 41, 61, 77, 65, 72, 83, 72, 73,
			89, 53, 206, 77, 40, 77, 41, 189, 40, 77,
			41, 61, 205, 93, 206, 32, 40, 78, 41, 32,
			61, 69, 72, 52, 206, 69, 40, 78, 71, 41,
			43, 61, 78, 202, 40, 78, 71, 41, 82, 61,
			78, 88, 199, 40, 78, 71, 41, 35, 61, 78,
			88, 199, 40, 78, 71, 76, 41, 37, 61, 78,
			88, 71, 85, 204, 40, 78, 71, 41, 61, 78,
			216, 40, 78, 75, 41, 61, 78, 88, 203, 32,
			40, 78, 79, 87, 41, 32, 61, 78, 65, 87,
			180, 78, 40, 78, 41, 189, 40, 78, 79, 78,
			41, 69, 61, 78, 65, 72, 52, 206, 40, 78,
			41, 61, 206, 93, 207, 32, 40, 79, 41, 32,
			61, 79, 72, 52, 215, 40, 79, 70, 41, 32,
			61, 65, 72, 214, 32, 40, 79, 72, 41, 32,
			61, 79, 87, 181, 40, 79, 82, 79, 85, 71,
			72, 41, 61, 69, 82, 52, 79, 215, 35, 58,
			40, 79, 82, 41, 32, 61, 69, 210, 35, 58,
			40, 79, 82, 83, 41, 32, 61, 69, 82, 218,
			40, 79, 82, 41, 61, 65, 79, 210, 32, 40,
			79, 78, 69, 41, 61, 87, 65, 72, 206, 35,
			40, 79, 78, 69, 41, 32, 61, 87, 65, 72,
			206, 40, 79, 87, 41, 61, 79, 215, 32, 40,
			79, 86, 69, 82, 41, 61, 79, 87, 53, 86,
			69, 210, 80, 82, 40, 79, 41, 86, 61, 85,
			87, 180, 40, 79, 86, 41, 61, 65, 72, 52,
			214, 40, 79, 41, 94, 37, 61, 79, 87, 181,
			40, 79, 41, 94, 69, 78, 61, 79, 215, 40,
			79, 41, 94, 73, 35, 61, 79, 87, 181, 40,
			79, 76, 41, 68, 61, 79, 87, 52, 204, 40,
			79, 85, 71, 72, 84, 41, 61, 65, 79, 53,
			212, 40, 79, 85, 71, 72, 41, 61, 65, 72,
			53, 198, 32, 40, 79, 85, 41, 61, 65, 215,
			72, 40, 79, 85, 41, 83, 35, 61, 65, 87,
			180, 40, 79, 85, 83, 41, 61, 65, 88, 211,
			40, 79, 85, 82, 41, 61, 79, 72, 210, 40,
			79, 85, 76, 68, 41, 61, 85, 72, 53, 196,
			40, 79, 85, 41, 94, 76, 61, 65, 72, 181,
			40, 79, 85, 80, 41, 61, 85, 87, 53, 208,
			40, 79, 85, 41, 61, 65, 215, 40, 79, 89,
			41, 61, 79, 217, 40, 79, 73, 78, 71, 41,
			61, 79, 87, 52, 73, 72, 78, 216, 40, 79,
			73, 41, 61, 79, 89, 181, 40, 79, 79, 82,
			41, 61, 79, 72, 53, 210, 40, 79, 79, 75,
			41, 61, 85, 72, 53, 203, 70, 40, 79, 79,
			68, 41, 61, 85, 87, 53, 196, 76, 40, 79,
			79, 68, 41, 61, 65, 72, 53, 196, 77, 40,
			79, 79, 68, 41, 61, 85, 87, 53, 196, 40,
			79, 79, 68, 41, 61, 85, 72, 53, 196, 70,
			40, 79, 79, 84, 41, 61, 85, 72, 53, 212,
			40, 79, 79, 41, 61, 85, 87, 181, 40, 79,
			39, 41, 61, 79, 200, 40, 79, 41, 69, 61,
			79, 215, 40, 79, 41, 32, 61, 79, 215, 40,
			79, 65, 41, 61, 79, 87, 180, 32, 40, 79,
			78, 76, 89, 41, 61, 79, 87, 52, 78, 76,
			73, 217, 32, 40, 79, 78, 67, 69, 41, 61,
			87, 65, 72, 52, 78, 211, 40, 79, 78, 39,
			84, 41, 61, 79, 87, 52, 78, 212, 67, 40,
			79, 41, 78, 61, 65, 193, 40, 79, 41, 78,
			71, 61, 65, 207, 32, 58, 94, 40, 79, 41,
			78, 61, 65, 200, 73, 40, 79, 78, 41, 61,
			85, 206, 35, 58, 40, 79, 78, 41, 61, 85,
			206, 35, 94, 40, 79, 78, 41, 61, 85, 206,
			40, 79, 41, 83, 84, 61, 79, 215, 40, 79,
			70, 41, 94, 61, 65, 79, 52, 198, 40, 79,
			84, 72, 69, 82, 41, 61, 65, 72, 53, 68,
			72, 69, 210, 82, 40, 79, 41, 66, 61, 82,
			65, 193, 94, 82, 40, 79, 41, 58, 35, 61,
			79, 87, 181, 40, 79, 83, 83, 41, 32, 61,
			65, 79, 53, 211, 35, 58, 94, 40, 79, 77,
			41, 61, 65, 72, 205, 40, 79, 41, 61, 65,
			193, 93, 208, 32, 40, 80, 41, 32, 61, 80,
			73, 89, 180, 40, 80, 72, 41, 61, 198, 40,
			80, 69, 79, 80, 76, 41, 61, 80, 73, 89,
			53, 80, 85, 204, 40, 80, 79, 87, 41, 61,
			80, 65, 87, 180, 40, 80, 85, 84, 41, 32,
			61, 80, 85, 72, 212, 40, 80, 41, 80, 189,
			40, 80, 41, 83, 189, 40, 80, 41, 78, 189,
			40, 80, 82, 79, 70, 46, 41, 61, 80, 82,
			79, 72, 70, 69, 72, 52, 83, 69, 210, 40,
			80, 41, 61, 208, 93, 209, 32, 40, 81, 41,
			32, 61, 75, 89, 85, 87, 180, 40, 81, 85,
			65, 82, 41, 61, 75, 87, 79, 72, 53, 210,
			40, 81, 85, 41, 61, 75, 215, 40, 81, 41,
			61, 203, 93, 210, 32, 40, 82, 41, 32, 61,
			65, 65, 53, 210, 32, 40, 82, 69, 41, 94,
			35, 61, 82, 73, 217, 40, 82, 41, 82, 189,
			40, 82, 41, 61, 210, 93, 211, 32, 40, 83,
			41, 32, 61, 69, 72, 52, 211, 40, 83, 72,
			41, 61, 83, 200, 35, 40, 83, 73, 79, 78,
			41, 61, 90, 72, 85, 206, 40, 83, 79, 77,
			69, 41, 61, 83, 65, 72, 205, 35, 40, 83,
			85, 82, 41, 35, 61, 90, 72, 69, 210, 40,
			83, 85, 82, 41, 35, 61, 83, 72, 69, 210,
			35, 40, 83, 85, 41, 35, 61, 90, 72, 85,
			215, 35, 40, 83, 83, 85, 41, 35, 61, 83,
			72, 85, 215, 35, 40, 83, 69, 68, 41, 61,
			90, 196, 35, 40, 83, 41, 35, 61, 218, 40,
			83, 65, 73, 68, 41, 61, 83, 69, 72, 196,
			94, 40, 83, 73, 79, 78, 41, 61, 83, 72,
			85, 206, 40, 83, 41, 83, 189, 46, 40, 83,
			41, 32, 61, 218, 35, 58, 46, 69, 40, 83,
			41, 32, 61, 218, 35, 58, 94, 35, 40, 83,
			41, 32, 61, 211, 85, 40, 83, 41, 32, 61,
			211, 32, 58, 35, 40, 83, 41, 32, 61, 218,
			35, 35, 40, 83, 41, 32, 61, 218, 32, 40,
			83, 67, 72, 41, 61, 83, 203, 40, 83, 41,
			67, 43, 189, 35, 40, 83, 77, 41, 61, 90,
			85, 205, 35, 40, 83, 78, 41, 39, 61, 90,
			85, 205, 40, 83, 84, 76, 69, 41, 61, 83,
			85, 204, 40, 83, 41, 61, 211, 93, 212, 32,
			40, 84, 41, 32, 61, 84, 73, 89, 180, 32,
			40, 84, 72, 69, 41, 32, 35, 61, 68, 72,
			73, 217, 32, 40, 84, 72, 69, 41, 32, 61,
			68, 72, 65, 216, 40, 84, 79, 41, 32, 61,
			84, 85, 216, 32, 40, 84, 72, 65, 84, 41,
			61, 68, 72, 65, 69, 212, 32, 40, 84, 72,
			73, 83, 41, 32, 61, 68, 72, 73, 72, 211,
			32, 40, 84, 72, 69, 89, 41, 61, 68, 72,
			69, 217, 32, 40, 84, 72, 69, 82, 69, 41,
			61, 68, 72, 69, 72, 210, 40, 84, 72, 69,
			82, 41, 61, 68, 72, 69, 210, 40, 84, 72,
			69, 73, 82, 41, 61, 68, 72, 69, 72, 210,
			32, 40, 84, 72, 65, 78, 41, 32, 61, 68,
			72, 65, 69, 206, 32, 40, 84, 72, 69, 77,
			41, 32, 61, 68, 72, 65, 69, 206, 40, 84,
			72, 69, 83, 69, 41, 32, 61, 68, 72, 73,
			89, 218, 32, 40, 84, 72, 69, 78, 41, 61,
			68, 72, 69, 72, 206, 40, 84, 72, 82, 79,
			85, 71, 72, 41, 61, 84, 72, 82, 85, 87,
			180, 40, 84, 72, 79, 83, 69, 41, 61, 68,
			72, 79, 72, 218, 40, 84, 72, 79, 85, 71,
			72, 41, 32, 61, 68, 72, 79, 215, 40, 84,
			79, 68, 65, 89, 41, 61, 84, 85, 88, 68,
			69, 217, 40, 84, 79, 77, 79, 41, 82, 82,
			79, 87, 61, 84, 85, 77, 65, 65, 181, 40,
			84, 79, 41, 84, 65, 76, 61, 84, 79, 87,
			181, 32, 40, 84, 72, 85, 83, 41, 61, 68,
			72, 65, 72, 52, 211, 40, 84, 72, 41, 61,
			84, 200, 35, 58, 40, 84, 69, 68, 41, 61,
			84, 73, 88, 196, 83, 40, 84, 73, 41, 35,
			78, 61, 67, 200, 40, 84, 73, 41, 79, 61,
			83, 200, 40, 84, 73, 41, 65, 61, 83, 200,
			40, 84, 73, 69, 78, 41, 61, 83, 72, 85,
			206, 40, 84, 85, 82, 41, 35, 61, 67, 72,
			69, 210, 40, 84, 85, 41, 65, 61, 67, 72,
			85, 215, 32, 40, 84, 87, 79, 41, 61, 84,
			85, 215, 38, 40, 84, 41, 69, 78, 32, 189,
			40, 84, 41, 61, 212, 93, 213, 32, 40, 85,
			41, 32, 61, 89, 85, 87, 180, 32, 40, 85,
			78, 41, 73, 61, 89, 85, 87, 206, 32, 40,
			85, 78, 41, 61, 65, 72, 206, 32, 40, 85,
			80, 79, 78, 41, 61, 65, 88, 80, 65, 79,
			206, 64, 40, 85, 82, 41, 35, 61, 85, 72,
			52, 210, 40, 85, 82, 41, 35, 61, 89, 85,
			72, 52, 210, 40, 85, 82, 41, 61, 69, 210,
			40, 85, 41, 94, 32, 61, 65, 200, 40, 85,
			41, 94, 94, 61, 65, 72, 181, 40, 85, 89,
			41, 61, 65, 89, 181, 32, 71, 40, 85, 41,
			35, 189, 71, 40, 85, 41, 37, 189, 71, 40,
			85, 41, 35, 61, 215, 35, 78, 40, 85, 41,
			61, 89, 85, 215, 64, 40, 85, 41, 61, 85,
			215, 40, 85, 41, 61, 89, 85, 215, 93, 214,
			32, 40, 86, 41, 32, 61, 86, 73, 89, 180,
			40, 86, 73, 69, 87, 41, 61, 86, 89, 85,
			87, 181, 40, 86, 41, 61, 214, 93, 215, 32,
			40, 87, 41, 32, 61, 68, 65, 72, 52, 66,
			85, 76, 89, 85, 215, 32, 40, 87, 69, 82,
			69, 41, 61, 87, 69, 210, 40, 87, 65, 41,
			83, 72, 61, 87, 65, 193, 40, 87, 65, 41,
			83, 84, 61, 87, 69, 217, 40, 87, 65, 41,
			83, 61, 87, 65, 200, 40, 87, 65, 41, 84,
			61, 87, 65, 193, 40, 87, 72, 69, 82, 69,
			41, 61, 87, 72, 69, 72, 210, 40, 87, 72,
			65, 84, 41, 61, 87, 72, 65, 72, 212, 40,
			87, 72, 79, 76, 41, 61, 47, 72, 79, 87,
			204, 40, 87, 72, 79, 41, 61, 47, 72, 85,
			215, 40, 87, 72, 41, 61, 87, 200, 40, 87,
			65, 82, 41, 35, 61, 87, 69, 72, 210, 40,
			87, 65, 82, 41, 61, 87, 65, 79, 210, 40,
			87, 79, 82, 41, 94, 61, 87, 69, 210, 40,
			87, 82, 41, 61, 210, 40, 87, 79, 77, 41,
			65, 61, 87, 85, 72, 205, 40, 87, 79, 77,
			41, 69, 61, 87, 73, 72, 205, 40, 87, 69,
			65, 41, 82, 61, 87, 69, 200, 40, 87, 65,
			78, 84, 41, 61, 87, 65, 65, 53, 78, 212,
			65, 78, 83, 40, 87, 69, 82, 41, 61, 69,
			210, 40, 87, 41, 61, 215, 93, 216, 32, 40,
			88, 41, 32, 61, 69, 72, 52, 75, 211, 32,
			40, 88, 41, 61, 218, 40, 88, 41, 61, 75,
			211, 93, 217, 32, 40, 89, 41, 32, 61, 87,
			65, 89, 180, 40, 89, 79, 85, 78, 71, 41,
			61, 89, 65, 72, 78, 216, 32, 40, 89, 79,
			85, 82, 41, 61, 89, 79, 72, 210, 32, 40,
			89, 79, 85, 41, 61, 89, 85, 215, 32, 40,
			89, 69, 83, 41, 61, 89, 69, 72, 211, 32,
			40, 89, 41, 61, 217, 70, 40, 89, 41, 61,
			65, 217, 80, 83, 40, 89, 67, 72, 41, 61,
			65, 89, 203, 35, 58, 94, 40, 89, 41, 61,
			73, 217, 35, 58, 94, 40, 89, 41, 73, 61,
			73, 217, 32, 58, 40, 89, 41, 32, 61, 65,
			217, 32, 58, 40, 89, 41, 35, 61, 65, 217,
			32, 58, 40, 89, 41, 94, 43, 58, 35, 61,
			73, 200, 32, 58, 40, 89, 41, 94, 35, 61,
			65, 217, 40, 89, 41, 61, 73, 200, 93, 218,
			32, 40, 90, 41, 32, 61, 90, 73, 89, 180,
			40, 90, 41, 61, 218, 234
		};

		public static readonly int[] RulesSet2 = new int[447]
		{
			40, 65, 41, 189, 40, 33, 41, 61, 174, 40,
			34, 41, 32, 61, 45, 65, 72, 53, 78, 75,
			87, 79, 87, 84, 173, 40, 34, 41, 61, 75,
			87, 79, 87, 52, 84, 173, 40, 35, 41, 61,
			32, 78, 65, 72, 52, 77, 66, 69, 210, 40,
			36, 41, 61, 32, 68, 65, 65, 52, 76, 69,
			210, 40, 37, 41, 61, 32, 80, 69, 82, 83,
			69, 72, 52, 78, 212, 40, 38, 41, 61, 32,
			65, 69, 78, 196, 40, 39, 41, 189, 40, 42,
			41, 61, 32, 65, 69, 52, 83, 84, 69, 82,
			73, 72, 83, 203, 40, 43, 41, 61, 32, 80,
			76, 65, 72, 52, 211, 40, 44, 41, 61, 172,
			32, 40, 45, 41, 32, 61, 173, 40, 45, 41,
			189, 40, 46, 41, 61, 32, 80, 79, 89, 78,
			212, 40, 47, 41, 61, 32, 83, 76, 65, 69,
			52, 83, 200, 40, 48, 41, 61, 32, 90, 73,
			89, 52, 82, 79, 215, 32, 40, 49, 83, 84,
			41, 61, 70, 69, 82, 52, 83, 212, 32, 40,
			49, 48, 84, 72, 41, 61, 84, 69, 72, 52,
			78, 84, 200, 40, 49, 41, 61, 32, 87, 65,
			72, 52, 206, 32, 40, 50, 78, 68, 41, 61,
			83, 69, 72, 52, 75, 85, 78, 196, 40, 50,
			41, 61, 32, 84, 85, 87, 180, 32, 40, 51,
			82, 68, 41, 61, 84, 72, 69, 82, 52, 196,
			40, 51, 41, 61, 32, 84, 72, 82, 73, 89,
			180, 40, 52, 41, 61, 32, 70, 79, 72, 52,
			210, 32, 40, 53, 84, 72, 41, 61, 70, 73,
			72, 52, 70, 84, 200, 40, 53, 41, 61, 32,
			70, 65, 89, 52, 214, 32, 40, 54, 52, 41,
			32, 61, 83, 73, 72, 52, 75, 83, 84, 73,
			89, 32, 70, 79, 72, 210, 40, 54, 41, 61,
			32, 83, 73, 72, 52, 75, 211, 40, 55, 41,
			61, 32, 83, 69, 72, 52, 86, 85, 206, 32,
			40, 56, 84, 72, 41, 61, 69, 89, 52, 84,
			200, 40, 56, 41, 61, 32, 69, 89, 52, 212,
			40, 57, 41, 61, 32, 78, 65, 89, 52, 206,
			40, 58, 41, 61, 174, 40, 59, 41, 61, 174,
			40, 60, 41, 61, 32, 76, 69, 72, 52, 83,
			32, 68, 72, 65, 69, 206, 40, 61, 41, 61,
			32, 73, 89, 52, 75, 87, 85, 76, 218, 40,
			62, 41, 61, 32, 71, 82, 69, 89, 52, 84,
			69, 82, 32, 68, 72, 65, 69, 206, 40, 63,
			41, 61, 191, 40, 64, 41, 61, 32, 65, 69,
			54, 212, 40, 94, 41, 61, 32, 75, 65, 69,
			52, 82, 73, 88, 212, 93, 193
		};

		public static List<char> StressCharTable = new List<char> { '1', '2', '3', '4', '5', '6', '7', '8' };

		public static List<string> PhonemeNameTable = new List<string>
		{
			" *", ".*", "?*", ",*", "-*", "IY", "IH", "EH", "AE", "AA",
			"AH", "AO", "UH", "AX", "IX", "ER", "UX", "OH", "RX", "LX",
			"WX", "YX", "WH", "R*", "L*", "W*", "Y*", "M*", "N*", "NX",
			"DX", "Q*", "S*", "SH", "F*", "TH", "/H", "/X", "Z*", "ZH",
			"V*", "DH", "CH", "**", "J*", "**", "**", "**", "EY", "AY",
			"OY", "AW", "OW", "UW", "B*", "**", "**", "D*", "**", "**",
			"G*", "**", "**", "GX", "**", "**", "P*", "**", "**", "T*",
			"**", "**", "K*", "**", "**", "KX", "**", "**", "UL", "UM",
			"UN"
		};

		public static ushort[] PhonemeFlagsTable = new ushort[81]
		{
			32768, 49408, 49408, 49408, 49408, 164, 164, 164, 164, 164,
			164, 132, 132, 164, 164, 132, 132, 132, 132, 132,
			132, 132, 68, 4164, 4164, 4164, 4164, 2124, 3148, 2124,
			1096, 16460, 9280, 8256, 8256, 9280, 64, 64, 9284, 8260,
			8260, 9284, 8264, 8256, 76, 8260, 0, 0, 180, 180,
			180, 148, 148, 148, 78, 78, 78, 1102, 1102, 1102,
			78, 78, 78, 78, 78, 78, 75, 75, 75, 1099,
			1099, 1099, 75, 75, 75, 75, 75, 75, 128, 193,
			193
		};

		public static readonly int[] PhonemeFrequencyTable = new int[80]
		{
			0, 5980947, 5980947, 5980947, 5980947, 7230474, 6113550, 5980947, 5783320, 5842971,
			5712919, 5775125, 5383440, 5844244, 6113550, 4075794, 5383182, 5774866, 4076306, 7218453,
			5250317, 6112527, 5904395, 3944978, 7216654, 5904395, 7230217, 5320198, 7943686, 6641158,
			7943686, 5980945, 6506758, 6967046, 5315078, 7946758, 6113550, 5383440, 6107913, 6767114,
			4990984, 6106890, 6639366, 6639366, 7946758, 6639365, 7958022, 0, 5916691, 5777179,
			5775125, 5778203, 5774866, 5382669, 5315078, 5315078, 5315078, 7946758, 7950854, 7946758,
			7368198, 7237126, 7237126, 6181894, 6181894, 6181894, 5315078, 5315078, 5315078, 7946758,
			7946758, 7946758, 6647046, 6641162, 7367946, 6181894, 6181894, 6181894, 556844, 98067
		};

		public static readonly int[] PhonemeAmplitudesTable = new int[80]
		{
			0, 0, 0, 0, 0, 526861, 461581, 527630, 527887, 68879,
			68623, 3087, 68367, 2316, 461581, 330508, 68623, 3087, 396301, 67597,
			2061, 461838, 2061, 330252, 67597, 2061, 526861, 780, 2313, 198153,
			0, 0, 0, 0, 0, 0, 0, 0, 779, 66827,
			779, 1035, 0, 0, 1, 66827, 920064, 66050, 593422, 68879,
			3087, 68879, 3087, 2061, 2, 260, 0, 2, 260, 0,
			1, 260, 0, 1, 260, 0, 0, 0, 0, 0,
			0, 0, 0, 461324, 0, 0, 330240, 0, 1245199, 1048591
		};

		public static readonly short[] PhonemeLengthTable = new short[80]
		{
			0, 4626, 4626, 4626, 2056, 2824, 2312, 2824, 3592, 3851,
			2822, 4108, 3082, 1541, 1541, 3595, 3082, 3594, 3082, 2825,
			2056, 2055, 2825, 2567, 2310, 2056, 2054, 2055, 2055, 2055,
			770, 1285, 514, 514, 514, 514, 514, 514, 1542, 1542,
			2055, 1542, 1542, 514, 2312, 1027, 513, 286, 3597, 3852,
			3852, 3852, 3598, 3593, 2054, 513, 514, 1797, 513, 257,
			1798, 513, 514, 1798, 513, 514, 2056, 514, 514, 1540,
			514, 514, 1798, 513, 1028, 1798, 257, 1028, 1479, 1535
		};

		public static readonly short[] Sinus = new short[256]
		{
			0, 3, 6, 9, 12, 16, 19, 22, 25, 28,
			31, 34, 37, 40, 43, 46, 49, 51, 54, 57,
			60, 63, 65, 68, 71, 73, 76, 78, 81, 83,
			85, 88, 90, 92, 94, 96, 98, 100, 102, 104,
			106, 107, 109, 111, 112, 113, 115, 116, 117, 118,
			120, 121, 122, 122, 123, 124, 125, 125, 126, 126,
			126, 127, 127, 127, 127, 127, 127, 127, 126, 126,
			126, 125, 125, 124, 123, 122, 122, 121, 120, 118,
			117, 116, 115, 113, 112, 111, 109, 107, 106, 104,
			102, 100, 98, 96, 94, 92, 90, 88, 85, 83,
			81, 78, 76, 73, 71, 68, 65, 63, 60, 57,
			54, 51, 49, 46, 43, 40, 37, 34, 31, 28,
			25, 22, 19, 16, 12, 9, 6, 3, 0, -3,
			-6, -9, -12, -16, -19, -22, -25, -28, -31, -34,
			-37, -40, -43, -46, -49, -51, -54, -57, -60, -63,
			-65, -68, -71, -73, -76, -78, -81, -83, -85, -88,
			-90, -92, -94, -96, -98, -100, -102, -104, -106, -107,
			-109, -111, -112, -113, -115, -116, -117, -118, -120, -121,
			-122, -122, -123, -124, -125, -125, -126, -126, -126, -127,
			-127, -127, -127, -127, -127, -127, -126, -126, -126, -125,
			-125, -124, -123, -122, -122, -121, -120, -118, -117, -116,
			-115, -113, -112, -111, -109, -107, -106, -104, -102, -100,
			-98, -96, -94, -92, -90, -88, -85, -83, -81, -78,
			-76, -73, -71, -68, -65, -63, -60, -57, -54, -51,
			-49, -46, -43, -40, -37, -34, -31, -28, -25, -22,
			-19, -16, -12, -9, -6, -3
		};

		public static readonly int[,] TimeTable = new int[5, 5]
		{
			{ 162, 167, 167, 127, 128 },
			{ 226, 60, 60, 0, 0 },
			{ 225, 60, 59, 0, 0 },
			{ 200, 0, 0, 54, 55 },
			{ 199, 0, 0, 54, 54 }
		};

		public static readonly int[] BlendRank = new int[80]
		{
			0, 31, 31, 31, 31, 2, 2, 2, 2, 2,
			2, 2, 2, 2, 5, 5, 2, 10, 2, 8,
			5, 5, 11, 10, 9, 8, 8, 160, 8, 8,
			23, 31, 18, 18, 18, 18, 30, 30, 20, 20,
			20, 20, 23, 23, 26, 26, 29, 29, 2, 2,
			2, 2, 2, 2, 26, 29, 27, 26, 29, 27,
			26, 29, 27, 26, 29, 27, 23, 29, 23, 23,
			29, 23, 23, 29, 23, 23, 29, 23, 23, 23
		};

		public static readonly int[] InBlend = new int[80]
		{
			0, 2, 2, 2, 2, 4, 4, 4, 4, 4,
			4, 4, 4, 4, 4, 4, 4, 4, 3, 3,
			4, 4, 3, 3, 3, 3, 3, 1, 2, 3,
			2, 1, 3, 3, 3, 3, 1, 1, 3, 3,
			3, 2, 2, 3, 2, 3, 0, 0, 5, 5,
			5, 5, 4, 4, 2, 0, 2, 2, 0, 3,
			2, 0, 4, 2, 0, 3, 2, 0, 2, 2,
			0, 2, 3, 0, 3, 3, 0, 3, 176, 160
		};

		public static readonly int[] OutBlend = new int[80]
		{
			0, 2, 2, 2, 2, 4, 4, 4, 4, 4,
			4, 4, 4, 4, 4, 4, 4, 4, 3, 2,
			4, 4, 2, 2, 2, 2, 2, 1, 1, 1,
			1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
			2, 1, 0, 1, 0, 1, 0, 5, 5, 5,
			5, 5, 4, 4, 2, 0, 1, 2, 0, 1,
			2, 0, 1, 2, 0, 1, 2, 0, 2, 2,
			0, 1, 3, 0, 2, 3, 0, 2, 160, 160
		};

		public static readonly int[] Tab1 = new int[108]
		{
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 2, 2, 2, 2, 2, 2, 130,
			0, 0, 2, 2, 2, 2, 2, 2, 3, 3,
			3, 3, 3, 3, 3, 3, 3, 3, 2, 2,
			2, 2, 2, 2, 2, 192, 168, 176, 172, 192,
			160, 184, 160, 192, 188, 160, 172, 168, 172, 192,
			160, 160, 172, 180, 164, 192, 168, 168, 176, 192,
			188, 0, 0, 0, 2, 0, 32, 32, 155, 32,
			192, 185, 32, 205, 163, 76, 138, 142
		};

		public static readonly int[] Tab2 = new int[26]
		{
			0, 149, 247, 162, 57, 197, 6, 126, 199, 38,
			55, 78, 145, 241, 85, 161, 254, 36, 69, 45,
			167, 54, 83, 46, 71, 218
		};

		public static readonly int[] Tab3 = new int[26]
		{
			125, 126, 126, 127, 128, 129, 130, 130, 130, 132,
			132, 132, 132, 132, 133, 135, 135, 136, 136, 137,
			138, 139, 139, 140, 140, 140
		};

		public static readonly int[] Tab4 = new int[11]
		{
			0, 0, 224, 230, 236, 243, 249, 0, 6, 12,
			6
		};

		public static readonly int[] Tab5 = new int[5] { 24, 26, 23, 23, 23 };

		public static readonly int[] AmplitudeRescale = new int[17]
		{
			0, 1, 2, 2, 2, 3, 3, 4, 4, 5,
			6, 8, 9, 11, 13, 15, 0
		};

		public static readonly int[] SampledConsonantFlags = new int[80]
		{
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 241, 226, 211, 187, 124, 149, 1, 2,
			3, 3, 0, 114, 0, 2, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 27, 0, 0,
			25, 0, 0, 0, 0, 0, 0, 0, 0, 0
		};

		public static readonly int[] SampleTable = new int[1280]
		{
			56, 132, 107, 25, 198, 99, 24, 134, 115, 152,
			198, 177, 28, 202, 49, 140, 199, 49, 136, 194,
			48, 152, 70, 49, 24, 198, 53, 12, 202, 49,
			12, 198, 33, 16, 36, 105, 18, 194, 49, 20,
			196, 113, 8, 74, 34, 73, 171, 106, 168, 172,
			73, 81, 50, 213, 82, 136, 147, 108, 148, 34,
			21, 84, 210, 37, 150, 212, 80, 165, 70, 33,
			8, 133, 107, 24, 196, 99, 16, 206, 107, 24,
			140, 113, 25, 140, 99, 53, 12, 198, 51, 153,
			204, 108, 181, 78, 162, 153, 70, 33, 40, 130,
			149, 46, 227, 48, 156, 197, 48, 156, 162, 177,
			156, 103, 49, 136, 102, 89, 44, 83, 24, 132,
			103, 80, 202, 227, 10, 172, 171, 48, 172, 98,
			48, 140, 99, 16, 148, 98, 177, 140, 130, 40,
			150, 51, 152, 214, 181, 76, 98, 41, 165, 74,
			181, 156, 198, 49, 20, 214, 56, 156, 75, 180,
			134, 101, 24, 174, 103, 28, 166, 99, 25, 150,
			35, 25, 132, 19, 8, 166, 82, 172, 202, 34,
			137, 110, 171, 25, 140, 98, 52, 196, 98, 25,
			134, 99, 24, 196, 35, 88, 214, 163, 80, 66,
			84, 74, 173, 74, 37, 17, 107, 100, 137, 74,
			99, 57, 138, 35, 49, 42, 234, 162, 169, 68,
			197, 18, 205, 66, 52, 140, 98, 24, 140, 99,
			17, 72, 102, 49, 157, 68, 51, 29, 70, 49,
			156, 198, 177, 12, 205, 50, 136, 196, 115, 24,
			134, 115, 8, 214, 99, 88, 7, 129, 224, 240,
			60, 7, 135, 144, 60, 124, 15, 199, 192, 192,
			240, 124, 30, 7, 128, 128, 0, 28, 120, 112,
			241, 199, 31, 192, 12, 254, 28, 31, 31, 14,
			10, 122, 192, 113, 242, 131, 143, 3, 15, 15,
			12, 0, 121, 248, 97, 224, 67, 15, 131, 231,
			24, 249, 193, 19, 218, 233, 99, 143, 15, 131,
			131, 135, 195, 31, 60, 112, 240, 225, 225, 227,
			135, 184, 113, 14, 32, 227, 141, 72, 120, 28,
			147, 135, 48, 225, 193, 193, 228, 120, 33, 131,
			131, 195, 135, 6, 57, 229, 195, 135, 7, 14,
			28, 28, 112, 244, 113, 156, 96, 54, 50, 195,
			30, 60, 243, 143, 14, 60, 112, 227, 199, 143,
			15, 15, 14, 60, 120, 240, 227, 135, 6, 240,
			227, 7, 193, 153, 135, 15, 24, 120, 112, 112,
			252, 243, 16, 177, 140, 140, 49, 124, 112, 225,
			134, 60, 100, 108, 176, 225, 227, 15, 35, 143,
			15, 30, 62, 56, 60, 56, 123, 143, 7, 14,
			60, 244, 23, 30, 60, 120, 242, 158, 114, 73,
			227, 37, 54, 56, 88, 57, 226, 222, 60, 120,
			120, 225, 199, 97, 225, 225, 176, 240, 240, 195,
			199, 14, 56, 192, 240, 206, 115, 115, 24, 52,
			176, 225, 199, 142, 28, 60, 248, 56, 240, 225,
			193, 139, 134, 143, 28, 120, 112, 240, 120, 172,
			177, 143, 57, 49, 219, 56, 97, 195, 14, 14,
			56, 120, 115, 23, 30, 57, 30, 56, 100, 225,
			241, 193, 78, 15, 64, 162, 2, 197, 143, 129,
			161, 252, 18, 8, 100, 224, 60, 34, 224, 69,
			7, 142, 12, 50, 144, 240, 31, 32, 73, 224,
			248, 12, 96, 240, 23, 26, 65, 170, 164, 208,
			141, 18, 130, 30, 30, 3, 248, 62, 3, 12,
			115, 128, 112, 68, 38, 3, 36, 225, 62, 4,
			78, 4, 28, 193, 9, 204, 158, 144, 33, 7,
			144, 67, 100, 192, 15, 198, 144, 156, 193, 91,
			3, 226, 29, 129, 224, 94, 29, 3, 132, 184,
			44, 15, 128, 177, 131, 224, 48, 65, 30, 67,
			137, 131, 80, 252, 36, 46, 19, 131, 241, 124,
			76, 44, 201, 13, 131, 176, 181, 130, 228, 232,
			6, 156, 7, 160, 153, 29, 7, 62, 130, 143,
			112, 48, 116, 64, 202, 16, 228, 232, 15, 146,
			20, 63, 6, 248, 132, 136, 67, 129, 10, 52,
			57, 65, 198, 227, 28, 71, 3, 176, 184, 19,
			10, 194, 100, 248, 24, 249, 96, 179, 192, 101,
			32, 96, 166, 140, 195, 129, 32, 48, 38, 30,
			28, 56, 211, 1, 176, 38, 64, 244, 11, 195,
			66, 31, 133, 50, 38, 96, 64, 201, 203, 1,
			236, 17, 40, 64, 250, 4, 52, 224, 112, 76,
			140, 29, 7, 105, 3, 22, 200, 4, 35, 232,
			198, 154, 11, 26, 3, 224, 118, 6, 5, 207,
			30, 188, 88, 49, 113, 102, 0, 248, 63, 4,
			252, 12, 116, 39, 138, 128, 113, 194, 58, 38,
			6, 192, 31, 5, 15, 152, 64, 174, 1, 127,
			192, 7, 255, 0, 14, 254, 0, 3, 223, 128,
			3, 239, 128, 27, 241, 194, 0, 231, 224, 24,
			252, 224, 33, 252, 128, 60, 252, 64, 14, 126,
			0, 63, 62, 0, 15, 254, 0, 31, 255, 0,
			62, 240, 7, 252, 0, 126, 16, 63, 255, 0,
			63, 56, 14, 124, 1, 135, 12, 252, 199, 0,
			62, 4, 15, 62, 31, 15, 15, 31, 15, 2,
			131, 135, 207, 3, 135, 15, 63, 192, 7, 158,
			96, 63, 192, 3, 254, 0, 63, 224, 119, 225,
			192, 254, 224, 195, 224, 1, 223, 248, 3, 7,
			0, 126, 112, 0, 124, 56, 24, 254, 12, 30,
			120, 28, 124, 62, 14, 31, 30, 30, 62, 0,
			127, 131, 7, 219, 135, 131, 7, 199, 7, 16,
			113, 255, 0, 63, 226, 1, 224, 193, 195, 225,
			0, 127, 192, 5, 240, 32, 248, 240, 112, 254,
			120, 121, 248, 2, 63, 12, 143, 3, 15, 159,
			224, 193, 199, 135, 3, 195, 195, 176, 225, 225,
			193, 227, 224, 113, 240, 0, 252, 112, 124, 12,
			62, 56, 14, 28, 112, 195, 199, 3, 129, 193,
			199, 231, 0, 15, 199, 135, 25, 9, 239, 196,
			51, 224, 193, 252, 248, 112, 240, 120, 248, 240,
			97, 199, 0, 31, 248, 1, 124, 248, 240, 120,
			112, 60, 124, 206, 14, 33, 131, 207, 8, 7,
			143, 8, 193, 135, 143, 128, 199, 227, 0, 7,
			248, 224, 239, 0, 57, 247, 128, 14, 248, 225,
			227, 248, 33, 159, 192, 255, 3, 248, 7, 192,
			31, 248, 196, 4, 252, 196, 193, 188, 135, 240,
			15, 192, 127, 5, 224, 37, 236, 192, 62, 132,
			71, 240, 142, 3, 248, 3, 251, 192, 25, 248,
			7, 156, 12, 23, 248, 7, 224, 31, 161, 252,
			15, 252, 1, 240, 63, 0, 254, 3, 240, 31,
			0, 253, 0, 255, 136, 13, 249, 1, 255, 0,
			112, 7, 192, 62, 66, 243, 13, 196, 127, 128,
			252, 7, 240, 94, 192, 63, 0, 120, 63, 129,
			255, 1, 248, 1, 195, 232, 12, 228, 100, 8,
			228, 15, 240, 7, 240, 194, 31, 0, 127, 192,
			111, 128, 126, 3, 248, 7, 240, 63, 192, 120,
			15, 130, 7, 254, 34, 119, 112, 2, 118, 3,
			254, 0, 254, 103, 0, 124, 199, 241, 142, 198,
			59, 224, 63, 132, 243, 25, 216, 3, 153, 252,
			9, 184, 15, 248, 0, 157, 36, 97, 249, 13,
			0, 253, 3, 240, 31, 144, 63, 1, 248, 31,
			208, 15, 248, 55, 1, 248, 7, 240, 15, 192,
			63, 0, 254, 3, 248, 15, 192, 63, 0, 250,
			3, 240, 15, 128, 255, 1, 184, 7, 240, 1,
			252, 1, 188, 128, 19, 30, 0, 127, 225, 64,
			127, 160, 127, 176, 0, 63, 192, 31, 192, 56,
			15, 240, 31, 128, 255, 1, 252, 3, 241, 126,
			1, 254, 1, 240, 255, 0, 127, 192, 29, 7,
			240, 15, 192, 126, 6, 224, 7, 224, 15, 248,
			6, 193, 254, 1, 252, 3, 224, 15, 0, 252
		};

		public static int FullMatch(char sign1, char sign2)
		{
			string sum = sign1.ToString() + sign2;
			return PhonemeNameTable.FindIndex((string value) => value == sum && value[1] != '*');
		}

		public static int WildMatch(char sign)
		{
			return PhonemeNameTable.IndexOf(sign + "*");
		}

		public static bool HasFlag(int phoneme, ushort flag)
		{
			return (PhonemeFlagsTable[phoneme] & flag) != 0;
		}
	}
	public class Legacy
	{
		public Sam Sam;

		private int A;

		private int X;

		private int Y;

		private int[] temp;

		public int[] StressOutput = new int[256];

		public int[] LengthOutput = new int[256];

		public int[] IndexOutput = new int[256];

		private int[] pitches = new int[256];

		private int[] sampledConsonantFlag = new int[256];

		private int[,] frequency = new int[3, 256];

		private int[,] amplitude = new int[3, 256];

		private int mem39;

		private int mem44;

		private int mem47;

		private int mem49;

		private int mem50;

		private int mem51;

		private int mem53;

		private int mem56;

		public Legacy(Sam sam)
		{
			Sam = sam;
		}

		public static void Inc(ref int value)
		{
			value = ++value & 0xFF;
		}

		public static void Dec(ref int value)
		{
			value = --value & 0xFF;
		}

		public bool Text2Phonemes(ref int[] input)
		{
			int value = 255;
			int value2 = 255;
			int num = 0;
			temp = new int[256];
			temp[0] = 32;
			X = 1;
			Y = 0;
			do
			{
				A = input[Y] & 0x7F;
				if (A >= 112)
				{
					A &= 95;
				}
				else if (A >= 96)
				{
					A &= 79;
				}
				temp[X] = A;
				Inc(ref X);
				Inc(ref Y);
			}
			while (Y != 255);
			A = 255;
			X = 255;
			temp[X] = 27;
			while (true)
			{
				Inc(ref value2);
				X = value2;
				if (X < temp.Length)
				{
					num = (A = temp[X]);
					if (A == 91)
					{
						Inc(ref value);
						X = value;
						A = 155;
						input[X] = 155;
						Inc(ref X);
						int[] array = new int[X];
						Array.Copy(input, array, X);
						input = array;
						return true;
					}
					if (A == 46)
					{
						Inc(ref X);
						Y = temp[X];
						A = Constants.Tab1[Y] & 1;
						if (A == 0)
						{
							Inc(ref value);
							X = value;
							input[X] = 46;
							continue;
						}
					}
				}
				A = num;
				Y = A;
				A = Constants.Tab1[A];
				int a = A;
				int num2;
				if (((uint)A & 2u) != 0)
				{
					num2 = 37541;
				}
				else
				{
					A = a;
					if (A == 0)
					{
						A = 32;
						if (X >= temp.Length)
						{
							return true;
						}
						temp[X] = 32;
						Inc(ref value);
						X = value;
						if (X <= 120)
						{
							input[X] = A;
							continue;
						}
						input[X] = 155;
						A = value2;
						return true;
					}
					A = a & 0x80;
					if (A == 0)
					{
						break;
					}
					X = num - 65;
					num2 = Constants.Tab2[X] | (Constants.Tab3[X] << 8);
				}
				int x;
				while (true)
				{
					IL_0377:
					Y = 0;
					do
					{
						num2++;
						A = GetRuleByte(num2, Y);
					}
					while ((A & 0x80) == 0);
					Inc(ref Y);
					while (true)
					{
						A = GetRuleByte(num2, Y);
						if (A == 40)
						{
							break;
						}
						Inc(ref Y);
					}
					int value3 = Y;
					do
					{
						Inc(ref Y);
						A = GetRuleByte(num2, Y);
					}
					while (A != 41);
					int y = Y;
					do
					{
						Inc(ref Y);
						A = GetRuleByte(num2, Y);
						A &= 127;
					}
					while (A != 61);
					num = Y;
					X = value2;
					x = X;
					Y = value3;
					Inc(ref Y);
					while (true)
					{
						a = temp[X];
						A = GetRuleByte(num2, Y);
						if (A != a)
						{
							break;
						}
						Inc(ref Y);
						if (Y == y)
						{
							goto IL_051b;
						}
						Inc(ref X);
						x = X;
					}
					continue;
					IL_051b:
					A = value2;
					int num3 = value2;
					while (true)
					{
						Dec(ref value3);
						Y = value3;
						A = GetRuleByte(num2, Y);
						a = A;
						if (((uint)A & 0x80u) != 0)
						{
							break;
						}
						X = A & 0x7F;
						A = Constants.Tab1[X] & 0x80;
						if (A != 0)
						{
							X = num3 - 1;
							A = temp[X];
							if (A != a)
							{
								goto IL_0377;
							}
							num3 = X;
							continue;
						}
						A = a;
						if (A != 32)
						{
							if (A != 35)
							{
								if (A != 46)
								{
									if (A != 38)
									{
										if (A != 64)
										{
											if (A != 94)
											{
												if (A != 43)
												{
													if (A != 58)
													{
														return false;
													}
													while (true)
													{
														UnknownCode1(num3);
														A &= 32;
														if (A == 0)
														{
															break;
														}
														num3 = X;
													}
													continue;
												}
												X = num3;
												Dec(ref X);
												A = temp[X];
												if (A != 69 && A != 73 && A != 89)
												{
													goto IL_0377;
												}
											}
											else
											{
												UnknownCode1(num3);
												A &= 32;
												if (A == 0)
												{
													goto IL_0377;
												}
											}
											num3 = X;
											continue;
										}
										UnknownCode1(num3);
										A &= 4;
										if (A == 0)
										{
											A = temp[X];
											if (A != 72 || (A != 84 && A != 67 && A != 83))
											{
												goto IL_0377;
											}
											num3 = X;
											continue;
										}
									}
									else
									{
										UnknownCode1(num3);
										A &= 16;
										if (A == 0)
										{
											A = temp[X];
											if (A != 72)
											{
												goto IL_0377;
											}
											Dec(ref X);
											A = temp[X];
											if (A != 67 && A != 83)
											{
												goto IL_0377;
											}
										}
									}
								}
								else
								{
									UnknownCode1(num3);
									A &= 8;
									if (A == 0)
									{
										goto IL_0377;
									}
								}
								num3 = X;
								continue;
							}
							UnknownCode1(num3);
							A &= 64;
							if (A == 0)
							{
								goto IL_0377;
							}
						}
						else
						{
							UnknownCode1(num3);
							A &= 128;
							if (A != 0)
							{
								goto IL_0377;
							}
						}
						num3 = X;
					}
					A = x;
					int num4 = A;
					while (true)
					{
						Y = y + 1;
						if (Y == num)
						{
							break;
						}
						y = Y;
						A = GetRuleByte(num2, Y);
						a = A;
						X = A;
						A = Constants.Tab1[X] & 0x80;
						if (A != 0)
						{
							X = num4 + 1;
							A = temp[X];
							if (A != a)
							{
								goto IL_0377;
							}
							num4 = X;
							continue;
						}
						A = a;
						if (A != 32)
						{
							if (A != 35)
							{
								if (A != 46)
								{
									if (A != 38)
									{
										if (A != 64)
										{
											if (A != 94)
											{
												if (A != 43)
												{
													if (A != 58)
													{
														if (A == 37 || A == 37)
														{
															X = num4 + 1;
															A = temp[X];
															if (A == 69)
															{
																Inc(ref X);
																Y = temp[X];
																Dec(ref X);
																A = Constants.Tab1[Y] & 0x80;
																if (A != 0)
																{
																	Inc(ref X);
																	A = temp[X];
																	if (A != 82 && A != 83 && A != 68)
																	{
																		if (A == 76)
																		{
																			Inc(ref X);
																			A = temp[X];
																			if (A != 89)
																			{
																				goto IL_0377;
																			}
																		}
																		else
																		{
																			if (A != 70)
																			{
																				goto IL_0377;
																			}
																			Inc(ref X);
																			A = temp[X];
																			if (A != 85)
																			{
																				goto IL_0377;
																			}
																			Inc(ref X);
																			A = temp[X];
																			if (A != 76)
																			{
																				goto IL_0377;
																			}
																		}
																	}
																}
															}
															else
															{
																if (A != 73)
																{
																	goto IL_0377;
																}
																Inc(ref X);
																A = temp[X];
																if (A != 78)
																{
																	goto IL_0377;
																}
																Inc(ref X);
																A = temp[X];
																if (A != 71)
																{
																	goto IL_0377;
																}
															}
															num4 = X;
															continue;
														}
														return false;
													}
													while (true)
													{
														UnknownCode2(num4);
														A &= 32;
														if (A == 0)
														{
															break;
														}
														num4 = X;
													}
													continue;
												}
												X = num4;
												Inc(ref X);
												A = temp[X];
												if (A != 69 && A != 73 && A != 89)
												{
													goto IL_0377;
												}
											}
											else
											{
												UnknownCode2(num4);
												A &= 32;
												if (A == 0)
												{
													goto IL_0377;
												}
											}
											num4 = X;
											continue;
										}
										UnknownCode2(num4);
										A &= 4;
										if (A == 0)
										{
											A = temp[X];
											if (A != 72 || (A != 84 && A != 67 && A != 83))
											{
												goto IL_0377;
											}
											num4 = X;
											continue;
										}
									}
									else
									{
										UnknownCode2(num4);
										A &= 16;
										if (A == 0)
										{
											A = temp[X];
											if (A != 72)
											{
												goto IL_0377;
											}
											Inc(ref X);
											A = temp[X];
											if (A != 67 && A != 83)
											{
												goto IL_0377;
											}
										}
									}
								}
								else
								{
									UnknownCode2(num4);
									A &= 8;
									if (A == 0)
									{
										goto IL_0377;
									}
								}
								num4 = X;
								continue;
							}
							UnknownCode2(num4);
							A &= 64;
							if (A == 0)
							{
								goto IL_0377;
							}
						}
						else
						{
							UnknownCode2(num4);
							A &= 128;
							if (A != 0)
							{
								goto IL_0377;
							}
						}
						num4 = X;
					}
					break;
				}
				Y = num;
				value2 = x;
				while (true)
				{
					A = GetRuleByte(num2, Y);
					a = A;
					A &= 127;
					if (A != 61)
					{
						Inc(ref value);
						X = value;
						input[X] = A;
					}
					if (((uint)a & 0x80u) != 0)
					{
						break;
					}
					Inc(ref Y);
				}
			}
			return false;
			static int GetRuleByte(int mem62, int Y)
			{
				return (mem62 >= 37541) ? Constants.RulesSet2[mem62 - 37541 + Y] : Constants.RulesSet1[mem62 - 32000 + Y];
			}
			void UnknownCode1(int mem59)
			{
				A = Constants.Tab1[Y = temp[X = mem59 - 1]];
			}
			void UnknownCode2(int mem58)
			{
				X = mem58;
				Inc(ref X);
				A = Constants.Tab1[Y = temp[X]];
			}
		}

		private void AddInflection(int mem48, int phase1)
		{
			int num = (mem49 = (A = X));
			A -= 30;
			if (num <= 30)
			{
				A = 0;
			}
			X = A;
			while ((A = pitches[X]) == 127)
			{
				Inc(ref X);
			}
			while (true)
			{
				pitches[X] = (phase1 = (A + mem48) & 0xFF);
				do
				{
					Inc(ref X);
					if (X == mem49)
					{
						return;
					}
				}
				while (pitches[X] == 255);
				A = phase1;
			}
		}

		private void RenderSample(ref int mem66)
		{
			int num = 0;
			mem49 = Y;
			A = mem39 & 7;
			mem53 = Constants.Tab5[mem47 = (mem56 = (X = A - 1))];
			A = mem39 & 0xF8;
			if (A == 0)
			{
				A = pitches[mem49] >> 4;
				int value = A ^ 0xFF;
				Y = mem66;
				do
				{
					mem56 = 8;
					A = Constants.SampleTable[mem47 * 256 + Y];
					do
					{
						num = A;
						A <<= 1;
						if (((uint)num & 0x80u) != 0)
						{
							Sam.Buffer.Write(3, 160);
						}
						else
						{
							Sam.Buffer.Write(4, 96);
						}
						Dec(ref mem56);
					}
					while (mem56 != 0);
					Inc(ref Y);
					Inc(ref value);
				}
				while (value != 0);
				A = 1;
				mem44 = 1;
				mem66 = Y;
				Y = mem49;
				return;
			}
			Y = A ^ 0xFF;
			do
			{
				mem56 = 8;
				A = Constants.SampleTable[mem47 * 256 + Y];
				do
				{
					num = A;
					A <<= 1;
					if ((num & 0x80) == 0)
					{
						X = mem53;
						Sam.Buffer.Write(1, (X & 0xF) * 16);
						if (X != 0)
						{
							goto IL_0136;
						}
					}
					Sam.Buffer.Write(2, 80);
					goto IL_0136;
					IL_0136:
					X = 0;
					Dec(ref mem56);
				}
				while (mem56 != 0);
				Inc(ref Y);
			}
			while (Y != 0);
			mem44 = 1;
			Y = mem49;
		}

		public void Render()
		{
			int num = 0;
			int mem = 0;
			if (IndexOutput[0] == 255)
			{
				return;
			}
			A = (X = (mem44 = 0));
			int num2;
			int value2;
			do
			{
				mem56 = (A = IndexOutput[Y = mem44]);
				if (A == 255)
				{
					break;
				}
				if (A == 1)
				{
					AddInflection(num2 = (A = 1), num);
				}
				if (A == 2)
				{
					AddInflection(num2 = 255, num);
				}
				num = Constants.Tab4[StressOutput[Y] + 1];
				value2 = LengthOutput[Y];
				Y = mem56;
				do
				{
					pitches[X] = Sam.Pitch + num;
					sampledConsonantFlag[X] = Constants.SampledConsonantFlags[Y];
					frequency[0, X] = Constants.PhonemeFrequencyTable[Y] & 0xFF;
					frequency[1, X] = (Constants.PhonemeFrequencyTable[Y] >> 8) & 0xFF;
					frequency[2, X] = (Constants.PhonemeFrequencyTable[Y] >> 16) & 0xFF;
					amplitude[0, X] = Constants.PhonemeAmplitudesTable[Y] & 0xFF;
					amplitude[1, X] = (Constants.PhonemeAmplitudesTable[Y] >> 8) & 0xFF;
					amplitude[2, X] = (Constants.PhonemeAmplitudesTable[Y] >> 16) & 0xFF;
					Inc(ref X);
					Dec(ref value2);
				}
				while (value2 != 0);
				Inc(ref mem44);
			}
			while (mem44 != 0);
			X = (mem44 = (mem49 = 0));
			int num3;
			int a;
			int num4;
			while (true)
			{
				Y = IndexOutput[X];
				A = IndexOutput[X + 1];
				if (A == 255)
				{
					break;
				}
				mem56 = Constants.BlendRank[X = A];
				A = Constants.BlendRank[Y];
				if (A == mem56)
				{
					num = Constants.OutBlend[Y];
					value2 = Constants.OutBlend[X];
				}
				else if (A < mem56)
				{
					num = Constants.InBlend[X];
					value2 = Constants.OutBlend[X];
				}
				else
				{
					num = Constants.OutBlend[Y];
					value2 = Constants.InBlend[Y];
				}
				Y = mem44;
				mem49 = (A = mem49 + LengthOutput[mem44]);
				A += value2;
				a = A;
				mem47 = 168;
				num3 = mem49 - num;
				num4 = (A = num + value2);
				X = A - 2;
				if ((X & 0x80) == 0)
				{
					do
					{
						int num5 = num4;
						if (mem47 == 168)
						{
							int num6 = LengthOutput[mem44] >> 1;
							int num7 = LengthOutput[mem44 + 1] >> 1;
							num5 = num6 + num7;
							num7 += mem49;
							num6 = mem49 - num6;
							A = Read(mem47, num7);
							Y = num6;
							mem53 = A - Read(mem47, num6);
						}
						else
						{
							A = Read(mem47, a);
							Y = num3;
							mem53 = A - Read(mem47, num3);
						}
						mem50 = mem53 & 0x80;
						int num8 = Mathf.Abs(mem53);
						mem51 = num8 % num5;
						mem53 /= num5;
						X = num5;
						Y = num3;
						mem56 = 0;
						while (true)
						{
							num2 = (A = Read(mem47, Y) + mem53);
							Inc(ref Y);
							Dec(ref X);
							if (X == 0)
							{
								break;
							}
							mem56 += mem51;
							if (mem56 >= num5)
							{
								mem56 -= num5;
								if ((mem50 & 0x80) == 0)
								{
									if (num2 != 0)
									{
										Inc(ref num2);
									}
								}
								else
								{
									Dec(ref num2);
								}
							}
							Write(mem47, Y, num2);
						}
						Inc(ref mem47);
					}
					while (mem47 != 175);
				}
				Inc(ref mem44);
				X = mem44;
			}
			num2 = mem49 + LengthOutput[mem44];
			for (int i = 0; i < 256; i++)
			{
				pitches[i] -= frequency[0, i] >> 1;
			}
			num = (value2 = (num3 = (mem49 = 0)));
			a = 72;
			for (int num9 = 255; num9 >= 0; num9--)
			{
				amplitude[0, num9] = Constants.AmplitudeRescale[amplitude[0, num9]];
				amplitude[1, num9] = Constants.AmplitudeRescale[amplitude[1, num9]];
				amplitude[2, num9] = Constants.AmplitudeRescale[amplitude[2, num9]];
			}
			Y = 0;
			mem44 = (A = (X = pitches[0]));
			num4 = A - (A >> 2);
			bool flag = false;
			while (true)
			{
				mem39 = (A = sampledConsonantFlag[Y]);
				A &= 248;
				if (A != 0)
				{
					RenderSample(ref mem);
					Y += 2;
					num2 -= 2;
				}
				else
				{
					int[] array = new int[5];
					int num10 = num * 256;
					int num11 = value2 * 256;
					int num12 = num3 * 256;
					for (int j = 0; j < 5; j++)
					{
						int num13 = Constants.Sinus[0xFF & (num10 >> 8)];
						int num14 = Constants.Sinus[0xFF & (num11 >> 8)];
						int num15 = ((((num12 >> 8) & 0xFF) <= 127) ? 144 : 112);
						int num16 = num13 * (amplitude[0, Y] & 0xF);
						int num17 = num14 * (amplitude[1, Y] & 0xF);
						int num18 = num15 * (amplitude[2, Y] & 0xF);
						array[j] = ((num16 + num17 + num18) / 32 + 128) & 0xFF;
						num10 += frequency[0, Y] * 64;
						num11 += frequency[1, Y] * 64;
						num12 += frequency[2, Y] * 64;
					}
					Sam.Buffer.WriteArray(0, array);
					Dec(ref a);
					if (a != 0)
					{
						goto IL_0953;
					}
					Inc(ref Y);
					Dec(ref num2);
				}
				if (num2 == 0)
				{
					break;
				}
				a = Sam.Speed;
				goto IL_0953;
				IL_0953:
				Dec(ref mem44);
				while (true)
				{
					if (mem44 == 0 || flag)
					{
						flag = false;
						mem44 = (A = pitches[Y]);
						num4 = (A -= A >> 2);
						num = (value2 = (num3 = 0));
						break;
					}
					Dec(ref num4);
					if (num4 != 0 || mem39 == 0)
					{
						num = (num + frequency[0, Y]) & 0xFF;
						value2 = (value2 + frequency[1, Y]) & 0xFF;
						num3 = (num3 + frequency[2, Y]) & 0xFF;
						break;
					}
					RenderSample(ref mem);
					flag = true;
				}
			}
			int Read(int type, int index)
			{
				if (1 == 0)
				{
				}
				int result = type switch
				{
					168 => pitches[index], 
					169 => frequency[0, index], 
					170 => frequency[1, index], 
					171 => frequency[2, index], 
					172 => amplitude[0, index], 
					173 => amplitude[1, index], 
					174 => amplitude[2, index], 
					_ => 0, 
				};
				if (1 == 0)
				{
				}
				return result;
			}
			void Write(int type, int index, int value)
			{
				switch (type)
				{
				case 168:
					pitches[Y] = value;
					break;
				case 169:
					frequency[0, Y] = value;
					break;
				case 170:
					frequency[1, Y] = value;
					break;
				case 171:
					frequency[2, Y] = value;
					break;
				case 172:
					amplitude[0, Y] = value;
					break;
				case 173:
					amplitude[1, Y] = value;
					break;
				case 174:
					amplitude[2, Y] = value;
					break;
				}
			}
		}
	}
	public class Sam
	{
		private int[] input = new int[256];

		private int[] phonemeStress = new int[256];

		private int[] phonemeLength = new int[256];

		private int[] phonemeIndex = new int[256];

		public int Speed;

		public int Pitch;

		public int Mouth;

		public int Throat;

		public Buffer Buffer;

		public Legacy Legacy;

		public Sam(int speed = 64, int pitch = 64, int mouth = 128, int throat = 128)
		{
			Speed = speed;
			Pitch = pitch;
			Mouth = mouth;
			Throat = throat;
			Legacy = new Legacy(this);
		}

		public string Cyrillic2Latin(string text)
		{
			StringBuilder stringBuilder = new StringBuilder();
			char c = ' ';
			foreach (char c2 in text)
			{
				if (c2 == 'Е' && (c == ' ' || c == 'Ъ' || c == 'Ь'))
				{
					stringBuilder.Append("YE");
				}
				else if (Constants.ISO9.ContainsKey(c2))
				{
					stringBuilder.Append(Constants.ISO9[c2]);
				}
				else
				{
					stringBuilder.Append(c2);
				}
				c = c2;
			}
			return stringBuilder.ToString();
		}

		public void Text2Phonemes(string text, out int[] output)
		{
			byte[] bytes = Encoding.UTF8.GetBytes(Cyrillic2Latin(text.ToUpper()));
			output = new int[256];
			for (int i = 0; i < bytes.Length; i++)
			{
				output[i] = bytes[i];
			}
			Legacy.Text2Phonemes(ref output);
		}

		public void SetInput(int[] input)
		{
			int num = Mathf.Min(input.Length, 254);
			for (int i = 0; i < num; i++)
			{
				this.input[i] = input[i];
			}
			this.input[num] = 255;
			this.input[255] = 255;
		}

		public void Insert(int pos, int phoneme, int length = 0, int stress = -1)
		{
			for (int num = 253; num >= pos; num--)
			{
				phonemeIndex[num + 1] = phonemeIndex[num];
				phonemeLength[num + 1] = phonemeLength[num];
				phonemeStress[num + 1] = phonemeStress[num];
			}
			phonemeIndex[pos] = phoneme;
			phonemeLength[pos] = length;
			phonemeStress[pos] = ((stress == -1) ? phonemeStress[pos - 1] : stress);
		}

		public Buffer GetBuffer()
		{
			for (int i = 0; i < 256; i++)
			{
				phonemeStress[i] = (phonemeLength[i] = 0);
			}
			if (!ParsePhonemes())
			{
				return null;
			}
			RewritePhonemes();
			SetPhonemeLength();
			InsertPauses();
			PrepareOutput();
			return Buffer;
		}

		public bool ParsePhonemes()
		{
			int num = 0;
			for (int i = 0; i < input.Length; i++)
			{
				char c = (char)input[i];
				char sign = (char)((i == input.Length - 1) ? 32u : ((uint)input[i + 1]));
				if (c == '\u009b')
				{
					phonemeIndex[num++] = 255;
					return true;
				}
				int num2 = Constants.FullMatch(c, sign);
				if (num2 != -1)
				{
					i++;
					phonemeIndex[num++] = num2;
					continue;
				}
				num2 = Constants.WildMatch(c);
				if (num2 != -1)
				{
					phonemeIndex[num++] = num2;
					continue;
				}
				num2 = Constants.StressCharTable.IndexOf(c);
				if (num2 != -1)
				{
					phonemeStress[num - 1] = num2 + 1;
					continue;
				}
				return false;
			}
			phonemeIndex[255] = 255;
			return true;
		}

		public void RewritePhonemes()
		{
			int num = 0;
			int num2;
			while ((num2 = phonemeIndex[++num]) != 255)
			{
				if (num2 == 0)
				{
					continue;
				}
				if (Constants.HasFlag(num2, 16))
				{
					Insert(num + 1, Constants.HasFlag(num2, 32) ? 21 : 20);
					HandleUW_CH_J(num2, num);
					continue;
				}
				switch (num2)
				{
				case 78:
					Change2AX(num, 24);
					continue;
				case 79:
					Change2AX(num, 27);
					continue;
				case 80:
					Change2AX(num, 28);
					continue;
				}
				if (Constants.HasFlag(num2, 128) && phonemeStress[num] != 0 && num <= 253)
				{
					if (phonemeIndex[num + 1] == 0)
					{
						num2 = phonemeIndex[num + 2];
						if (num2 != 0 && Constants.HasFlag(num2, 128) && phonemeStress[num + 2] != 0)
						{
							Insert(num + 2, 31, 0, 0);
						}
					}
				}
				else if (phonemeIndex[num - 1] == 23)
				{
					HandleTR_DR_R(phonemeIndex[num - 1], num);
				}
				else if (Constants.HasFlag(num2, 1))
				{
					if (phonemeIndex[num - 1] == 32)
					{
						phonemeIndex[num] = num2 - 12;
					}
				}
				else
				{
					HandleUW_CH_J(num2, num);
				}
			}
			void Change2AX(int pos, int suffix)
			{
				phonemeIndex[pos] = 13;
				Insert(pos + 1, suffix);
			}
			void HandleTR_DR_R(int phoneme, int pos)
			{
				switch (phoneme)
				{
				case 57:
					phonemeIndex[pos - 1] = 44;
					break;
				case 69:
					phonemeIndex[pos - 1] = 42;
					break;
				default:
					if (Constants.HasFlag(phoneme, 128))
					{
						phonemeIndex[pos] = 18;
					}
					break;
				}
			}
			void HandleUW_CH_J(int phoneme, int pos)
			{
				switch (phoneme)
				{
				case 42:
					Insert(pos + 1, 43);
					break;
				case 44:
					Insert(pos + 1, 45);
					break;
				case 53:
					if (Constants.HasFlag(phonemeIndex[pos - 1], 1024))
					{
						phonemeIndex[pos] = 16;
					}
					break;
				}
			}
		}

		public void SetPhonemeLength()
		{
			int num = 0;
			int num2;
			while ((num2 = phonemeIndex[++num]) != 255)
			{
				int num3 = phonemeStress[num];
				if (num3 == 0 || ((uint)num3 & 0x80u) != 0)
				{
					phonemeLength[num] = Constants.PhonemeLengthTable[num2] & 0xFF;
				}
				else
				{
					phonemeLength[num] = Constants.PhonemeLengthTable[num2] >> 8;
				}
			}
		}

		public void InsertPauses()
		{
			int num = 0;
			int num2;
			while ((num2 = phonemeIndex[++num]) != 255)
			{
				if (num2 != 254 && Constants.HasFlag(num2, 256))
				{
					Insert(++num, 254);
				}
			}
		}

		public void PrepareOutput()
		{
			Buffer = new Buffer();
			int num = 0;
			int num2 = 0;
			int num3;
			while ((num3 = phonemeIndex[++num]) != 255)
			{
				switch (num3)
				{
				case 254:
					Legacy.IndexOutput[num2] = 255;
					Legacy.Render();
					num2 = 0;
					break;
				default:
					Legacy.IndexOutput[num2] = num3;
					Legacy.LengthOutput[num2] = phonemeLength[num];
					Legacy.StressOutput[num2] = phonemeStress[num];
					num2++;
					break;
				case 0:
					break;
				}
			}
			Legacy.IndexOutput[num2] = 255;
			Legacy.Render();
		}
	}
	public class SamAPI
	{
		public static Sam Sam = new Sam();

		public static float[] Say(string text)
		{
			text += "[";
			Sam.Text2Phonemes(text, out var output);
			Sam.SetInput(output);
			return Sam.GetBuffer().GetFloats();
		}

		public static AudioClip Clip(string text)
		{
			float[] array = Say(text);
			AudioClip val = AudioClip.Create("Sam", array.Length, 1, 22050, false);
			val.SetData(array, 0);
			return val;
		}

		public static string CutColors(string original)
		{
			return Regex.Replace(original, "<.*?>|\\[.*?\\]", string.Empty);
		}

		public static void TryPlay(string text, AudioSource source)
		{
			try
			{
				source.clip = Clip(CutColors(text));
				source.Play();
			}
			catch (Exception)
			{
			}
		}
	}
}
namespace UltraNet
{
	[BepInPlugin("duviz.UltraNet", "UltraNet", "0.0.6")]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin instance;

		public static bool debugMode;

		private GameObject canvasObject;

		private GameObject canvasInstance;

		private bool lastPlayerActive = false;

		private bool openedOnce = false;

		public void Awake()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			((Object)this).hideFlags = (HideFlags)61;
			instance = this;
			new Harmony("duviz.UltraNet").PatchAll();
			LogInfo("UltraNet loaded.");
		}

		public void Start()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			GameObject val = new GameObject("BundlesManager");
			GameObject val2 = new GameObject("PlayerFetcher");
			val.AddComponent<BundlesManager>();
			val2.AddComponent<PlayerFetcher>();
			val2.AddComponent<PlayerListener>();
			((Component)this).gameObject.AddComponent<Numerators>();
			GameObject val3 = Object.Instantiate<GameObject>(BundlesManager.netBundle.LoadAsset<GameObject>("UltraNetNotifications"));
			canvasObject = BundlesManager.netBundle.LoadAsset<GameObject>("UltraNetCanvas");
			canvasInstance = Object.Instantiate<GameObject>(canvasObject);
			canvasInstance.SetActive(false);
			Object.DontDestroyOnLoad((Object)(object)canvasInstance);
			Object.DontDestroyOnLoad((Object)(object)val2);
			openedOnce = PlayerPrefs.GetInt("UltraNet_Opened", 0) == 1;
			Application.runInBackground = true;
		}

		public void Update()
		{
			if (Input.GetKeyDown((KeyCode)116))
			{
				if (UIBusy())
				{
					return;
				}
				canvasInstance.SetActive(!canvasInstance.activeSelf);
				if (!openedOnce)
				{
					PlayerPrefs.SetInt("UltraNet_Opened", 1);
					openedOnce = true;
				}
			}
			if ((Object)(object)MonoSingleton<NewMovement>.Instance != (Object)null && !openedOnce)
			{
				if (lastPlayerActive != MonoSingleton<NewMovement>.Instance.activated)
				{
					MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("Press <color=#ff66cc>(T)</color> to open <color=#66ff66>UltraNet</color>", "", "", 0, false, false, true);
				}
				lastPlayerActive = MonoSingleton<NewMovement>.Instance.activated;
			}
		}

		public static bool UIBusy()
		{
			return (Object)(object)EventSystem.current != (Object)null && (Object)(object)EventSystem.current.currentSelectedGameObject != (Object)null && (Object)(object)EventSystem.current.currentSelectedGameObject.GetComponent<TMP_InputField>() != (Object)null && EventSystem.current.currentSelectedGameObject.GetComponent<TMP_InputField>().isFocused && EventSystem.current.currentSelectedGameObject.activeInHierarchy;
		}

		public void OnApplicationFocus(bool isFocused)
		{
			if ((Object)(object)MonoSingleton<OptionsManager>.Instance != (Object)null && SceneHelper.CurrentScene != "Main Menu" && !MonoSingleton<OptionsManager>.Instance.paused)
			{
				MonoSingleton<OptionsManager>.Instance.Pause();
			}
		}

		public static T Ass<T>(string path)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return Addressables.LoadAssetAsync<T>((object)path).WaitForCompletion();
		}

		public static void LogInfo(object msg)
		{
			((BaseUnityPlugin)instance).Logger.LogInfo(msg);
		}

		public static void LogWarning(object msg)
		{
			((BaseUnityPlugin)instance).Logger.LogWarning(msg);
		}

		public static void LogError(object msg)
		{
			((BaseUnityPlugin)instance).Logger.LogError(msg);
		}
	}
	public class PluginInfo
	{
		public const string GUID = "duviz.UltraNet";

		public const string Name = "UltraNet";

		public const string Version = "0.0.6";
	}
}
namespace UltraNet.Patches
{
	[HarmonyPatch]
	public class CheatFix
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(CheatsManager), "HandleCheatBind")]
		private static bool Patch1()
		{
			return !Plugin.UIBusy();
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(CheatsController), "Update")]
		private static bool Patch2()
		{
			return !Plugin.UIBusy();
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Noclip), "UpdateTick")]
		private static bool Patch3()
		{
			return !Plugin.UIBusy();
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Flight), "Update")]
		private static bool Patch4()
		{
			return !Plugin.UIBusy();
		}
	}
}
namespace UltraNet.Classes
{
	public class Numerators : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <GetStringFromUrl>d__4 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public string url;

			public Action<string> callback;

			private UnityWebRequest <www>5__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <GetStringFromUrl>d__4(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<www>5__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_007f: Invalid comparison between Unknown and I4
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<www>5__1 = UnityWebRequest.Get(url);
						<>1__state = -3;
						<www>5__1.timeout = 5;
						<>2__current = <www>5__1.SendWebRequest();
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -3;
						if ((int)<www>5__1.result != 1)
						{
							if (!string.IsNullOrEmpty(<www>5__1.error) && <www>5__1.error.Contains("Unknown Error"))
							{
								callback?.Invoke("?");
							}
							Plugin.LogError("Failed to load string: " + <www>5__1.error);
							callback?.Invoke(null);
						}
						else
						{
							callback?.Invoke(<www>5__1.downloadHandler.text);
						}
						<>m__Finally1();
						<www>5__1 = null;
						return false;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<www>5__1 != null)
				{
					((IDisposable)<www>5__1).Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <PostRequest>d__5 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public string url;

			public Dictionary<string, string> postData;

			public Action<string> callback;

			private float <startTime>5__1;

			private WWWForm <form>5__2;

			private Dictionary<string, string>.Enumerator <>s__3;

			private KeyValuePair<string, string> <pair>5__4;

			private UnityWebRequest <www>5__5;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <PostRequest>d__5(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<form>5__2 = null;
				<>s__3 = default(Dictionary<string, string>.Enumerator);
				<pair>5__4 = default(KeyValuePair<string, string>);
				<www>5__5 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Expected O, but got Unknown
				//IL_011b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0121: Invalid comparison between Unknown and I4
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<startTime>5__1 = Time.realtimeSinceStartup;
						<form>5__2 = new WWWForm();
						<>s__3 = postData.GetEnumerator();
						try
						{
							while (<>s__3.MoveNext())
							{
								<pair>5__4 = <>s__3.Current;
								<form>5__2.AddField(<pair>5__4.Key, <pair>5__4.Value);
								<pair>5__4 = default(KeyValuePair<string, string>);
							}
						}
						finally
						{
							((IDisposable)<>s__3).Dispose();
						}
						<>s__3 = default(Dictionary<string, string>.Enumerator);
						<www>5__5 = UnityWebRequest.Post(url, <form>5__2);
						<>1__state = -3;
						<www>5__5.timeout = 5;
						<>2__current = <www>5__5.SendWebRequest();
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -3;
						if ((int)<www>5__5.result != 1)
						{
							if (!string.IsNullOrEmpty(<www>5__5.error) && <www>5__5.error.Contains("Unknown Error"))
							{
								callback?.Invoke("?");
							}
							Plugin.LogError("Failed to post request: " + <www>5__5.error);
							callback?.Invoke(null);
						}
						else
						{
							callback?.Invoke(<www>5__5.downloadHandler.text);
						}
						<>m__Finally1();
						<www>5__5 = null;
						return false;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<www>5__5 != null)
				{
					((IDisposable)<www>5__5).Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <TimerButton>d__3 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Button button;

			public float time;

			public Numerators <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <TimerButton>d__3(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSecondsRealtime(time);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if ((Object)(object)button == (Object)null)
					{
						return false;
					}
					if (!_busy)
					{
						((UnityEvent)button.onClick).Invoke();
					}
					((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.TimerButton(button, time));
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public static Numerators instance;

		public static bool _busy;

		public void Start()
		{
			instance = this;
		}

		[IteratorStateMachine(typeof(<TimerButton>d__3))]
		public IEnumerator TimerButton(Button button, float time)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <TimerButton>d__3(0)
			{
				<>4__this = this,
				button = button,
				time = time
			};
		}

		[IteratorStateMachine(typeof(<GetStringFromUrl>d__4))]
		public static IEnumerator GetStringFromUrl(string url, Action<string> callback)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <GetStringFromUrl>d__4(0)
			{
				url = url,
				callback = callback
			};
		}

		[IteratorStateMachine(typeof(<PostRequest>d__5))]
		public static IEnumerator PostRequest(string url, Dictionary<string, string> postData, Action<string> callback)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <PostRequest>d__5(0)
			{
				url = url,
				postData = postData,
				callback = callback
			};
		}
	}
	public class Player : MonoBehaviour
	{
		public float lerpSpeed = 2f;

		private Vector3 targetPos;

		private TMP_Text t;

		private string originalText;

		private bool lastCheats = false;

		public void SetTarget(Vector3 newPos, bool cheats)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			targetPos = newPos;
			if (lastCheats != cheats)
			{
				t.text = (cheats ? ("<size=0.5>(C)</size>" + originalText) : originalText);
			}
			lastCheats = cheats;
		}

		public void CreateName(string text, string id, string url)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(BundlesManager.netBundle.LoadAsset<GameObject>("PlayerName"));
			val.transform.localScale = new Vector3(-0.5f, 0.5f, 1f);
			val.transform.SetParent(((Component)this).transform, false);
			val.GetComponentInChildren<TMP_Text>().text = TextParser.Parse(text);
			t = val.GetComponentInChildren<TMP_Text>();
			originalText = TextParser.Parse(text);
			GetPfp(id, val, url);
		}

		public async void GetPfp(string id, GameObject obj, string url)
		{
			if (!string.IsNullOrEmpty(url))
			{
				obj.GetComponentInChildren<ImageGetter>().imageUrl = url;
				obj.GetComponentInChildren<ImageGetter>().SetImg();
			}
		}

		public void Update()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			float num = Vector3.Distance(((Component)this).transform.position, targetPos);
			float num2 = num * lerpSpeed;
			float num3 = Time.unscaledDeltaTime * num2;
			((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, targetPos, num3);
			((Component)this).transform.LookAt(((Object)(object)Camera.main != (Object)null) ? ((Component)Camera.main).transform.position : Vector3.zero);
		}
	}
	public class PlayerFetcher : MonoBehaviour
	{
		public static PlayerFetcher instance;

		public float syncTime = 0.3f;

		private Dictionary<string, GameObject> players = new Dictionary<string, GameObject>();

		private string syncUrl = "https://duviz.xyz/ultranet/user/update";

		private float timer = 0f;

		private bool _busy = false;

		private int attempts = 0;

		public void Update()
		{
			timer += Time.unscaledDeltaTime;
			if (timer >= syncTime && !(SceneHelper.CurrentScene == "Main Menu") && !((Object)(object)MonoSingleton<NewMovement>.Instance == (Object)null))
			{
				timer = 0f;
				Sync();
			}
		}

		public void Sync()
		{
			attempts++;
			if (attempts >= 10)
			{
				_busy = false;
			}
			if (_busy)
			{
				timer = syncTime;
				return;
			}
			_busy = true;
			attempts = 0;
			((MonoBehaviour)this).StopAllCoroutines();
			((MonoBehaviour)this).StartCoroutine(Numerators.PostRequest(syncUrl, new Dictionary<string, string>
			{
				{
					"token",
					ContentManager.GetToken()
				},
				{
					"position",
					ContentManager.GetPosition()
				},
				{
					"level",
					SceneHelper.CurrentScene
				},
				{
					"cheats",
					CheatsActive().ToString()
				}
			}, delegate(string json)
			{
				_busy = false;
				if (json != null)
				{
					ParseJson(json);
				}
			}));
		}

		public GameObject CreatePlayer(string id, Vector3 pos, string name, string url)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Player viewer");
			val.transform.position = pos;
			Player player = val.AddComponent<Player>();
			player.CreateName(name, id, url);
			players.Add(id, val);
			return val;
		}

		public void ParseJson(string json)
		{
			//IL_0095: 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_00d3: Expected O, but got Unknown
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			JObject val;
			try
			{
				val = JObject.Parse(json);
			}
			catch (Exception arg)
			{
				Plugin.LogError($"Failed to parse scene json: {arg}");
				return;
			}
			foreach (KeyValuePair<string, GameObject> item in players.ToList())
			{
				if ((Object)(object)item.Value == (Object)null)
				{
					players.Remove(item.Key);
				}
			}
			List<string> list = new List<string>();
			foreach (KeyValuePair<string, JToken> item2 in (JObject)val["players"])
			{
				string id = item2.Key;
				JObject val2 = (JObject)item2.Value;
				string input = ((object)val2["position"])?.ToString();
				string name = ((object)val2["name"])?.ToString();
				string url = ((object)val2["pfp"])?.ToString();
				string text = ((object)val2["cheats"]).ToString();
				bool cheats = text.ToLower() == "true";
				Vector3 val3 = ParseVector3(input);
				GameObject val4 = players.FirstOrDefault((KeyValuePair<string, GameObject> p) => p.Key == id).Value;
				list.Add(id);
				if ((Object)(object)val4 == (Object)null)
				{
					val4 = CreatePlayer(id, val3, name, url);
				}
				val4.GetComponent<Player>().SetTarget(val3, cheats);
			}
			foreach (KeyValuePair<string, JToken> item3 in (JObject)val["events"])
			{
				string key = item3.Key;
				DoEvent(key);
			}
			foreach (KeyValuePair<string, GameObject> item4 in players.ToList())
			{
				if (!list.Contains(item4.Key))
				{
					GameObject value = item4.Value;
					players.Remove(item4.Key);
					if ((Object)(object)value != (Object)null)
					{
						Object.Destroy((Object)(object)value);
					}
				}
			}
		}

		private void DoEvent(string e)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			if (e == "filth")
			{
				GameObject val = Plugin.Ass<GameObject>("Assets/Prefabs/Enemies/Zombie.prefab");
				GameObject val2 = Object.Instantiate<GameObject>(val, ((Component)MonoSingleton<NewMovement>.Instance).transform.position, Quaternion.identity);
			}
			if (e == "stray")
			{
				GameObject val3 = Plugin.Ass<GameObject>("Assets/Prefabs/Enemies/Projectile Zombie.prefab");
				GameObject val4 = Object.Instantiate<GameObject>(val3, ((Component)MonoSingleton<NewMovement>.Instance).transform.position, Quaternion.identity);
			}
			if (e == "minos")
			{
				GameObject val5 = Plugin.Ass<GameObject>("Assets/Prefabs/Enemies/MinosPrime.prefab");
				GameObject val6 = Object.Instantiate<GameObject>(val5, ((Component)MonoSingleton<NewMovement>.Instance).transform.position, Quaternion.identity);
			}
			if (e == "explosion")
			{
				GameObject val7 = Plugin.Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Explosions/Explosion.prefab");
				GameObject val8 = Object.Instantiate<GameObject>(val7, ((Component)MonoSingleton<NewMovement>.Instance).transform.position, Quaternion.identity);
			}
			if (e == "gravity")
			{
				Physics.gravity = new Vector3(0f - Physics.gravity.y, 0f - Physics.gravity.z, 0f - Physics.gravity.x);
			}
			if (e.StartsWith("custom_"))
			{
				GameObject val9 = Plugin.Ass<GameObject>("Assets/Prefabs/" + e.Replace("custom_", "") + ".prefab");
				GameObject val10 = Object.Instantiate<GameObject>(val9, ((Component)MonoSingleton<NewMovement>.Instance).transform.position, Quaternion.identity);
			}
		}

		private Vector4 ParseVector4(string input)
		{
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			input = input.Trim('(', ')', ' ');
			string[] array = input.Split(',');
			if (array.Length != 4)
			{
				Plugin.LogError("Invalid Vector4 format: " + input);
				return Vector4.zero;
			}
			return new Vector4(float.Parse(array[0], CultureInfo.InvariantCulture), float.Parse(array[1], CultureInfo.InvariantCulture), float.Parse(array[2], CultureInfo.InvariantCulture), float.Parse(array[3], CultureInfo.InvariantCulture));
		}

		public static Vector3 ParseVector3(string input)
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			input = input.Trim('(', ')', ' ');
			string[] array = input.Split(',');
			if (array.Length != 3)
			{
				Plugin.LogError("Invalid Vector3 format: " + input);
				return Vector3.zero;
			}
			return new Vector3(float.Parse(array[0], CultureInfo.InvariantCulture), float.Parse(array[1], CultureInfo.InvariantCulture), float.Parse(array[2], CultureInfo.InvariantCulture));
		}

		public static Vector2 ParseVector2(string input)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			input = input.Trim('(', ')', ' ');
			string[] array = input.Split(',');
			if (array.Length != 2)
			{
				Plugin.LogError("Invalid Vector2 format: " + input);
				return Vector2.zero;
			}
			return new Vector2(float.Parse(array[0], CultureInfo.InvariantCulture), float.Parse(array[1], CultureInfo.InvariantCulture));
		}

		public bool CheatsActive()
		{
			return MonoSingleton<CheatsController>.Instance.cheatsEnabled || MonoSingleton<StatsManager>.Instance.majorUsed;
		}
	}
	public class PlayerListener : MonoBehaviour
	{
		private UdpClient udpClient;

		private Thread receiveThread;

		private string lastReceivedData = "";

		private readonly object lockObject = new object();

		public int port = 41789;

		public void Start()
		{
		}

		private void ReceiveData()
		{
			IPAddress address = IPAddress.Parse("88.9.11.249");
			udpClient = new UdpClient(port);
			IPEndPoint remoteEP = new IPEndPoint(address, 0);
			while (true)
			{
				try
				{
					byte[] bytes = udpClient.Receive(ref remoteEP);
					string @string = Encoding.UTF8.GetString(bytes);
					lock (lockObject)
					{
						lastReceivedData = @string;
					}
				}
				catch (Exception ex)
				{
					Plugin.LogError(ex.ToString());
				}
			}
		}

		public void Update()
		{
		}

		private void OnDisable()
		{
			udpClient?.Close();
		}

		private void OnApplicationQuit()
		{
			udpClient?.Close();
		}
	}
	public class SteamAvatarFetcher : MonoBehaviour
	{
		private static readonly HttpClient client = new HttpClient();

		public async Task<string> GetSteamAvatarURL(string steamID64)
		{
			string xmlUrl = "https://steamcommunity.com/profiles/" + steamID64 + "/?xml=1";
			try
			{
				string xml = await client.GetStringAsync(xmlUrl);
				XmlDocument doc = new XmlDocument();
				doc.LoadXml(xml);
				XmlNode avatarFullNode = doc.SelectSingleNode("//avatarFull");
				if (avatarFullNode != null)
				{
					return avatarFullNode.InnerText;
				}
				Plugin.LogWarning("Not found.");
				return null;
			}
			catch (HttpRequestException ex)
			{
				HttpRequestException e2 = ex;
				Plugin.LogError("HTTP request error: " + e2.Message);
				return null;
			}
			catch (XmlException ex2)
			{
				XmlException e = ex2;
				Plugin.LogError("XML parsing error: " + e.Message);
				return null;
			}
		}
	}
}
namespace UltraNet.Canvas
{
	public class ContentManager : MonoBehaviour
	{
		public Transform content;

		public ResetScrollbar resetScrollbar;

		public ScrollRect scrollRect;

		[Header("Root")]
		public TMP_Text titleText;

		[Header("Prefabs")]
		public GameObject textPrefab;

		public GameObject imagePrefab;

		public GameObject buttonPrefab;

		public GameObject inputFieldPrefab;

		public GameObject playerPrefab;

		private AudioSource source = null;

		public const string mainUrl = "https://duviz.xyz/login";

		public const string errorJson = "\r\n            {\r\n                'title': 'Error!',\r\n                'elements': [\r\n                    {\r\n                        'type': 'text',\r\n                        'name': 'ErrorText',\r\n                        'text': 'There was an error when trying to load the site. Try again later.',\r\n                        'color': '#FF0000'\r\n                    },\r\n                    {\r\n                        'type': 'button',\r\n                        'name': 'BackButton',\r\n                        'text': 'Go back',\r\n                        'url': 'https://duviz.xyz/login',\r\n                        'action': 'postToken'\r\n                    }\r\n                ]\r\n            }\r\n        ";

		public string lastJson = "";

		private string lastTTS = "";

		public void Start()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			((Component)((Component)this).transform.GetChild(1)).GetComponent<Animator>().updateMode = (AnimatorUpdateMode)2;
			PostWebsite("https://duviz.xyz/login", new Dictionary<string, string> { 
			{
				"token",
				GetToken()
			} });
			source = new GameObject("Audio").AddComponent<AudioSource>();
			source.playOnAwake = false;
			source.volume = 1f;
			Object.DontDestroyOnLoad((Object)(object)((Component)source).gameObject);
		}

		public void Update()
		{
			if ((Object)(object)MonoSingleton<OptionsManager>.Instance != (Object)null && SceneHelper.CurrentScene != "Main Menu" && !MonoSingleton<OptionsManager>.Instance.paused)
			{
				MonoSingleton<OptionsManager>.Instance.Pause();
			}
			Time.timeScale = 0f;
			Cursor.visible = true;
			Cursor.lockState = (CursorLockMode)0;
			if (Input.GetKeyDown((KeyCode)27))
			{
				Time.timeScale = 1f;
				((Component)this).gameObject.SetActive(false);
				if ((Object)(object)MonoSingleton<OptionsManager>.Instance != (Object)null && SceneHelper.CurrentScene != "Main Menu")
				{
					MonoSingleton<OptionsManager>.Instance.UnPause();
				}
			}
			if (Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)114))
			{
				lastJson = "";
				PostWebsite("https://duviz.xyz/login", new Dictionary<string, string> { 
				{
					"token",
					GetToken()
				} });
			}
		}

		public void OnEnable()
		{
			if (titleText.text.Contains("LOADING"))
			{
				lastJson = "";
				PostWebsite("https://duviz.xyz/login", new Dictionary<string, string> { 
				{
					"token",
					GetToken()
				} });
			}
			else if (titleText.text.Contains("CHAT"))
			{
				string json = lastJson;
				lastJson = "";
				ParseJson(json);
			}
		}

		public void LoadWebsite(string url, bool deletePrev = true)
		{
			Numerators._busy = true;
			if (deletePrev)
			{
				((MonoBehaviour)Numerators.instance).StopAllCoroutines();
			}
			if (deletePrev)
			{
				CleanUp();
				lastJson = null;
			}
			((MonoBehaviour)Numerators.instance).StartCoroutine(Numerators.GetStringFromUrl(url, delegate(string json)
			{
				Numerators._busy = false;
				if (json != null)
				{
					if (!(json == "?"))
					{
						ParseJson(json);
					}
				}
				else
				{
					ParseJson("\r\n            {\r\n                'title': 'Error!',\r\n                'elements': [\r\n                    {\r\n                        'type': 'text',\r\n                        'name': 'ErrorText',\r\n                        'text': 'There was an error when trying to load the site. Try again later.',\r\n                        'color': '#FF0000'\r\n                    },\r\n                    {\r\n                        'type': 'button',\r\n                        'name': 'BackButton',\r\n                        'text': 'Go back',\r\n                        'url': 'https://duviz.xyz/login',\r\n                        'action': 'postToken'\r\n                    }\r\n                ]\r\n            }\r\n        ");
				}
			}));
		}

		public void PostWebsite(string url, Dictionary<string, string> postData, bool deletePrev = true)
		{
			if (deletePrev)
			{
				((MonoBehaviour)Numerators.instance).StopAllCoroutines();
			}
			if (deletePrev)
			{
				CleanUp();
				lastJson = null;
			}
			((MonoBehaviour)Numerators.instance).StartCoroutine(Numerators.PostRequest(url, postData, delegate(string json)
			{
				if (json != null)
				{
					if (!(json == "?"))
					{
						ParseJson(json);
					}
				}
				else if (deletePrev)
				{
					ParseJson("\r\n            {\r\n                'title': 'Error!',\r\n                'elements': [\r\n                    {\r\n                        'type': 'text',\r\n                        'name': 'ErrorText',\r\n                        'text': 'There was an error when trying to load the site. Try again later.',\r\n                        'color': '#FF0000'\r\n                    },\r\n                    {\r\n                        'type': 'button',\r\n                        'name': 'BackButton',\r\n                        'text': 'Go back',\r\n                        'url': 'https://duviz.xyz/login',\r\n                        'action': 'postToken'\r\n                    }\r\n                ]\r\n            }\r\n        ");
				}
			}));
		}

		public void ParseJson(string json)
		{
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_042a: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0903: Unknown result type (might be due to invalid IL or missing references)
			//IL_0908: Unknown result type (might be due to invalid IL or missing references)
			//IL_0573: Unknown result type (might be due to invalid IL or missing references)
			//IL_0531: Unknown result type (might be due to invalid IL or missing references)
			//IL_0689: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ba7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c3a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c44: Expected O, but got Unknown
			//IL_0808: Unknown result type (might be due to invalid IL or missing references)
			//IL_0897: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a1: Expected O, but got Unknown
			//IL_0578->IL0578: Incompatible stack types: O vs I4
			//IL_0553->IL0578: Incompatible stack types: I4 vs O
			//IL_0553->IL0578: Incompatible stack types: O vs I4
			//IL_068e->IL068e: Incompatible stack types: O vs I4
			//IL_0669->IL068e: Incompatible stack types: I4 vs O
			//IL_0669->IL068e: Incompatible stack types: O vs I4
			//IL_0bac->IL0bac: Incompatible stack types: O vs I4
			//IL_0b87->IL0bac: Incompatible stack types: I4 vs O
			//IL_0b87->IL0bac: Incompatible stack types: O vs I4
			if (lastJson == json)
			{
				return;
			}
			string text = titleText.text;
			CleanUp();
			JObject val;
			try
			{
				val = JObject.Parse(json);
			}
			catch (Exception arg)
			{
				Plugin.LogError($"Failed to parse scene json: {arg}");
				ParseJson("\r\n            {\r\n                'title': 'Error!',\r\n                'elements': [\r\n                    {\r\n                        'type': 'text',\r\n                        'name': 'ErrorText',\r\n                        'text': 'There was an error when trying to load the site. Try again later.',\r\n                        'color': '#FF0000'\r\n                    },\r\n                    {\r\n                        'type': 'button',\r\n                        'name': 'BackButton',\r\n                        'text': 'Go back',\r\n                        'url': 'https://duviz.xyz/login',\r\n                        'action': 'postToken'\r\n                    }\r\n                ]\r\n            }\r\n        ");
				return;
			}
			titleText.text = (((object)val["title"])?.ToString() ?? "Unnamed").ToUpper();
			if (val["cookieKey"] != null)
			{
				string text2 = ((object)val["cookieKey"])?.ToString() ?? "Element";
				string text3 = ((object)val["cookieValue"])?.ToString() ?? "Element";
				PlayerPrefs.SetString(text2, text3);
			}
			if (val["tts"] != null)
			{
				if (!((Component)this).gameObject.activeInHierarchy && lastTTS != ((object)val["tts"]).ToString())
				{
					NotificationListener.Show();
				}
				if (lastTTS != ((object)val["tts"]).ToString())
				{
					source.volume = PlayerPrefs.GetFloat("UltranetConfig_TTSVolume", 0.5f);
					lastTTS = ((object)val["tts"]).ToString();
					SamAPI.TryPlay(TextParser.Parse(((object)val["tts"]).ToString()), source);
				}
			}
			List<(string, TMP_InputField)> inputFields = new List<(string, TMP_InputField)>();
			foreach (JToken item2 in (IEnumerable<JToken>)val["elements"])
			{
				string text4 = ((object)item2[(object)"type"])?.ToString();
				if (1 == 0)
				{
				}
				GameObject val2 = (GameObject)(text4 switch
				{
					"text" => textPrefab, 
					"image" => imagePrefab, 
					"button" => buttonPrefab, 
					"inputField" => inputFieldPrefab, 
					"player" => playerPrefab, 
					_ => null, 
				});
				if (1 == 0)
				{
				}
				GameObject val3 = val2;
				if ((Object)(object)val3 == (Object)null)
				{
					Plugin.LogWarning("Unknown element type: " + text4);
					continue;
				}
				GameObject obj = Object.Instantiate<GameObject>(val3, content);
				((Object)obj).name = ((object)item2[(object)"name"])?.ToString() ?? "Element";
				RectTransform component = obj.GetComponent<RectTransform>();
				component.sizeDelta = new Vector2((item2[(object)"width"] != null) ? ((float)item2[(object)"width"]) : component.sizeDelta.x, (item2[(object)"height"] != null) ? ((float)item2[(object)"height"]) : component.sizeDelta.y);
				if (Plugin.debugMode)
				{
					GameObject val4 = Object.Instantiate<GameObject>(textPrefab, obj.transform);
					((Transform)val4.GetComponent<RectTransform>()).localPosition = new Vector3(600f, 0f, 0f);
					TMP_Text component2 = val4.GetComponent<TMP_Text>();
					component2.alignment = (TextAlignmentOptions)513;
					component2.text = "#" + ((Object)obj).name;
					component2.enableAutoSizing = false;
					component2.fontSize = 16f;
					((Graphic)component2).color = new Color(1f, 1f, 1f, 1f);
					((Graphic)component2).raycastTarget = false;
				}
				switch (text4)
				{
				case "text":
				{
					TMP_Text component5 = obj.GetComponent<TMP_Text>();
					if ((Object)(object)component5 != (Object)null)
					{
						component5.text = TextParser.Parse(((object)item2[(object)"text"])?.ToString()) ?? "Text";