<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;
using KSPAchievements;

namespace ProgressParser
{
	[KSPAddon(KSPAddon.Startup.MainMenu, true)]
	public class progressController : MonoBehaviour
	{
		private static bool initialized;
		
		public static progressController instance;

		private void Start()
		{
			if (initialized)
				Destroy(gameObject);

			instance = this;

			DontDestroyOnLoad(gameObject);

			Debug.Log("[Progress Tracking Parser] Starting Progress Controller...");
			initialized = true;

			GameEvents.onLevelWasLoaded.Add(onSceneChange);
			GameEvents.OnProgressReached.Add(onReach);
			GameEvents.OnProgressAchieved.Add(onAchieve);
			GameEvents.OnProgressComplete.Add(onComplete);
		}

		private void onSceneChange(GameScenes g)
		{
			switch (g)
			{
				case GameScenes.LOADING:
				case GameScenes.CREDITS:
				case GameScenes.LOADINGBUFFER:
				case GameScenes.MAINMENU:
				case GameScenes.PSYSTEM:
				case GameScenes.SETTINGS:
					return;
			}

			Debug.Log("[Progress Tracking Parser] Initializing Progress Parser...");

			progressParser.initialize(HighLogic.CurrentGame);
		}

		private void onReach(ProgressNode node)
		{
			Debug.Log("Reaching A Node...");

			if (node == null)
				return;
<commit_msg>Load the stock achievement icon<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;
using KSPAchievements;

namespace ProgressParser
{
	[KSPAddon(KSPAddon.Startup.MainMenu, true)]
	public class progressController : MonoBehaviour
	{
		private static bool initialized;
		private static bool messageIconLoaded;
		private static Texture2D messageIcon = new Texture2D(32, 32);
		
		public static progressController instance;

		public static Texture2D MessageIcon
		{
			get { return messageIcon; }
		}

		private void Start()
		{
			if (initialized)
				Destroy(gameObject);

			instance = this;

			DontDestroyOnLoad(gameObject);

			Debug.Log("[Progress Tracking Parser] Starting Progress Controller...");
			initialized = true;

			GameEvents.onLevelWasLoaded.Add(onSceneChange);
			GameEvents.OnProgressReached.Add(onReach);
			GameEvents.OnProgressAchieved.Add(onAchieve);
			GameEvents.OnProgressComplete.Add(onComplete);
		}

		private void loadMessageSystemIcon()
		{
			MessageSystem.Message m = new MessageSystem.Message("", "", MessageSystemButton.MessageButtonColor.BLUE, MessageSystemButton.ButtonIcons.MESSAGE);

			if (m == null)
				return;

			if (m.button == null)
			{
				m = null;
				return;
			}

			MessageSystemButton b = m.button;

			if (b.iconAchieve == null)
			{
				m = null;
				return;
			}

			Debug.Log("[Progress Tracking Parser] Message System Icon Loaded");

			messageIcon = (Texture2D)b.iconAchieve;

			messageIconLoaded = true;

			m = null;
		}

		private void onSceneChange(GameScenes g)
		{
			switch (g)
			{
				case GameScenes.LOADING:
				case GameScenes.CREDITS:
				case GameScenes.LOADINGBUFFER:
				case GameScenes.MAINMENU:
				case GameScenes.PSYSTEM:
				case GameScenes.SETTINGS:
					return;
			}

			if (!messageIconLoaded)
				loadMessageSystemIcon();

			Debug.Log("[Progress Tracking Parser] Initializing Progress Parser...");

			progressParser.initialize(HighLogic.CurrentGame);
		}

		private void onReach(ProgressNode node)
		{
			Debug.Log("Reaching A Node...");

			if (node == null)
				return;

{'fraction_non_alphanumeric': 0.09762456546929317, 'fraction_numerical': 0.002317497103128621, 'mean_word_length': 3.8909348441926346, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2946375', 'n_tokens_mistral': 1298, 'n_tokens_neox': 1072, 'n_words': 238}