Please disclose if any content in your mod (code, assets) was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Neofetch v1.0.5
BepInEx/plugins/Neofetch.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Threading.Tasks; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Neofetch.Patches; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Neofetch")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Neofetch")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("599875da-c595-4e12-b3c3-ab2ce83de20c")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace Neofetch { [BepInPlugin("Neofetch", "Neofetch Mod", "1.0.0.1")] public class TerminalBase : BaseUnityPlugin { private const string modGUID = "Neofetch"; private const string modName = "Neofetch Mod"; private const string modVersion = "1.0.0.1"; private readonly Harmony harmony = new Harmony("Neofetch"); private static TerminalBase Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("Neofetch"); mls.LogInfo((object)"Neofetch started"); harmony.PatchAll(typeof(TerminalBase)); harmony.PatchAll(typeof(TerminalPatch)); } } } namespace Neofetch.Patches { [HarmonyPatch(typeof(Terminal))] internal class TerminalPatch { public static bool used; public static int time; public static int packeges; public const string prompt = "<color=#4E9A06>root@terminal:<color=blue>~</color>9</color> "; public static async Task TimeKeeper() { used = true; Logger.CreateLogSource("Terminal").LogInfo((object)"uptime started"); while (used) { await Task.Delay(60000); time++; } Logger.CreateLogSource("Terminal").LogInfo((object)"uptime ended"); TimeKeeper(); } [HarmonyPatch("BeginUsingTerminal")] [HarmonyPrefix] private static void NeofetchPatch(ref TerminalNodesList ___terminalNodes, ref bool ___usedTerminalThisSession) { //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Expected O, but got Unknown if (!___usedTerminalThisSession) { if (used) { used = false; } else { TimeKeeper(); } time = 0; packeges = ___terminalNodes.allKeywords.Length; } string text = ((time < 60 && time != 1) ? (time + " mins") : ((time < 120 && time % 60 != 1 && time != 60) ? ("1 hour, " + time % 60 + " mins") : ((time % 60 != 1) ? (time / 60 + " hours, " + time % 60 + " mins") : ((time < 60) ? "1 min" : ((time < 120) ? "1 hour, 1 min" : ((time == 60) ? "1 hour" : (time / 60 + " hours, 1 min"))))))); string[] array = new string[5] { "<#CE00CC>Uptime:</color> " + text, "<#CE00CC>Packages:</color> " + packeges, "", "<mark=#000000><color=black>__</color></mark><mark=#CC0000><color=#CC0000>__</color></mark><mark=#00CD00><color=#00CD00>__</color></mark><mark=#CDCD00><color=#CDCD00>__</color></mark><mark=#0000CD><color=#0000CD>__</color></mark><mark=#CE00CC><color=#CE00CC>__</color></mark><mark=#01CDCF><color=#01CDCF>__</color></mark><mark=#E5E5E5><color=#E5E5E5>__</color></mark>", "" }; if (time >= 60) { string text2 = "<#CE00CC>Uptime:</color> " + text.Substring(0, text.IndexOf(",") + 1); string text3 = text.Substring(text.IndexOf(",") + 2); for (int num = array.Length - 1; num >= 2; num--) { array[num] = array[num - 1]; } array[0] = text2; array[1] = text3; } TerminalNode val = new TerminalNode(); val.displayText = " <color=#76FFEF>++++++++++</color> <color=#76FFEF>root</color>@<color=#76FFEF>terminal</color>\r\n <color=#76FFEF>+=--=++++++==-=+</color> -------------\r\n <color=#76FFEF>=-=++ ++=-=</color> <#CE00CC>OS:</color> FORTUNE-9\r\n <color=#76FFEF>+-=++ -*- *+=-+</color> " + array[0] + "\r\n <color=#76FFEF>+-++ +==+++-++ ++-+</color> " + array[1] + "\r\n<color=#76FFEF>+-++ =-+ +-+ ++-+</color> " + array[2] + "\r\n<color=#76FFEF>==+ +-= +-=+ +==</color> " + array[3] + "\r\n<color=#76FFEF>-++ *==+ +--+ ++-</color> " + array[4] + "\r\n<color=#76FFEF>-++ ++-++++==--+ *+-</color>\r\n<color=#76FFEF>==+ ++* +==* +==</color>\r\n<color=#76FFEF>+-++ +==+ ++-+</color>\r\n <color=#76FFEF>+-++ +=++++=-+ ++-+</color>\r\n <color=#76FFEF>+-=+* ++++ *+=-+</color>\r\n <color=#76FFEF>=-=++ ++=-=</color> \r\n <color=#76FFEF>+=--++++++++=-=++</color> \r\n <color=#76FFEF>++++++++++++</color> \r\n\r\n\r\n"; val.clearPreviousText = true; ___terminalNodes.specialNodes[13] = val; } [HarmonyPatch("TextPostProcess")] public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ret) { list.InsertRange(i, new List<CodeInstruction> { new CodeInstruction(OpCodes.Ldarg_1, (object)null), new CodeInstruction(OpCodes.Ldstr, (object)"<color=#4E9A06>root@terminal:<color=blue>~</color>9</color> "), new CodeInstruction(OpCodes.Call, (object)typeof(string).GetMethod("Concat", new Type[2] { typeof(string), typeof(string) })) }); list.RemoveAt(i); break; } } return list.AsEnumerable(); } } }