using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
[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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("BunchOfHotfix")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Hotfix for Bunch of Emotes")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BunchOfHotfix")]
[assembly: AssemblyTitle("BunchOfHotfix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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;
}
}
}
[BepInPlugin("com.dragsun.bunchofemotespatch", "BunchOfEmotesPatch", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class EmotePatcher : BaseUnityPlugin
{
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"BunchOfEmotes Patcher Loaded!");
PatchEmoteFile();
}
private void PatchEmoteFile()
{
string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
string text = Path.Combine(directoryName, "bunchofemotescontroller");
string text2 = Path.Combine(Paths.PluginPath, "Dragsun-Bunch_Of_Emotes");
string text3 = Path.Combine(text2, "bunchofemotescontroller");
if (!File.Exists(text))
{
((BaseUnityPlugin)this).Logger.LogError((object)("Source file not found at: " + text));
return;
}
if (!Directory.Exists(text2))
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"Target plugin folder not found. Skipping patch.");
return;
}
if (File.Exists(text3))
{
string fileHash = GetFileHash(text);
string fileHash2 = GetFileHash(text3);
if (fileHash == fileHash2)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"File is already patched. Skipping overwrite.");
return;
}
}
try
{
File.Copy(text, text3, overwrite: true);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Successfully applied new patch to bunchofemotescontroller!");
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogError((object)("Failed to copy file: " + ex.Message));
}
}
private string GetFileHash(string filename)
{
using MD5 mD = MD5.Create();
using FileStream inputStream = File.OpenRead(filename);
byte[] array = mD.ComputeHash(inputStream);
return BitConverter.ToString(array).Replace("-", "").ToLowerInvariant();
}
}
namespace BunchOfEmotesPatch
{
public static class PluginInfo
{
public const string PLUGIN_GUID = "BunchOfHotfix";
public const string PLUGIN_NAME = "BunchOfHotfix";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}