Decompiled source of CommandLib v1.0.0

CommandLib.dll

Decompiled a year ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("CommandLib")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Template mod for lethal company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CommandLib")]
[assembly: AssemblyTitle("CommandLib")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CommandLib
{
	public class ModInfo
	{
		public const string name = "Command Library";

		public const string guid = "buzzbb.cmdlib";

		public const string version = "1.0.0";
	}
	[BepInPlugin("buzzbb.cmdlib", "Command Library", "1.0.0")]
	public class Commands : BaseUnityPlugin
	{
		private Harmony harmonyInstance = new Harmony("buzzbb.cmdlib");

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Reached awake point for Command [email protected], applying patches");
			harmonyInstance.PatchAll(Assembly.GetExecutingAssembly());
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Applied patches");
		}

		public static void RegisterCommand(string word, string returnText, string eventName, Terminal terminal)
		{
			TerminalKeyword val = MakeKeyword(word.ToLower());
			TerminalNode specialKeywordResult = MakeNode(returnText, eventName);
			val.specialKeywordResult = specialKeywordResult;
			RegisterKeyword(val, terminal);
		}

		public static TerminalKeyword MakeKeyword(string word)
		{
			TerminalKeyword val = ScriptableObject.CreateInstance<TerminalKeyword>();
			val.word = word;
			return val;
		}

		public static TerminalNode MakeNode(string returnText, string associatedEvent)
		{
			TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
			val.displayText = returnText;
			val.clearPreviousText = true;
			val.terminalEvent = associatedEvent;
			return val;
		}

		public static void RegisterKeyword(TerminalKeyword keyword, Terminal terminal)
		{
			if ((Object)(object)terminal != (Object)null)
			{
				terminal.terminalNodes.allKeywords = CollectionExtensions.AddToArray<TerminalKeyword>(terminal.terminalNodes.allKeywords, keyword);
			}
			else
			{
				Debug.LogError((object)"Tried to register keyword with null terminal");
			}
		}
	}
}