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

using Contracts;
using UnityEngine;

namespace Contracts_Window
{
	[KSPAddonImproved(KSPAddonImproved.Startup.EditorAny | KSPAddonImproved.Startup.TimeElapses, false)]
	class contractsWindow: MonoBehaviourWindow
	{
		private List<contractContainer> cList = new List<contractContainer>();
		private string version;
		private Assembly assembly;
		
		internal override void Awake()
		{
			if (HighLogic.CurrentGame.Mode == Game.Modes.CAREER)
			{
				assembly = AssemblyLoader.loadedAssemblies.GetByAssembly(Assembly.GetExecutingAssembly()).assembly;
				version = FileVersionInfo.GetVersionInfo(assembly.Location).ProductVersion;
				WindowCaption = string.Format("Contracts v{0}", "version");
				WindowRect = new Rect(0, 0, 150, 100);
				Visible = true;
			}
		}

		internal override void Start()
		{
			GameEvents.Contract.onAccepted.Add(contractAccepted);
			GameEvents.Contract.onContractsLoaded.Add(contractLoaded);
		}

		internal override void OnDestroy()
		{
			GameEvents.Contract.onAccepted.Remove(contractAccepted);
			GameEvents.Contract.onContractsLoaded.Remove(contractLoaded);
		}

		internal override void Update()
		{
			
		}

		internal override void DrawWindow(int id)
		{

		}

		private void contractAccepted(Contract c)
		{
			cList.Add(new contractContainer(c));
		}

		private void contractLoaded()
		{<commit_msg>a working window with active contracts<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;
using System.Reflection;

using Contracts;
using UnityEngine;

namespace Contracts_Window
{
	[KSPAddonImproved(KSPAddonImproved.Startup.EditorAny | KSPAddonImproved.Startup.TimeElapses, false)]
	class contractsWindow: MonoBehaviourWindow
	{
		private List<contractContainer> cList = new List<contractContainer>();
		private string version;
		private Assembly assembly;
		
		internal override void Awake()
		{
			if (HighLogic.CurrentGame.Mode == Game.Modes.CAREER)
			{
				assembly = AssemblyLoader.loadedAssemblies.GetByAssembly(Assembly.GetExecutingAssembly()).assembly;
				version = FileVersionInfo.GetVersionInfo(assembly.Location).ProductVersion;
				WindowCaption = string.Format("Contracts {0}", version);
				WindowRect = new Rect(0, 0, 150, 100);
				Visible = true;
				DragEnabled = true;
				SkinsLibrary.SetCurrent("DefaultSkin");
			}
		}

		internal override void Start()
		{
			GameEvents.Contract.onAccepted.Add(contractAccepted);
			GameEvents.Contract.onContractsLoaded.Add(contractLoaded);
		}

		internal override void OnDestroy()
		{
			GameEvents.Contract.onAccepted.Remove(contractAccepted);
			GameEvents.Contract.onContractsLoaded.Remove(contractLoaded);
		}

		internal override void Update()
		{
			
		}

		internal override void DrawWindow(int id)
		{

			GUILayout.Label(new GUIContent("Contracts", "Get Contracts"));
			GUILayout.Label(string.Format("Active Contracts: {0}", ContractSystem.Instance.Contracts.Count));
			GUILayout.BeginVertical();
			foreach (contractContainer c in cList)
				GUILayout.Box(c.contract.Title);
			GUILayout.EndVertical();

		}

		private void contractAccepted(Contract c)
		{
			cList.Add(new contractContainer(c));
		}

		private void contractLoaded()
		{
{'fraction_non_alphanumeric': 0.100868003591739, 'fraction_numerical': 0.005686920083807243, 'mean_word_length': 4.8426573426573425, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5242193', 'n_tokens_mistral': 1157, 'n_tokens_neox': 985, 'n_words': 196}