<commit_before>﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public static class ActiveSubroutines {

	public static List<Subroutine> List = new List<Subroutine>();
	public static List<IMalware> MalwareList = new List<IMalware>();

	public delegate void ChangeHandler();
	public static event ChangeHandler OnMalwareListChange;
	
	public static void Add(Subroutine newlyActive)
	{
		if (!List.Contains(newlyActive))
		{
			List.Add(newlyActive);

			//notify viruses of this
			foreach(IMalware iMal in MalwareList)
			{
				if (iMal is VirusAI)
				{
					(iMal as VirusAI).OnSubroutineActive(newlyActive);
				}
			}
		}
	}

	public static void Remove(Subroutine newlyInactive)
	{
		if (List.Contains(newlyInactive))
		{
			List.Remove(newlyInactive);

			//notify viruses of this
			foreach(IMalware iMal in MalwareList)
			{
				if (iMal is VirusAI)
				{
					(iMal as VirusAI).OnSubroutineInactive(newlyInactive);
				}
			}
		}
	}

	public static void AddVirus(IMalware newVirus)
	{
		MalwareList.Add(newVirus);

		Machine m = CyberspaceBattlefield.Current.FindByName(newVirus.transform.root.name);
		if (m != null)
			m.ActiveMalware.Add(newVirus);

		if (OnMalwareListChange != null)
			OnMalwareListChange();
	}

	public static void RemoveVirus(IMalware oldVirus)
	{
		Machine m = CyberspaceBattlefield.Current.FindByName(oldVirus.transform.root.name);
		if (m != null)
		{
			m.ActiveMalware.Remove(oldVirus);
			if ((m.ActiveMalware.Count == 0) && (m.OnSystemClean != null))
				m.OnSystemClean();
		}

		MalwareList.Remove(oldVirus);
		if (OnMalwareListChange != null)
			OnMalwareListChange();
	}
<commit_msg>Fix for system not being cleaned<commit_after>﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public static class ActiveSubroutines {

	public static List<Subroutine> List = new List<Subroutine>();
	public static List<IMalware> MalwareList = new List<IMalware>();

	public delegate void ChangeHandler();
	public static event ChangeHandler OnMalwareListChange;
	
	public static void Add(Subroutine newlyActive)
	{
		if (!List.Contains(newlyActive))
		{
			List.Add(newlyActive);

			//notify viruses of this
			foreach(IMalware iMal in MalwareList)
			{
				if (iMal is VirusAI)
				{
					(iMal as VirusAI).OnSubroutineActive(newlyActive);
				}
			}
		}
	}

	public static void Remove(Subroutine newlyInactive)
	{
		if (List.Contains(newlyInactive))
		{
			List.Remove(newlyInactive);

			//notify viruses of this
			foreach(IMalware iMal in MalwareList)
			{
				if (iMal is VirusAI)
				{
					(iMal as VirusAI).OnSubroutineInactive(newlyInactive);
				}
			}
		}
	}

	public static void AddVirus(IMalware newVirus)
	{
		MalwareList.Add(newVirus);

		Machine m = CyberspaceBattlefield.Current.FindByName(newVirus.transform.root.name);
		if (m != null)
			m.ActiveMalware.Add(newVirus);

		if (OnMalwareListChange != null)
			OnMalwareListChange();
	}

	public static void RemoveVirus(IMalware oldVirus)
	{
		Machine m = CyberspaceBattlefield.Current.FindByName(oldVirus.transform.root.name);
		if (m != null)
		{
			m.ActiveMalware.Remove(oldVirus);
			if ((m.ActiveMalware.Count == 0) && (m.OnSystemClean != null))
				m.IsInfected = false;
				m.OnSystemClean();
		}

		MalwareList.Remove(oldVirus);
		if (OnMalwareListChange != null)
			OnMalwareListChange();
	}

{'fraction_non_alphanumeric': 0.10866329264662102, 'fraction_numerical': 0.0005954153021732659, 'mean_word_length': 4.014925373134329, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '5934674', 'n_tokens_mistral': 1336, 'n_tokens_neox': 1151, 'n_words': 241}