Decompiled source of MatchInfo v2.0.2

Mods/MatchInfo.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Il2CppRUMBLE.Managers;
using Il2CppRUMBLE.Networking.MatchFlow;
using Il2CppRUMBLE.Utilities;
using Il2CppTMPro;
using MatchInfo;
using MelonLoader;
using RumbleModdingAPI;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(main), "MatchInfo", "2.0.2", "UlvakSkillz", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 195, 0, 255)]
[assembly: MelonAuthorColor(255, 195, 0, 255)]
[assembly: VerifyLoaderVersion(0, 6, 2, true)]
[assembly: AssemblyTitle("MatchInfo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MatchInfo")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f5e62496-0e7a-420d-81f3-34006cbabc29")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MatchInfo;

public class main : MelonMod
{
	private string FILEPATH = "UserData\\MatchInfo";

	private string FILENAME = "MatchInfo.txt";

	private string BACKUPFILENAME = "MatchInfo_Backup";

	private string SETTINGFILENAME = "Settings.txt";

	private List<string> fileText = new List<string>();

	private bool sceneChanged = false;

	private string currentScene = "";

	private bool init = false;

	private GameObject matchInfoGameObject;

	private GameObject player1GameObject;

	private GameObject player2GameObject;

	private GameObject vsGameObject;

	private GameObject player1BPGameObject;

	private GameObject player2BPGameObject;

	private GameObject player1MatchWinsGameObject;

	private GameObject player2MatchWinsGameObject;

	private TextMeshPro player1Component;

	private TextMeshPro player2Component;

	private TextMeshPro vsComponent;

	private TextMeshPro player1BPComponent;

	private TextMeshPro player2BPComponent;

	private TextMeshPro player1MatchWinsComponent;

	private TextMeshPro player2MatchWinsComponent;

	private GameObject gymMatchInfoGameObject;

	private GameObject gymMatchInfoTotalGameObject;

	private GameObject gymMatchInfoWinsGameObject;

	private GameObject gymMatchInfoLossesGameObject;

	private GameObject gymMatchInfoWinPercentGameObject;

	private TextMeshPro gymMatchInfoTitleComponent;

	private TextMeshPro gymMatchInfoTotalComponent;

	private TextMeshPro gymMatchInfoWinsComponent;

	private TextMeshPro gymMatchInfoLossesComponent;

	private TextMeshPro gymMatchInfoWinPercentComponent;

	private DateTime hideTime = DateTime.Now;

	private int waitedTicks = 0;

	private bool textActive = false;

	private bool matchActive = false;

	private bool ranWinLoss = true;

	private PlayerManager playerManager;

	private MatchHandler matchHandler;

	private int playerFileSpot = 0;

	private bool showWinRate = true;

	private bool showWinLoss = true;

	private bool backedUp = false;

	private bool newSettingsFile = false;

	public override void OnLateInitializeMelon()
	{
		MelonCoroutines.Start(CheckIfFileExists(FILEPATH, FILENAME));
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		if (init)
		{
			ReadSettingsFile();
		}
		currentScene = sceneName;
		sceneChanged = true;
	}

	public override void OnFixedUpdate()
	{
		//IL_1077: Unknown result type (might be due to invalid IL or missing references)
		//IL_107d: Invalid comparison between Unknown and I4
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Expected O, but got Unknown
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0264: Unknown result type (might be due to invalid IL or missing references)
		//IL_0269: Unknown result type (might be due to invalid IL or missing references)
		//IL_037d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0539: Unknown result type (might be due to invalid IL or missing references)
		//IL_07b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_07da: Unknown result type (might be due to invalid IL or missing references)
		//IL_07ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0824: Unknown result type (might be due to invalid IL or missing references)
		//IL_0849: Unknown result type (might be due to invalid IL or missing references)
		//IL_086e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0893: Unknown result type (might be due to invalid IL or missing references)
		//IL_08b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_08dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0902: Unknown result type (might be due to invalid IL or missing references)
		//IL_0927: Unknown result type (might be due to invalid IL or missing references)
		//IL_094c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0971: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b51: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b76: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b03: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b28: Unknown result type (might be due to invalid IL or missing references)
		if (sceneChanged)
		{
			try
			{
				if (currentScene == "Gym" && !init)
				{
					if (!backedUp)
					{
						Log("Backing up File 2 -> 3");
						File.Copy(FILEPATH + "\\Backups\\" + BACKUPFILENAME + "2.txt", FILEPATH + "\\Backups\\" + BACKUPFILENAME + "3.txt", overwrite: true);
						Log("Backing up File 1 -> 2");
						File.Copy(FILEPATH + "\\Backups\\" + BACKUPFILENAME + "1.txt", FILEPATH + "\\Backups\\" + BACKUPFILENAME + "2.txt", overwrite: true);
						Log("Backing up File MatchInfo.txt -> 1");
						File.Copy(FILEPATH + "\\" + FILENAME, FILEPATH + "\\Backups\\" + BACKUPFILENAME + "1.txt", overwrite: true);
						backedUp = true;
					}
					if (newSettingsFile)
					{
						File.WriteAllLines(contents: new string[2] { "Show Gym Info: True", "Show Win/Loss in Match: True" }, path: FILEPATH + "\\" + SETTINGFILENAME);
						newSettingsFile = false;
					}
					if (waitedTicks == 120)
					{
						playerManager = Singleton<PlayerManager>.instance;
						matchInfoGameObject = new GameObject();
						((Object)matchInfoGameObject).name = "MatchInfoMod";
						matchInfoGameObject.SetActive(false);
						player1GameObject = Object.Instantiate<GameObject>(Nr.GetGameObject());
						player1GameObject.transform.parent = matchInfoGameObject.transform;
						((Object)player1GameObject).name = "Player1Name";
						player1Component = player1GameObject.GetComponent<TextMeshPro>();
						((TMP_Text)player1Component).text = "name";
						((TMP_Text)player1Component).fontSize = 5f;
						((TMP_Text)player1Component).color = new Color(1f, 1f, 1f, 1f);
						((TMP_Text)player1Component).outlineColor = Color32.op_Implicit(new Color(0f, 0f, 0f, 0.5f));
						((TMP_Text)player1Component).alignment = (TextAlignmentOptions)516;
						((TMP_Text)player1Component).enableWordWrapping = false;
						((TMP_Text)player1Component).outlineWidth = 0.1f;
						player2GameObject = Object.Instantiate<GameObject>(player1GameObject);
						player2GameObject.transform.parent = matchInfoGameObject.transform;
						((Object)player2GameObject).name = "Player2Name";
						player2Component = player2GameObject.GetComponent<TextMeshPro>();
						((TMP_Text)player2Component).alignment = (TextAlignmentOptions)513;
						vsGameObject = Object.Instantiate<GameObject>(player2GameObject);
						vsGameObject.transform.parent = matchInfoGameObject.transform;
						((Object)vsGameObject).name = "VSText";
						vsComponent = vsGameObject.GetComponent<TextMeshPro>();
						((TMP_Text)vsComponent).alignment = (TextAlignmentOptions)514;
						((TMP_Text)vsComponent).color = new Color(0f, 0f, 0f, 1f);
						((TMP_Text)vsComponent).text = "vs";
						((TMP_Text)vsComponent).fontSize = 3.5f;
						player1BPGameObject = Object.Instantiate<GameObject>(player2GameObject);
						player1BPGameObject.transform.parent = matchInfoGameObject.transform;
						((Object)player1BPGameObject).name = "Player1BP";
						player1BPComponent = player1BPGameObject.GetComponent<TextMeshPro>();
						((TMP_Text)player1BPComponent).alignment = (TextAlignmentOptions)514;
						((TMP_Text)player1BPComponent).text = "P1BP";
						((TMP_Text)player1BPComponent).fontSize = 4f;
						player2BPGameObject = Object.Instantiate<GameObject>(player2GameObject);
						player2BPGameObject.transform.parent = matchInfoGameObject.transform;
						((Object)player2BPGameObject).name = "Player2BP";
						player2BPComponent = player2BPGameObject.GetComponent<TextMeshPro>();
						((TMP_Text)player2BPComponent).alignment = (TextAlignmentOptions)514;
						((TMP_Text)player2BPComponent).text = "P2BP";
						((TMP_Text)player2BPComponent).fontSize = 4f;
						player1MatchWinsGameObject = Object.Instantiate<GameObject>(player1BPGameObject);
						player1MatchWinsGameObject.transform.parent = matchInfoGameObject.transform;
						((Object)player1MatchWinsGameObject).name = "P1Wins";
						player1MatchWinsComponent = player1MatchWinsGameObject.GetComponent<TextMeshPro>();
						((TMP_Text)player1MatchWinsComponent).alignment = (TextAlignmentOptions)514;
						((TMP_Text)player1MatchWinsComponent).text = "0 Wins";
						((TMP_Text)player1MatchWinsComponent).color = new Color(1f, 1f, 1f, 1f);
						player2MatchWinsGameObject = Object.Instantiate<GameObject>(player1MatchWinsGameObject);
						player2MatchWinsGameObject.transform.parent = matchInfoGameObject.transform;
						((Object)player2MatchWinsGameObject).name = "P2Wins";
						player2MatchWinsComponent = player2MatchWinsGameObject.GetComponent<TextMeshPro>();
						((TMP_Text)player2MatchWinsComponent).alignment = (TextAlignmentOptions)514;
						((TMP_Text)player2MatchWinsComponent).text = "0 Wins";
						gymMatchInfoGameObject = Object.Instantiate<GameObject>(player1GameObject);
						((Object)gymMatchInfoGameObject).name = "GymMatchInfo";
						gymMatchInfoTitleComponent = gymMatchInfoGameObject.GetComponent<TextMeshPro>();
						((TMP_Text)gymMatchInfoTitleComponent).alignment = (TextAlignmentOptions)513;
						((TMP_Text)gymMatchInfoTitleComponent).text = "Match History";
						((TMP_Text)gymMatchInfoTitleComponent).fontSize = 3.5f;
						gymMatchInfoTotalGameObject = Object.Instantiate<GameObject>(gymMatchInfoGameObject);
						gymMatchInfoTotalGameObject.transform.parent = gymMatchInfoGameObject.transform;
						((Object)gymMatchInfoTotalGameObject).name = "Total";
						gymMatchInfoTotalComponent = gymMatchInfoTotalGameObject.GetComponent<TextMeshPro>();
						((TMP_Text)gymMatchInfoTotalComponent).text = "Total: ";
						gymMatchInfoWinsGameObject = Object.Instantiate<GameObject>(gymMatchInfoTotalGameObject);
						gymMatchInfoWinsGameObject.transform.parent = gymMatchInfoGameObject.transform;
						((Object)gymMatchInfoWinsGameObject).name = "Wins";
						gymMatchInfoWinsComponent = gymMatchInfoWinsGameObject.GetComponent<TextMeshPro>();
						((TMP_Text)gymMatchInfoWinsComponent).text = "Wins: ";
						gymMatchInfoLossesGameObject = Object.Instantiate<GameObject>(gymMatchInfoTotalGameObject);
						gymMatchInfoLossesGameObject.transform.parent = gymMatchInfoGameObject.transform;
						((Object)gymMatchInfoLossesGameObject).name = "Losses";
						gymMatchInfoLossesComponent = gymMatchInfoLossesGameObject.GetComponent<TextMeshPro>();
						((TMP_Text)gymMatchInfoLossesComponent).text = "Losses: ";
						gymMatchInfoWinPercentGameObject = Object.Instantiate<GameObject>(gymMatchInfoTotalGameObject);
						gymMatchInfoWinPercentGameObject.transform.parent = gymMatchInfoGameObject.transform;
						((Object)gymMatchInfoWinPercentGameObject).name = "WinPercent";
						gymMatchInfoWinPercentComponent = gymMatchInfoWinPercentGameObject.GetComponent<TextMeshPro>();
						((TMP_Text)gymMatchInfoWinPercentComponent).text = "Win Rate: ";
						player1GameObject.transform.position = new Vector3(-0.75f, 1f, 0f);
						player1BPGameObject.transform.position = new Vector3(-1.25f, 0.5f, 0f);
						vsGameObject.transform.position = new Vector3(0f, 0.75f, 0f);
						player2GameObject.transform.position = new Vector3(0.75f, 1f, 0f);
						player2BPGameObject.transform.position = new Vector3(1.25f, 0.5f, 0f);
						player1MatchWinsGameObject.transform.position = new Vector3(-1.25f, 0f, 0f);
						player2MatchWinsGameObject.transform.position = new Vector3(1.25f, 0f, 0f);
						gymMatchInfoGameObject.transform.position = new Vector3(5.5236f, 2.75f, 11.3364f);
						gymMatchInfoGameObject.transform.rotation = Quaternion.Euler(0f, 30.5f, 0f);
						gymMatchInfoTotalGameObject.transform.localPosition = new Vector3(0.0334f, -0.3f, -0.0012f);
						gymMatchInfoWinsGameObject.transform.localPosition = new Vector3(0.0334f, -0.6f, -0.0012f);
						gymMatchInfoLossesGameObject.transform.localPosition = new Vector3(0.0334f, -0.9f, -0.0012f);
						gymMatchInfoWinPercentGameObject.transform.localPosition = new Vector3(0.0334f, -1.2f, -0.0012f);
						gymMatchInfoGameObject.SetActive(false);
						Object.DontDestroyOnLoad((Object)(object)matchInfoGameObject);
						Object.DontDestroyOnLoad((Object)(object)gymMatchInfoGameObject);
						init = true;
						Log("Initialized");
					}
					else
					{
						waitedTicks++;
					}
				}
				if (!init)
				{
					return;
				}
				if (currentScene == "Gym")
				{
					matchInfoGameObject.SetActive(false);
					gymMatchInfoGameObject.SetActive(true);
					CountWinLoss();
					if (!showWinRate)
					{
						gymMatchInfoGameObject.SetActive(false);
					}
				}
				else
				{
					gymMatchInfoGameObject.SetActive(false);
				}
				if (currentScene == "Map0" || currentScene == "Map1")
				{
					matchInfoGameObject.SetActive(true);
					try
					{
						if (currentScene == "Map0")
						{
							matchHandler = MatchHandler.GetGameObject().GetComponent<MatchHandler>();
						}
						else if (currentScene == "Map1")
						{
							matchHandler = MatchHandler.GetGameObject().GetComponent<MatchHandler>();
						}
					}
					catch
					{
						return;
					}
					if (Players.IsHost())
					{
						matchInfoGameObject.transform.position = new Vector3(-3f, 3f, 0f);
						matchInfoGameObject.transform.rotation = Quaternion.Euler(0f, -90f, 0f);
					}
					else
					{
						matchInfoGameObject.transform.position = new Vector3(3f, 3f, 0f);
						matchInfoGameObject.transform.rotation = Quaternion.Euler(0f, 90f, 0f);
					}
					((TMP_Text)player2Component).text = playerManager.AllPlayers[0].Data.GeneralData.PublicUsername;
					if (playerManager.AllPlayers[0].Data.GeneralData.InternalUsername == "5832566FD2375E31")
					{
						((TMP_Text)player2Component).text = "<#990099>U<#ff00ff>l<#ff66ff>v<#cc66ff>a<#9966ff>k<#6666ff>S<#3366ff>k<#6699ff>i<#809fff>l<#b3c6ff>l<#e6ecff>z";
					}
					((TMP_Text)player2BPComponent).text = playerManager.AllPlayers[0].Data.GeneralData.BattlePoints + " BP";
					if (playerManager.AllPlayers.Count > 1)
					{
						((TMP_Text)player1Component).text = playerManager.AllPlayers[1].Data.GeneralData.PublicUsername;
						if (playerManager.AllPlayers[1].Data.GeneralData.InternalUsername == "5832566FD2375E31")
						{
							((TMP_Text)player1Component).text = "<#990099>U<#ff00ff>l<#ff66ff>v<#cc66ff>a<#9966ff>k<#6666ff>S<#3366ff>k<#6699ff>i<#809fff>l<#b3c6ff>l<#e6ecff>z";
						}
						((TMP_Text)player1BPComponent).text = playerManager.AllPlayers[1].Data.GeneralData.BattlePoints + " BP";
						bool flag = false;
						for (int i = 0; i < fileText.Count; i += 3)
						{
							if (fileText[i].Contains(playerManager.AllPlayers[1].Data.GeneralData.InternalUsername))
							{
								if (fileText[i] == playerManager.AllPlayers[1].Data.GeneralData.InternalUsername)
								{
									List<string> list = fileText;
									int index = i;
									list[index] = list[index] + " - " + playerManager.AllPlayers[1].Data.GeneralData.PublicUsername;
								}
								else if (!fileText[i].Contains(playerManager.AllPlayers[1].Data.GeneralData.PublicUsername))
								{
									fileText[i] = playerManager.AllPlayers[1].Data.GeneralData.InternalUsername + " - " + playerManager.AllPlayers[1].Data.GeneralData.PublicUsername;
								}
								playerFileSpot = i;
								flag = true;
								break;
							}
						}
						if (!flag)
						{
							fileText.Add(playerManager.AllPlayers[1].Data.GeneralData.InternalUsername + " - " + playerManager.AllPlayers[1].Data.GeneralData.PublicUsername);
							fileText.Add("0");
							fileText.Add("0");
							playerFileSpot = fileText.Count - 3;
						}
						player1MatchWinsGameObject.SetActive(true);
						player2MatchWinsGameObject.SetActive(true);
						((TMP_Text)player1MatchWinsComponent).text = fileText[playerFileSpot + 2] + " Wins";
						((TMP_Text)player2MatchWinsComponent).text = fileText[playerFileSpot + 1] + " Wins";
						if (!showWinLoss)
						{
							player1MatchWinsGameObject.SetActive(false);
							player2MatchWinsGameObject.SetActive(false);
						}
						matchActive = true;
						ranWinLoss = false;
						hideTime = DateTime.Now.AddSeconds(7.0);
						textActive = true;
					}
					else
					{
						MelonCoroutines.Start(OnePlayerFound());
					}
				}
			}
			catch
			{
				return;
			}
			sceneChanged = false;
		}
		if (textActive && hideTime <= DateTime.Now)
		{
			MoveSign();
			textActive = false;
		}
		if (!matchActive)
		{
			return;
		}
		try
		{
			if (ranWinLoss || playerManager.AllPlayers.Count != 2 || (int)matchHandler.CurrentMatchPhase != 4)
			{
				return;
			}
			bool flag2 = false;
			string text = "";
			if (currentScene == "Map0")
			{
				text = ((!Players.IsHost()) ? ((TMP_Text)MatchText.GetGameObject().GetComponent<TextMeshProUGUI>()).text : ((TMP_Text)MatchText.GetGameObject().GetComponent<TextMeshProUGUI>()).text);
			}
			else if (currentScene == "Map1")
			{
				text = ((!Players.IsHost()) ? ((TMP_Text)MatchText.GetGameObject().GetComponent<TextMeshProUGUI>()).text : ((TMP_Text)MatchText.GetGameObject().GetComponent<TextMeshProUGUI>()).text);
			}
			if (!(text == ""))
			{
				if ((text == "Victory!") ? true : false)
				{
					fileText[playerFileSpot + 1] = (int.Parse(fileText[playerFileSpot + 1]) + 1).ToString();
					((TMP_Text)player2MatchWinsComponent).text = fileText[playerFileSpot + 1] + " Wins";
				}
				else
				{
					fileText[playerFileSpot + 2] = (int.Parse(fileText[playerFileSpot + 2]) + 1).ToString();
					((TMP_Text)player1MatchWinsComponent).text = fileText[playerFileSpot + 2] + " Wins";
				}
				((TMP_Text)player2BPComponent).text = playerManager.AllPlayers[0].Data.GeneralData.BattlePoints + " BP";
				((TMP_Text)player1BPComponent).text = playerManager.AllPlayers[1].Data.GeneralData.BattlePoints + " BP";
				ranWinLoss = true;
				File.WriteAllLines(FILEPATH + "\\" + FILENAME, fileText);
			}
		}
		catch
		{
		}
	}

	public void MoveSign()
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		if (currentScene == "Map0")
		{
			matchInfoGameObject.transform.position = new Vector3(-1f, -0.5f, 20.5f);
			matchInfoGameObject.transform.rotation = Quaternion.Euler(0f, 0f, 0f);
		}
		else if (currentScene == "Map1")
		{
			matchInfoGameObject.transform.position = new Vector3(0f, 5.25f, 11f);
			matchInfoGameObject.transform.rotation = Quaternion.Euler(0f, 0f, 0f);
		}
	}

	public IEnumerator OnePlayerFound()
	{
		for (int i = 0; i < 200; i++)
		{
			yield return (object)new WaitForFixedUpdate();
		}
		matchInfoGameObject.SetActive(false);
	}

	public void CountWinLoss()
	{
		int num = 0;
		int num2 = 0;
		for (int i = 0; i < fileText.Count; i += 3)
		{
			num += int.Parse(fileText[i + 1]);
			num2 += int.Parse(fileText[i + 2]);
		}
		((TMP_Text)gymMatchInfoTotalComponent).text = "Total: " + (num + num2);
		((TMP_Text)gymMatchInfoWinsComponent).text = "Wins: " + num;
		((TMP_Text)gymMatchInfoLossesComponent).text = "Losses: " + num2;
		((TMP_Text)gymMatchInfoWinPercentComponent).text = "Win Rate: " + (float)(int)((float)num / (float)(num + num2) * 10000f) / 100f + "%";
		if (num + num2 == 0)
		{
			((TMP_Text)gymMatchInfoWinPercentComponent).text = "Win Rate: N/A";
		}
	}

	public IEnumerator CheckIfFileExists(string filePath, string fileName)
	{
		bool newMatchInfoFile = false;
		if (!File.Exists(filePath + "\\" + fileName) || !File.Exists(filePath + "\\" + SETTINGFILENAME) || !File.Exists(filePath + "\\Backups\\" + BACKUPFILENAME + "1.txt") || !File.Exists(filePath + "\\Backups\\" + BACKUPFILENAME + "2.txt") || !File.Exists(filePath + "\\Backups\\" + BACKUPFILENAME + "3.txt"))
		{
			if (!Directory.Exists(filePath))
			{
				Log("Folder Not Found, Creating Folder: " + filePath);
				Directory.CreateDirectory(filePath);
			}
			if (!File.Exists(filePath + "\\" + fileName))
			{
				Log("Creating File " + fileName);
				File.Create(filePath + "\\" + fileName);
				newMatchInfoFile = true;
			}
			if (!File.Exists(filePath + "\\" + SETTINGFILENAME))
			{
				newSettingsFile = true;
				Log("Creating File " + SETTINGFILENAME);
				File.Create(filePath + "\\" + SETTINGFILENAME);
			}
			if (!Directory.Exists(filePath))
			{
				Log("Folder Not Found, Creating Folder: " + filePath);
				Directory.CreateDirectory(filePath);
			}
			if (!Directory.Exists(filePath + "\\Backups"))
			{
				Log("Folder Not Found, Creating Folder: " + filePath + "\\Backups");
				Directory.CreateDirectory(filePath + "\\Backups");
			}
			if (!File.Exists(filePath + "\\Backups\\" + BACKUPFILENAME + "1.txt"))
			{
				Log("Creating File " + BACKUPFILENAME + "1.txt");
				File.Create(filePath + "\\Backups\\" + BACKUPFILENAME + "1.txt");
			}
			if (!File.Exists(filePath + "\\Backups\\" + BACKUPFILENAME + "2.txt"))
			{
				Log("Creating File " + BACKUPFILENAME + "2.txt");
				File.Create(filePath + "\\Backups\\" + BACKUPFILENAME + "2.txt");
			}
			if (!File.Exists(filePath + "\\Backups\\" + BACKUPFILENAME + "3.txt"))
			{
				Log("Creating File " + BACKUPFILENAME + "3.txt");
				File.Create(filePath + "\\Backups\\" + BACKUPFILENAME + "3.txt");
			}
		}
		for (int i = 0; i < 60; i++)
		{
			yield return (object)new WaitForFixedUpdate();
		}
		if (!newSettingsFile)
		{
			ReadSettingsFile();
		}
		if (!newMatchInfoFile)
		{
			string[] tempStringList = ReadFileText(FILEPATH, FILENAME);
			string[] array = tempStringList;
			foreach (string tempString in array)
			{
				fileText.Add(tempString);
			}
		}
		yield return null;
	}

	public void ReadSettingsFile()
	{
		try
		{
			string[] array = ReadFileText(FILEPATH, SETTINGFILENAME);
			showWinRate = !array[0].ToLower().Contains("false");
			showWinLoss = !array[1].ToLower().Contains("false");
		}
		catch (Exception ex)
		{
			MelonLogger.Error("Error Reading Settings File: " + ex);
		}
	}

	public static string[] ReadFileText(string filePath, string fileName)
	{
		try
		{
			List<string> list = new List<string>();
			return File.ReadAllLines(filePath + "\\" + fileName);
		}
		catch (Exception ex)
		{
			MelonLogger.Error((object)ex);
		}
		return null;
	}

	public static void Log(string msg)
	{
		MelonLogger.Msg(msg);
	}
}