Decompiled source of CodeYapper Protobuf v1.0.1

plugins/CodeYapper-Protobuf.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using CodeYapper.Protobuf;
using Microsoft.CodeAnalysis;
using ProtoBuf;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Soggy_Pancake")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+c67e0e766e3f2be6e125acc95465697099758d0c")]
[assembly: AssemblyProduct("CodeYapper-Protobuf")]
[assembly: AssemblyTitle("CodeYapper-Protobuf")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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;
		}
	}
	[CompilerGenerated]
	[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 CodeTalker.Packets
{
	public abstract class ProtobufPacketBase : BinaryPacketBase
	{
		private static MethodInfo? serializeMethod;

		private static MethodInfo? deserializeMethod;

		public ProtobufPacketBase()
		{
			if (serializeMethod == null)
			{
				serializeMethod = typeof(Serializer).GetMethods().First((MethodInfo x) => x.IsGenericMethod && x.Name == "Serialize" && x.GetParameters().Length == 2 && x.GetParameters()[0].ParameterType == typeof(Stream));
				deserializeMethod = typeof(Serializer).GetMethods().First((MethodInfo x) => x.IsGenericMethod && x.Name == "Merge" && x.GetParameters().Length == 2 && x.GetParameters()[0].ParameterType == typeof(Stream));
			}
		}

		public override byte[] Serialize()
		{
			MemoryStream memoryStream = new MemoryStream();
			serializeMethod.MakeGenericMethod(((object)this).GetType()).Invoke(null, new object[2] { memoryStream, this });
			return memoryStream.ToArray();
		}

		public override void Deserialize(byte[] data)
		{
			Plugin.logger.LogInfo((object)("[Protobuf] " + ((object)this).GetType().Name + " deserialized"));
			MemoryStream memoryStream = new MemoryStream(data);
			deserializeMethod.MakeGenericMethod(((object)this).GetType()).Invoke(null, new object[2] { memoryStream, this });
		}
	}
}
namespace CodeYapper.Protobuf
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Soggy_Pancake.CodeYapper.Protobuf", "CodeYapper-Protobuf", "1.0.1")]
	internal class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource logger;

		private void Awake()
		{
			logger = ((BaseUnityPlugin)this).Logger;
		}
	}
	internal class PluginInfo
	{
		public const string GUID = "Soggy_Pancake.CodeYapper.Protobuf";

		public const string NAME = "CodeYapper-Protobuf";

		public const string VERSION = "1.0.1";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}