using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Fields;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("JadeLib")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0+085ffe4211a0db0db5387e2edbb22fabe47b3174")]
[assembly: AssemblyProduct("JadeLib")]
[assembly: AssemblyTitle("JadeLib")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.0.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 JadeLib
{
public static class DictionaryExtensions
{
public static void TrySetValue<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey key, TValue value, bool addIfNotContained = false)
{
if (!dictionary.ContainsKey(key))
{
if (addIfNotContained)
{
dictionary.Add(key, value);
}
}
else
{
dictionary[key] = value;
}
}
}
public static class EnumExtensions
{
public static void DoIf<T>(this T _, Func<T, bool> condition, Action<T> action) where T : Enum
{
foreach (T value in Enum.GetValues(typeof(T)))
{
if (condition(value))
{
action(value);
}
}
}
public static string Name<T>(this T value) where T : Enum
{
return Enum.GetName(typeof(T), value);
}
}
public static class GenericExtensions
{
public static string GetRankText(int index)
{
return index switch
{
0 => "<color=blue>D</color>ESTRUCTIVE",
2 => "<color=green>C</color>HAOTIC",
1 => "<color=yellow>B</color>RUTAL",
3 => "<color=orange>A</color>NARCHIC",
4 => "<color=red>S</color>UPREME",
5 => "<color=red>SS</color>ADISTIC",
6 => "<color=red>SSS</color>HITSTORM",
7 => "<color=orange>ULTRAKILL</color>",
_ => "<color=red><u>UNKNOWN</u></color>",
};
}
}
public static class ImageImporter
{
public enum Error
{
NoError,
PathNullOrEmpty,
FileMissing,
FailedToLoad
}
public static Sprite LoadFromFile(string path, out Error error)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
if (string.IsNullOrWhiteSpace(path))
{
error = Error.PathNullOrEmpty;
}
else if (!File.Exists(path))
{
error = Error.FileMissing;
}
else
{
Texture2D val = new Texture2D(0, 0);
if (ImageConversion.LoadImage(val, File.ReadAllBytes(path)))
{
error = Error.NoError;
return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
}
error = Error.FailedToLoad;
}
return null;
}
}
public static class KeyValuePairExtensions
{
public static void Deconstruct<TKey, TValue>(this KeyValuePair<TKey, TValue> kvp, out TKey key, out TValue value)
{
TKey key2 = kvp.Key;
TValue value2 = kvp.Value;
key = key2;
value = value2;
}
}
public static class ObjectExtensions
{
public static T AddComponent<T>(this Component component) where T : Component
{
return component.gameObject.AddComponent<T>();
}
public static Transform Find(this Component component, string n)
{
return component.transform.Find(n);
}
public static Transform Find(this GameObject gameObject, string n)
{
return gameObject.transform.Find(n);
}
public static RectTransform FindAsRect(this Component component, string n)
{
Transform obj = component.transform.Find(n);
return (RectTransform)(object)((obj is RectTransform) ? obj : null);
}
public static void SetActive(this Transform transform, bool value)
{
((Component)transform).gameObject.SetActive(value);
}
public static void SetParent(this GameObject gameObject, GameObject parent, bool worldPositionStays)
{
gameObject.transform.SetParent(parent.transform, worldPositionStays);
}
public static T Instantiate<T>(this T original, Transform parent, bool worldPositionStays) where T : Object
{
return Object.Instantiate<T>(original, parent, worldPositionStays);
}
}
}
namespace JadeLib.PluginConfigurator.Fields
{
public class SpriteField : CustomConfigField
{
private Image image;
private Sprite sprite;
public Sprite Sprite
{
get
{
return sprite;
}
set
{
sprite = value;
SetSprite(value);
}
}
public SpriteField(ConfigPanel parentPanel, float height = 60f, Sprite sprite = null)
: base(parentPanel)
{
this.sprite = sprite;
base.fieldHeight = height;
}
protected override void OnCreateUI(RectTransform fieldUI)
{
image = ((Component)(object)fieldUI).AddComponent<Image>();
image.preserveAspect = true;
SetSprite(sprite);
}
private void SetSprite(Sprite sprite)
{
if (Object.op_Implicit((Object)(object)image))
{
((Component)image).gameObject.SetActive(Object.op_Implicit((Object)(object)sprite));
image.sprite = sprite;
}
}
}
}