Decompiled source of TexturesLib Shared v1.0.0

TexturesLib.Shared.dll

Decompiled a year ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("TexturesLib.Shared")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TexturesLib.Shared")]
[assembly: AssemblyTitle("TexturesLib.Shared")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace TexturesLib.Shared;

public class ColorsHelper
{
	public static Color Black = new Color(0.196f, 0.196f, 0.196f, 1f);

	public static Color Grey = new Color(0.514f, 0.502f, 0.514f, 1f);

	public static Color White = new Color(1f, 1f, 1f, 1f);

	public static Color Green = new Color(0.635f, 0.741f, 0.451f, 1f);

	public static Color DeepGreen = new Color(0.259f, 0.403f, 0.155f, 1f);

	public static Color Blue = new Color(0.471f, 0.529f, 0.667f, 1f);

	public static Color DeepBlue = new Color(0f, 0f, 0.286f, 1f);

	public static Color Red = new Color(0.667f, 0.333f, 0.251f, 1f);

	public static Color DeepRed = new Color(0.323f, 0.054f, 0.05f, 1f);

	public static Color Purple = new Color(0.46f, 0.093f, 0.903f, 1f);

	public static Color DeepPurple = new Color(0.369f, 0.157f, 0.569f, 1f);

	public static Color Brown = new Color(0.544f, 0.411f, 0.265f, 1f);

	public static Color DeepBrown = new Color(0.612f, 0.478f, 0.208f, 1f);

	public static Color GetContrastByName(string colorName)
	{
		//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_01ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0204: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0244: Unknown result type (might be due to invalid IL or missing references)
		//IL_0237: Unknown result type (might be due to invalid IL or missing references)
		//IL_023c: Unknown result type (might be due to invalid IL or missing references)
		//IL_024f: 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_0207: 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_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_0217: Unknown result type (might be due to invalid IL or missing references)
		//IL_021c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f7: 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_0227: Unknown result type (might be due to invalid IL or missing references)
		//IL_022c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_01df: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0224: Unknown result type (might be due to invalid IL or missing references)
		return (Color)(colorName.ToLower() switch
		{
			"blue" => DeepBlue, 
			"deepblue" => Blue, 
			"red" => DeepRed, 
			"deepred" => Red, 
			"green" => DeepGreen, 
			"deepgreen" => Green, 
			"purple" => DeepPurple, 
			"deeppurple" => Purple, 
			"brown" => DeepBrown, 
			"deepbrown" => Brown, 
			"black" => Grey, 
			"grey" => Black, 
			"white" => Grey, 
			_ => Grey, 
		});
	}
}
[BepInPlugin("AgusBut.TexturesLib.Shared", "TexturesLib.Shared", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public static Plugin Instance { get; private set; }

	public static ManualLogSource Log { get; private set; }

	private void Awake()
	{
		Instance = this;
		Log = ((BaseUnityPlugin)this).Logger;
		((BaseUnityPlugin)this).Logger.LogInfo((object)"TexturesLib.Shared loaded successfully.");
	}
}
public static class SpriteHelper
{
	private static readonly Dictionary<string, Sprite> _spriteCache = new Dictionary<string, Sprite>();

	public static Sprite FindSpriteByName(string spriteName)
	{
		if (_spriteCache.TryGetValue(spriteName, out var value))
		{
			return value;
		}
		Sprite[] array = Resources.FindObjectsOfTypeAll<Sprite>();
		foreach (Sprite val in array)
		{
			if (((Object)val).name == spriteName || ((Object)val).name == spriteName + "_TexturesLib")
			{
				_spriteCache[spriteName] = val;
				return val;
			}
		}
		Plugin.Log.LogWarning((object)("Sprite '" + spriteName + "' not found in memory."));
		return null;
	}
}