Decompiled source of LethalAnonymity v1.0.5

LethalAnonymity_v1.0.5.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LethalAnonymity")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+4cc0166fea24700f533720cbccba5d7e4904b474")]
[assembly: AssemblyProduct("LethalAnonymity")]
[assembly: AssemblyTitle("LethalAnonymity")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 LethalAnonymity
{
	internal class Config
	{
		public readonly ConfigEntry<string> Username;

		public readonly ConfigEntry<bool> HideProfilePicture;

		public Config(ConfigFile cfg)
		{
			cfg.SaveOnConfigSet = false;
			Username = cfg.Bind<string>("General", "Username", "Player", "Name to replace other players' usernames with");
			HideProfilePicture = cfg.Bind<bool>("General", "HideProfilePicture", true, "Show/hide other players' profile pictures in-game (if hidden displays a placeholder picture)");
			ClearOrphanedEntries(cfg);
			cfg.Save();
			cfg.SaveOnConfigSet = true;
		}

		private static void ClearOrphanedEntries(ConfigFile cfg)
		{
			((Dictionary<ConfigDefinition, string>)AccessTools.Property(typeof(ConfigFile), "OrphanedEntries").GetValue(cfg)).Clear();
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public static class HideUsername
	{
		public static bool Prefix(ref string __result)
		{
			__result = Plugin.PluginConfig.Username.Value;
			return false;
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public static class HidePersona
	{
		public static bool Prefix(ref string __result)
		{
			__result = Plugin.PluginConfig.Username.Value;
			return false;
		}
	}
	[HarmonyPatch(typeof(HUDManager), "FillImageWithSteamProfile")]
	public static class HidePicture
	{
		public static bool Prefix()
		{
			return !Plugin.PluginConfig.HideProfilePicture.Value;
		}
	}
	[BepInPlugin("LethalAnonymity", "LethalAnonymity", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static Config PluginConfig { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		private void Awake()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			PluginConfig = new Config(((BaseUnityPlugin)this).Config);
			new Harmony("LethalAnonymity").PatchAll();
			Logger.LogInfo((object)"LethalAnonymity v1.0.0 has loaded!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "LethalAnonymity";

		public const string PLUGIN_NAME = "LethalAnonymity";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}