using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using YAPYAP;
using YapLocalizer;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.omniscye.morecolors")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2+586068a69298cf879f48765bb31b88f40c5d6141")]
[assembly: AssemblyProduct("com.omniscye.morecolors")]
[assembly: AssemblyTitle("MoreColors")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace MoreColors
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.omniscye.morecolors", "MoreColors", "1.0.2")]
public class MoreColorsPlugin : BaseUnityPlugin
{
private static bool _colorsAdded = false;
public static List<Costume> CachedCostumes = new List<Costume>();
public const string Id = "com.omniscye.morecolors";
public static string Name => "MoreColors";
public static string Version => "1.0.2";
private void Awake()
{
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
Debug.Log((object)"[MoreColors] Initializing... Scanning for Custom Colors.");
string[] array = (from f in Directory.GetFiles(Paths.PluginPath, "konami_code.txt", SearchOption.AllDirectories)
orderby f
select f).ToArray();
Debug.Log((object)$"[MoreColors] Found {array.Length} configuration files.");
string[] array2 = array;
foreach (string text in array2)
{
try
{
Debug.Log((object)("[MoreColors] Processing file: " + text));
string[] array3 = File.ReadAllLines(text);
string directoryName = Path.GetDirectoryName(text);
string text2 = string.Empty;
string text3 = string.Empty;
string text4 = string.Empty;
string text5 = string.Empty;
List<KeyValuePair<SystemLanguage, string>> list = new List<KeyValuePair<SystemLanguage, string>>();
string[] array4 = array3;
for (int j = 0; j < array4.Length; j++)
{
string text6 = array4[j].Trim();
if (string.IsNullOrEmpty(text6) || !text6.Contains(":"))
{
if (!string.IsNullOrEmpty(text3) && !string.IsNullOrEmpty(text5) && !string.IsNullOrEmpty(text2) && text4 != text3 + text5)
{
ProcessColor(text3, text2, text5, directoryName, list);
text4 = text3 + text5;
}
list = new List<KeyValuePair<SystemLanguage, string>>();
continue;
}
string text7 = text6.Substring(0, text6.IndexOf(':')).Trim();
string text8 = text6;
int num = text6.IndexOf(':') + 1;
string text9 = text8.Substring(num, text8.Length - num).Trim();
if (text7.Equals("Author", StringComparison.OrdinalIgnoreCase))
{
text2 = text9;
}
else if (text7.Equals("Name", StringComparison.OrdinalIgnoreCase))
{
text3 = text9;
}
else if (text7.Equals("FileName", StringComparison.OrdinalIgnoreCase))
{
text5 = text9;
}
else if (text7.Contains("Local", StringComparison.OrdinalIgnoreCase))
{
if (Enum.TryParse<SystemLanguage>(text7.Replace("-Local", ""), out SystemLanguage result))
{
list.Add(new KeyValuePair<SystemLanguage, string>(result, text9));
}
else
{
((BaseUnityPlugin)this).Logger.LogWarning((object)("Unable to assign localization for " + text6));
}
}
}
}
catch (Exception arg)
{
Debug.LogError((object)$"[MoreColors] Error loading file {text}: {arg}");
}
}
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
Harmony.CreateAndPatchAll(typeof(MoreColorsPlugin), (string)null);
}
private void ProcessColor(string colorName, string authorName, string imageName, string folder, List<KeyValuePair<SystemLanguage, string>> locals)
{
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Expected O, but got Unknown
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Expected O, but got Unknown
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: 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_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Expected O, but got Unknown
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Expected O, but got Unknown
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: 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_0201: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Expected O, but got Unknown
//IL_021b: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_022d: Unknown result type (might be due to invalid IL or missing references)
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_0233: Unknown result type (might be due to invalid IL or missing references)
//IL_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_023f: Expected O, but got Unknown
((BaseUnityPlugin)this).Logger.LogDebug((object)$"ProcessColor:\ncolorName: {colorName}\nauthorName: {authorName}\nimageName: {imageName}\nfolder: {folder}\nlocalizationCount: {locals.Count}");
string text = Path.Combine(folder, imageName);
ModLocalizedText val = new ModLocalizedText(colorName + "-" + authorName + "-" + imageName, "");
if (CachedCostumes.Any((Costume c) => c.costumeName == colorName))
{
string text2 = colorName;
if (!string.IsNullOrEmpty(authorName))
{
colorName = authorName + " " + colorName;
}
Debug.Log((object)("[MoreColors] Conflict detected for '" + text2 + "'. Renamed to '" + colorName + "'."));
}
val.FallbackResult = colorName;
foreach (KeyValuePair<SystemLanguage, string> local in locals)
{
val.SetLocalization(local.Key, local.Value);
}
if (File.Exists(text))
{
byte[] array = File.ReadAllBytes(text);
Texture2D val2 = new Texture2D(2, 2);
if (ImageConversion.LoadImage(val2, array))
{
((Object)val2).name = colorName;
Costume val3 = new Costume
{
costumeName = colorName,
localisationKey = val.LocalizationKey,
costumeUIColor = Color.white,
properties = new List<CostumePropertyData>()
};
CostumePropertyData item = new CostumePropertyData
{
propertyName = "_MainTex",
type = (PropertyType)1,
textureValue = (Texture)(object)val2
};
val3.properties.Add(item);
CostumePropertyData item2 = new CostumePropertyData
{
propertyName = "_Color",
type = (PropertyType)0,
colorValue = Color.white
};
val3.properties.Add(item2);
CostumePropertyData item3 = new CostumePropertyData
{
propertyName = "_BaseColor",
type = (PropertyType)0,
colorValue = Color.white
};
val3.properties.Add(item3);
CachedCostumes.Add(val3);
Debug.Log((object)("[MoreColors] Successfully registered costume '" + colorName + "' from " + imageName));
}
}
else
{
Debug.LogWarning((object)("[MoreColors] FAILED to find image: " + text));
}
colorName = "";
imageName = "";
}
[HarmonyPatch(typeof(PawnMaterial), "Awake")]
[HarmonyPrefix]
public static void PawnMaterial_Awake_Prefix(PawnMaterial __instance)
{
if (_colorsAdded)
{
return;
}
CostumeLibrarySO costumeLibrary = __instance.costumeLibrary;
PropertyRendererMapping[] propertyRendererMappings = __instance.propertyRendererMappings;
RendererMaterialSetup[] setups = __instance.rendererSetups;
List<PropertyRendererMapping> mappingsList;
bool mappingsChanged;
if (!((Object)(object)costumeLibrary == (Object)null) && costumeLibrary.costumes != null)
{
mappingsList = propertyRendererMappings.ToList();
mappingsChanged = false;
EnsureMapping("_MainTex");
EnsureMapping("_Color");
EnsureMapping("_BaseColor");
if (mappingsChanged)
{
__instance.propertyRendererMappings = mappingsList.ToArray();
}
if (CachedCostumes.Count > 0)
{
List<Costume> list = costumeLibrary.costumes.ToList();
list.AddRange(CachedCostumes);
costumeLibrary.costumes = list.ToArray();
Debug.Log((object)$"[MoreColors] Injected {CachedCostumes.Count} custom colors into CostumeLibrary.");
}
_colorsAdded = true;
}
void EnsureMapping(string propName)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Expected O, but got Unknown
if (!mappingsList.Any((PropertyRendererMapping m) => m.propertyName == propName))
{
PropertyRendererMapping val = new PropertyRendererMapping
{
propertyName = propName,
targets = new List<PropertyTarget>()
};
if (setups != null)
{
RendererMaterialSetup[] array = setups;
foreach (RendererMaterialSetup val2 in array)
{
if ((Object)(object)val2.targetRenderer != (Object)null)
{
PropertyTarget item = new PropertyTarget
{
targetRenderer = val2.targetRenderer,
materialIndex = 0
};
val.targets.Add(item);
}
}
}
mappingsList.Add(val);
mappingsChanged = true;
}
}
}
}
}
namespace System.Diagnostics.CodeAnalysis
{
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class ConstantExpectedAttribute : Attribute
{
public object? Min { get; set; }
public object? Max { get; set; }
}
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class ExperimentalAttribute : Attribute
{
public string DiagnosticId { get; }
public string? UrlFormat { get; set; }
public ExperimentalAttribute(string diagnosticId)
{
DiagnosticId = diagnosticId;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
[ExcludeFromCodeCoverage]
internal sealed class MemberNotNullAttribute : Attribute
{
public string[] Members { get; }
public MemberNotNullAttribute(string member)
{
Members = new string[1] { member };
}
public MemberNotNullAttribute(params string[] members)
{
Members = members;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
[ExcludeFromCodeCoverage]
internal sealed class MemberNotNullWhenAttribute : Attribute
{
public bool ReturnValue { get; }
public string[] Members { get; }
public MemberNotNullWhenAttribute(bool returnValue, string member)
{
ReturnValue = returnValue;
Members = new string[1] { member };
}
public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
{
ReturnValue = returnValue;
Members = members;
}
}
[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class SetsRequiredMembersAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class StringSyntaxAttribute : Attribute
{
public const string CompositeFormat = "CompositeFormat";
public const string DateOnlyFormat = "DateOnlyFormat";
public const string DateTimeFormat = "DateTimeFormat";
public const string EnumFormat = "EnumFormat";
public const string GuidFormat = "GuidFormat";
public const string Json = "Json";
public const string NumericFormat = "NumericFormat";
public const string Regex = "Regex";
public const string TimeOnlyFormat = "TimeOnlyFormat";
public const string TimeSpanFormat = "TimeSpanFormat";
public const string Uri = "Uri";
public const string Xml = "Xml";
public string Syntax { get; }
public object?[] Arguments { get; }
public StringSyntaxAttribute(string syntax)
{
Syntax = syntax;
Arguments = new object[0];
}
public StringSyntaxAttribute(string syntax, params object?[] arguments)
{
Syntax = syntax;
Arguments = arguments;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class UnscopedRefAttribute : Attribute
{
}
}
namespace System.Runtime.Versioning
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class RequiresPreviewFeaturesAttribute : Attribute
{
public string? Message { get; }
public string? Url { get; set; }
public RequiresPreviewFeaturesAttribute()
{
}
public RequiresPreviewFeaturesAttribute(string? message)
{
Message = message;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class CallerArgumentExpressionAttribute : Attribute
{
public string ParameterName { get; }
public CallerArgumentExpressionAttribute(string parameterName)
{
ParameterName = parameterName;
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class CollectionBuilderAttribute : Attribute
{
public Type BuilderType { get; }
public string MethodName { get; }
public CollectionBuilderAttribute(Type builderType, string methodName)
{
BuilderType = builderType;
MethodName = methodName;
}
}
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class CompilerFeatureRequiredAttribute : Attribute
{
public const string RefStructs = "RefStructs";
public const string RequiredMembers = "RequiredMembers";
public string FeatureName { get; }
public bool IsOptional { get; set; }
public CompilerFeatureRequiredAttribute(string featureName)
{
FeatureName = featureName;
}
}
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute
{
public string[] Arguments { get; }
public InterpolatedStringHandlerArgumentAttribute(string argument)
{
Arguments = new string[1] { argument };
}
public InterpolatedStringHandlerArgumentAttribute(params string[] arguments)
{
Arguments = arguments;
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class InterpolatedStringHandlerAttribute : Attribute
{
}
[EditorBrowsable(EditorBrowsableState.Never)]
[ExcludeFromCodeCoverage]
internal static class IsExternalInit
{
}
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class ModuleInitializerAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class OverloadResolutionPriorityAttribute : Attribute
{
public int Priority { get; }
public OverloadResolutionPriorityAttribute(int priority)
{
Priority = priority;
}
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)]
[ExcludeFromCodeCoverage]
internal sealed class ParamCollectionAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class RequiredMemberAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
[EditorBrowsable(EditorBrowsableState.Never)]
[ExcludeFromCodeCoverage]
internal sealed class RequiresLocationAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class SkipLocalsInitAttribute : Attribute
{
}
}