<commit_before>using System;
using System.Linq;
using UnityEngine;

namespace SpeedrunTimerMod
{
	sealed class ModLoader : MonoBehaviour
	{
		public static bool IsLegacyVersion { get; private set; }
		public static Settings Settings { get; private set; }

		public static GameObject LoaderObject { get; private set; }
		public static GameObject MainObject { get; private set; }
		public static GameObject LevelObject { get; private set; }

		static bool _disabled;
		static string _errorDisplayMessage;

		void Awake()
		{
			ModInit();

			if (_disabled)
				return;

			ModObjInit();
			LevelObjInit();
		}

		void ModInit()
		{
			if (Settings != null)
				return;

			IsLegacyVersion = CheckIfLegacy();
			Settings = new Settings();
			if (!Settings.Load())
				Debug.Log("Failed to load Speedrun Timer Mod settings.");

			if (Settings.ModDisabled)
			{
				_disabled = true;
				return;
			}

			Application.targetFrameRate = Settings.TargetFramerate;
			Application.runInBackground = Settings.RunInBackground;
			QualitySettings.vSyncCount = Settings.Vsync ? 1 : 0;
		}

		void ModObjInit()
		{
			if (MainObject != null)
				return;

			Resources.Instance.LoadAllResources();

			MainObject = new GameObject();
			DontDestroyOnLoad(MainObject);

            MainObject.AddComponent<DebugBeatListener>();
			var speedrunTimer = MainObject.AddComponent<SpeedrunTimer>();
			speedrunTimer.LiveSplitSyncEnabled = Settings.LiveSplitSyncEnabled;
			MainObject.AddComponent<UI>();
			MainObject.AddComponent<Updater>();
		}

		void LevelObjInit()
		{
			LevelObject = new GameObject();
            LevelObject.AddComponent<GameObserversManager>();
			LevelObject.AddComponent<ResetHotkey>();
			LevelObject.AddComponent<Cheats>();
			LevelObject.AddComponent<PlayerControlOverride>();
		}

		void OnGUI()
		{
			if (!string.IsNullOrEmpty(_errorDisplayMessage))
			{<commit_msg>fix indentation<commit_after>using System;
using System.Linq;
using UnityEngine;

namespace SpeedrunTimerMod
{
	sealed class ModLoader : MonoBehaviour
	{
		public static bool IsLegacyVersion { get; private set; }
		public static Settings Settings { get; private set; }

		public static GameObject LoaderObject { get; private set; }
		public static GameObject MainObject { get; private set; }
		public static GameObject LevelObject { get; private set; }

		static bool _disabled;
		static string _errorDisplayMessage;

		void Awake()
		{
			ModInit();

			if (_disabled)
				return;

			ModObjInit();
			LevelObjInit();
		}

		void ModInit()
		{
			if (Settings != null)
				return;

			IsLegacyVersion = CheckIfLegacy();
			Settings = new Settings();
			if (!Settings.Load())
				Debug.Log("Failed to load Speedrun Timer Mod settings.");

			if (Settings.ModDisabled)
			{
				_disabled = true;
				return;
			}

			Application.targetFrameRate = Settings.TargetFramerate;
			Application.runInBackground = Settings.RunInBackground;
			QualitySettings.vSyncCount = Settings.Vsync ? 1 : 0;
		}

		void ModObjInit()
		{
			if (MainObject != null)
				return;

			Resources.Instance.LoadAllResources();

			MainObject = new GameObject();
			DontDestroyOnLoad(MainObject);

			MainObject.AddComponent<DebugBeatListener>();
			var speedrunTimer = MainObject.AddComponent<SpeedrunTimer>();
			speedrunTimer.LiveSplitSyncEnabled = Settings.LiveSplitSyncEnabled;
			MainObject.AddComponent<UI>();
			MainObject.AddComponent<Updater>();
		}

		void LevelObjInit()
		{
			LevelObject = new GameObject();
            LevelObject.AddComponent<GameObserversManager>();
			LevelObject.AddComponent<ResetHotkey>();
			LevelObject.AddComponent<Cheats>();
			LevelObject.AddComponent<PlayerControlOverride>();
		}

		void OnGUI()
		{
			if (!string.IsNullOrEmpty(_errorDisplayMessage))
			{
{'fraction_non_alphanumeric': 0.10242731395038678, 'fraction_numerical': 0.0010669511869831954, 'mean_word_length': 3.9800796812749004, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3806108', 'n_tokens_mistral': 1303, 'n_tokens_neox': 1078, 'n_words': 253}