Decompiled source of JadeLib v1.0.1

JadeLib.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Microsoft.CodeAnalysis;
using PluginConfig.API.Fields;
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(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("JadeLib")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Extensions library for my mods.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("JadeLib")]
[assembly: AssemblyTitle("JadeLib")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 ColorExtensions
	{
		public static string ToHexString(this Color clr)
		{
			//IL_000d: 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_003f: 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)
			return $"#{Mathf.RoundToInt(clr.r * 255f):X2}{Mathf.RoundToInt(clr.g * 255f):X2}{Mathf.RoundToInt(clr.b * 255f):X2}{Mathf.RoundToInt(clr.a * 255f):X2}";
		}
	}
	public static class EnumerableExtensions
	{
		public static void AddToArray<T>(ref T[] array, int index, params T[] objs)
		{
			T[] array2 = new T[Math.Max(index, array.Length) + objs.Length];
			Array.Copy(array, array2, Math.Min(index, array.Length));
			Array.Copy(objs, 0, array2, index, objs.Length);
			Array.Copy(array, index, array2, index + objs.Length, array.Length - index);
			array = array2;
		}

		public static IEnumerable<T> DistinctBy<T, TKey>(this IEnumerable<T> items, Func<T, TKey> property)
		{
			return from x in items.GroupBy(property)
				select x.First();
		}
	}
	public static class EnumExtensions
	{
		public static void Do<T>(this T _, Action<T> action) where T : Enum
		{
			foreach (T value in Enum.GetValues(typeof(T)))
			{
				action(value);
			}
		}

		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 KeyValuePairExtensions
	{
		public static void Deconstruct<TKey, TValue>(this KeyValuePair<TKey, TValue> kvp, out TKey key, out TValue value)
		{
			key = kvp.Key;
			value = kvp.Value;
		}
	}
	public static class PluginConfiguratorExtensions
	{
		public static void SetEnumDisplayNames<T>(this EnumField<T> field, params string[] names) where T : struct, Enum
		{
			T[] array = Enum.GetValues(typeof(T)) as T[];
			for (int i = 0; i < Math.Min(array.Length, names.Length); i++)
			{
				field.SetEnumDisplayName(array[i], names[i]);
			}
		}
	}
	public static class VectorExtensions
	{
		public static Vector2 SetX(this Vector2 v, float x)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return new Vector2(x, v.y);
		}

		public static Vector2 SetY(this Vector2 v, float y)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return new Vector2(v.x, y);
		}

		public static Vector2 Sqrt(Vector2 v)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			return ((Vector2)(ref v)).normalized * Mathf.Sqrt(((Vector2)(ref v)).magnitude);
		}

		public static Vector3 SetX(this Vector3 v, float x)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(x, v.y, v.z);
		}

		public static Vector3 SetY(this Vector3 v, float y)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(v.x, y, v.z);
		}

		public static Vector3 SetZ(this Vector3 v, float z)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(v.x, v.y, z);
		}

		public static Vector3 Sqrt(Vector3 v)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			return ((Vector3)(ref v)).normalized * Mathf.Sqrt(((Vector3)(ref v)).magnitude);
		}
	}
}