Decompiled source of ExtraEmotes v1.0.0

plugins/ExtraEmotes.dll

Decompiled 3 weeks ago
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.Permissions;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using EmoteLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ExtraEmotes")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ExtraEmotes")]
[assembly: AssemblyTitle("ExtraEmotes")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ExtraEmotes;

[BepInPlugin("com.extraemotes.roadsideresearch", "ExtraEmotes", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BasePlugin
{
	public const string GUID = "com.extraemotes.roadsideresearch";

	public const string Name = "ExtraEmotes";

	public const string Version = "1.0.0";

	internal static ManualLogSource Log;

	public override void Load()
	{
		Log = ((BasePlugin)this).Log;
		((BasePlugin)this).AddComponent<EmoteTester>();
		Log.LogInfo((object)"ExtraEmotes loaded!");
	}
}
public class EmoteTester : MonoBehaviour
{
	private const float BundleLoadDelaySeconds = 3f;

	private bool _loadAttempted;

	private float _startupTime;

	private static string _breadcrumbPath;

	private void Start()
	{
		_startupTime = Time.realtimeSinceStartup;
		_breadcrumbPath = Path.Combine(Path.GetDirectoryName(typeof(Plugin).Assembly.Location) ?? ".", "bundle_breadcrumbs.log");
		Crumb("Start");
	}

	private void Update()
	{
		if (!_loadAttempted && !(Time.realtimeSinceStartup - _startupTime < 3f))
		{
			_loadAttempted = true;
			LoadBundle();
		}
	}

	private void LoadBundle()
	{
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Expected O, but got Unknown
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Expected O, but got Unknown
		string text = Path.Combine(Path.GetDirectoryName(typeof(Plugin).Assembly.Location), "customemotes");
		Crumb("LoadBundle: path=" + text);
		bool flag = default(bool);
		try
		{
			int num = AssetBundleLoader.LoadAndRegisterClips(text, Plugin.Log);
			Crumb($"LoadBundle: registered {num} clips");
			ManualLogSource log = Plugin.Log;
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(58, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("ExtraEmotes: Registered ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" custom emotes with EmoteLib wheel");
			}
			log.LogInfo(val);
		}
		catch (Exception ex)
		{
			Crumb($"LoadBundle: FATAL {ex}");
			ManualLogSource log2 = Plugin.Log;
			BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(33, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("ExtraEmotes: Bundle load failed: ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
			}
			log2.LogError(val2);
		}
	}

	private static void Crumb(string msg)
	{
		try
		{
			File.AppendAllText(_breadcrumbPath ?? "bundle_breadcrumbs.log", $"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} | t={Time.realtimeSinceStartup:F2} | {msg}{Environment.NewLine}");
		}
		catch
		{
		}
	}
}