Decompiled source of LethalFetch v0.1.2

LethalFetch.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 TerminalApi;
using TerminalApi.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("LethalFetch")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("neofetch for Lethal Company's Terminal")]
[assembly: AssemblyFileVersion("0.1.2.0")]
[assembly: AssemblyInformationalVersion("0.1.2")]
[assembly: AssemblyProduct("LethalFetch")]
[assembly: AssemblyTitle("LethalFetch")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.2.0")]
[module: UnverifiableCode]
namespace LethalFetch;

[BepInPlugin("LethalFetch", "LethalFetch", "0.1.2")]
[BepInDependency("atomic.terminalapi", "1.2.0")]
public class Plugin : BaseUnityPlugin
{
	private string template = "\r\n+---------+ OS: Fortune OS\r\n|         | Kernel: GNU/Hurd v45\r\n| ({0}) | Uptime: {1}\r\n|         | Packages: 6 (bracken) 9 (rpm)\r\n+---------+ Shell: quota\r\n            Terminal: VT-33000\r\n            CPU: BORSON 300 @ 2500 MHz\r\n            GPU: Nvidia Tesla V900\r\n            Memory:  {2} MiB / 448 MiB";

	private int ramUsed;

	private const int ramMax = 448;

	private Random rand;

	private TerminalKeyword keyword;

	private DateTime boot;

	private void Awake()
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Expected O, but got Unknown
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalFetch is loaded!");
		Events.TerminalBeginUsing += new TerminalEventHandler(RecordBootTime);
		Events.TerminalTextChanged += new TerminalTextChangedEventHandler(updateKeyword);
		template.Trim();
		template += "\n";
		rand = new Random();
		keyword = TerminalApi.CreateTerminalKeyword("neofetch", template, false, "");
		TerminalApi.AddTerminalKeyword(keyword);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Added keyword neofetch");
	}

	private void updateKeyword(object sender, TerminalTextChangedEventArgs e)
	{
		TimeSpan timeSpan = DateTime.Now - boot;
		string arg = ((timeSpan.Minutes != 0) ? $"{timeSpan.Minutes} minutes, {timeSpan.Seconds} seconds" : $"{timeSpan.Seconds} seconds");
		ramUsed += Math.Abs(rand.Next(-5, 6));
		string arg2 = $"{ramUsed % 448}";
		string arg3 = ((rand.Next(10) > 2) ? "image" : "anime");
		string text = string.Format(template, arg3, arg, arg2);
		keyword = TerminalApi.CreateTerminalKeyword("neofetch", text, true, "");
		TerminalApi.UpdateKeyword(keyword);
	}

	private void RecordBootTime(object sender, TerminalEventArgs e)
	{
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Recorded boot time");
		boot = DateTime.Now;
	}
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "LethalFetch";

	public const string PLUGIN_NAME = "LethalFetch";

	public const string PLUGIN_VERSION = "0.1.2";
}