Decompiled source of ChatClipboard v1.0.0

ChatClipboard.dll

Decompiled 3 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
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 = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ChatClipboard")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ChatClipboard")]
[assembly: AssemblyTitle("ChatClipboard")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace ChatClipboard
{
	[HarmonyPatch(typeof(ChatManager), "Update")]
	public class ChatManagerPatch
	{
		private static readonly FieldInfo chatActiveInfo = typeof(ChatManager).GetField("chatActive", BindingFlags.Instance | BindingFlags.NonPublic);

		private static readonly FieldInfo chatMessageInfo = typeof(ChatManager).GetField("chatMessage", BindingFlags.Instance | BindingFlags.NonPublic);

		[HarmonyPostfix]
		private static void Postfix(ChatManager __instance)
		{
			if (chatActiveInfo == null || chatMessageInfo == null || !Input.anyKeyDown)
			{
				return;
			}
			bool flag = (bool)chatActiveInfo.GetValue(__instance);
			if (!(Input.GetKey((KeyCode)306) && flag))
			{
				return;
			}
			if (Input.GetKeyDown((KeyCode)99))
			{
				GUIUtility.systemCopyBuffer = (string)chatMessageInfo.GetValue(__instance);
			}
			else if (Input.GetKeyDown((KeyCode)118))
			{
				string systemCopyBuffer = GUIUtility.systemCopyBuffer;
				if (systemCopyBuffer != null)
				{
					string text = (string)chatMessageInfo.GetValue(__instance) + systemCopyBuffer;
					text.Replace("<b>|</b>", "");
					chatMessageInfo.SetValue(__instance, text);
				}
			}
		}
	}
}
namespace ChatClipBoard
{
	[BepInPlugin("com.manancialgd.chatclipboard", "ChatClipboard", "1.0.0")]
	public class PushToMuteMod : BaseUnityPlugin
	{
		private Harmony harmony;

		private void Awake()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			harmony = new Harmony("com.coddingcat.pushtomute");
			harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"ChatClipBoard loaded!");
		}
	}
}