Decompiled source of TootTallyCore v1.2.5
plugins/Microsoft.CSharp.dll
Decompiled 5 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Specialized; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Dynamic; using System.Globalization; using System.Linq; using System.Linq.Expressions; using System.Numerics.Hashing; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Security; using System.Text; using System.Threading; using FxResources.Microsoft.CSharp; using Microsoft.CSharp.RuntimeBinder.Errors; using Microsoft.CSharp.RuntimeBinder.Semantics; using Microsoft.CSharp.RuntimeBinder.Syntax; using Microsoft.CodeAnalysis; [assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)] [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyDefaultAlias("Microsoft.CSharp")] [assembly: AssemblyMetadata(".NETFrameworkAssembly", "")] [assembly: AssemblyMetadata("Serviceable", "True")] [assembly: AssemblyMetadata("PreferInbox", "True")] [assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] [assembly: AssemblyDescription("Microsoft.CSharp")] [assembly: AssemblyFileVersion("4.700.19.56404")] [assembly: AssemblyInformationalVersion("3.1.0+0f7f38c4fd323b26da10cce95f857f77f0f09b48")] [assembly: AssemblyProduct("Microsoft® .NET Core")] [assembly: AssemblyTitle("Microsoft.CSharp")] [assembly: AssemblyCompany("Microsoft Corporation")] [assembly: CLSCompliant(true)] [assembly: AssemblyVersion("4.0.5.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [Microsoft.CodeAnalysis.Embedded] [CompilerGenerated] internal sealed class IsReadOnlyAttribute : Attribute { } } namespace FxResources.Microsoft.CSharp { internal static class SR { } } namespace System { internal static class SR { private static ResourceManager s_resourceManager; internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR))); internal static string InternalCompilerError => GetResourceString("InternalCompilerError"); internal static string BindPropertyFailedMethodGroup => GetResourceString("BindPropertyFailedMethodGroup"); internal static string BindPropertyFailedEvent => GetResourceString("BindPropertyFailedEvent"); internal static string BindInvokeFailedNonDelegate => GetResourceString("BindInvokeFailedNonDelegate"); internal static string NullReferenceOnMemberException => GetResourceString("NullReferenceOnMemberException"); internal static string BindCallToConditionalMethod => GetResourceString("BindCallToConditionalMethod"); internal static string BindToVoidMethodButExpectResult => GetResourceString("BindToVoidMethodButExpectResult"); internal static string EmptyDynamicView => GetResourceString("EmptyDynamicView"); internal static string GetValueonWriteOnlyProperty => GetResourceString("GetValueonWriteOnlyProperty"); internal static string BadBinaryOps => GetResourceString("BadBinaryOps"); internal static string BadIndexLHS => GetResourceString("BadIndexLHS"); internal static string BadIndexCount => GetResourceString("BadIndexCount"); internal static string BadUnaryOp => GetResourceString("BadUnaryOp"); internal static string NoImplicitConv => GetResourceString("NoImplicitConv"); internal static string NoExplicitConv => GetResourceString("NoExplicitConv"); internal static string ConstOutOfRange => GetResourceString("ConstOutOfRange"); internal static string AmbigBinaryOps => GetResourceString("AmbigBinaryOps"); internal static string AmbigUnaryOp => GetResourceString("AmbigUnaryOp"); internal static string ValueCantBeNull => GetResourceString("ValueCantBeNull"); internal static string NoSuchMember => GetResourceString("NoSuchMember"); internal static string ObjectRequired => GetResourceString("ObjectRequired"); internal static string AmbigCall => GetResourceString("AmbigCall"); internal static string BadAccess => GetResourceString("BadAccess"); internal static string AssgLvalueExpected => GetResourceString("AssgLvalueExpected"); internal static string NoConstructors => GetResourceString("NoConstructors"); internal static string PropertyLacksGet => GetResourceString("PropertyLacksGet"); internal static string ObjectProhibited => GetResourceString("ObjectProhibited"); internal static string AssgReadonly => GetResourceString("AssgReadonly"); internal static string AssgReadonlyStatic => GetResourceString("AssgReadonlyStatic"); internal static string AssgReadonlyProp => GetResourceString("AssgReadonlyProp"); internal static string UnsafeNeeded => GetResourceString("UnsafeNeeded"); internal static string BadBoolOp => GetResourceString("BadBoolOp"); internal static string MustHaveOpTF => GetResourceString("MustHaveOpTF"); internal static string ConstOutOfRangeChecked => GetResourceString("ConstOutOfRangeChecked"); internal static string AmbigMember => GetResourceString("AmbigMember"); internal static string NoImplicitConvCast => GetResourceString("NoImplicitConvCast"); internal static string InaccessibleGetter => GetResourceString("InaccessibleGetter"); internal static string InaccessibleSetter => GetResourceString("InaccessibleSetter"); internal static string BadArity => GetResourceString("BadArity"); internal static string TypeArgsNotAllowed => GetResourceString("TypeArgsNotAllowed"); internal static string HasNoTypeVars => GetResourceString("HasNoTypeVars"); internal static string NewConstraintNotSatisfied => GetResourceString("NewConstraintNotSatisfied"); internal static string GenericConstraintNotSatisfiedRefType => GetResourceString("GenericConstraintNotSatisfiedRefType"); internal static string GenericConstraintNotSatisfiedNullableEnum => GetResourceString("GenericConstraintNotSatisfiedNullableEnum"); internal static string GenericConstraintNotSatisfiedNullableInterface => GetResourceString("GenericConstraintNotSatisfiedNullableInterface"); internal static string GenericConstraintNotSatisfiedValType => GetResourceString("GenericConstraintNotSatisfiedValType"); internal static string CantInferMethTypeArgs => GetResourceString("CantInferMethTypeArgs"); internal static string RefConstraintNotSatisfied => GetResourceString("RefConstraintNotSatisfied"); internal static string ValConstraintNotSatisfied => GetResourceString("ValConstraintNotSatisfied"); internal static string AmbigUDConv => GetResourceString("AmbigUDConv"); internal static string BindToBogus => GetResourceString("BindToBogus"); internal static string CantCallSpecialMethod => GetResourceString("CantCallSpecialMethod"); internal static string ConvertToStaticClass => GetResourceString("ConvertToStaticClass"); internal static string IncrementLvalueExpected => GetResourceString("IncrementLvalueExpected"); internal static string BadArgCount => GetResourceString("BadArgCount"); internal static string BadArgTypes => GetResourceString("BadArgTypes"); internal static string BadProtectedAccess => GetResourceString("BadProtectedAccess"); internal static string BindToBogusProp2 => GetResourceString("BindToBogusProp2"); internal static string BindToBogusProp1 => GetResourceString("BindToBogusProp1"); internal static string BadDelArgCount => GetResourceString("BadDelArgCount"); internal static string BadDelArgTypes => GetResourceString("BadDelArgTypes"); internal static string BadCtorArgCount => GetResourceString("BadCtorArgCount"); internal static string NonInvocableMemberCalled => GetResourceString("NonInvocableMemberCalled"); internal static string BadNamedArgument => GetResourceString("BadNamedArgument"); internal static string BadNamedArgumentForDelegateInvoke => GetResourceString("BadNamedArgumentForDelegateInvoke"); internal static string DuplicateNamedArgument => GetResourceString("DuplicateNamedArgument"); internal static string NamedArgumentUsedInPositional => GetResourceString("NamedArgumentUsedInPositional"); internal static string TypeArgumentRequiredForStaticCall => GetResourceString("TypeArgumentRequiredForStaticCall"); internal static string DynamicArgumentNeedsValue => GetResourceString("DynamicArgumentNeedsValue"); internal static string BadNonTrailingNamedArgument => GetResourceString("BadNonTrailingNamedArgument"); [MethodImpl(MethodImplOptions.NoInlining)] private static bool UsingResourceKeys() { return false; } internal static string GetResourceString(string resourceKey, string defaultString = null) { if (UsingResourceKeys()) { return defaultString ?? resourceKey; } string text = null; try { text = ResourceManager.GetString(resourceKey); } catch (MissingManifestResourceException) { } if (defaultString != null && resourceKey.Equals(text)) { return defaultString; } return text; } internal static string Format(string resourceFormat, object p1) { if (UsingResourceKeys()) { return string.Join(", ", resourceFormat, p1); } return string.Format(resourceFormat, p1); } } } namespace System.Numerics.Hashing { internal static class HashHelpers { public static readonly int RandomSeed = new Random().Next(int.MinValue, int.MaxValue); public static int Combine(int h1, int h2) { uint num = (uint)(h1 << 5) | ((uint)h1 >> 27); return ((int)num + h1) ^ h2; } } } namespace Microsoft.CSharp.RuntimeBinder { internal readonly struct ArgumentObject { internal readonly object Value; internal readonly CSharpArgumentInfo Info; internal readonly Type Type; public ArgumentObject(object value, CSharpArgumentInfo info, Type type) { Value = value; Info = info; Type = type; } } [EditorBrowsable(EditorBrowsableState.Never)] public static class Binder { public static CallSiteBinder BinaryOperation(CSharpBinderFlags flags, ExpressionType operation, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo) { bool isChecked = (flags & CSharpBinderFlags.CheckedContext) != 0; bool flag = (flags & CSharpBinderFlags.BinaryOperationLogical) != 0; CSharpBinaryOperationFlags cSharpBinaryOperationFlags = CSharpBinaryOperationFlags.None; if (flag) { cSharpBinaryOperationFlags |= CSharpBinaryOperationFlags.LogicalOperation; } return new CSharpBinaryOperationBinder(operation, isChecked, cSharpBinaryOperationFlags, context, argumentInfo).TryGetExisting(); } public static CallSiteBinder Convert(CSharpBinderFlags flags, Type type, Type context) { CSharpConversionKind conversionKind = (((flags & CSharpBinderFlags.ConvertExplicit) != 0) ? CSharpConversionKind.ExplicitConversion : (((flags & CSharpBinderFlags.ConvertArrayIndex) != 0) ? CSharpConversionKind.ArrayCreationConversion : CSharpConversionKind.ImplicitConversion)); bool isChecked = (flags & CSharpBinderFlags.CheckedContext) != 0; return new CSharpConvertBinder(type, conversionKind, isChecked, context).TryGetExisting(); } public static CallSiteBinder GetIndex(CSharpBinderFlags flags, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo) { return new CSharpGetIndexBinder(context, argumentInfo).TryGetExisting(); } public static CallSiteBinder GetMember(CSharpBinderFlags flags, string name, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo) { bool resultIndexed = (flags & CSharpBinderFlags.ResultIndexed) != 0; return new CSharpGetMemberBinder(name, resultIndexed, context, argumentInfo).TryGetExisting(); } public static CallSiteBinder Invoke(CSharpBinderFlags flags, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo) { bool flag = (flags & CSharpBinderFlags.ResultDiscarded) != 0; CSharpCallFlags cSharpCallFlags = CSharpCallFlags.None; if (flag) { cSharpCallFlags |= CSharpCallFlags.ResultDiscarded; } return new CSharpInvokeBinder(cSharpCallFlags, context, argumentInfo).TryGetExisting(); } public static CallSiteBinder InvokeMember(CSharpBinderFlags flags, string name, IEnumerable<Type> typeArguments, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo) { bool flag = (flags & CSharpBinderFlags.InvokeSimpleName) != 0; bool flag2 = (flags & CSharpBinderFlags.InvokeSpecialName) != 0; bool flag3 = (flags & CSharpBinderFlags.ResultDiscarded) != 0; CSharpCallFlags cSharpCallFlags = CSharpCallFlags.None; if (flag) { cSharpCallFlags |= CSharpCallFlags.SimpleNameCall; } if (flag2) { cSharpCallFlags |= CSharpCallFlags.EventHookup; } if (flag3) { cSharpCallFlags |= CSharpCallFlags.ResultDiscarded; } return new CSharpInvokeMemberBinder(cSharpCallFlags, name, context, typeArguments, argumentInfo).TryGetExisting(); } public static CallSiteBinder InvokeConstructor(CSharpBinderFlags flags, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo) { return new CSharpInvokeConstructorBinder(CSharpCallFlags.None, context, argumentInfo).TryGetExisting(); } public static CallSiteBinder IsEvent(CSharpBinderFlags flags, string name, Type context) { return new CSharpIsEventBinder(name, context).TryGetExisting(); } public static CallSiteBinder SetIndex(CSharpBinderFlags flags, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo) { bool isCompoundAssignment = (flags & CSharpBinderFlags.ValueFromCompoundAssignment) != 0; bool isChecked = (flags & CSharpBinderFlags.CheckedContext) != 0; return new CSharpSetIndexBinder(isCompoundAssignment, isChecked, context, argumentInfo).TryGetExisting(); } public static CallSiteBinder SetMember(CSharpBinderFlags flags, string name, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo) { bool isCompoundAssignment = (flags & CSharpBinderFlags.ValueFromCompoundAssignment) != 0; bool isChecked = (flags & CSharpBinderFlags.CheckedContext) != 0; return new CSharpSetMemberBinder(name, isCompoundAssignment, isChecked, context, argumentInfo).TryGetExisting(); } public static CallSiteBinder UnaryOperation(CSharpBinderFlags flags, ExpressionType operation, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo) { bool isChecked = (flags & CSharpBinderFlags.CheckedContext) != 0; return new CSharpUnaryOperationBinder(operation, isChecked, context, argumentInfo).TryGetExisting(); } } internal static class BinderEquivalence { internal class BinderEqualityComparer : IEqualityComparer<ICSharpBinder> { public bool Equals(ICSharpBinder x, ICSharpBinder y) { return x.IsEquivalentTo(y); } public int GetHashCode(ICSharpBinder obj) { return obj.GetGetBinderEquivalenceHash(); } } private static int cachedBinderCount; private static readonly ConcurrentDictionary<ICSharpBinder, ICSharpBinder> binderEquivalenceCache = new ConcurrentDictionary<ICSharpBinder, ICSharpBinder>(2, 32, new BinderEqualityComparer()); internal static T TryGetExisting<T>(this T binder) where T : ICSharpBinder { ICSharpBinder orAdd = binderEquivalenceCache.GetOrAdd(binder, binder); if (orAdd == (object)binder) { int num = Interlocked.Increment(ref cachedBinderCount); if ((uint)num > 4096u) { binderEquivalenceCache.Clear(); cachedBinderCount = 0; } } return (T)orAdd; } } internal static class BinderHelper { private static MethodInfo s_DoubleIsNaN; private static MethodInfo s_SingleIsNaN; internal static DynamicMetaObject Bind(ICSharpBinder action, RuntimeBinder binder, DynamicMetaObject[] args, IEnumerable<CSharpArgumentInfo> arginfos, DynamicMetaObject onBindingError) { Expression[] array = new Expression[args.Length]; BindingRestrictions bindingRestrictions = BindingRestrictions.Empty; ICSharpInvokeOrInvokeMemberBinder callPayload = action as ICSharpInvokeOrInvokeMemberBinder; ParameterExpression parameterExpression = null; IEnumerator<CSharpArgumentInfo> enumerator = (arginfos ?? Array.Empty<CSharpArgumentInfo>()).GetEnumerator(); for (int i = 0; i < args.Length; i++) { DynamicMetaObject dynamicMetaObject = args[i]; CSharpArgumentInfo cSharpArgumentInfo = (enumerator.MoveNext() ? enumerator.Current : null); if (i == 0 && IsIncrementOrDecrementActionOnLocal(action)) { object value = dynamicMetaObject.Value; parameterExpression = (ParameterExpression)(array[0] = Expression.Variable((value != null) ? value.GetType() : typeof(object), "t0")); } else { array[i] = dynamicMetaObject.Expression; } BindingRestrictions restrictions = DeduceArgumentRestriction(i, callPayload, dynamicMetaObject, cSharpArgumentInfo); bindingRestrictions = bindingRestrictions.Merge(restrictions); if (cSharpArgumentInfo != null && cSharpArgumentInfo.LiteralConstant) { if (dynamicMetaObject.Value is double && double.IsNaN((double)dynamicMetaObject.Value)) { MethodInfo method = s_DoubleIsNaN ?? (s_DoubleIsNaN = typeof(double).GetMethod("IsNaN")); Expression expression = Expression.Call(null, method, dynamicMetaObject.Expression); bindingRestrictions = bindingRestrictions.Merge(BindingRestrictions.GetExpressionRestriction(expression)); } else if (dynamicMetaObject.Value is float && float.IsNaN((float)dynamicMetaObject.Value)) { MethodInfo method2 = s_SingleIsNaN ?? (s_SingleIsNaN = typeof(float).GetMethod("IsNaN")); Expression expression2 = Expression.Call(null, method2, dynamicMetaObject.Expression); bindingRestrictions = bindingRestrictions.Merge(BindingRestrictions.GetExpressionRestriction(expression2)); } else { Expression expression3 = Expression.Equal(dynamicMetaObject.Expression, Expression.Constant(dynamicMetaObject.Value, dynamicMetaObject.Expression.Type)); restrictions = BindingRestrictions.GetExpressionRestriction(expression3); bindingRestrictions = bindingRestrictions.Merge(restrictions); } } } try { Expression expression4 = binder.Bind(action, array, args, out var deferredBinding); if (deferredBinding != null) { expression4 = ConvertResult(deferredBinding.Expression, action); bindingRestrictions = deferredBinding.Restrictions.Merge(bindingRestrictions); return new DynamicMetaObject(expression4, bindingRestrictions); } if (parameterExpression != null) { DynamicMetaObject dynamicMetaObject2 = args[0]; expression4 = Expression.Block(new ParameterExpression[1] { parameterExpression }, Expression.Assign(parameterExpression, Expression.Convert(dynamicMetaObject2.Expression, dynamicMetaObject2.Value.GetType())), expression4, Expression.Assign(dynamicMetaObject2.Expression, Expression.Convert(parameterExpression, dynamicMetaObject2.Expression.Type))); } expression4 = ConvertResult(expression4, action); return new DynamicMetaObject(expression4, bindingRestrictions); } catch (RuntimeBinderException ex) { if (onBindingError != null) { return onBindingError; } return new DynamicMetaObject(Expression.Throw(Expression.New(typeof(RuntimeBinderException).GetConstructor(new Type[1] { typeof(string) }), Expression.Constant(ex.Message)), GetTypeForErrorMetaObject(action, args)), bindingRestrictions); } } public static void ValidateBindArgument(DynamicMetaObject argument, string paramName) { if (argument == null) { throw Error.ArgumentNull(paramName); } if (!argument.HasValue) { throw Error.DynamicArgumentNeedsValue(paramName); } } public static void ValidateBindArgument(DynamicMetaObject[] arguments, string paramName) { if (arguments != null) { for (int i = 0; i != arguments.Length; i++) { ValidateBindArgument(arguments[i], $"{paramName}[{i}]"); } } } private static bool IsTypeOfStaticCall(int parameterIndex, ICSharpInvokeOrInvokeMemberBinder callPayload) { if (parameterIndex == 0 && callPayload != null) { return callPayload.StaticCall; } return false; } private static bool IsComObject(object obj) { if (obj != null) { return Marshal.IsComObject(obj); } return false; } private static bool IsTransparentProxy(object obj) { return false; } private static bool IsDynamicallyTypedRuntimeProxy(DynamicMetaObject argument, CSharpArgumentInfo info) { return info != null && !info.UseCompileTimeType && (IsComObject(argument.Value) || IsTransparentProxy(argument.Value)); } private static BindingRestrictions DeduceArgumentRestriction(int parameterIndex, ICSharpInvokeOrInvokeMemberBinder callPayload, DynamicMetaObject argument, CSharpArgumentInfo info) { if (argument.Value != null && !IsTypeOfStaticCall(parameterIndex, callPayload) && !IsDynamicallyTypedRuntimeProxy(argument, info)) { return BindingRestrictions.GetTypeRestriction(argument.Expression, argument.RuntimeType); } return BindingRestrictions.GetInstanceRestriction(argument.Expression, argument.Value); } private static Expression ConvertResult(Expression binding, ICSharpBinder action) { if (action is CSharpInvokeConstructorBinder) { return binding; } if (binding.Type == typeof(void)) { if (action is ICSharpInvokeOrInvokeMemberBinder iCSharpInvokeOrInvokeMemberBinder && iCSharpInvokeOrInvokeMemberBinder.ResultDiscarded) { return Expression.Block(binding, Expression.Default(action.ReturnType)); } throw Error.BindToVoidMethodButExpectResult(); } if (binding.Type.IsValueType && !action.ReturnType.IsValueType) { return Expression.Convert(binding, action.ReturnType); } return binding; } private static Type GetTypeForErrorMetaObject(ICSharpBinder action, DynamicMetaObject[] args) { if (action is CSharpInvokeConstructorBinder) { return args[0].Value as Type; } return action.ReturnType; } private static bool IsIncrementOrDecrementActionOnLocal(ICSharpBinder action) { if (action is CSharpUnaryOperationBinder cSharpUnaryOperationBinder) { if (cSharpUnaryOperationBinder.Operation != ExpressionType.Increment) { return cSharpUnaryOperationBinder.Operation == ExpressionType.Decrement; } return true; } return false; } internal static T[] Cons<T>(T sourceHead, T[] sourceTail) { if (sourceTail == null || sourceTail.Length != 0) { T[] array = new T[sourceTail.Length + 1]; array[0] = sourceHead; sourceTail.CopyTo(array, 1); return array; } return new T[1] { sourceHead }; } internal static T[] Cons<T>(T sourceHead, T[] sourceMiddle, T sourceLast) { if (sourceMiddle == null || sourceMiddle.Length != 0) { T[] array = new T[sourceMiddle.Length + 2]; array[0] = sourceHead; array[^1] = sourceLast; sourceMiddle.CopyTo(array, 1); return array; } return new T[2] { sourceHead, sourceLast }; } internal static T[] ToArray<T>(IEnumerable<T> source) { if (source != null) { return source.ToArray(); } return Array.Empty<T>(); } internal static CallInfo CreateCallInfo(ref IEnumerable<CSharpArgumentInfo> argInfos, int discard) { int num = 0; List<string> list = new List<string>(); CSharpArgumentInfo[] array = (CSharpArgumentInfo[])(argInfos = ToArray(argInfos)); foreach (CSharpArgumentInfo cSharpArgumentInfo in array) { if (cSharpArgumentInfo.NamedArgument) { list.Add(cSharpArgumentInfo.Name); } num++; } return new CallInfo(num - discard, list); } internal static string GetCLROperatorName(this ExpressionType p) { return p switch { ExpressionType.Add => "op_Addition", ExpressionType.Subtract => "op_Subtraction", ExpressionType.Multiply => "op_Multiply", ExpressionType.Divide => "op_Division", ExpressionType.Modulo => "op_Modulus", ExpressionType.LeftShift => "op_LeftShift", ExpressionType.RightShift => "op_RightShift", ExpressionType.LessThan => "op_LessThan", ExpressionType.GreaterThan => "op_GreaterThan", ExpressionType.LessThanOrEqual => "op_LessThanOrEqual", ExpressionType.GreaterThanOrEqual => "op_GreaterThanOrEqual", ExpressionType.Equal => "op_Equality", ExpressionType.NotEqual => "op_Inequality", ExpressionType.And => "op_BitwiseAnd", ExpressionType.ExclusiveOr => "op_ExclusiveOr", ExpressionType.Or => "op_BitwiseOr", ExpressionType.AddAssign => "op_Addition", ExpressionType.SubtractAssign => "op_Subtraction", ExpressionType.MultiplyAssign => "op_Multiply", ExpressionType.DivideAssign => "op_Division", ExpressionType.ModuloAssign => "op_Modulus", ExpressionType.AndAssign => "op_BitwiseAnd", ExpressionType.ExclusiveOrAssign => "op_ExclusiveOr", ExpressionType.OrAssign => "op_BitwiseOr", ExpressionType.LeftShiftAssign => "op_LeftShift", ExpressionType.RightShiftAssign => "op_RightShift", ExpressionType.Negate => "op_UnaryNegation", ExpressionType.UnaryPlus => "op_UnaryPlus", ExpressionType.Not => "op_LogicalNot", ExpressionType.OnesComplement => "op_OnesComplement", ExpressionType.IsTrue => "op_True", ExpressionType.IsFalse => "op_False", ExpressionType.Increment => "op_Increment", ExpressionType.Decrement => "op_Decrement", _ => null, }; } internal static int AddArgHashes(int hash, Type[] typeArguments, CSharpArgumentInfo[] argInfos) { foreach (Type type in typeArguments) { hash = HashHelpers.Combine(hash, type.GetHashCode()); } return AddArgHashes(hash, argInfos); } internal static int AddArgHashes(int hash, CSharpArgumentInfo[] argInfos) { foreach (CSharpArgumentInfo cSharpArgumentInfo in argInfos) { hash = HashHelpers.Combine(hash, (int)cSharpArgumentInfo.Flags); string name = cSharpArgumentInfo.Name; if (!string.IsNullOrEmpty(name)) { hash = HashHelpers.Combine(hash, name.GetHashCode()); } } return hash; } internal static bool CompareArgInfos(Type[] typeArgs, Type[] otherTypeArgs, CSharpArgumentInfo[] argInfos, CSharpArgumentInfo[] otherArgInfos) { for (int i = 0; i < typeArgs.Length; i++) { if (typeArgs[i] != otherTypeArgs[i]) { return false; } } return CompareArgInfos(argInfos, otherArgInfos); } internal static bool CompareArgInfos(CSharpArgumentInfo[] argInfos, CSharpArgumentInfo[] otherArgInfos) { for (int i = 0; i < argInfos.Length; i++) { CSharpArgumentInfo cSharpArgumentInfo = argInfos[i]; CSharpArgumentInfo cSharpArgumentInfo2 = otherArgInfos[i]; if (cSharpArgumentInfo.Flags != cSharpArgumentInfo2.Flags || cSharpArgumentInfo.Name != cSharpArgumentInfo2.Name) { return false; } } return true; } } [EditorBrowsable(EditorBrowsableState.Never)] public sealed class CSharpArgumentInfo { internal static readonly CSharpArgumentInfo None = new CSharpArgumentInfo(CSharpArgumentInfoFlags.None, null); internal CSharpArgumentInfoFlags Flags { get; } internal string Name { get; } internal bool UseCompileTimeType => (Flags & CSharpArgumentInfoFlags.UseCompileTimeType) != 0; internal bool LiteralConstant => (Flags & CSharpArgumentInfoFlags.Constant) != 0; internal bool NamedArgument => (Flags & CSharpArgumentInfoFlags.NamedArgument) != 0; internal bool IsByRefOrOut => (Flags & (CSharpArgumentInfoFlags.IsRef | CSharpArgumentInfoFlags.IsOut)) != 0; internal bool IsOut => (Flags & CSharpArgumentInfoFlags.IsOut) != 0; internal bool IsStaticType => (Flags & CSharpArgumentInfoFlags.IsStaticType) != 0; private CSharpArgumentInfo(CSharpArgumentInfoFlags flags, string name) { Flags = flags; Name = name; } public static CSharpArgumentInfo Create(CSharpArgumentInfoFlags flags, string name) { return new CSharpArgumentInfo(flags, name); } } [EditorBrowsable(EditorBrowsableState.Never)] [Flags] public enum CSharpArgumentInfoFlags { None = 0, UseCompileTimeType = 1, Constant = 2, NamedArgument = 4, IsRef = 8, IsOut = 0x10, IsStaticType = 0x20 } internal sealed class CSharpBinaryOperationBinder : BinaryOperationBinder, ICSharpBinder { private readonly CSharpBinaryOperationFlags _binopFlags; private readonly CSharpArgumentInfo[] _argumentInfo; private readonly RuntimeBinder _binder; private readonly Type _callingContext; [ExcludeFromCodeCoverage] public string Name => null; public BindingFlag BindingFlags => (BindingFlag)0; public bool IsBinderThatCanHaveRefReceiver => false; internal bool IsLogicalOperation => (_binopFlags & CSharpBinaryOperationFlags.LogicalOperation) != 0; private bool IsChecked => _binder.IsChecked; public Expr DispatchPayload(RuntimeBinder runtimeBinder, ArgumentObject[] arguments, LocalVariableSymbol[] locals) { return runtimeBinder.BindBinaryOperation(this, arguments, locals); } public void PopulateSymbolTableWithName(Type callingType, ArgumentObject[] arguments) { string cLROperatorName = base.Operation.GetCLROperatorName(); SymbolTable.PopulateSymbolTableWithName(cLROperatorName, null, arguments[0].Type); SymbolTable.PopulateSymbolTableWithName(cLROperatorName, null, arguments[1].Type); } CSharpArgumentInfo ICSharpBinder.GetArgumentInfo(int index) { return _argumentInfo[index]; } public CSharpBinaryOperationBinder(ExpressionType operation, bool isChecked, CSharpBinaryOperationFlags binaryOperationFlags, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo) : base(operation) { _binopFlags = binaryOperationFlags; _callingContext = callingContext; _argumentInfo = BinderHelper.ToArray(argumentInfo); _binder = new RuntimeBinder(callingContext, isChecked); } public int GetGetBinderEquivalenceHash() { int h = _callingContext?.GetHashCode() ?? 0; h = HashHelpers.Combine(h, (int)_binopFlags); if (IsChecked) { h = HashHelpers.Combine(h, 1); } h = HashHelpers.Combine(h, (int)base.Operation); return BinderHelper.AddArgHashes(h, _argumentInfo); } public bool IsEquivalentTo(ICSharpBinder other) { if (!(other is CSharpBinaryOperationBinder cSharpBinaryOperationBinder)) { return false; } if (_binopFlags != cSharpBinaryOperationBinder._binopFlags || base.Operation != cSharpBinaryOperationBinder.Operation || IsChecked != cSharpBinaryOperationBinder.IsChecked || _callingContext != cSharpBinaryOperationBinder._callingContext) { return false; } return BinderHelper.CompareArgInfos(_argumentInfo, cSharpBinaryOperationBinder._argumentInfo); } public override DynamicMetaObject FallbackBinaryOperation(DynamicMetaObject target, DynamicMetaObject arg, DynamicMetaObject errorSuggestion) { BinderHelper.ValidateBindArgument(target, "target"); BinderHelper.ValidateBindArgument(arg, "arg"); return BinderHelper.Bind(this, _binder, new DynamicMetaObject[2] { target, arg }, _argumentInfo, errorSuggestion); } } [Flags] internal enum CSharpBinaryOperationFlags { None = 0, MemberAccess = 1, LogicalOperation = 2 } [Flags] [EditorBrowsable(EditorBrowsableState.Never)] public enum CSharpBinderFlags { None = 0, CheckedContext = 1, InvokeSimpleName = 2, InvokeSpecialName = 4, BinaryOperationLogical = 8, ConvertExplicit = 0x10, ConvertArrayIndex = 0x20, ResultIndexed = 0x40, ValueFromCompoundAssignment = 0x80, ResultDiscarded = 0x100 } [Flags] internal enum CSharpCallFlags { None = 0, SimpleNameCall = 1, EventHookup = 2, ResultDiscarded = 4 } internal enum CSharpConversionKind { ImplicitConversion, ExplicitConversion, ArrayCreationConversion } internal sealed class CSharpConvertBinder : ConvertBinder, ICSharpBinder { private readonly RuntimeBinder _binder; private readonly Type _callingContext; [ExcludeFromCodeCoverage] public string Name => null; public BindingFlag BindingFlags => (BindingFlag)0; public bool IsBinderThatCanHaveRefReceiver => false; private CSharpConversionKind ConversionKind { get; } private bool IsChecked => _binder.IsChecked; public Expr DispatchPayload(RuntimeBinder runtimeBinder, ArgumentObject[] arguments, LocalVariableSymbol[] locals) { if (!base.Explicit) { return runtimeBinder.BindImplicitConversion(arguments, base.Type, locals, ConversionKind == CSharpConversionKind.ArrayCreationConversion); } return runtimeBinder.BindExplicitConversion(arguments, base.Type, locals); } public void PopulateSymbolTableWithName(Type callingType, ArgumentObject[] arguments) { } CSharpArgumentInfo ICSharpBinder.GetArgumentInfo(int index) { return CSharpArgumentInfo.None; } public CSharpConvertBinder(Type type, CSharpConversionKind conversionKind, bool isChecked, Type callingContext) : base(type, conversionKind == CSharpConversionKind.ExplicitConversion) { ConversionKind = conversionKind; _callingContext = callingContext; _binder = new RuntimeBinder(callingContext, isChecked); } public int GetGetBinderEquivalenceHash() { int h = _callingContext?.GetHashCode() ?? 0; h = HashHelpers.Combine(h, (int)ConversionKind); if (IsChecked) { h = HashHelpers.Combine(h, 1); } return HashHelpers.Combine(h, base.Type.GetHashCode()); } public bool IsEquivalentTo(ICSharpBinder other) { if (!(other is CSharpConvertBinder cSharpConvertBinder)) { return false; } if (ConversionKind != cSharpConvertBinder.ConversionKind || IsChecked != cSharpConvertBinder.IsChecked || _callingContext != cSharpConvertBinder._callingContext || base.Type != cSharpConvertBinder.Type) { return false; } return true; } public override DynamicMetaObject FallbackConvert(DynamicMetaObject target, DynamicMetaObject errorSuggestion) { BinderHelper.ValidateBindArgument(target, "target"); return BinderHelper.Bind(this, _binder, new DynamicMetaObject[1] { target }, null, errorSuggestion); } } internal sealed class CSharpGetIndexBinder : GetIndexBinder, ICSharpBinder { private readonly CSharpArgumentInfo[] _argumentInfo; private readonly RuntimeBinder _binder; private readonly Type _callingContext; public string Name => "$Item$"; public BindingFlag BindingFlags => BindingFlag.BIND_RVALUEREQUIRED; public bool IsBinderThatCanHaveRefReceiver => true; public Expr DispatchPayload(RuntimeBinder runtimeBinder, ArgumentObject[] arguments, LocalVariableSymbol[] locals) { Expr optionalIndexerArguments = runtimeBinder.CreateArgumentListEXPR(arguments, locals, 1, arguments.Length); return runtimeBinder.BindProperty(this, arguments[0], locals[0], optionalIndexerArguments); } public void PopulateSymbolTableWithName(Type callingType, ArgumentObject[] arguments) { SymbolTable.PopulateSymbolTableWithName("$Item$", null, arguments[0].Type); } CSharpArgumentInfo ICSharpBinder.GetArgumentInfo(int index) { return _argumentInfo[index]; } public CSharpGetIndexBinder(Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo) : base(BinderHelper.CreateCallInfo(ref argumentInfo, 1)) { _argumentInfo = argumentInfo as CSharpArgumentInfo[]; _callingContext = callingContext; _binder = new RuntimeBinder(callingContext); } public int GetGetBinderEquivalenceHash() { int hash = _callingContext?.GetHashCode() ?? 0; return BinderHelper.AddArgHashes(hash, _argumentInfo); } public bool IsEquivalentTo(ICSharpBinder other) { if (!(other is CSharpGetIndexBinder cSharpGetIndexBinder)) { return false; } if (_callingContext != cSharpGetIndexBinder._callingContext || _argumentInfo.Length != cSharpGetIndexBinder._argumentInfo.Length) { return false; } return BinderHelper.CompareArgInfos(_argumentInfo, cSharpGetIndexBinder._argumentInfo); } public override DynamicMetaObject FallbackGetIndex(DynamicMetaObject target, DynamicMetaObject[] indexes, DynamicMetaObject errorSuggestion) { BinderHelper.ValidateBindArgument(target, "target"); BinderHelper.ValidateBindArgument(indexes, "indexes"); return BinderHelper.Bind(this, _binder, BinderHelper.Cons(target, indexes), _argumentInfo, errorSuggestion); } } internal sealed class CSharpGetMemberBinder : GetMemberBinder, IInvokeOnGetBinder, ICSharpBinder { private readonly CSharpArgumentInfo[] _argumentInfo; private readonly RuntimeBinder _binder; private readonly Type _callingContext; public BindingFlag BindingFlags => BindingFlag.BIND_RVALUEREQUIRED; public bool IsBinderThatCanHaveRefReceiver => false; bool IInvokeOnGetBinder.InvokeOnGet => !ResultIndexed; private bool ResultIndexed { get; } public Expr DispatchPayload(RuntimeBinder runtimeBinder, ArgumentObject[] arguments, LocalVariableSymbol[] locals) { return runtimeBinder.BindProperty(this, arguments[0], locals[0], null); } public void PopulateSymbolTableWithName(Type callingType, ArgumentObject[] arguments) { SymbolTable.PopulateSymbolTableWithName(base.Name, null, arguments[0].Type); } CSharpArgumentInfo ICSharpBinder.GetArgumentInfo(int index) { return _argumentInfo[index]; } public CSharpGetMemberBinder(string name, bool resultIndexed, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo) : base(name, ignoreCase: false) { ResultIndexed = resultIndexed; _argumentInfo = BinderHelper.ToArray(argumentInfo); _callingContext = callingContext; _binder = new RuntimeBinder(callingContext); } public int GetGetBinderEquivalenceHash() { int h = _callingContext?.GetHashCode() ?? 0; if (ResultIndexed) { h = HashHelpers.Combine(h, 1); } h = HashHelpers.Combine(h, base.Name.GetHashCode()); return BinderHelper.AddArgHashes(h, _argumentInfo); } public bool IsEquivalentTo(ICSharpBinder other) { if (!(other is CSharpGetMemberBinder cSharpGetMemberBinder)) { return false; } if (base.Name != cSharpGetMemberBinder.Name || ResultIndexed != cSharpGetMemberBinder.ResultIndexed || _callingContext != cSharpGetMemberBinder._callingContext || _argumentInfo.Length != cSharpGetMemberBinder._argumentInfo.Length) { return false; } return BinderHelper.CompareArgInfos(_argumentInfo, cSharpGetMemberBinder._argumentInfo); } public override DynamicMetaObject FallbackGetMember(DynamicMetaObject target, DynamicMetaObject errorSuggestion) { BinderHelper.ValidateBindArgument(target, "target"); return BinderHelper.Bind(this, _binder, new DynamicMetaObject[1] { target }, _argumentInfo, errorSuggestion); } [SpecialName] string ICSharpBinder.get_Name() { return base.Name; } } internal sealed class CSharpInvokeBinder : InvokeBinder, ICSharpInvokeOrInvokeMemberBinder, ICSharpBinder { private readonly CSharpCallFlags _flags; private readonly CSharpArgumentInfo[] _argumentInfo; private readonly RuntimeBinder _binder; private readonly Type _callingContext; public BindingFlag BindingFlags => (BindingFlag)0; public bool IsBinderThatCanHaveRefReceiver => true; bool ICSharpInvokeOrInvokeMemberBinder.StaticCall { get { if (_argumentInfo[0] != null) { return _argumentInfo[0].IsStaticType; } return false; } } string ICSharpBinder.Name => "Invoke"; Type[] ICSharpInvokeOrInvokeMemberBinder.TypeArguments => Array.Empty<Type>(); CSharpCallFlags ICSharpInvokeOrInvokeMemberBinder.Flags => _flags; bool ICSharpInvokeOrInvokeMemberBinder.ResultDiscarded => (_flags & CSharpCallFlags.ResultDiscarded) != 0; public Expr DispatchPayload(RuntimeBinder runtimeBinder, ArgumentObject[] arguments, LocalVariableSymbol[] locals) { return runtimeBinder.DispatchPayload(this, arguments, locals); } public void PopulateSymbolTableWithName(Type callingType, ArgumentObject[] arguments) { RuntimeBinder.PopulateSymbolTableWithPayloadInformation(this, callingType, arguments); } CSharpArgumentInfo ICSharpBinder.GetArgumentInfo(int index) { return _argumentInfo[index]; } public CSharpInvokeBinder(CSharpCallFlags flags, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo) : base(BinderHelper.CreateCallInfo(ref argumentInfo, 1)) { _flags = flags; _callingContext = callingContext; _argumentInfo = argumentInfo as CSharpArgumentInfo[]; _binder = new RuntimeBinder(callingContext); } public int GetGetBinderEquivalenceHash() { int h = _callingContext?.GetHashCode() ?? 0; h = HashHelpers.Combine(h, (int)_flags); return BinderHelper.AddArgHashes(h, _argumentInfo); } public bool IsEquivalentTo(ICSharpBinder other) { if (!(other is CSharpInvokeBinder cSharpInvokeBinder)) { return false; } if (_flags != cSharpInvokeBinder._flags || _callingContext != cSharpInvokeBinder._callingContext || _argumentInfo.Length != cSharpInvokeBinder._argumentInfo.Length) { return false; } return BinderHelper.CompareArgInfos(_argumentInfo, cSharpInvokeBinder._argumentInfo); } public override DynamicMetaObject FallbackInvoke(DynamicMetaObject target, DynamicMetaObject[] args, DynamicMetaObject errorSuggestion) { BinderHelper.ValidateBindArgument(target, "target"); BinderHelper.ValidateBindArgument(args, "args"); return BinderHelper.Bind(this, _binder, BinderHelper.Cons(target, args), _argumentInfo, errorSuggestion); } } internal sealed class CSharpInvokeConstructorBinder : DynamicMetaObjectBinder, ICSharpInvokeOrInvokeMemberBinder, ICSharpBinder { private readonly CSharpArgumentInfo[] _argumentInfo; private readonly RuntimeBinder _binder; private readonly Type _callingContext; public BindingFlag BindingFlags => (BindingFlag)0; public bool IsBinderThatCanHaveRefReceiver => true; public CSharpCallFlags Flags { get; } public bool StaticCall => true; public Type[] TypeArguments => Array.Empty<Type>(); public string Name => ".ctor"; bool ICSharpInvokeOrInvokeMemberBinder.ResultDiscarded => false; public Expr DispatchPayload(RuntimeBinder runtimeBinder, ArgumentObject[] arguments, LocalVariableSymbol[] locals) { return runtimeBinder.DispatchPayload(this, arguments, locals); } public void PopulateSymbolTableWithName(Type callingType, ArgumentObject[] arguments) { RuntimeBinder.PopulateSymbolTableWithPayloadInformation(this, callingType, arguments); } CSharpArgumentInfo ICSharpBinder.GetArgumentInfo(int index) { return _argumentInfo[index]; } public CSharpInvokeConstructorBinder(CSharpCallFlags flags, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo) { Flags = flags; _callingContext = callingContext; _argumentInfo = BinderHelper.ToArray(argumentInfo); _binder = new RuntimeBinder(callingContext); } public int GetGetBinderEquivalenceHash() { int h = _callingContext?.GetHashCode() ?? 0; h = HashHelpers.Combine(h, (int)Flags); h = HashHelpers.Combine(h, Name.GetHashCode()); return BinderHelper.AddArgHashes(h, TypeArguments, _argumentInfo); } public bool IsEquivalentTo(ICSharpBinder other) { if (!(other is CSharpInvokeConstructorBinder cSharpInvokeConstructorBinder)) { return false; } if (Flags != cSharpInvokeConstructorBinder.Flags || _callingContext != cSharpInvokeConstructorBinder._callingContext || Name != cSharpInvokeConstructorBinder.Name || TypeArguments.Length != cSharpInvokeConstructorBinder.TypeArguments.Length || _argumentInfo.Length != cSharpInvokeConstructorBinder._argumentInfo.Length) { return false; } return BinderHelper.CompareArgInfos(TypeArguments, cSharpInvokeConstructorBinder.TypeArguments, _argumentInfo, cSharpInvokeConstructorBinder._argumentInfo); } public override DynamicMetaObject Bind(DynamicMetaObject target, DynamicMetaObject[] args) { BinderHelper.ValidateBindArgument(target, "target"); BinderHelper.ValidateBindArgument(args, "args"); return BinderHelper.Bind(this, _binder, BinderHelper.Cons(target, args), _argumentInfo, null); } } internal sealed class CSharpInvokeMemberBinder : InvokeMemberBinder, ICSharpInvokeOrInvokeMemberBinder, ICSharpBinder { private readonly CSharpArgumentInfo[] _argumentInfo; private readonly RuntimeBinder _binder; public BindingFlag BindingFlags => (BindingFlag)0; public bool IsBinderThatCanHaveRefReceiver => true; bool ICSharpInvokeOrInvokeMemberBinder.StaticCall => _argumentInfo[0]?.IsStaticType ?? false; public CSharpCallFlags Flags { get; } public Type CallingContext { get; } public Type[] TypeArguments { get; } bool ICSharpInvokeOrInvokeMemberBinder.ResultDiscarded => (Flags & CSharpCallFlags.ResultDiscarded) != 0; public Expr DispatchPayload(RuntimeBinder runtimeBinder, ArgumentObject[] arguments, LocalVariableSymbol[] locals) { return runtimeBinder.DispatchPayload(this, arguments, locals); } public void PopulateSymbolTableWithName(Type callingType, ArgumentObject[] arguments) { RuntimeBinder.PopulateSymbolTableWithPayloadInformation(this, callingType, arguments); } public CSharpArgumentInfo GetArgumentInfo(int index) { return _argumentInfo[index]; } public CSharpArgumentInfo[] ArgumentInfoArray() { CSharpArgumentInfo[] array = new CSharpArgumentInfo[_argumentInfo.Length]; _argumentInfo.CopyTo(array, 0); return array; } public CSharpInvokeMemberBinder(CSharpCallFlags flags, string name, Type callingContext, IEnumerable<Type> typeArguments, IEnumerable<CSharpArgumentInfo> argumentInfo) : base(name, ignoreCase: false, BinderHelper.CreateCallInfo(ref argumentInfo, 1)) { Flags = flags; CallingContext = callingContext; TypeArguments = BinderHelper.ToArray(typeArguments); _argumentInfo = BinderHelper.ToArray(argumentInfo); _binder = new RuntimeBinder(callingContext); } public int GetGetBinderEquivalenceHash() { int h = CallingContext?.GetHashCode() ?? 0; h = HashHelpers.Combine(h, (int)Flags); h = HashHelpers.Combine(h, base.Name.GetHashCode()); return BinderHelper.AddArgHashes(h, TypeArguments, _argumentInfo); } public bool IsEquivalentTo(ICSharpBinder other) { if (!(other is CSharpInvokeMemberBinder cSharpInvokeMemberBinder)) { return false; } if (Flags != cSharpInvokeMemberBinder.Flags || CallingContext != cSharpInvokeMemberBinder.CallingContext || base.Name != cSharpInvokeMemberBinder.Name || TypeArguments.Length != cSharpInvokeMemberBinder.TypeArguments.Length || _argumentInfo.Length != cSharpInvokeMemberBinder._argumentInfo.Length) { return false; } return BinderHelper.CompareArgInfos(TypeArguments, cSharpInvokeMemberBinder.TypeArguments, _argumentInfo, cSharpInvokeMemberBinder._argumentInfo); } public override DynamicMetaObject FallbackInvokeMember(DynamicMetaObject target, DynamicMetaObject[] args, DynamicMetaObject errorSuggestion) { BinderHelper.ValidateBindArgument(target, "target"); BinderHelper.ValidateBindArgument(args, "args"); return BinderHelper.Bind(this, _binder, BinderHelper.Cons(target, args), _argumentInfo, errorSuggestion); } public override DynamicMetaObject FallbackInvoke(DynamicMetaObject target, DynamicMetaObject[] args, DynamicMetaObject errorSuggestion) { CSharpInvokeBinder cSharpInvokeBinder = new CSharpInvokeBinder(Flags, CallingContext, _argumentInfo).TryGetExisting(); return cSharpInvokeBinder.Defer(target, args); } [SpecialName] string ICSharpBinder.get_Name() { return base.Name; } } internal sealed class CSharpIsEventBinder : DynamicMetaObjectBinder, ICSharpBinder { private readonly RuntimeBinder _binder; private readonly Type _callingContext; public BindingFlag BindingFlags => (BindingFlag)0; public bool IsBinderThatCanHaveRefReceiver => false; public string Name { get; } public override Type ReturnType => typeof(bool); public Expr DispatchPayload(RuntimeBinder runtimeBinder, ArgumentObject[] arguments, LocalVariableSymbol[] locals) { return runtimeBinder.BindIsEvent(this, arguments, locals); } public void PopulateSymbolTableWithName(Type callingType, ArgumentObject[] arguments) { SymbolTable.PopulateSymbolTableWithName(Name, null, arguments[0].Info.IsStaticType ? (arguments[0].Value as Type) : arguments[0].Type); } CSharpArgumentInfo ICSharpBinder.GetArgumentInfo(int index) { return CSharpArgumentInfo.None; } public CSharpIsEventBinder(string name, Type callingContext) { Name = name; _callingContext = callingContext; _binder = new RuntimeBinder(callingContext); } public int GetGetBinderEquivalenceHash() { int h = _callingContext?.GetHashCode() ?? 0; return HashHelpers.Combine(h, Name.GetHashCode()); } public bool IsEquivalentTo(ICSharpBinder other) { if (!(other is CSharpIsEventBinder cSharpIsEventBinder)) { return false; } if (_callingContext != cSharpIsEventBinder._callingContext || Name != cSharpIsEventBinder.Name) { return false; } return true; } public override DynamicMetaObject Bind(DynamicMetaObject target, DynamicMetaObject[] args) { BinderHelper.ValidateBindArgument(target, "target"); return BinderHelper.Bind(this, _binder, new DynamicMetaObject[1] { target }, null, null); } } internal sealed class CSharpSetIndexBinder : SetIndexBinder, ICSharpBinder { private readonly CSharpArgumentInfo[] _argumentInfo; private readonly RuntimeBinder _binder; private readonly Type _callingContext; public string Name => "$Item$"; public BindingFlag BindingFlags => (BindingFlag)0; public bool IsBinderThatCanHaveRefReceiver => true; internal bool IsCompoundAssignment { get; } private bool IsChecked => _binder.IsChecked; public Expr DispatchPayload(RuntimeBinder runtimeBinder, ArgumentObject[] arguments, LocalVariableSymbol[] locals) { return runtimeBinder.BindAssignment(this, arguments, locals); } public void PopulateSymbolTableWithName(Type callingType, ArgumentObject[] arguments) { SymbolTable.PopulateSymbolTableWithName("$Item$", null, arguments[0].Type); } CSharpArgumentInfo ICSharpBinder.GetArgumentInfo(int index) { return _argumentInfo[index]; } public CSharpSetIndexBinder(bool isCompoundAssignment, bool isChecked, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo) : base(BinderHelper.CreateCallInfo(ref argumentInfo, 2)) { IsCompoundAssignment = isCompoundAssignment; _argumentInfo = argumentInfo as CSharpArgumentInfo[]; _callingContext = callingContext; _binder = new RuntimeBinder(callingContext, isChecked); } public int GetGetBinderEquivalenceHash() { int num = _callingContext?.GetHashCode() ?? 0; if (IsChecked) { num = HashHelpers.Combine(num, 1); } if (IsCompoundAssignment) { num = HashHelpers.Combine(num, 1); } return BinderHelper.AddArgHashes(num, _argumentInfo); } public bool IsEquivalentTo(ICSharpBinder other) { if (!(other is CSharpSetIndexBinder cSharpSetIndexBinder)) { return false; } if (_callingContext != cSharpSetIndexBinder._callingContext || IsChecked != cSharpSetIndexBinder.IsChecked || IsCompoundAssignment != cSharpSetIndexBinder.IsCompoundAssignment || _argumentInfo.Length != cSharpSetIndexBinder._argumentInfo.Length) { return false; } return BinderHelper.CompareArgInfos(_argumentInfo, cSharpSetIndexBinder._argumentInfo); } public override DynamicMetaObject FallbackSetIndex(DynamicMetaObject target, DynamicMetaObject[] indexes, DynamicMetaObject value, DynamicMetaObject errorSuggestion) { BinderHelper.ValidateBindArgument(target, "target"); BinderHelper.ValidateBindArgument(indexes, "indexes"); BinderHelper.ValidateBindArgument(value, "value"); return BinderHelper.Bind(this, _binder, BinderHelper.Cons(target, indexes, value), _argumentInfo, errorSuggestion); } } internal sealed class CSharpSetMemberBinder : SetMemberBinder, ICSharpBinder { private readonly CSharpArgumentInfo[] _argumentInfo; private readonly RuntimeBinder _binder; private readonly Type _callingContext; public BindingFlag BindingFlags => (BindingFlag)0; public bool IsBinderThatCanHaveRefReceiver => false; internal bool IsCompoundAssignment { get; } private bool IsChecked => _binder.IsChecked; public Expr DispatchPayload(RuntimeBinder runtimeBinder, ArgumentObject[] arguments, LocalVariableSymbol[] locals) { return runtimeBinder.BindAssignment(this, arguments, locals); } public void PopulateSymbolTableWithName(Type callingType, ArgumentObject[] arguments) { SymbolTable.PopulateSymbolTableWithName(base.Name, null, arguments[0].Type); } CSharpArgumentInfo ICSharpBinder.GetArgumentInfo(int index) { return _argumentInfo[index]; } public CSharpSetMemberBinder(string name, bool isCompoundAssignment, bool isChecked, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo) : base(name, ignoreCase: false) { IsCompoundAssignment = isCompoundAssignment; _argumentInfo = BinderHelper.ToArray(argumentInfo); _callingContext = callingContext; _binder = new RuntimeBinder(callingContext, isChecked); } public int GetGetBinderEquivalenceHash() { int h = _callingContext?.GetHashCode() ?? 0; if (IsChecked) { h = HashHelpers.Combine(h, 1); } if (IsCompoundAssignment) { h = HashHelpers.Combine(h, 1); } h = HashHelpers.Combine(h, base.Name.GetHashCode()); return BinderHelper.AddArgHashes(h, _argumentInfo); } public bool IsEquivalentTo(ICSharpBinder other) { if (!(other is CSharpSetMemberBinder cSharpSetMemberBinder)) { return false; } if (base.Name != cSharpSetMemberBinder.Name || _callingContext != cSharpSetMemberBinder._callingContext || IsChecked != cSharpSetMemberBinder.IsChecked || IsCompoundAssignment != cSharpSetMemberBinder.IsCompoundAssignment || _argumentInfo.Length != cSharpSetMemberBinder._argumentInfo.Length) { return false; } return BinderHelper.CompareArgInfos(_argumentInfo, cSharpSetMemberBinder._argumentInfo); } public override DynamicMetaObject FallbackSetMember(DynamicMetaObject target, DynamicMetaObject value, DynamicMetaObject errorSuggestion) { BinderHelper.ValidateBindArgument(target, "target"); BinderHelper.ValidateBindArgument(value, "value"); return BinderHelper.Bind(this, _binder, new DynamicMetaObject[2] { target, value }, _argumentInfo, errorSuggestion); } [SpecialName] string ICSharpBinder.get_Name() { return base.Name; } } internal sealed class CSharpUnaryOperationBinder : UnaryOperationBinder, ICSharpBinder { private readonly CSharpArgumentInfo[] _argumentInfo; private readonly RuntimeBinder _binder; private readonly Type _callingContext; [ExcludeFromCodeCoverage] public string Name => null; public BindingFlag BindingFlags => (BindingFlag)0; public bool IsBinderThatCanHaveRefReceiver => false; private bool IsChecked => _binder.IsChecked; public Expr DispatchPayload(RuntimeBinder runtimeBinder, ArgumentObject[] arguments, LocalVariableSymbol[] locals) { return runtimeBinder.BindUnaryOperation(this, arguments, locals); } public void PopulateSymbolTableWithName(Type callingType, ArgumentObject[] arguments) { SymbolTable.PopulateSymbolTableWithName(base.Operation.GetCLROperatorName(), null, arguments[0].Type); } CSharpArgumentInfo ICSharpBinder.GetArgumentInfo(int index) { return _argumentInfo[index]; } public CSharpUnaryOperationBinder(ExpressionType operation, bool isChecked, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo) : base(operation) { _argumentInfo = BinderHelper.ToArray(argumentInfo); _callingContext = callingContext; _binder = new RuntimeBinder(callingContext, isChecked); } public int GetGetBinderEquivalenceHash() { int h = _callingContext?.GetHashCode() ?? 0; h = HashHelpers.Combine(h, (int)base.Operation); if (IsChecked) { h = HashHelpers.Combine(h, 1); } return BinderHelper.AddArgHashes(h, _argumentInfo); } public bool IsEquivalentTo(ICSharpBinder other) { if (!(other is CSharpUnaryOperationBinder cSharpUnaryOperationBinder)) { return false; } if (base.Operation != cSharpUnaryOperationBinder.Operation || IsChecked != cSharpUnaryOperationBinder.IsChecked || _callingContext != cSharpUnaryOperationBinder._callingContext) { return false; } return BinderHelper.CompareArgInfos(_argumentInfo, cSharpUnaryOperationBinder._argumentInfo); } public override DynamicMetaObject FallbackUnaryOperation(DynamicMetaObject target, DynamicMetaObject errorSuggestion) { BinderHelper.ValidateBindArgument(target, "target"); return BinderHelper.Bind(this, _binder, new DynamicMetaObject[1] { target }, _argumentInfo, errorSuggestion); } } [Serializable] [EditorBrowsable(EditorBrowsableState.Never)] internal sealed class DynamicBindingFailedException : Exception { public DynamicBindingFailedException() { } private DynamicBindingFailedException(SerializationInfo info, StreamingContext context) : base(info, context) { } } internal sealed class GetMemberValueBinder : GetMemberBinder { public GetMemberValueBinder(string name, bool ignoreCase) : base(name, ignoreCase) { } public override DynamicMetaObject FallbackGetMember(DynamicMetaObject self, DynamicMetaObject onBindingError) { if (onBindingError == null) { List<DynamicMetaObject> contributingObjects = new List<DynamicMetaObject> { self }; return new DynamicMetaObject(Expression.Throw(Expression.Constant(new DynamicBindingFailedException(), typeof(Exception)), typeof(object)), BindingRestrictions.Combine(contributingObjects)); } return onBindingError; } } internal sealed class DynamicMetaObjectProviderDebugView { [DebuggerDisplay("{value}", Name = "{name, nq}", Type = "{type, nq}")] internal class DynamicProperty { [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly string name; [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly object value; [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly string type; public DynamicProperty(string name, object value) { this.name = name; this.value = value; type = ((value == null) ? "<null>" : value.GetType().ToString()); } } [Serializable] internal class DynamicDebugViewEmptyException : Exception { public string Empty => System.SR.EmptyDynamicView; public DynamicDebugViewEmptyException() { } protected DynamicDebugViewEmptyException(SerializationInfo info, StreamingContext context) : base(info, context) { } } [DebuggerBrowsable(DebuggerBrowsableState.Never)] private IList<KeyValuePair<string, object>> results; [DebuggerBrowsable(DebuggerBrowsableState.Never)] private object obj; [DebuggerBrowsable(DebuggerBrowsableState.Never)] private static readonly ParameterExpression parameter = Expression.Parameter(typeof(object), "debug"); [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] internal DynamicProperty[] Items { get { if (results == null || results.Count == 0) { results = QueryDynamicObject(obj); if (results == null || results.Count == 0) { throw new DynamicDebugViewEmptyException(); } } DynamicProperty[] array = new DynamicProperty[results.Count]; for (int i = 0; i < results.Count; i++) { array[i] = new DynamicProperty(results[i].Key, results[i].Value); } return array; } } public DynamicMetaObjectProviderDebugView(object arg) { obj = arg; } public static object TryEvalBinaryOperators<T1, T2>(T1 arg1, T2 arg2, CSharpArgumentInfoFlags arg1Flags, CSharpArgumentInfoFlags arg2Flags, ExpressionType opKind, Type accessibilityContext) { CSharpArgumentInfo cSharpArgumentInfo = CSharpArgumentInfo.Create(arg1Flags, null); CSharpArgumentInfo cSharpArgumentInfo2 = CSharpArgumentInfo.Create(arg2Flags, null); CSharpBinaryOperationBinder binder = new CSharpBinaryOperationBinder(opKind, isChecked: false, CSharpBinaryOperationFlags.None, accessibilityContext, new CSharpArgumentInfo[2] { cSharpArgumentInfo, cSharpArgumentInfo2 }); CallSite<Func<CallSite, T1, T2, object>> callSite = CallSite<Func<CallSite, T1, T2, object>>.Create(binder); return callSite.Target(callSite, arg1, arg2); } public static object TryEvalUnaryOperators<T>(T obj, ExpressionType oper, Type accessibilityContext) { if (oper == ExpressionType.IsTrue || oper == ExpressionType.IsFalse) { CallSite<Func<CallSite, T, bool>> callSite = CallSite<Func<CallSite, T, bool>>.Create(new CSharpUnaryOperationBinder(oper, isChecked: false, accessibilityContext, new CSharpArgumentInfo[1] { CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null) })); return callSite.Target(callSite, obj); } CallSite<Func<CallSite, T, object>> callSite2 = CallSite<Func<CallSite, T, object>>.Create(new CSharpUnaryOperationBinder(oper, isChecked: false, accessibilityContext, new CSharpArgumentInfo[1] { CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null) })); return callSite2.Target(callSite2, obj); } public static K TryEvalCast<T, K>(T obj, Type type, CSharpBinderFlags kind, Type accessibilityContext) { CallSite<Func<CallSite, T, K>> callSite = CallSite<Func<CallSite, T, K>>.Create(Binder.Convert(kind, type, accessibilityContext)); return callSite.Target(callSite, obj); } private static void CreateDelegateSignatureAndArgumentInfos(object[] args, Type[] argTypes, CSharpArgumentInfoFlags[] argFlags, out Type[] delegateSignatureTypes, out CSharpArgumentInfo[] argInfos) { int num = args.Length; delegateSignatureTypes = new Type[num + 2]; delegateSignatureTypes[0] = typeof(CallSite); argInfos = new CSharpArgumentInfo[num]; for (int i = 0; i < num; i++) { if (argTypes[i] != null) { delegateSignatureTypes[i + 1] = argTypes[i]; } else if (args[i] != null) { delegateSignatureTypes[i + 1] = args[i].GetType(); } else { delegateSignatureTypes[i + 1] = typeof(object); } argInfos[i] = CSharpArgumentInfo.Create(argFlags[i], null); } delegateSignatureTypes[num + 1] = typeof(object); } private static object CreateDelegateAndInvoke(Type[] delegateSignatureTypes, CallSiteBinder binder, object[] args) { Type delegateType = Expression.GetDelegateType(delegateSignatureTypes); CallSite callSite = CallSite.Create(delegateType, binder); Delegate @delegate = (Delegate)callSite.GetType().GetField("Target").GetValue(callSite); object[] array = new object[args.Length + 1]; array[0] = callSite; args.CopyTo(array, 1); return @delegate.DynamicInvoke(array); } public static object TryEvalMethodVarArgs(object[] methodArgs, Type[] argTypes, CSharpArgumentInfoFlags[] argFlags, string methodName, Type accessibilityContext, Type[] typeArguments) { Type[] delegateSignatureTypes = null; CSharpArgumentInfo[] argInfos = null; CreateDelegateSignatureAndArgumentInfos(methodArgs, argTypes, argFlags, out delegateSignatureTypes, out argInfos); return CreateDelegateAndInvoke(binder: (!string.IsNullOrEmpty(methodName)) ? ((CallSiteBinder)new CSharpInvokeMemberBinder(CSharpCallFlags.ResultDiscarded, methodName, accessibilityContext, typeArguments, argInfos)) : ((CallSiteBinder)new CSharpInvokeBinder(CSharpCallFlags.ResultDiscarded, accessibilityContext, argInfos)), delegateSignatureTypes: delegateSignatureTypes, args: methodArgs); } public static object TryGetMemberValue<T>(T obj, string propName, Type accessibilityContext, bool isResultIndexed) { CSharpGetMemberBinder binder = new CSharpGetMemberBinder(propName, isResultIndexed, accessibilityContext, new CSharpArgumentInfo[1] { CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null) }); CallSite<Func<CallSite, T, object>> callSite = CallSite<Func<CallSite, T, object>>.Create(binder); return callSite.Target(callSite, obj); } public static object TryGetMemberValueVarArgs(object[] propArgs, Type[] argTypes, CSharpArgumentInfoFlags[] argFlags, Type accessibilityContext) { Type[] delegateSignatureTypes = null; CSharpArgumentInfo[] argInfos = null; CreateDelegateSignatureAndArgumentInfos(propArgs, argTypes, argFlags, out delegateSignatureTypes, out argInfos); CallSiteBinder binder = new CSharpGetIndexBinder(accessibilityContext, argInfos); return CreateDelegateAndInvoke(delegateSignatureTypes, binder, propArgs); } public static object TrySetMemberValue<TObject, TValue>(TObject obj, string propName, TValue value, CSharpArgumentInfoFlags valueFlags, Type accessibilityContext) { CSharpArgumentInfo cSharpArgumentInfo = CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null); CSharpArgumentInfo cSharpArgumentInfo2 = CSharpArgumentInfo.Create(valueFlags, null); CSharpSetMemberBinder binder = new CSharpSetMemberBinder(propName, isCompoundAssignment: false, isChecked: false, accessibilityContext, new CSharpArgumentInfo[2] { cSharpArgumentInfo, cSharpArgumentInfo2 }); CallSite<Func<CallSite, TObject, TValue, object>> callSite = CallSite<Func<CallSite, TObject, TValue, object>>.Create(binder); return callSite.Target(callSite, obj, value); } public static object TrySetMemberValueVarArgs(object[] propArgs, Type[] argTypes, CSharpArgumentInfoFlags[] argFlags, Type accessibilityContext) { Type[] delegateSignatureTypes = null; CSharpArgumentInfo[] argInfos = null; CreateDelegateSignatureAndArgumentInfos(propArgs, argTypes, argFlags, out delegateSignatureTypes, out argInfos); CallSiteBinder binder = new CSharpSetIndexBinder(isCompoundAssignment: false, isChecked: false, accessibilityContext, argInfos); return CreateDelegateAndInvoke(delegateSignatureTypes, binder, propArgs); } internal static object TryGetMemberValue(object obj, string name, bool ignoreException) { bool ignoreCase = false; object obj2 = null; CallSite<Func<CallSite, object, object>> callSite = CallSite<Func<CallSite, object, object>>.Create(new GetMemberValueBinder(name, ignoreCase)); try { return callSite.Target(callSite, obj); } catch (DynamicBindingFailedException ex) { if (ignoreException) { return null; } throw ex; } catch (MissingMemberException ex2) { if (ignoreException) { return System.SR.GetValueonWriteOnlyProperty; } throw ex2; } } private static IList<KeyValuePair<string, object>> QueryDynamicObject(object obj) { if (obj is IDynamicMetaObjectProvider dynamicMetaObjectProvider) { DynamicMetaObject metaObject = dynamicMetaObjectProvider.GetMetaObject(parameter); List<string> list = new List<string>(metaObject.GetDynamicMemberNames()); list.Sort(); if (list != null) { List<KeyValuePair<string, object>> list2 = new List<KeyValuePair<string, object>>(); { foreach (string item in list) { object value; if ((value = TryGetMemberValue(obj, item, ignoreException: true)) != null) { list2.Add(new KeyValuePair<string, object>(item, value)); } } return list2; } } } return new KeyValuePair<string, object>[0]; } } internal static class Error { internal static Exception InternalCompilerError() { return new RuntimeBinderInternalCompilerException(System.SR.InternalCompilerError); } internal static Exception BindPropertyFailedMethodGroup(object p0) { return new RuntimeBinderException(System.SR.Format(System.SR.BindPropertyFailedMethodGroup, p0)); } internal static Exception BindPropertyFailedEvent(object p0) { return new RuntimeBinderException(System.SR.Format(System.SR.BindPropertyFailedEvent, p0)); } internal static Exception BindInvokeFailedNonDelegate() { return new RuntimeBinderException(System.SR.BindInvokeFailedNonDelegate); } internal static Exception BindStaticRequiresType(string paramName) { return new ArgumentException(System.SR.TypeArgumentRequiredForStaticCall, paramName); } internal static Exception NullReferenceOnMemberException() { return new RuntimeBinderException(System.SR.NullReferenceOnMemberException); } internal static Exception BindCallToConditionalMethod(object p0) { return new RuntimeBinderException(System.SR.Format(System.SR.BindCallToConditionalMethod, p0)); } internal static Exception BindToVoidMethodButExpectResult() { return new RuntimeBinderException(System.SR.BindToVoidMethodButExpectResult); } internal static Exception ArgumentNull(string paramName) { return new ArgumentNullException(paramName); } internal static Exception DynamicArgumentNeedsValue(string paramName) { return new ArgumentException(System.SR.DynamicArgumentNeedsValue, paramName); } } internal sealed class ExpressionTreeCallRewriter : ExprVisitorBase { private sealed class ExpressionExpr : Expr { public readonly Expression Expression; public ExpressionExpr(Expression e) : base(ExpressionKind.NoOp) { Expression = e; } } private readonly Dictionary<ExprCall, Expression> _DictionaryOfParameters; private readonly Expression[] _ListOfParameters; private int _currentParameterIndex; private ExpressionTreeCallRewriter(Expression[] listOfParameters) { _DictionaryOfParameters = new Dictionary<ExprCall, Expression>(); _ListOfParameters = listOfParameters; } public static Expression Rewrite(ExprBinOp binOp, Expression[] listOfParameters) { ExpressionTreeCallRewriter expressionTreeCallRewriter = new ExpressionTreeCallRewriter(listOfParameters); expressionTreeCallRewriter.Visit(binOp.OptionalLeftChild); ExprCall pExpr = (ExprCall)binOp.OptionalRightChild; ExpressionExpr expressionExpr = expressionTreeCallRewriter.Visit(pExpr) as ExpressionExpr; return expressionExpr.Expression; } protected override Expr VisitSAVE(ExprBinOp pExpr) { ExprCall key = (ExprCall)pExpr.OptionalLeftChild; Expression value = _ListOfParameters[_currentParameterIndex++]; _DictionaryOfParameters.Add(key, value); return null; } protected override Expr VisitCALL(ExprCall pExpr) { if (pExpr.PredefinedMethod == PREDEFMETH.PM_COUNT) { return pExpr; } Expression e; switch (pExpr.PredefinedMethod) { case PREDEFMETH.PM_EXPRESSION_LAMBDA: return GenerateLambda(pExpr); case PREDEFMETH.PM_EXPRESSION_CALL: e = GenerateCall(pExpr); break; case PREDEFMETH.PM_EXPRESSION_ARRAYINDEX: case PREDEFMETH.PM_EXPRESSION_ARRAYINDEX2: e = GenerateArrayIndex(pExpr); break; case PREDEFMETH.PM_EXPRESSION_CONVERT: case PREDEFMETH.PM_EXPRESSION_CONVERT_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_CONVERTCHECKED: case PREDEFMETH.PM_EXPRESSION_CONVERTCHECKED_USER_DEFINED: e = GenerateConvert(pExpr); break; case PREDEFMETH.PM_EXPRESSION_PROPERTY: e = GenerateProperty(pExpr); break; case PREDEFMETH.PM_EXPRESSION_FIELD: e = GenerateField(pExpr); break; case PREDEFMETH.PM_EXPRESSION_INVOKE: e = GenerateInvoke(pExpr); break; case PREDEFMETH.PM_EXPRESSION_NEW: e = GenerateNew(pExpr); break; case PREDEFMETH.PM_EXPRESSION_ADD: case PREDEFMETH.PM_EXPRESSION_ADDCHECKED: case PREDEFMETH.PM_EXPRESSION_AND: case PREDEFMETH.PM_EXPRESSION_ANDALSO: case PREDEFMETH.PM_EXPRESSION_DIVIDE: case PREDEFMETH.PM_EXPRESSION_EQUAL: case PREDEFMETH.PM_EXPRESSION_EXCLUSIVEOR: case PREDEFMETH.PM_EXPRESSION_GREATERTHAN: case PREDEFMETH.PM_EXPRESSION_GREATERTHANOREQUAL: case PREDEFMETH.PM_EXPRESSION_LEFTSHIFT: case PREDEFMETH.PM_EXPRESSION_LESSTHAN: case PREDEFMETH.PM_EXPRESSION_LESSTHANOREQUAL: case PREDEFMETH.PM_EXPRESSION_MODULO: case PREDEFMETH.PM_EXPRESSION_MULTIPLY: case PREDEFMETH.PM_EXPRESSION_MULTIPLYCHECKED: case PREDEFMETH.PM_EXPRESSION_NOTEQUAL: case PREDEFMETH.PM_EXPRESSION_OR: case PREDEFMETH.PM_EXPRESSION_ORELSE: case PREDEFMETH.PM_EXPRESSION_RIGHTSHIFT: case PREDEFMETH.PM_EXPRESSION_SUBTRACT: case PREDEFMETH.PM_EXPRESSION_SUBTRACTCHECKED: e = GenerateBinaryOperator(pExpr); break; case PREDEFMETH.PM_EXPRESSION_ADD_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_ADDCHECKED_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_AND_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_ANDALSO_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_DIVIDE_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_EQUAL_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_EXCLUSIVEOR_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_GREATERTHAN_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_GREATERTHANOREQUAL_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_LEFTSHIFT_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_LESSTHAN_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_LESSTHANOREQUAL_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_MODULO_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_MULTIPLY_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_MULTIPLYCHECKED_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_NOTEQUAL_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_OR_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_ORELSE_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_RIGHTSHIFT_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_SUBTRACT_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_SUBTRACTCHECKED_USER_DEFINED: e = GenerateUserDefinedBinaryOperator(pExpr); break; case PREDEFMETH.PM_EXPRESSION_NEGATE: case PREDEFMETH.PM_EXPRESSION_NEGATECHECKED: case PREDEFMETH.PM_EXPRESSION_NOT: e = GenerateUnaryOperator(pExpr); break; case PREDEFMETH.PM_EXPRESSION_UNARYPLUS_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_NEGATE_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_NEGATECHECKED_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_NOT_USER_DEFINED: e = GenerateUserDefinedUnaryOperator(pExpr); break; case PREDEFMETH.PM_EXPRESSION_CONSTANT_OBJECT_TYPE: e = GenerateConstantType(pExpr); break; case PREDEFMETH.PM_EXPRESSION_ASSIGN: e = GenerateAssignment(pExpr); break; default: throw Error.InternalCompilerError(); } return new ExpressionExpr(e); } protected override Expr VisitWRAP(ExprWrap pExpr) { return new ExpressionExpr(GetExpression(pExpr)); } private Expr GenerateLambda(ExprCall pExpr) { return Visit(((ExprList)pExpr.OptionalArguments).OptionalElement); } private Expression GenerateCall(ExprCall pExpr) { ExprList exprList = (ExprList)pExpr.OptionalArguments; ExprMethodInfo exprMethodInfo; ExprArrayInit arrinit; if (exprList.OptionalNextListNode is ExprList exprList2) { exprMethodInfo = (ExprMethodInfo)exprList2.OptionalElement; arrinit = (ExprArrayInit)exprList2.OptionalNextListNode; } else { exprMethodInfo = (ExprMethodInfo)exprList.OptionalNextListNode; arrinit = null; } Expression instance = null; MethodInfo methodInfo = exprMethodInfo.MethodInfo; Expression[] argumentsFromArrayInit = GetArgumentsFromArrayInit(arrinit); if (methodInfo == null) { throw Error.InternalCompilerError(); } if (!methodInfo.IsStatic) { instance = GetExpression(((ExprList)pExpr.OptionalArguments).OptionalElement); } return Expression.Call(instance, methodInfo, argumentsFromArrayInit); } private Expression GenerateArrayIndex(ExprCall pExpr) { ExprList exprList = (ExprList)pExpr.OptionalArguments; Expression expression = GetExpression(exprList.OptionalElement); Expression[] indexes = ((pExpr.PredefinedMethod != PREDEFMETH.PM_EXPRESSION_ARRAYINDEX) ? GetArgumentsFromArrayInit((ExprArrayInit)exprList.OptionalNextListNode) : new Expression[1] { GetExpression(exprList.OptionalNextListNode) }); return Expression.ArrayAccess(expression, indexes); } private Expression GenerateConvert(ExprCall pExpr) { PREDEFMETH predefinedMethod = pExpr.PredefinedMethod; Expression expression; Type associatedSystemType; if (predefinedMethod == PREDEFMETH.PM_EXPRESSION_CONVERT_USER_DEFINED || predefinedMethod == PREDEFMETH.PM_EXPRESSION_CONVERTCHECKED_USER_DEFINED) { ExprList exprList = (ExprList)pExpr.OptionalArguments; ExprList exprList2 = (ExprList)exprList.OptionalNextListNode; expression = GetExpression(exprList.OptionalElement); associatedSystemType = ((ExprTypeOf)exprList2.OptionalElement).SourceType.AssociatedSystemType; if (expression.Type.MakeByRefType() == associatedSystemType) { return expression; } MethodInfo methodInfo = ((ExprMethodInfo)exprList2.OptionalNextListNode).MethodInfo; if (predefinedMethod == PREDEFMETH.PM_EXPRESSION_CONVERT_USER_DEFINED) { return Expression.Convert(expression, associatedSystemType, methodInfo); } return Expression.ConvertChecked(expression, associatedSystemType, methodInfo); } ExprList exprList3 = (ExprList)pExpr.OptionalArguments; expression = GetExpression(exprList3.OptionalElement); associatedSystemType = ((ExprTypeOf)exprList3.OptionalNextListNode).SourceType.AssociatedSystemType; if (expression.Type.MakeByRefType() == associatedSystemType) { return expression; } if ((pExpr.Flags & EXPRFLAG.EXF_USERCALLABLE) != 0) { return Expression.Unbox(expression, associatedSystemType); } if (predefinedMethod == PREDEFMETH.PM_EXPRESSION_CONVERT) { return Expression.Convert(expression, associatedSystemType); } return Expression.ConvertChecked(expression, associatedSystemType); } private Expression GenerateProperty(ExprCall pExpr) { ExprList exprList = (ExprList)pExpr.OptionalArguments; Expr optionalElement = exprList.OptionalElement; Expr optionalNextListNode = exprList.OptionalNextListNode; ExprPropertyInfo exprPropertyInfo; ExprArrayInit exprArrayInit; if (optionalNextListNode is ExprList exprList2) { exprPropertyInfo = exprList2.OptionalElement as ExprPropertyInfo; exprArrayInit = exprList2.OptionalNextListNode as ExprArrayInit; } else { exprPropertyInfo = optionalNextListNode as ExprPropertyInfo; exprArrayInit = null; } PropertyInfo propertyInfo = exprPropertyInfo.PropertyInfo; if (propertyInfo == null) { throw Error.InternalCompilerError(); } if (exprArrayInit == null) { return Expression.Property(GetExpression(optionalElement), propertyInfo); } return Expression.Property(GetExpression(optionalElement), propertyInfo, GetArgumentsFromArrayInit(exprArrayInit)); } private Expression GenerateField(ExprCall pExpr) { ExprList exprList = (ExprList)pExpr.OptionalArguments; ExprFieldInfo exprFieldInfo = (ExprFieldInfo)exprList.OptionalNextListNode; Type type = exprFieldInfo.FieldType.AssociatedSystemType; FieldInfo fieldInfo = exprFieldInfo.Field.AssociatedFieldInfo; if (!type.IsGenericType && !type.IsNested) { type = fieldInfo.DeclaringType; } if (type.IsGenericType) { fieldInfo = type.GetField(fieldInfo.Name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); } return Expression.Field(GetExpression(exprList.OptionalElement), fieldInfo); } private Expression GenerateInvoke(ExprCall pExpr) { ExprList exprList = (ExprList)pExpr.OptionalArguments; return Expression.Invoke(GetExpression(exprList.OptionalElement), GetArgumentsFromArrayInit(exprList.OptionalNextListNode as ExprArrayInit)); } private Expression GenerateNew(ExprCall pExpr) { ExprList exprList = (ExprList)pExpr.OptionalArguments; ConstructorInfo constructorInfo = ((ExprMethodInfo)exprList.OptionalElement).ConstructorInfo; Expression[] argumentsFromArrayInit = GetArgumentsFromArrayInit(exprList.OptionalNextListNode as ExprArrayInit); return Expression.New(constructorInfo, argumentsFromArrayInit); } private static Expression GenerateConstantType(ExprCall pExpr) { ExprList exprList = (ExprList)pExpr.OptionalArguments; return Expression.Constant(exprList.OptionalElement.Object, ((ExprTypeOf)exprList.OptionalNextListNode).SourceType.AssociatedSystemType); } private Expression GenerateAssignment(ExprCall pExpr) { ExprList exprList = (ExprList)pExpr.OptionalArguments; return Expression.Assign(GetExpression(exprList.OptionalElement), GetExpression(exprList.OptionalNextListNode)); } private Expression GenerateBinaryOperator(ExprCall pExpr) { ExprList exprList = (ExprList)pExpr.OptionalArguments; Expression expression = GetExpression(exprList.OptionalElement); Expression expression2 = GetExpression(exprList.OptionalNextListNode); return pExpr.PredefinedMethod switch { PREDEFMETH.PM_EXPRESSION_ADD => Expression.Add(expression, expression2), PREDEFMETH.PM_EXPRESSION_AND => Expression.And(expression, expression2), PREDEFMETH.PM_EXPRESSION_DIVIDE => Expression.Divide(expression, expression2), PREDEFMETH.PM_EXPRESSION_EQUAL => Expression.Equal(expression, expression2), PREDEFMETH.PM_EXPRESSION_EXCLUSIVEOR => Expression.ExclusiveOr(expression, expression2), PREDEFMETH.PM_EXPRESSION_GREATERTHAN => Expression.GreaterThan(expression, expression2), PREDEFMETH.PM_EXPRESSION_GREATERTHANOREQUAL => Expression.GreaterThanOrEqual(expression, expression2), PREDEFMETH.PM_EXPRESSION_LEFTSHIFT => Expression.LeftShift(expression, expression2), PREDEFMETH.PM_EXPRESSION_LESSTHAN => Expression.LessThan(expression, expression2), PREDEFMETH.PM_EXPRESSION_LESSTHANOREQUAL => Expression.LessThanOrEqual(expression, expression2), PREDEFMETH.PM_EXPRESSION_MODULO => Expression.Modulo(expression, expression2), PREDEFMETH.PM_EXPRESSION_MULTIPLY => Expression.Multiply(expression, expression2), PREDEFMETH.PM_EXPRESSION_NOTEQUAL => Expression.NotEqual(expression, expression2), PREDEFMETH.PM_EXPRESSION_OR => Expression.Or(expression, expression2), PREDEFMETH.PM_EXPRESSION_RIGHTSHIFT => Expression.RightShift(expression, expression2), PREDEFMETH.PM_EXPRESSION_SUBTRACT => Expression.Subtract(expression, expression2), PREDEFMETH.PM_EXPRESSION_ORELSE => Expression.OrElse(expression, expression2), PREDEFMETH.PM_EXPRESSION_ANDALSO => Expression.AndAlso(expression, expression2), PREDEFMETH.PM_EXPRESSION_ADDCHECKED => Expression.AddChecked(expression, expression2), PREDEFMETH.PM_EXPRESSION_MULTIPLYCHECKED => Expression.MultiplyChecked(expression, expression2), PREDEFMETH.PM_EXPRESSION_SUBTRACTCHECKED => Expression.SubtractChecked(expression, expression2), _ => throw Error.InternalCompilerError(), }; } private Expression GenerateUserDefinedBinaryOperator(ExprCall pExpr) { ExprList exprList = (ExprList)pExpr.OptionalArguments; Expression expression = GetExpression(exprList.OptionalElement); Expression expression2 = GetExpression(((ExprList)exprList.OptionalNextListNode).OptionalElement); exprList = (ExprList)exprList.OptionalNextListNode; bool liftToNull = false; MethodInfo methodInfo; if (exprList.OptionalNextListNode is ExprList exprList2) { ExprConstant exprConstant = (ExprConstant)exprList2.OptionalElement; liftToNull = exprConstant.Val.Int32Val == 1; methodInfo = ((ExprMethodInfo)exprList2.OptionalNextListNode).MethodInfo; } else { methodInfo = ((ExprMethodInfo)exprList.OptionalNextListNode).MethodInfo; } return pExpr.PredefinedMethod switch { PREDEFMETH.PM_EXPRESSION_ADD_USER_DEFINED => Expression.Add(expression, expression2, methodInfo), PREDEFMETH.PM_EXPRESSION_AND_USER_DEFINED => Expression.And(expression, expression2, methodInfo), PREDEFMETH.PM_EXPRESSION_DIVIDE_USER_DEFINED => Expression.Divide(expression, expression2, methodInfo), PREDEFMETH.PM_EXPRESSION_EQUAL_USER_DEFINED => Expression.Equal(expression, expression2, liftToNull, methodInfo), PREDEFMETH.PM_EXPRESSION_EXCLUSIVEOR_USER_DEFINED => Expression.ExclusiveOr(expression, expression2, methodInfo), PREDEFMETH.PM_EXPRESSION_GREATERTHAN_USER_DEFINED => Expression.GreaterThan(expression, expression2, liftToNull, methodInfo), PREDEFMETH.PM_EXPRESSION_GREATERTHANOREQUAL_USER_DEFINED => Expression.GreaterThanOrEqual(expression, expression2, liftToNull, methodInfo), PREDEFMETH.PM_EXPRESSION_LEFTSHIFT_USER_DEFINED => Expression.LeftShift(expression, expression2, methodInfo), PREDEFMETH.PM_EXPRESSION_LESSTHAN_USER_DEFINED => Expression.LessThan(expression, expression2, liftToNull, methodInfo), PREDEFMETH.PM_EXPRESSION_LESSTHANOREQUAL_USER_DEFINED => Expression.LessThanOrEqual(expression, expression2, liftToNull, methodInfo), PREDEFMETH.PM_EXPRESSION_MODULO_USER_DEFINED => Expression.Modulo(expression, expression2, methodInfo), PREDEFMETH.PM_EXPRESSION_MULTIPLY_USER_DEFINED => Expression.Multiply(expression, expression2, methodInfo), PREDEFMETH.PM_EXPRESSION_NOTEQUAL_USER_DEFINED => Expression.NotEqual(expression, expression2, liftToNull, methodInfo), PREDEFMETH.PM_EXPRESSION_OR_USER_DEFINED => Expression.Or(expression, expression2, methodInfo), PREDEFMETH.PM_EXPRESSION_RIGHTSHIFT_USER_DEFINED => Expression.RightShift(expression, expression2, methodInfo), PREDEFMETH.PM_EXPRESSION_SUBTRACT_USER_DEFINED => Expression.Subtract(expression, expression2, methodInfo), PREDEFMETH.PM_EXPRESSION_ORELSE_USER_DEFINED => Expression.OrElse(expression, expression2, methodInfo), PREDEFMETH.PM_EXPRESSION_ANDALSO_USER_DEFINED => Expression.AndAlso(expression, expression2, methodInfo), PREDEFMETH.PM_EXPRESSION_ADDCHECKED_USER_DEFINED => Expression.AddChecked(expression, expression2, methodInfo), PREDEFMETH.PM_EXPRESSION_MULTIPLYCHECKED_USER_DEFINED => Expression.MultiplyChecked(expression, expression2, methodInfo), PREDEFMETH.PM_EXPRESSION_SUBTRACTCHECKED_USER_DEFINED => Expression.SubtractChecked(expression, expression2, methodInfo), _ => throw Error.InternalCompilerError(), }; } private Expression GenerateUnaryOperator(ExprCall pExpr) { PREDEFMETH predefinedMethod = pExpr.PredefinedMethod; Expression expression = GetExpression(pExpr.OptionalArguments); return predefinedMethod switch { PREDEFMETH.PM_EXPRESSION_NOT => Expression.Not(expression), PREDEFMETH.PM_EXPRESSION_NEGATE => Expression.Negate(expression), PREDEFMETH.PM_EXPRESSION_NEGATECHECKED => Expression.NegateChecked(expression), _ => throw Error.InternalCompilerError(), }; } private Expression GenerateUserDefinedUnaryOperator(ExprCall pExpr) { PREDEFMETH predefinedMethod = pExpr.PredefinedMethod; ExprList exprList = (ExprList)pExpr.OptionalArguments; Expression expression = GetExpression(exprList.OptionalElement); MethodInfo methodInfo = ((ExprMethodInfo)exprList.OptionalNextListNode).MethodInfo; return predefinedMethod switch { PREDEFMETH.PM_EXPRESSION_NOT_USER_DEFINED => Expression.Not(expression, methodInfo), PREDEFMETH.PM_EXPRESSION_NEGATE_USER_DEFINED => Expression.Negate(expression, methodInfo), PREDEFMETH.PM_EXPRESSION_UNARYPLUS_USER_DEFINED => Expression.UnaryPlus(expression, methodInfo), PREDEFMETH.PM_EXPRESSION_NEGATECHECKED_USER_DEFINED => Expression.NegateChecked(expression, methodInfo), _ => throw Error.InternalCompilerError(), }; } private Expression GetExpression(Expr pExpr) { if (pExpr is ExprWrap exprWrap) { return _DictionaryOfParameters[(ExprCall)exprWrap.OptionalExpression]; } if (pExpr is ExprConstant) { return null; } ExprCall exprCall = (ExprCall)pExpr; switch (exprCall.PredefinedMethod) { case PREDEFMETH.PM_EXPRESSION_CALL: return GenerateCall(exprCall); case PREDEFMETH.PM_EXPRESSION_CONVERT: case PREDEFMETH.PM_EXPRESSION_CONVERT_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_CONVERTCHECKED: case PREDEFMETH.PM_EXPRESSION_CONVERTCHECKED_USER_DEFINED: return GenerateConvert(exprCall); case PREDEFMETH.PM_EXPRESSION_NEWARRAYINIT: { ExprList exprList = (ExprList)exprCall.OptionalArguments; return Expression.NewArrayInit(((ExprTypeOf)exprList.OptionalElement).SourceType.AssociatedSystemType, GetArgumentsFromArrayInit((ExprArrayInit)exprList.OptionalNextListNode)); } case PREDEFMETH.PM_EXPRESSION_ARRAYINDEX: case PREDEFMETH.PM_EXPRESSION_ARRAYINDEX2: return GenerateArrayIndex(exprCall); case PREDEFMETH.PM_EXPRESSION_NEW: return GenerateNew(exprCall); case PREDEFMETH.PM_EXPRESSION_PROPERTY: return GenerateProperty(exprCall); case PREDEFMETH.PM_EXPRESSION_FIELD: return GenerateField(exprCall); case PREDEFMETH.PM_EXPRESSION_CONSTANT_OBJECT_TYPE: return GenerateConstantType(exprCall); case PREDEFMETH.PM_EXPRESSION_ASSIGN: return GenerateAssignment(exprCall); case PREDEFMETH.PM_EXPRESSION_ADD: case PREDEFMETH.PM_EXPRESSION_ADDCHECKED: case PREDEFMETH.PM_EXPRESSION_AND: case PREDEFMETH.PM_EXPRESSION_ANDALSO: case PREDEFMETH.PM_EXPRESSION_DIVIDE: case PREDEFMETH.PM_EXPRESSION_EQUAL: case PREDEFMETH.PM_EXPRESSION_EXCLUSIVEOR: case PREDEFMETH.PM_EXPRESSION_GREATERTHAN: case PREDEFMETH.PM_EXPRESSION_GREATERTHANOREQUAL: case PREDEFMETH.PM_EXPRESSION_LEFTSHIFT: case PREDEFMETH.PM_EXPRESSION_LESSTHAN: case PREDEFMETH.PM_EXPRESSION_LESSTHANOREQUAL: case PREDEFMETH.PM_EXPRESSION_MODULO: case PREDEFMETH.PM_EXPRESSION_MULTIPLY: case PREDEFMETH.PM_EXPRESSION_MULTIPLYCHECKED: case PREDEFMETH.PM_EXPRESSION_NOTEQUAL: case PREDEFMETH.PM_EXPRESSION_OR: case PREDEFMETH.PM_EXPRESSION_ORELSE: case PREDEFMETH.PM_EXPRESSION_RIGHTSHIFT: case PREDEFMETH.PM_EXPRESSION_SUBTRACT: case PREDEFMETH.PM_EXPRESSION_SUBTRACTCHECKED: return GenerateBinaryOperator(exprCall); case PREDEFMETH.PM_EXPRESSION_ADD_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_ADDCHECKED_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_AND_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_ANDALSO_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_DIVIDE_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_EQUAL_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_EXCLUSIVEOR_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_GREATERTHAN_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_GREATERTHANOREQUAL_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_LEFTSHIFT_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_LESSTHAN_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_LESSTHANOREQUAL_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_MODULO_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_MULTIPLY_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_MULTIPLYCHECKED_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_NOTEQUAL_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_OR_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_ORELSE_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_RIGHTSHIFT_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_SUBTRACT_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_SUBTRACTCHECKED_USER_DEFINED: return GenerateUserDefinedBinaryOperator(exprCall); case PREDEFMETH.PM_EXPRESSION_NEGATE: case PREDEFMETH.PM_EXPRESSION_NEGATECHECKED: case PREDEFMETH.PM_EXPRESSION_NOT: return GenerateUnaryOperator(exprCall); case PREDEFMETH.PM_EXPRESSION_UNARYPLUS_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_NEGATE_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_NEGATECHECKED_USER_DEFINED: case PREDEFMETH.PM_EXPRESSION_NOT_USER_DEFINED: return GenerateUserDefinedUnaryOperator(exprCall); default: throw Error.InternalCompilerError(); } } private Expression[] GetArgumentsFromArrayInit(ExprArrayInit arrinit) { List<Expression> list = new List<Expression>(); if (arrinit != null) { Expr expr = arrinit.OptionalArguments; while (expr != null) { Expr pExpr; if (expr is ExprList exprList) { pExpr = exprList.OptionalElement; expr = exprList.OptionalNextListNode; } else { pExpr = expr; expr = null; } list.Add(GetExpression(pExpr)); } } return list.ToArray(); } } internal interface ICSharpBinder { bool IsBinderThatCanHaveRefReceiver { get; } BindingFlag BindingFlags { get; } string Name { get; } Type ReturnType { get; } CSharpArgumentInfo GetArgumentInfo(int index); void PopulateSymbolTableWithName(Type callingType, ArgumentObject[] arguments); Expr DispatchPayload(RuntimeBinder runtimeBinder, ArgumentObject[] arguments, LocalVariableSymbol[] locals); int GetGetBinderEquivalenceHash(); bool IsEquivalentTo(ICSharpBinder other); } internal interface ICSharpInvokeOrInvokeMemberBinder : ICSharpBinder { bool StaticCall { get; } bool ResultDiscarded { get; } CSharpCallFlags Flags { get; } Type[] TypeArguments { get; } } internal readonly struct RuntimeBinder { private static readonly object s_bindLock = new object(); private readonly ExpressionBinder _binder; internal bool IsChecked => _binder.Context.Checked; public RuntimeBinder(Type contextType, bool isChecked = false) { AggregateSymbol context; if (contextType != null) { lock (s_bindLock) { context = ((AggregateType)SymbolTable.GetCTypeFromType(contextType)).OwningAggregate; } } else { context = null; } _binder = new ExpressionBinder(new BindingContext(context, isChecked)); } public Expression Bind(ICSharpBinder payload, Expression[] parameters, DynamicMetaObject[] args, out DynamicMetaObject deferredBinding) { lock (s_bindLock) { return BindCore(payload, parameters, args, out deferredBinding); } } private Expression BindCore(ICSharpBinder payload, Expression[] parameters, DynamicMetaObject[] args, out DynamicMetaObject deferredBinding) { ArgumentObject[] array = CreateArgumentArray(payload, parameters, args); payload.PopulateSymbolTableWithName(array[0].Type, array); AddConversionsForArguments(array); Scope pScope = SymFactory.CreateScope(); LocalVariableSymbol[] locals = PopulateLocalScope(payload, pScope, array, parameters); if (DeferBinding(payload, array, args, locals, out deferredBinding)) { return null; } Expr pResult = payload.DispatchPayload(this, array, locals); return CreateExpressionTreeFromResult(parameters, pScope, pResult); } private bool DeferBinding(ICSharpBinder payload, ArgumentObject[] arguments, DynamicMetaObject[] args, LocalVariableSymbol[] locals, out DynamicMetaObject deferredBinding) { if (payload is CSharpInvokeMemberBinder cSharpInvokeMemberBinder) { Type[] typeArguments = cSharpInvokeMemberBinder.TypeArguments; int arity = ((typeArguments != null) ? typeArguments.Length : 0); MemberLookup mem = new MemberLookup(); Expr callingObject = CreateCallingObjectForCall(cSharpInvokeMemberBinder, arguments, locals); SymWithType symWithType = SymbolTable.LookupMember(cSharpInvokeMemberBinder.Name, callingObject, _binder.Context.ContextForMemberLookup, arity, mem, (cSharpInvokeMemberBinder.Flags & CSharpCallFlags.EventHookup) != 0, requireInvocable: true); if (symWithType != null && symWithType.Sym.getKind() != SYMKIND.SK_MethodSymbol) { CSharpGetMemberBinder cSharpGetMemberBinder = new CSharpGetMemberBinder(cSharpInvokeMemberBinder.Name, resultIndexed: false, cSharpInvokeMemberBinder.CallingContext, new CSharpArgumentInfo[1] { cSharpInvokeMemberBinder.GetArgumentInfo(0) }).TryGetExisting(); CSharpArgumentInfo[] array = cSharpInvokeMemberBinder.ArgumentInfoArray(); array[0] = CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null); CSharpInvokeBinder cSharpInvokeBinder = new CSharpInvokeBinder(cSharpInvokeMemberBinder.Flags, cSharpInvokeMemberBinder.CallingContext, array).TryGetExisting(); DynamicMetaObject[] array2 = new DynamicMetaObject[args.Length - 1]; Array.Copy(args, 1, array2, 0, args.Length - 1); deferredBinding = cSharpInvokeBinder.Defer(cSharpGetMemberBinder.Defer(args[0]), array2); return true; } } deferredBinding = null; return false; } private static Expression CreateExpressionTreeFromResult(Expression[] parameters, Scope pScope, Expr pResult) { ExprBoundLambda expr = GenerateBoundLambda(pScope, pResult); ExprBinOp binOp = ExpressionTreeRewriter.Rewrite(expr); return ExpressionTreeCallRewriter.Rewrite(binOp, parameters); } private Type GetArgumentType(ICSharpBinder p, CSharpArgumentInfo argInfo, Expression param, DynamicMetaObject arg, int index) { Type type = (argInfo.UseCompileTimeType ? param.Type : arg.LimitType); if (argInfo.IsByRefOrOut) { if (index != 0 || !p.IsBinderThatCanHaveRefReceiver) { type = type.MakeByRefType(); } } else if (!argInfo.UseCompileTimeType) { CType cTypeFromType = SymbolTable.GetCTypeFromType(type); CType bestAccessibleType = TypeManager.GetBestAccessibleType(_binder.Context.ContextForMemberLookup, cTypeFromType); type = bestAccessibleType.AssociatedSystemType; } return type; } private ArgumentObject[] CreateArgumentArray(ICSharpBinder payload, Expression[] parameters, DynamicMetaObject[] args) { ArgumentObject[] array = new ArgumentObject[parameters.Length]; for (int i = 0; i < parameters.Length; i++) { CSharpArgumentInfo argumentInfo = payload.GetArgumentInfo(i); array[i] = new ArgumentObject(args[i].Value, argumentInfo, GetArgumentType(payload, argumentInfo, parameters[i], args[i], i)); } return array; } internal static void PopulateSymbolTableWithPayloadInformation(ICSharpInvokeOrInvokeMemberBinder callOrInvoke, Type callingType, ArgumentObject[] arguments) { Type type; if (callOrInvoke.StaticCall) { type = arguments[0].Value as Type; if (type == null) { throw Error.BindStaticRequiresType(arguments[0].Info.Name); } } else { type = callingType; } SymbolTable.PopulateSymbolTableWithName(callOrInvoke.Name, callOrInvoke.TypeArguments, type); if (callOrInvoke.Name.StartsWith("set_", StringComparison.Ordinal) || callOrInvoke.Name.StartsWith("get_", StringComparison.Ordinal)) { SymbolTable.PopulateSymbolTableWithName(callOrInvoke.Name.Substring(4), callOrInvoke.TypeArguments, type); } } private static void AddConversionsForArguments(ArgumentObject[] arguments) { for (int i = 0; i < arguments.Length; i++) { ArgumentObject argumentObject = arguments[i]; SymbolTable.AddConversionsForType(argumentObject.Type); } } internal ExprWithArgs DispatchPayload(ICSharpInvokeOrInvokeMemberBinder payload, ArgumentObject[] arguments, LocalVariableSymbol[] locals) { return BindCall(payload, CreateCallingObjectForCall(payload, arguments, locals), arguments, locals); } private static LocalVariableSymbol[] PopulateLocalScope(ICSharpBinder payload, Scope pScope, ArgumentObject[] arguments, Expression[] parameterExpressions) { LocalVariableSymbol[] array = new LocalVariableSymbol[parameterExpressions.Length]; for (int i = 0; i < parameterExpressions.Length; i++) { Expression expression = parameterExpressions[i]; CType cType = SymbolTable.GetCTypeFromType(expression.Type); if ((i != 0 || !payload.IsBinderThatCanHaveRefReceiver) && expression is ParameterExpression parameterExpression && parameterExpression.IsByRef) { CSharpArgumentInfo info = arguments[i].Info; if (info.IsByRefOrOut) { cType = TypeManager.GetParameterModifier(cType, info.IsOut); } } LocalVariableSymbol localVariableSymbol = SymFactory.CreateLocalVar(NameManager.Add("p" + i), pScope, cType); array[i] = localVariableSymbol; } return array; } private static ExprBoundLambda GenerateBoundLambda(Scope pScope, Expr call) { AggregateType predefindType = SymbolLoader.GetPredefindType(PredefinedType.PT_FUNC); return ExprFactory.CreateAnonymousMethod(predefindType, pScope, call); } private Expr CreateLocal(Type type, bool isOut, LocalVariableSymbol local) { CType dest = ((!isOut) ? SymbolTable.GetCTypeFromType(type) : TypeManager.GetParameterModifier(SymbolTable.GetCTypeFromType(type.GetElementType()), isOut: true)); ExprLocal expr = ExprFactory.CreateLocal(local); Expr expr2 = _binder.tryConvert(expr, dest) ?? _binder.mustCast(expr, dest); expr2.Flags |= EXPRFLAG.EXF_LVALUE; return expr2; } internal Expr CreateArgumentListEXPR(ArgumentObject[] arguments, LocalVariableSymbol[] locals, int startIndex, int endIndex) { Expr first = null; Expr last = null; if (arguments != null) { for (int i = startIndex; i < endIndex; i++) { ArgumentObject argument = arguments[i]; Expr expr = CreateArgumentEXPR(argument, locals[i]); if (first == null) { first = expr; last = first; } else { ExprFactory.AppendItemToList(expr, ref first, ref last); } } } return first; } private Expr CreateArgumentEXPR(ArgumentObject argument, LocalVariableSymbol local) { Expr expr = (argument.Info.LiteralConstant ? ((argument.Value != null) ? ExprFactory.CreateConstant(SymbolTable.GetCTypeFromType(argument.Type), ConstVal.Get(argument.Value)) : ((!argument.Info.UseCompileTimeType) ? ExprFactory.CreateNull() : ExprFactory.CreateConstant(SymbolTable.GetCTypeFromType(argument.Type), default(ConstVal)))) : ((argument.Info.UseCompileTimeType || argument.Value != null) ? CreateLocal(argument.Type, argument.Info.IsOut, local) : ExprFactory.CreateNull())); if (argument.Info.NamedArgument) { expr = ExprFactory.CreateNamedArgumentSpecification(NameManager.Add(argument.Info.Name), expr); } if (!argument.Info.UseCompileTimeType && argument.Value != null) { expr.RuntimeObject = argument.Value;
plugins/TootTallyCore.dll
Decompiled 5 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using BaboonAPI.Hooks.Initializer; using BaboonAPI.Hooks.Tracks; using BaboonAPI.Internal.BaseGame; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Steamworks; using TMPro; using TootTallyCore.APIServices; using TootTallyCore.Graphics; using TootTallyCore.Graphics.Animations; using TootTallyCore.Utils.Assets; using TootTallyCore.Utils.Helpers; using TootTallyCore.Utils.SoundEffects; using TootTallyCore.Utils.Steam; using TootTallyCore.Utils.TootTallyGlobals; using TootTallyCore.Utils.TootTallyModules; using TootTallyCore.Utils.TootTallyNotifs; using TrombLoader.CustomTracks; using TrombLoader.Helpers; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Localization.Components; using UnityEngine.Networking; using UnityEngine.Scripting; using UnityEngine.UI; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("TootTally")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("TootTally API for Trombone Champ modding")] [assembly: AssemblyFileVersion("1.2.5.0")] [assembly: AssemblyInformationalVersion("1.2.5")] [assembly: AssemblyProduct("TootTallyCore")] [assembly: AssemblyTitle("TootTallyCore")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/TootTally/TootTallyCore")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.5.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; } } } namespace TootTallyCore { [BepInPlugin("TootTallyCore", "TootTallyCore", "1.2.5")] [BepInIncompatibility("TootTally")] public class Plugin : BaseUnityPlugin { public static int BUILDDATE = 20240331; private const string DEFAULT_THEME = "Default"; public static Plugin Instance; private Harmony _harmony; private bool _isReloadingTracks; public ConfigEntry<bool> DebugMode { get; private set; } public ConfigEntry<bool> ShouldShowNotifs { get; private set; } public ConfigEntry<string> ThemeName { get; private set; } public ConfigEntry<bool> RunGCWhilePlaying { get; private set; } public ConfigEntry<bool> ChangePitch { get; private set; } public static void LogInfo(string msg) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)msg); } public static void LogWarning(string msg) { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)msg); } public static void LogError(string msg) { ((BaseUnityPlugin)Instance).Logger.LogError((object)msg); } public static void LogDebug(string msg) { if (Instance.DebugMode.Value) { ((BaseUnityPlugin)Instance).Logger.LogDebug((object)msg); } } public static void LogException(Exception ex) { LogError(ex.Message); LogError(ex.StackTrace); } private void Awake() { //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown if ((Object)(object)Instance != (Object)null) { return; } Instance = this; ShouldShowNotifs = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Display Toasts", true, "Activate toast notifications for important events."); DebugMode = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Debug Mode", false, "Add extra logging information for debugging."); ThemeName = ((BaseUnityPlugin)this).Config.Bind<string>("Themes", "ThemeName", "Default".ToString(), (ConfigDescription)null); RunGCWhilePlaying = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Deactivate Garbage Collector While Playing.", false, "Deactivate the garbage collector during gameplay to prevent lag spikes."); ChangePitch = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Change Pitch", false, "Change the pitch on speed changes."); ((BaseUnityPlugin)this).Config.SettingChanged += ThemeManager.Config_SettingChanged; string text = Path.Combine(Paths.BepInExRootPath, "Themes"); if (!Directory.Exists(text)) { string text2 = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location), "Themes"); if (!Directory.Exists(text2)) { return; } Directory.Move(text2, text); } _harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); GameInitializationEvent.Register(((BaseUnityPlugin)this).Info, (Action)TryInitialize); } private void Update() { if (!_isReloadingTracks && Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)114)) { _isReloadingTracks = true; TootTallyNotifManager.DisplayNotif("Reloading tracks... Lag is normal."); ((MonoBehaviour)Instance).Invoke("ReloadTracks", 0.5f); } else if (Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)103)) { TootTallyNotifManager.DisplayNotif("Forcing garbage collection."); for (int i = 0; i < 9; i++) { GC.Collect(i % 3, GCCollectionMode.Forced); } } } public void ReloadTracks() { TrackLookup.reload(); _isReloadingTracks = false; } private void TryInitialize() { AssetManager.LoadAssets(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location), "Assets")); _harmony.PatchAll(typeof(ThemeManager)); _harmony.PatchAll(typeof(GameObjectFactory)); _harmony.PatchAll(typeof(TootTallyPatches)); ((Component)this).gameObject.AddComponent<TootTallyNotifManager>(); ((Component)this).gameObject.AddComponent<TootTallyAnimationManager>(); TootTallyModuleManager.LoadModules(); SteamAuthTicketHandler.GetSteamAuthTicket(); LogInfo(string.Format("Plugin {0} [Build {1}] is loaded!", "TootTallyCore", BUILDDATE)); LogInfo("Game Version: " + Application.version); } } public static class Theme { public class CapsulesColors { public Color year; public Color yearShadow; public Color composer; public Color composerShadow; public Color genre; public Color genreShadow; public Color description; public Color descriptionShadow; public Color tempo; } public class DiffStarColors { public Color gradientStart; public Color gradientEnd; } public class LeaderboardColors { public Color panelBody; public Color scoresBody; public Color rowEntry; public Color yourRowEntry; public Color headerText; public Color text; public Color textOutline; public SliderColors slider; public ColorBlock tabs; } public class NotificationColors { public Color border; public Color background; public Color defaultText; public Color warningText; public Color errorText; public Color textOutline; } public class PlayBackButtonColors { public Color background; public Color backgroundOver; public Color outline; public Color outlineOver; public Color text; public Color textOver; public Color shadow; public Color shadowOver; } public class RandomButtonColors { public Color background; public Color backgroundOver; public Color outline; public Color outlineOver; public Color text; public Color textOver; public Color shadow; public Color shadowOver; } public class ReplayButtonColors { public Color text; public ColorBlock colors; } public class ScrollSpeedSliderColors { public Color handle; public Color text; public Color background; public Color fill; } public class SliderColors { public Color handle; public Color background; public Color fill; } public class SongButtonColors { public Color background; public Color text; public Color textOver; public Color selectedText; public Color outline; public Color outlineOver; public Color shadow; public Color square; } public class PointerColors { public Color background; public Color shadow; public Color outline; } public class BackgroundColors { public Color waves; public Color waves2; public Color dots; public Color dots2; public Color shape; public Color diamond; public Color background; } public class TitleColors { public Color songName; public Color titleBar; public Color title; public Color titleShadow; public Color outline; } public class ThemeColors { public LeaderboardColors leaderboard; public ScrollSpeedSliderColors scrollSpeedSlider; public NotificationColors notification; public ReplayButtonColors replayButton; public CapsulesColors capsules; public RandomButtonColors randomButton; public PlayBackButtonColors backButton; public PlayBackButtonColors playButton; public SongButtonColors songButton; public DiffStarColors diffStar; public PointerColors pointer; public BackgroundColors background; public TitleColors title; public void InitializeEmpty() { leaderboard = new LeaderboardColors { slider = new SliderColors() }; scrollSpeedSlider = new ScrollSpeedSliderColors(); notification = new NotificationColors(); replayButton = new ReplayButtonColors(); capsules = new CapsulesColors(); randomButton = new RandomButtonColors(); backButton = new PlayBackButtonColors(); playButton = new PlayBackButtonColors(); songButton = new SongButtonColors(); diffStar = new DiffStarColors(); pointer = new PointerColors(); backButton = new PlayBackButtonColors(); background = new BackgroundColors(); title = new TitleColors(); } } public const string version = "0.0.2"; public static bool isDefault; public static ThemeColors colors; public static void SetDefaultTheme() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) isDefault = true; ThemeColors themeColors = new ThemeColors(); LeaderboardColors obj = new LeaderboardColors { panelBody = new Color(0.95f, 0.22f, 0.35f), scoresBody = new Color(0.06f, 0.06f, 0.06f), rowEntry = new Color(0.1f, 0.1f, 0.1f), yourRowEntry = new Color(0.65f, 0.65f, 0.65f, 0.25f), headerText = new Color(0.95f, 0.22f, 0.35f), text = new Color(1f, 1f, 1f), textOutline = new Color(0f, 0f, 0f, 0.5f), slider = new SliderColors { background = new Color(0f, 0f, 0f), fill = new Color(1f, 1f, 1f), handle = new Color(1f, 1f, 1f) } }; ColorBlock tabs = default(ColorBlock); ((ColorBlock)(ref tabs)).normalColor = new Color(1f, 1f, 1f); ((ColorBlock)(ref tabs)).pressedColor = new Color(1f, 1f, 0f); ((ColorBlock)(ref tabs)).highlightedColor = new Color(0.75f, 0.75f, 0.75f); ((ColorBlock)(ref tabs)).colorMultiplier = 1f; ((ColorBlock)(ref tabs)).fadeDuration = 0.2f; obj.tabs = tabs; themeColors.leaderboard = obj; themeColors.notification = new NotificationColors { border = new Color(1f, 0.3f, 0.5f, 0.75f), background = new Color(0f, 0f, 0f, 0.95f), defaultText = new Color(1f, 1f, 1f), textOutline = new Color(0f, 0f, 0f), warningText = new Color(1f, 1f, 0f), errorText = new Color(1f, 0f, 0f) }; ReplayButtonColors obj2 = new ReplayButtonColors { text = new Color(1f, 1f, 1f) }; tabs = default(ColorBlock); ((ColorBlock)(ref tabs)).normalColor = new Color(0.95f, 0.22f, 0.35f); ((ColorBlock)(ref tabs)).highlightedColor = new Color(0.77f, 0.18f, 0.29f); ((ColorBlock)(ref tabs)).pressedColor = new Color(1f, 1f, 0f); obj2.colors = tabs; themeColors.replayButton = obj2; themeColors.scrollSpeedSlider = new ScrollSpeedSliderColors { background = new Color(0f, 0f, 0f), text = new Color(0f, 0f, 0f), handle = new Color(1f, 1f, 0f), fill = new Color(0.95f, 0.22f, 0.35f) }; colors = themeColors; } public static void SetNightTheme() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_0546: Unknown result type (might be due to invalid IL or missing references) //IL_055b: Unknown result type (might be due to invalid IL or missing references) //IL_0560: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_057a: Unknown result type (might be due to invalid IL or missing references) //IL_058f: Unknown result type (might be due to invalid IL or missing references) //IL_0594: Unknown result type (might be due to invalid IL or missing references) //IL_05a9: Unknown result type (might be due to invalid IL or missing references) //IL_05ae: Unknown result type (might be due to invalid IL or missing references) //IL_05b4: Unknown result type (might be due to invalid IL or missing references) //IL_05b9: Unknown result type (might be due to invalid IL or missing references) //IL_05bf: Unknown result type (might be due to invalid IL or missing references) //IL_05c4: Unknown result type (might be due to invalid IL or missing references) //IL_05e4: Unknown result type (might be due to invalid IL or missing references) //IL_05e9: Unknown result type (might be due to invalid IL or missing references) //IL_05fe: Unknown result type (might be due to invalid IL or missing references) //IL_0603: Unknown result type (might be due to invalid IL or missing references) //IL_0618: Unknown result type (might be due to invalid IL or missing references) //IL_061d: Unknown result type (might be due to invalid IL or missing references) //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_0637: Unknown result type (might be due to invalid IL or missing references) //IL_063d: Unknown result type (might be due to invalid IL or missing references) //IL_0642: Unknown result type (might be due to invalid IL or missing references) //IL_0657: Unknown result type (might be due to invalid IL or missing references) //IL_065c: Unknown result type (might be due to invalid IL or missing references) //IL_0671: Unknown result type (might be due to invalid IL or missing references) //IL_0676: Unknown result type (might be due to invalid IL or missing references) //IL_068b: Unknown result type (might be due to invalid IL or missing references) //IL_0690: Unknown result type (might be due to invalid IL or missing references) //IL_06b0: Unknown result type (might be due to invalid IL or missing references) //IL_06b5: Unknown result type (might be due to invalid IL or missing references) //IL_06ca: Unknown result type (might be due to invalid IL or missing references) //IL_06cf: Unknown result type (might be due to invalid IL or missing references) //IL_06e4: Unknown result type (might be due to invalid IL or missing references) //IL_06e9: Unknown result type (might be due to invalid IL or missing references) //IL_06fe: Unknown result type (might be due to invalid IL or missing references) //IL_0703: Unknown result type (might be due to invalid IL or missing references) //IL_0723: Unknown result type (might be due to invalid IL or missing references) //IL_0728: Unknown result type (might be due to invalid IL or missing references) //IL_073d: Unknown result type (might be due to invalid IL or missing references) //IL_0742: Unknown result type (might be due to invalid IL or missing references) //IL_0762: Unknown result type (might be due to invalid IL or missing references) //IL_0767: Unknown result type (might be due to invalid IL or missing references) //IL_077c: Unknown result type (might be due to invalid IL or missing references) //IL_0781: Unknown result type (might be due to invalid IL or missing references) //IL_0796: Unknown result type (might be due to invalid IL or missing references) //IL_079b: Unknown result type (might be due to invalid IL or missing references) //IL_07c0: Unknown result type (might be due to invalid IL or missing references) //IL_07c5: Unknown result type (might be due to invalid IL or missing references) //IL_07df: Unknown result type (might be due to invalid IL or missing references) //IL_07e4: Unknown result type (might be due to invalid IL or missing references) //IL_07fe: Unknown result type (might be due to invalid IL or missing references) //IL_0803: Unknown result type (might be due to invalid IL or missing references) //IL_081d: Unknown result type (might be due to invalid IL or missing references) //IL_0822: Unknown result type (might be due to invalid IL or missing references) //IL_083c: Unknown result type (might be due to invalid IL or missing references) //IL_0841: Unknown result type (might be due to invalid IL or missing references) //IL_085b: Unknown result type (might be due to invalid IL or missing references) //IL_0860: Unknown result type (might be due to invalid IL or missing references) //IL_087a: Unknown result type (might be due to invalid IL or missing references) //IL_087f: Unknown result type (might be due to invalid IL or missing references) //IL_089f: Unknown result type (might be due to invalid IL or missing references) //IL_08a4: Unknown result type (might be due to invalid IL or missing references) //IL_08b9: Unknown result type (might be due to invalid IL or missing references) //IL_08be: Unknown result type (might be due to invalid IL or missing references) //IL_08d3: Unknown result type (might be due to invalid IL or missing references) //IL_08d8: Unknown result type (might be due to invalid IL or missing references) //IL_08ed: Unknown result type (might be due to invalid IL or missing references) //IL_08f2: Unknown result type (might be due to invalid IL or missing references) ThemeColors themeColors = new ThemeColors(); LeaderboardColors obj = new LeaderboardColors { panelBody = new Color(0.2f, 0.2f, 0.2f), scoresBody = new Color(0.1f, 0.1f, 0.1f, 0.65f), rowEntry = new Color(0.17f, 0.17f, 0.17f), yourRowEntry = new Color(0f, 0f, 0f, 0.65f), headerText = new Color(1f, 1f, 1f), text = new Color(1f, 1f, 1f), textOutline = new Color(0f, 0f, 0f), slider = new SliderColors { background = new Color(0.15f, 0.15f, 0.15f), fill = new Color(0.35f, 0.35f, 0.35f), handle = new Color(0.35f, 0.35f, 0.35f) } }; ColorBlock tabs = default(ColorBlock); ((ColorBlock)(ref tabs)).normalColor = new Color(1f, 1f, 1f); ((ColorBlock)(ref tabs)).pressedColor = new Color(1f, 1f, 0f); ((ColorBlock)(ref tabs)).highlightedColor = new Color(0.75f, 0.75f, 0.75f); ((ColorBlock)(ref tabs)).colorMultiplier = 1f; ((ColorBlock)(ref tabs)).fadeDuration = 0.2f; obj.tabs = tabs; themeColors.leaderboard = obj; themeColors.notification = new NotificationColors { border = new Color(0.2f, 0.2f, 0.2f, 0.75f), background = new Color(0f, 0f, 0f, 0.95f), defaultText = new Color(1f, 1f, 1f), textOutline = new Color(0.2f, 0.2f, 0.2f), warningText = new Color(1f, 1f, 0f), errorText = new Color(1f, 0f, 0f) }; ReplayButtonColors obj2 = new ReplayButtonColors { text = new Color(1f, 1f, 1f) }; tabs = default(ColorBlock); ((ColorBlock)(ref tabs)).normalColor = new Color(0f, 0f, 0f); ((ColorBlock)(ref tabs)).highlightedColor = new Color(0.2f, 0.2f, 0.2f); ((ColorBlock)(ref tabs)).pressedColor = new Color(0.1f, 0.1f, 0.1f); ((ColorBlock)(ref tabs)).colorMultiplier = 1f; ((ColorBlock)(ref tabs)).fadeDuration = 0.2f; obj2.colors = tabs; themeColors.replayButton = obj2; themeColors.capsules = new CapsulesColors { year = new Color(0f, 0f, 0f), tempo = new Color(0.2f, 0.2f, 0.2f, 0.45f), genre = new Color(0.12f, 0.12f, 0.12f), composer = new Color(0.12f, 0.12f, 0.12f), description = new Color(0f, 0f, 0f), yearShadow = Color.gray, genreShadow = Color.gray, composerShadow = Color.gray, descriptionShadow = Color.gray }; themeColors.randomButton = new RandomButtonColors { background = new Color(0f, 0f, 0f), backgroundOver = new Color(0.2f, 0.2f, 0.2f), outline = new Color(0.2f, 0.2f, 0.2f), outlineOver = new Color(0f, 0f, 0f), text = new Color(0.92f, 0.92f, 0.92f), textOver = new Color(0.8f, 0.8f, 0.8f) }; themeColors.backButton = new PlayBackButtonColors { background = new Color(0f, 0f, 0f), backgroundOver = new Color(0.2f, 0.2f, 0.2f), outline = new Color(0.2f, 0.2f, 0.2f), outlineOver = new Color(0f, 0f, 0f), text = new Color(0.92f, 0.92f, 0.92f), textOver = new Color(0.8f, 0.8f, 0.8f), shadow = Color.gray, shadowOver = Color.black }; themeColors.playButton = new PlayBackButtonColors { background = new Color(0f, 0f, 0f), backgroundOver = new Color(0.2f, 0.2f, 0.2f), outline = new Color(0.2f, 0.2f, 0.2f), outlineOver = new Color(0f, 0f, 0f), text = new Color(0.92f, 0.92f, 0.92f), textOver = new Color(0.8f, 0.8f, 0.8f), shadow = Color.gray, shadowOver = Color.black }; themeColors.songButton = new SongButtonColors { background = new Color(0f, 0f, 0f), outline = new Color(0.12f, 0.12f, 0.12f), outlineOver = new Color(0.2f, 0.2f, 0.2f), selectedText = new Color(0.35f, 0.35f, 0.35f), shadow = Color.gray, textOver = new Color(0.92f, 0.92f, 0.92f), text = new Color(0.35f, 0.35f, 0.35f), square = new Color(0f, 0f, 0f) }; themeColors.scrollSpeedSlider = new ScrollSpeedSliderColors { background = new Color(0.15f, 0.15f, 0.15f), text = new Color(1f, 1f, 1f), handle = new Color(0.35f, 0.35f, 0.35f), fill = new Color(0.35f, 0.35f, 0.35f) }; themeColors.diffStar = new DiffStarColors { gradientStart = new Color(0.2f, 0.2f, 0.2f), gradientEnd = new Color(0.7f, 0.7f, 0.7f) }; themeColors.pointer = new PointerColors { background = new Color(0.92f, 0.92f, 0.92f), outline = new Color(0.12f, 0.12f, 0.12f), shadow = new Color(0f, 0f, 0f) }; themeColors.background = new BackgroundColors { waves = new Color(0f, 0f, 0f, 0.9f), waves2 = new Color(0.2f, 0.2f, 0.2f, 0.9f), dots = new Color(0f, 0f, 0f, 1f), dots2 = new Color(0f, 0f, 0f, 1f), diamond = new Color(0f, 0f, 0f, 0.6f), shape = new Color(0f, 0f, 0f, 0.75f), background = new Color(0.12f, 0.12f, 0.12f, 0.1f) }; themeColors.title = new TitleColors { songName = new Color(1f, 1f, 1f), titleBar = new Color(0.2f, 0.2f, 0.2f), title = new Color(1f, 1f, 1f), titleShadow = new Color(0.2f, 0.2f, 0.2f) }; colors = themeColors; } public static void SetDayTheme() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0516: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_053b: Unknown result type (might be due to invalid IL or missing references) //IL_0550: Unknown result type (might be due to invalid IL or missing references) //IL_0555: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_056f: Unknown result type (might be due to invalid IL or missing references) //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_0589: Unknown result type (might be due to invalid IL or missing references) //IL_059e: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Unknown result type (might be due to invalid IL or missing references) //IL_05b8: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Unknown result type (might be due to invalid IL or missing references) //IL_05c3: Unknown result type (might be due to invalid IL or missing references) //IL_05c8: Unknown result type (might be due to invalid IL or missing references) //IL_05dd: Unknown result type (might be due to invalid IL or missing references) //IL_05e2: Unknown result type (might be due to invalid IL or missing references) //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_0607: Unknown result type (might be due to invalid IL or missing references) //IL_061c: Unknown result type (might be due to invalid IL or missing references) //IL_0621: Unknown result type (might be due to invalid IL or missing references) //IL_0636: Unknown result type (might be due to invalid IL or missing references) //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_0650: Unknown result type (might be due to invalid IL or missing references) //IL_0655: Unknown result type (might be due to invalid IL or missing references) //IL_066a: Unknown result type (might be due to invalid IL or missing references) //IL_066f: Unknown result type (might be due to invalid IL or missing references) //IL_0684: Unknown result type (might be due to invalid IL or missing references) //IL_0689: Unknown result type (might be due to invalid IL or missing references) //IL_069e: Unknown result type (might be due to invalid IL or missing references) //IL_06a3: Unknown result type (might be due to invalid IL or missing references) //IL_06b8: Unknown result type (might be due to invalid IL or missing references) //IL_06bd: Unknown result type (might be due to invalid IL or missing references) //IL_06dd: Unknown result type (might be due to invalid IL or missing references) //IL_06e2: Unknown result type (might be due to invalid IL or missing references) //IL_06f7: Unknown result type (might be due to invalid IL or missing references) //IL_06fc: Unknown result type (might be due to invalid IL or missing references) //IL_0711: Unknown result type (might be due to invalid IL or missing references) //IL_0716: Unknown result type (might be due to invalid IL or missing references) //IL_072b: Unknown result type (might be due to invalid IL or missing references) //IL_0730: Unknown result type (might be due to invalid IL or missing references) //IL_0750: Unknown result type (might be due to invalid IL or missing references) //IL_0755: Unknown result type (might be due to invalid IL or missing references) //IL_076a: Unknown result type (might be due to invalid IL or missing references) //IL_076f: Unknown result type (might be due to invalid IL or missing references) //IL_078f: Unknown result type (might be due to invalid IL or missing references) //IL_0794: Unknown result type (might be due to invalid IL or missing references) //IL_07a9: Unknown result type (might be due to invalid IL or missing references) //IL_07ae: Unknown result type (might be due to invalid IL or missing references) //IL_07b4: Unknown result type (might be due to invalid IL or missing references) //IL_07b9: Unknown result type (might be due to invalid IL or missing references) //IL_07de: Unknown result type (might be due to invalid IL or missing references) //IL_07e3: Unknown result type (might be due to invalid IL or missing references) //IL_07fd: Unknown result type (might be due to invalid IL or missing references) //IL_0802: Unknown result type (might be due to invalid IL or missing references) //IL_081c: Unknown result type (might be due to invalid IL or missing references) //IL_0821: Unknown result type (might be due to invalid IL or missing references) //IL_083b: Unknown result type (might be due to invalid IL or missing references) //IL_0840: Unknown result type (might be due to invalid IL or missing references) //IL_085a: Unknown result type (might be due to invalid IL or missing references) //IL_085f: Unknown result type (might be due to invalid IL or missing references) //IL_0879: Unknown result type (might be due to invalid IL or missing references) //IL_087e: Unknown result type (might be due to invalid IL or missing references) //IL_0898: Unknown result type (might be due to invalid IL or missing references) //IL_089d: Unknown result type (might be due to invalid IL or missing references) //IL_08bd: Unknown result type (might be due to invalid IL or missing references) //IL_08c2: Unknown result type (might be due to invalid IL or missing references) //IL_08dc: Unknown result type (might be due to invalid IL or missing references) //IL_08e1: Unknown result type (might be due to invalid IL or missing references) //IL_08f6: Unknown result type (might be due to invalid IL or missing references) //IL_08fb: Unknown result type (might be due to invalid IL or missing references) //IL_0910: Unknown result type (might be due to invalid IL or missing references) //IL_0915: Unknown result type (might be due to invalid IL or missing references) ThemeColors themeColors = new ThemeColors(); LeaderboardColors obj = new LeaderboardColors { panelBody = new Color(0f, 0f, 0f), scoresBody = new Color(0.9f, 0.9f, 0.9f, 0.9f), rowEntry = new Color(0.75f, 0.75f, 0.75f), yourRowEntry = new Color(1f, 1f, 1f, 0.65f), headerText = new Color(0f, 0f, 0f), text = new Color(0f, 0f, 0f), textOutline = new Color(1f, 1f, 1f), slider = new SliderColors { background = new Color(0.85f, 0.85f, 0.85f), fill = new Color(0f, 0f, 0f), handle = new Color(0f, 0f, 0f) } }; ColorBlock tabs = default(ColorBlock); ((ColorBlock)(ref tabs)).normalColor = new Color(0f, 0f, 0f); ((ColorBlock)(ref tabs)).pressedColor = new Color(1f, 1f, 0f); ((ColorBlock)(ref tabs)).highlightedColor = new Color(0.25f, 0.25f, 0.25f); ((ColorBlock)(ref tabs)).colorMultiplier = 1f; ((ColorBlock)(ref tabs)).fadeDuration = 0.2f; obj.tabs = tabs; themeColors.leaderboard = obj; themeColors.notification = new NotificationColors { border = new Color(0.8f, 0.8f, 0.8f, 0.75f), background = new Color(1f, 1f, 1f, 0.95f), defaultText = new Color(0f, 0f, 0f), textOutline = new Color(1f, 1f, 1f), warningText = new Color(0.6f, 0.6f, 0f), errorText = new Color(0.6f, 0f, 0f) }; ReplayButtonColors obj2 = new ReplayButtonColors { text = new Color(0f, 0f, 0f) }; tabs = default(ColorBlock); ((ColorBlock)(ref tabs)).normalColor = new Color(1f, 1f, 1f); ((ColorBlock)(ref tabs)).highlightedColor = new Color(0.8f, 0.8f, 0.8f); ((ColorBlock)(ref tabs)).pressedColor = new Color(0.9f, 0.9f, 0.9f); ((ColorBlock)(ref tabs)).colorMultiplier = 1f; ((ColorBlock)(ref tabs)).fadeDuration = 0.2f; obj2.colors = tabs; themeColors.replayButton = obj2; themeColors.capsules = new CapsulesColors { year = new Color(1f, 1f, 1f), tempo = new Color(0.8f, 0.8f, 0.8f, 0.75f), genre = new Color(0.88f, 0.88f, 0.88f), composer = new Color(0.88f, 0.88f, 0.88f), description = new Color(1f, 1f, 1f), yearShadow = Color.black, genreShadow = Color.black, composerShadow = Color.black, descriptionShadow = Color.black }; themeColors.randomButton = new RandomButtonColors { background = new Color(1f, 1f, 1f), backgroundOver = new Color(0.8f, 0.8f, 0.8f), outline = new Color(0.15f, 0.15f, 0.15f), outlineOver = new Color(0.25f, 0.25f, 0.25f), text = new Color(0.08f, 0.08f, 0.08f), textOver = new Color(0.2f, 0.2f, 0.2f) }; themeColors.backButton = new PlayBackButtonColors { background = new Color(1f, 1f, 1f), backgroundOver = new Color(0.9f, 0.9f, 0.9f), outline = new Color(0.15f, 0.15f, 0.15f), outlineOver = new Color(0.25f, 0.25f, 0.25f), text = new Color(0.08f, 0.08f, 0.08f), textOver = new Color(0.2f, 0.2f, 0.2f), shadow = Color.black, shadowOver = new Color(0.95f, 0.95f, 0.95f) }; themeColors.playButton = new PlayBackButtonColors { background = new Color(1f, 1f, 1f), backgroundOver = new Color(0.9f, 0.9f, 0.9f), outline = new Color(0.15f, 0.15f, 0.15f), outlineOver = new Color(0.25f, 0.25f, 0.25f), text = new Color(0.08f, 0.08f, 0.08f), textOver = new Color(0.2f, 0.2f, 0.2f), shadow = Color.black, shadowOver = new Color(0.95f, 0.95f, 0.95f) }; themeColors.songButton = new SongButtonColors { background = new Color(1f, 1f, 1f), outline = new Color(0.8f, 0.8f, 0.8f), outlineOver = new Color(0.35f, 0.35f, 0.35f), selectedText = new Color(0f, 0f, 0f), shadow = new Color(0.05f, 0.05f, 0.05f), textOver = new Color(0.08f, 0.08f, 0.08f), text = new Color(0.35f, 0.35f, 0.35f), square = new Color(0.35f, 0.35f, 0.35f) }; themeColors.scrollSpeedSlider = new ScrollSpeedSliderColors { background = new Color(0.85f, 0.85f, 0.85f), text = new Color(1f, 1f, 1f), handle = new Color(0f, 0f, 0f), fill = new Color(0f, 0f, 0f) }; themeColors.diffStar = new DiffStarColors { gradientStart = new Color(0.8f, 0.8f, 0.8f), gradientEnd = new Color(0.3f, 0.3f, 0.3f) }; themeColors.pointer = new PointerColors { background = new Color(0.88f, 0.88f, 0.88f), outline = new Color(0.08f, 0.08f, 0.08f), shadow = Color.black }; themeColors.background = new BackgroundColors { waves = new Color(0f, 0f, 0f, 0.9f), waves2 = new Color(0.6f, 0.6f, 0.6f, 0.9f), dots = new Color(0.9f, 0.9f, 0.9f, 1f), dots2 = new Color(0.9f, 0.9f, 0.9f, 1f), diamond = new Color(0.9f, 0.9f, 0.9f, 0.6f), shape = new Color(0.9f, 0.9f, 0.9f, 0.45f), background = new Color(0.77f, 0.77f, 0.77f, 0.1f) }; themeColors.title = new TitleColors { songName = new Color(0f, 0f, 0f), titleBar = new Color(0.9f, 0.9f, 0.9f, 0.75f), title = new Color(0f, 0f, 0f), titleShadow = new Color(0.9f, 0.9f, 0.9f) }; colors = themeColors; } public static void SetCustomTheme(string themeFileName) { if (File.Exists(Paths.BepInExRootPath + "/Themes/" + themeFileName + ".json")) { string text = File.ReadAllText(Paths.BepInExRootPath + "/Themes/" + themeFileName + ".json"); try { SerializableClass.JsonThemeDeserializer themeConfig = JsonConvert.DeserializeObject<SerializableClass.JsonThemeDeserializer>(text); LoadTheme(themeConfig); return; } catch (Exception ex) { Plugin.LogError(ex.ToString()); Plugin.LogError("Corrupted theme: " + themeFileName); Plugin.LogError("Loading default theme..."); SetDefaultTheme(); return; } } Plugin.LogError("Missing theme: " + themeFileName); SetDefaultTheme(); } public static void LoadTheme(SerializableClass.JsonThemeDeserializer themeConfig) { //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) colors = new ThemeColors(); colors.InitializeEmpty(); ColorUtility.TryParseHtmlString(themeConfig.theme.leaderboard.panelBody, ref colors.leaderboard.panelBody); ColorUtility.TryParseHtmlString(themeConfig.theme.leaderboard.scoresBody, ref colors.leaderboard.scoresBody); ColorUtility.TryParseHtmlString(themeConfig.theme.leaderboard.rowEntry, ref colors.leaderboard.rowEntry); ColorUtility.TryParseHtmlString(themeConfig.theme.leaderboard.yourRowEntry, ref colors.leaderboard.yourRowEntry); ColorUtility.TryParseHtmlString(themeConfig.theme.scrollSpeedSlider.background, ref colors.scrollSpeedSlider.background); ColorUtility.TryParseHtmlString(themeConfig.theme.scrollSpeedSlider.text, ref colors.scrollSpeedSlider.text); ColorUtility.TryParseHtmlString(themeConfig.theme.scrollSpeedSlider.handle, ref colors.scrollSpeedSlider.handle); ColorUtility.TryParseHtmlString(themeConfig.theme.scrollSpeedSlider.fill, ref colors.scrollSpeedSlider.fill); ColorUtility.TryParseHtmlString(themeConfig.theme.leaderboard.slider.background, ref colors.leaderboard.slider.background); ColorUtility.TryParseHtmlString(themeConfig.theme.leaderboard.slider.fill, ref colors.leaderboard.slider.fill); ColorUtility.TryParseHtmlString(themeConfig.theme.leaderboard.slider.handle, ref colors.leaderboard.slider.handle); ColorUtility.TryParseHtmlString(themeConfig.theme.leaderboard.headerText, ref colors.leaderboard.headerText); ColorUtility.TryParseHtmlString(themeConfig.theme.leaderboard.text, ref colors.leaderboard.text); ColorUtility.TryParseHtmlString(themeConfig.theme.leaderboard.textOutline, ref colors.leaderboard.textOutline); Color normalColor = default(Color); ColorUtility.TryParseHtmlString(themeConfig.theme.leaderboard.tabs.normal, ref normalColor); Color pressedColor = default(Color); ColorUtility.TryParseHtmlString(themeConfig.theme.leaderboard.tabs.pressed, ref pressedColor); Color highlightedColor = default(Color); ColorUtility.TryParseHtmlString(themeConfig.theme.leaderboard.tabs.highlighted, ref highlightedColor); LeaderboardColors leaderboard = colors.leaderboard; ColorBlock tabs = default(ColorBlock); ((ColorBlock)(ref tabs)).normalColor = normalColor; ((ColorBlock)(ref tabs)).pressedColor = pressedColor; ((ColorBlock)(ref tabs)).highlightedColor = highlightedColor; ((ColorBlock)(ref tabs)).colorMultiplier = 1f; ((ColorBlock)(ref tabs)).fadeDuration = 0.1f; leaderboard.tabs = tabs; ColorUtility.TryParseHtmlString(themeConfig.theme.notification.border, ref colors.notification.border); ColorUtility.TryParseHtmlString(themeConfig.theme.notification.background, ref colors.notification.background); ColorUtility.TryParseHtmlString(themeConfig.theme.notification.defaultText, ref colors.notification.defaultText); ColorUtility.TryParseHtmlString(themeConfig.theme.notification.warningText, ref colors.notification.warningText); ColorUtility.TryParseHtmlString(themeConfig.theme.notification.errorText, ref colors.notification.errorText); ColorUtility.TryParseHtmlString(themeConfig.theme.notification.textOutline, ref colors.notification.textOutline); ColorUtility.TryParseHtmlString(themeConfig.theme.replayButton.text, ref colors.replayButton.text); ColorUtility.TryParseHtmlString(themeConfig.theme.replayButton.normal, ref normalColor); ColorUtility.TryParseHtmlString(themeConfig.theme.replayButton.pressed, ref pressedColor); ColorUtility.TryParseHtmlString(themeConfig.theme.replayButton.highlighted, ref highlightedColor); ReplayButtonColors replayButton = colors.replayButton; tabs = default(ColorBlock); ((ColorBlock)(ref tabs)).normalColor = normalColor; ((ColorBlock)(ref tabs)).pressedColor = pressedColor; ((ColorBlock)(ref tabs)).highlightedColor = highlightedColor; ((ColorBlock)(ref tabs)).colorMultiplier = 1f; ((ColorBlock)(ref tabs)).fadeDuration = 0.1f; replayButton.colors = tabs; ColorUtility.TryParseHtmlString(themeConfig.theme.capsules.year, ref colors.capsules.year); ColorUtility.TryParseHtmlString(themeConfig.theme.capsules.yearShadow, ref colors.capsules.yearShadow); ColorUtility.TryParseHtmlString(themeConfig.theme.capsules.composer, ref colors.capsules.composer); ColorUtility.TryParseHtmlString(themeConfig.theme.capsules.composerShadow, ref colors.capsules.composerShadow); ColorUtility.TryParseHtmlString(themeConfig.theme.capsules.genre, ref colors.capsules.genre); ColorUtility.TryParseHtmlString(themeConfig.theme.capsules.genreShadow, ref colors.capsules.genreShadow); ColorUtility.TryParseHtmlString(themeConfig.theme.capsules.description, ref colors.capsules.description); ColorUtility.TryParseHtmlString(themeConfig.theme.capsules.descriptionShadow, ref colors.capsules.descriptionShadow); ColorUtility.TryParseHtmlString(themeConfig.theme.capsules.tempo, ref colors.capsules.tempo); ColorUtility.TryParseHtmlString(themeConfig.theme.randomButton.background, ref colors.randomButton.background); ColorUtility.TryParseHtmlString(themeConfig.theme.randomButton.backgroundOver, ref colors.randomButton.backgroundOver); ColorUtility.TryParseHtmlString(themeConfig.theme.randomButton.outline, ref colors.randomButton.outline); ColorUtility.TryParseHtmlString(themeConfig.theme.randomButton.outlineOver, ref colors.randomButton.outlineOver); ColorUtility.TryParseHtmlString(themeConfig.theme.randomButton.text, ref colors.randomButton.text); ColorUtility.TryParseHtmlString(themeConfig.theme.randomButton.textOver, ref colors.randomButton.textOver); ColorUtility.TryParseHtmlString(themeConfig.theme.backButton.background, ref colors.backButton.background); ColorUtility.TryParseHtmlString(themeConfig.theme.backButton.backgroundOver, ref colors.backButton.backgroundOver); ColorUtility.TryParseHtmlString(themeConfig.theme.backButton.outline, ref colors.backButton.outline); ColorUtility.TryParseHtmlString(themeConfig.theme.backButton.outlineOver, ref colors.backButton.outlineOver); ColorUtility.TryParseHtmlString(themeConfig.theme.backButton.text, ref colors.backButton.text); ColorUtility.TryParseHtmlString(themeConfig.theme.backButton.textOver, ref colors.backButton.textOver); ColorUtility.TryParseHtmlString(themeConfig.theme.backButton.shadow, ref colors.backButton.shadow); ColorUtility.TryParseHtmlString(themeConfig.theme.backButton.shadowOver, ref colors.backButton.shadowOver); ColorUtility.TryParseHtmlString(themeConfig.theme.playButton.background, ref colors.playButton.background); ColorUtility.TryParseHtmlString(themeConfig.theme.playButton.backgroundOver, ref colors.playButton.backgroundOver); ColorUtility.TryParseHtmlString(themeConfig.theme.playButton.outline, ref colors.playButton.outline); ColorUtility.TryParseHtmlString(themeConfig.theme.playButton.outlineOver, ref colors.playButton.outlineOver); ColorUtility.TryParseHtmlString(themeConfig.theme.playButton.text, ref colors.playButton.text); ColorUtility.TryParseHtmlString(themeConfig.theme.playButton.textOver, ref colors.playButton.textOver); ColorUtility.TryParseHtmlString(themeConfig.theme.playButton.shadow, ref colors.playButton.shadow); ColorUtility.TryParseHtmlString(themeConfig.theme.playButton.shadowOver, ref colors.playButton.shadowOver); ColorUtility.TryParseHtmlString(themeConfig.theme.songButton.background, ref colors.songButton.background); ColorUtility.TryParseHtmlString(themeConfig.theme.songButton.outline, ref colors.songButton.outline); ColorUtility.TryParseHtmlString(themeConfig.theme.songButton.outlineOver, ref colors.songButton.outlineOver); ColorUtility.TryParseHtmlString(themeConfig.theme.songButton.shadow, ref colors.songButton.shadow); ColorUtility.TryParseHtmlString(themeConfig.theme.songButton.text, ref colors.songButton.text); ColorUtility.TryParseHtmlString(themeConfig.theme.songButton.textOver, ref colors.songButton.textOver); ColorUtility.TryParseHtmlString(themeConfig.theme.songButton.square, ref colors.songButton.square); ColorUtility.TryParseHtmlString(themeConfig.theme.diffStar.gradientStart, ref colors.diffStar.gradientStart); ColorUtility.TryParseHtmlString(themeConfig.theme.diffStar.gradientEnd, ref colors.diffStar.gradientEnd); ColorUtility.TryParseHtmlString(themeConfig.theme.pointer.background, ref colors.pointer.background); ColorUtility.TryParseHtmlString(themeConfig.theme.pointer.shadow, ref colors.pointer.shadow); ColorUtility.TryParseHtmlString(themeConfig.theme.pointer.outline, ref colors.pointer.outline); ColorUtility.TryParseHtmlString(themeConfig.theme.background.waves, ref colors.background.waves); ColorUtility.TryParseHtmlString(themeConfig.theme.background.waves2, ref colors.background.waves2); ColorUtility.TryParseHtmlString(themeConfig.theme.background.dots, ref colors.background.dots); ColorUtility.TryParseHtmlString(themeConfig.theme.background.dots2, ref colors.background.dots2); ColorUtility.TryParseHtmlString(themeConfig.theme.background.shape, ref colors.background.shape); ColorUtility.TryParseHtmlString(themeConfig.theme.background.diamond, ref colors.background.diamond); ColorUtility.TryParseHtmlString(themeConfig.theme.background.background, ref colors.background.background); ColorUtility.TryParseHtmlString(themeConfig.theme.title.songName, ref colors.title.songName); ColorUtility.TryParseHtmlString(themeConfig.theme.title.titleBar, ref colors.title.titleBar); ColorUtility.TryParseHtmlString(themeConfig.theme.title.title, ref colors.title.title); ColorUtility.TryParseHtmlString(themeConfig.theme.title.titleShadow, ref colors.title.titleShadow); } public static void SetRandomTheme() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_0509: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Unknown result type (might be due to invalid IL or missing references) //IL_051a: Unknown result type (might be due to invalid IL or missing references) //IL_0531: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_0542: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_0563: Unknown result type (might be due to invalid IL or missing references) //IL_056f: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_0580: Unknown result type (might be due to invalid IL or missing references) //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_059c: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05b2: Unknown result type (might be due to invalid IL or missing references) //IL_05be: Unknown result type (might be due to invalid IL or missing references) //IL_05c3: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: Unknown result type (might be due to invalid IL or missing references) //IL_05d4: Unknown result type (might be due to invalid IL or missing references) //IL_05e0: Unknown result type (might be due to invalid IL or missing references) //IL_05e5: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_0607: Unknown result type (might be due to invalid IL or missing references) //IL_061e: Unknown result type (might be due to invalid IL or missing references) //IL_0623: Unknown result type (might be due to invalid IL or missing references) //IL_062f: Unknown result type (might be due to invalid IL or missing references) //IL_0634: Unknown result type (might be due to invalid IL or missing references) //IL_0640: Unknown result type (might be due to invalid IL or missing references) //IL_0645: Unknown result type (might be due to invalid IL or missing references) //IL_0651: Unknown result type (might be due to invalid IL or missing references) //IL_0656: Unknown result type (might be due to invalid IL or missing references) Random rdm = new Random(DateTime.Now.Millisecond); ThemeColors themeColors = new ThemeColors(); LeaderboardColors obj = new LeaderboardColors { panelBody = GetRandomColor(rdm, 1f), scoresBody = GetRandomColor(rdm, 1f), rowEntry = GetRandomColor(rdm, 1f), yourRowEntry = GetRandomColor(rdm, 0.35f), headerText = GetRandomColor(rdm, 1f), text = GetRandomColor(rdm, 1f), textOutline = GetRandomColor(rdm, 0.75f), slider = new SliderColors { background = GetRandomColor(rdm, 1f), fill = GetRandomColor(rdm, 1f), handle = GetRandomColor(rdm, 1f) } }; ColorBlock tabs = default(ColorBlock); ((ColorBlock)(ref tabs)).normalColor = GetRandomColor(rdm, 1f); ((ColorBlock)(ref tabs)).pressedColor = GetRandomColor(rdm, 1f); ((ColorBlock)(ref tabs)).highlightedColor = GetRandomColor(rdm, 1f); ((ColorBlock)(ref tabs)).colorMultiplier = 1f; ((ColorBlock)(ref tabs)).fadeDuration = 0.2f; obj.tabs = tabs; themeColors.leaderboard = obj; themeColors.notification = new NotificationColors { border = GetRandomColor(rdm, 0.75f), background = GetRandomColor(rdm, 0.84f), defaultText = GetRandomColor(rdm, 1f), textOutline = GetRandomColor(rdm, 0.84f), warningText = GetRandomColor(rdm, 1f), errorText = GetRandomColor(rdm, 1f) }; ReplayButtonColors obj2 = new ReplayButtonColors { text = GetRandomColor(rdm, 1f) }; tabs = default(ColorBlock); ((ColorBlock)(ref tabs)).normalColor = GetRandomColor(rdm, 1f); ((ColorBlock)(ref tabs)).highlightedColor = GetRandomColor(rdm, 1f); ((ColorBlock)(ref tabs)).pressedColor = GetRandomColor(rdm, 1f); obj2.colors = tabs; themeColors.replayButton = obj2; themeColors.capsules = new CapsulesColors { year = GetRandomColor(rdm, 1f), tempo = GetRandomColor(rdm, 1f), genre = GetRandomColor(rdm, 1f), composer = GetRandomColor(rdm, 1f), description = GetRandomColor(rdm, 1f), yearShadow = GetRandomColor(rdm, 1f), genreShadow = GetRandomColor(rdm, 1f), composerShadow = GetRandomColor(rdm, 1f), descriptionShadow = GetRandomColor(rdm, 1f) }; themeColors.randomButton = new RandomButtonColors { background = GetRandomColor(rdm, 1f), backgroundOver = GetRandomColor(rdm, 1f), outline = GetRandomColor(rdm, 1f), outlineOver = GetRandomColor(rdm, 1f), text = GetRandomColor(rdm, 1f), textOver = GetRandomColor(rdm, 1f) }; themeColors.backButton = new PlayBackButtonColors { background = GetRandomColor(rdm, 1f), backgroundOver = GetRandomColor(rdm, 1f), outline = GetRandomColor(rdm, 1f), outlineOver = GetRandomColor(rdm, 1f), text = GetRandomColor(rdm, 1f), textOver = GetRandomColor(rdm, 1f), shadow = GetRandomColor(rdm, 1f), shadowOver = GetRandomColor(rdm, 1f) }; themeColors.playButton = new PlayBackButtonColors { background = GetRandomColor(rdm, 1f), backgroundOver = GetRandomColor(rdm, 1f), outline = GetRandomColor(rdm, 1f), outlineOver = GetRandomColor(rdm, 1f), text = GetRandomColor(rdm, 1f), textOver = GetRandomColor(rdm, 1f), shadow = GetRandomColor(rdm, 1f), shadowOver = GetRandomColor(rdm, 1f) }; themeColors.songButton = new SongButtonColors { background = GetRandomColor(rdm, 1f), outline = GetRandomColor(rdm, 1f), outlineOver = GetRandomColor(rdm, 1f), shadow = GetRandomColor(rdm, 1f), textOver = GetRandomColor(rdm, 1f), text = GetRandomColor(rdm, 1f), selectedText = GetRandomColor(rdm, 1f), square = GetRandomColor(rdm, 1f) }; themeColors.scrollSpeedSlider = new ScrollSpeedSliderColors { background = GetRandomColor(rdm, 1f), text = GetRandomColor(rdm, 1f), handle = GetRandomColor(rdm, 1f), fill = GetRandomColor(rdm, 1f) }; themeColors.diffStar = new DiffStarColors { gradientStart = GetRandomColor(rdm, 1f), gradientEnd = GetRandomColor(rdm, 1f) }; themeColors.pointer = new PointerColors { background = GetRandomColor(rdm, 1f), shadow = GetRandomColor(rdm, 1f), outline = GetRandomColor(rdm, 1f) }; themeColors.background = new BackgroundColors { waves = GetRandomColor(rdm, 0.5f), waves2 = GetRandomColor(rdm, 0.5f), dots = GetRandomColor(rdm, 0.5f), dots2 = GetRandomColor(rdm, 0.5f), shape = GetRandomColor(rdm, 0.5f), diamond = GetRandomColor(rdm, 0.5f), background = GetRandomColor(rdm, 0.5f) }; themeColors.title = new TitleColors { songName = GetRandomColor(rdm, 1f), title = GetRandomColor(rdm, 1f), titleBar = GetRandomColor(rdm, 1f), titleShadow = GetRandomColor(rdm, 1f) }; colors = themeColors; } private static Color GetRandomColor(Random rdm, float alpha) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) return new Color((float)rdm.NextDouble(), (float)rdm.NextDouble(), (float)rdm.NextDouble(), alpha); } } public static class ThemeManager { public static Action OnThemeRefreshEvents; private const string CONFIG_FIELD = "Themes"; private const string DEFAULT_THEME = "Default"; public static Text songyear; public static Text songgenre; public static Text songcomposer; public static Text songtempo; public static Text songduration; public static Text songdesctext; private static string _currentTheme; private static bool _isInitialized; private static AudioSource _btnClickSfx; public static void SetTheme(string themeName) { _currentTheme = themeName; Theme.isDefault = false; switch (themeName) { case "Day": Theme.SetDayTheme(); break; case "Night": Theme.SetNightTheme(); break; case "Random": Theme.SetRandomTheme(); break; case "Default": Theme.SetDefaultTheme(); break; default: Theme.SetCustomTheme(themeName); break; } GameObjectFactory.UpdatePrefabTheme(); } public static void Config_SettingChanged(object sender, SettingChangedEventArgs e) { if (!(_currentTheme == Plugin.Instance.ThemeName.Value)) { _currentTheme = Plugin.Instance.ThemeName.Value; RefreshTheme(); } } public static void RefreshTheme() { SetTheme(_currentTheme); OnThemeRefreshEvents?.Invoke(); TootTallyNotifManager.DisplayNotif("Theme Reloaded!"); } [HarmonyPatch(typeof(HomeController), "Start")] [HarmonyPrefix] public static void Initialize() { if (!_isInitialized) { SetTheme(Plugin.Instance.ThemeName.Value); _isInitialized = true; } } [HarmonyPatch(typeof(LevelSelectController), "Start")] [HarmonyPostfix] public static void ChangeThemeOnLevelSelectControllerStartPostFix(LevelSelectController __instance) { //IL_10aa: Unknown result type (might be due to invalid IL or missing references) //IL_10c3: Unknown result type (might be due to invalid IL or missing references) //IL_10dc: Unknown result type (might be due to invalid IL or missing references) //IL_10f5: Unknown result type (might be due to invalid IL or missing references) //IL_110e: Unknown result type (might be due to invalid IL or missing references) //IL_1127: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_0b5d: Unknown result type (might be due to invalid IL or missing references) //IL_0b90: Unknown result type (might be due to invalid IL or missing references) //IL_0bc3: Unknown result type (might be due to invalid IL or missing references) //IL_0bfe: Unknown result type (might be due to invalid IL or missing references) //IL_0c0a: Unknown result type (might be due to invalid IL or missing references) //IL_0c6f: Unknown result type (might be due to invalid IL or missing references) //IL_0cef: Unknown result type (might be due to invalid IL or missing references) //IL_0d16: Unknown result type (might be due to invalid IL or missing references) //IL_0d4f: Unknown result type (might be due to invalid IL or missing references) //IL_0d56: Expected O, but got Unknown //IL_0d59: Unknown result type (might be due to invalid IL or missing references) //IL_0d84: Unknown result type (might be due to invalid IL or missing references) //IL_0d8b: Expected O, but got Unknown //IL_0d8e: Unknown result type (might be due to invalid IL or missing references) //IL_0e0c: Unknown result type (might be due to invalid IL or missing references) //IL_0e42: Unknown result type (might be due to invalid IL or missing references) //IL_0e5d: Unknown result type (might be due to invalid IL or missing references) //IL_0e93: Unknown result type (might be due to invalid IL or missing references) //IL_0eae: Unknown result type (might be due to invalid IL or missing references) //IL_0efb: Unknown result type (might be due to invalid IL or missing references) //IL_0f2e: Unknown result type (might be due to invalid IL or missing references) //IL_0f61: Unknown result type (might be due to invalid IL or missing references) //IL_0f94: Unknown result type (might be due to invalid IL or missing references) //IL_0ff4: Unknown result type (might be due to invalid IL or missing references) //IL_1017: Unknown result type (might be due to invalid IL or missing references) //IL_103a: Unknown result type (might be due to invalid IL or missing references) //IL_1075: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Expected O, but got Unknown //IL_07e9: Unknown result type (might be due to invalid IL or missing references) //IL_07f0: Expected O, but got Unknown //IL_09b9: Unknown result type (might be due to invalid IL or missing references) //IL_09c0: Expected O, but got Unknown //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_0570: Unknown result type (might be due to invalid IL or missing references) //IL_057f: Unknown result type (might be due to invalid IL or missing references) //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_05af: Unknown result type (might be due to invalid IL or missing references) //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_0608: Unknown result type (might be due to invalid IL or missing references) //IL_0617: Unknown result type (might be due to invalid IL or missing references) //IL_061c: Unknown result type (might be due to invalid IL or missing references) //IL_0647: Unknown result type (might be due to invalid IL or missing references) //IL_068e: Unknown result type (might be due to invalid IL or missing references) //IL_06f1: Unknown result type (might be due to invalid IL or missing references) //IL_0703: Unknown result type (might be due to invalid IL or missing references) //IL_0712: Unknown result type (might be due to invalid IL or missing references) //IL_0717: Unknown result type (might be due to invalid IL or missing references) //IL_0742: Unknown result type (might be due to invalid IL or missing references) //IL_0853: Unknown result type (might be due to invalid IL or missing references) //IL_0893: Unknown result type (might be due to invalid IL or missing references) //IL_08e1: Unknown result type (might be due to invalid IL or missing references) //IL_0921: Unknown result type (might be due to invalid IL or missing references) //IL_0a23: Unknown result type (might be due to invalid IL or missing references) //IL_0a63: Unknown result type (might be due to invalid IL or missing references) //IL_0abd: Unknown result type (might be due to invalid IL or missing references) //IL_0afd: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) if (Theme.isDefault) { return; } _btnClickSfx = __instance.hoversfx; GameObject[] btns = __instance.btns; foreach (GameObject val in btns) { ((Graphic)((Component)val.transform.Find("ScoreText")).gameObject.GetComponent<Text>()).color = Theme.colors.leaderboard.text; } try { GameObject val2 = Object.Instantiate<GameObject>(((Component)__instance.btnbgs[0]).gameObject); Object.DestroyImmediate((Object)(object)((Component)val2.transform.Find("Image")).gameObject); for (int j = 0; j < 7; j++) { Image val3 = __instance.btnbgs[j]; val3.sprite = AssetManager.GetSprite("SongButtonBackground.png"); ((Graphic)((Component)((Component)val3).transform.parent.GetChild(3)).GetComponent<Text>()).color = ((j == 0) ? Theme.colors.songButton.textOver : Theme.colors.songButton.text); GameObject val4 = Object.Instantiate<GameObject>(val2, ((Component)val3).gameObject.transform.parent); ((Object)val4).name = "Shadow"; OverwriteGameObjectSpriteAndColor(val4, "SongButtonShadow.png", Theme.colors.songButton.shadow); GameObject val5 = Object.Instantiate<GameObject>(val2, ((Component)val3).gameObject.transform); ((Object)val5).name = "Outline"; OverwriteGameObjectSpriteAndColor(val5, "SongButtonOutline.png", (j == 0) ? Theme.colors.songButton.outlineOver : Theme.colors.songButton.outline); ((Graphic)((Component)((Component)val3).transform.Find("Image")).GetComponent<Image>()).color = Theme.colors.songButton.square; ((Graphic)val3).color = Theme.colors.songButton.background; } for (int k = 7; k < __instance.btnbgs.Length; k++) { ((Graphic)__instance.btnbgs[k]).color = Theme.colors.songButton.background; } Object.DestroyImmediate((Object)(object)val2); } catch (Exception ex) { Plugin.LogError("SongButton theme couldn't be applied:" + ex.Message); } try { ((Graphic)__instance.songtitlebar.GetComponent<Image>()).color = Theme.colors.title.titleBar; ((Graphic)__instance.scenetitle.GetComponent<Text>()).color = Theme.colors.title.titleShadow; ((Graphic)__instance.longsongtitle).color = Theme.colors.title.songName; ((Graphic)__instance.longsongtitle_dropshadow).color = Theme.colors.title.titleShadow; ((Shadow)((Component)__instance.longsongtitle).GetComponent<Outline>()).effectColor = Theme.colors.title.outline; } catch (Exception ex2) { Plugin.LogError("Song Title theme couldn't be applied:" + ex2.Message); } try { GameObject gameObject = ((Component)__instance.btnspanel.transform.Find("RightLines")).gameObject; RectTransform component = gameObject.GetComponent<RectTransform>(); component.anchoredPosition += new Vector2(-2f, 0f); LineRenderer component2 = ((Component)gameObject.transform.Find("Red")).GetComponent<LineRenderer>(); component2.startColor = Theme.colors.leaderboard.panelBody; component2.endColor = Theme.colors.leaderboard.scoresBody; for (int l = 1; l < 8; l++) { LineRenderer component3 = ((Component)gameObject.transform.Find("Yellow" + l)).GetComponent<LineRenderer>(); component3.startColor = Theme.colors.leaderboard.panelBody; component3.endColor = Theme.colors.leaderboard.scoresBody; } } catch (Exception ex3) { Plugin.LogError("Lines theme couldn't be applied:" + ex3.Message); } try { GameObject gameObject2 = GameObject.Find("MainCanvas/FullScreenPanel/capsules").gameObject; GameObject val6 = Object.Instantiate<GameObject>(gameObject2); foreach (Transform item in val6.transform) { Transform val7 = item; Object.Destroy((Object)(object)((Component)val7).gameObject); } RectTransform component4 = val6.GetComponent<RectTransform>(); ((Transform)component4).localScale = Vector3.one; component4.anchoredPosition = Vector2.zero; GameObject val8 = Object.Instantiate<GameObject>(val6, gameObject2.transform); OverwriteGameObjectSpriteAndColor(val8, "YearCapsule.png", Theme.colors.capsules.yearShadow); RectTransform component5 = val8.GetComponent<RectTransform>(); component5.anchoredPosition += new Vector2(5f, -3f); GameObject val9 = Object.Instantiate<GameObject>(val6, gameObject2.transform); OverwriteGameObjectSpriteAndColor(val9, "YearCapsule.png", Theme.colors.capsules.year); songyear = Object.Instantiate<Text>(__instance.songyear, val9.transform); GameObject val10 = Object.Instantiate<GameObject>(val6, gameObject2.transform); OverwriteGameObjectSpriteAndColor(val10, "GenreCapsule.png", Theme.colors.capsules.genreShadow); RectTransform component6 = val10.GetComponent<RectTransform>(); component6.anchoredPosition += new Vector2(5f, -3f); GameObject val11 = Object.Instantiate<GameObject>(val6, gameObject2.transform); OverwriteGameObjectSpriteAndColor(val11, "GenreCapsule.png", Theme.colors.capsules.genre); songgenre = Object.Instantiate<Text>(__instance.songgenre, val11.transform); GameObject val12 = Object.Instantiate<GameObject>(val6, gameObject2.transform); OverwriteGameObjectSpriteAndColor(val12, "ComposerCapsule.png", Theme.colors.capsules.composerShadow); RectTransform component7 = val12.GetComponent<RectTransform>(); component7.anchoredPosition += new Vector2(5f, -3f); GameObject val13 = Object.Instantiate<GameObject>(val6, gameObject2.transform); OverwriteGameObjectSpriteAndColor(val13, "ComposerCapsule.png", Theme.colors.capsules.composer); songcomposer = Object.Instantiate<Text>(__instance.songcomposer, val13.transform); GameObject val14 = Object.Instantiate<GameObject>(val6, gameObject2.transform); OverwriteGameObjectSpriteAndColor(val14, "BPMTimeCapsule.png", Theme.colors.capsules.tempo); songtempo = Object.Instantiate<Text>(__instance.songtempo, val14.transform); songduration = Object.Instantiate<Text>(__instance.songduration, val14.transform); GameObject val15 = Object.Instantiate<GameObject>(val6, gameObject2.transform); OverwriteGameObjectSpriteAndColor(val15, "DescCapsule.png", Theme.colors.capsules.descriptionShadow); RectTransform component8 = val15.GetComponent<RectTransform>(); component8.anchoredPosition += new Vector2(5f, -3f); GameObject val16 = Object.Instantiate<GameObject>(val6, gameObject2.transform); OverwriteGameObjectSpriteAndColor(val16, "DescCapsule.png", Theme.colors.capsules.description); songdesctext = Object.Instantiate<Text>(__instance.songdesctext, val16.transform); Object.DestroyImmediate((Object)(object)gameObject2.GetComponent<Image>()); Object.DestroyImmediate((Object)(object)val6); } catch (Exception ex4) { Plugin.LogError("Capsules theme couldn't be applied:" + ex4.Message); } try { GameObject gameObject3 = ((Component)__instance.playbtnobj.transform.Find("play-bg")).gameObject; GameObject val17 = Object.Instantiate<GameObject>(gameObject3, ((Component)__instance.playbtn).transform); foreach (Transform item2 in val17.transform) { Transform val18 = item2; ((Component)val18).gameObject.SetActive(false); } GameObje