scripts
This commit is contained in:
@@ -0,0 +1,233 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace System
|
||||
{
|
||||
// Token: 0x02000661 RID: 1633
|
||||
internal struct MonoEnumInfo
|
||||
{
|
||||
// Token: 0x06003E15 RID: 15893 RVA: 0x000D3378 File Offset: 0x000D1578
|
||||
private MonoEnumInfo(MonoEnumInfo other)
|
||||
{
|
||||
this.utype = other.utype;
|
||||
this.values = other.values;
|
||||
this.names = other.names;
|
||||
this.name_hash = other.name_hash;
|
||||
}
|
||||
|
||||
// Token: 0x06003E17 RID: 15895
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
private static extern void get_enum_info(Type enumType, out MonoEnumInfo info);
|
||||
|
||||
// Token: 0x17000B8A RID: 2954
|
||||
// (get) Token: 0x06003E18 RID: 15896 RVA: 0x000D3408 File Offset: 0x000D1608
|
||||
private static Hashtable Cache
|
||||
{
|
||||
get
|
||||
{
|
||||
if (MonoEnumInfo.cache == null)
|
||||
{
|
||||
MonoEnumInfo.cache = new Hashtable();
|
||||
}
|
||||
return MonoEnumInfo.cache;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06003E19 RID: 15897 RVA: 0x000D3424 File Offset: 0x000D1624
|
||||
internal static void GetInfo(Type enumType, out MonoEnumInfo info)
|
||||
{
|
||||
if (MonoEnumInfo.Cache.ContainsKey(enumType))
|
||||
{
|
||||
info = (MonoEnumInfo)MonoEnumInfo.cache[enumType];
|
||||
return;
|
||||
}
|
||||
object obj = MonoEnumInfo.global_cache_monitor;
|
||||
lock (obj)
|
||||
{
|
||||
if (MonoEnumInfo.global_cache.ContainsKey(enumType))
|
||||
{
|
||||
object obj2 = MonoEnumInfo.global_cache[enumType];
|
||||
MonoEnumInfo.cache[enumType] = obj2;
|
||||
info = (MonoEnumInfo)obj2;
|
||||
return;
|
||||
}
|
||||
}
|
||||
MonoEnumInfo.get_enum_info(enumType, out info);
|
||||
IComparer comparer = null;
|
||||
if (!(info.values is byte[]) && !(info.values is ushort[]) && !(info.values is uint[]) && !(info.values is ulong[]))
|
||||
{
|
||||
if (info.values is int[])
|
||||
{
|
||||
comparer = MonoEnumInfo.int_comparer;
|
||||
}
|
||||
else if (info.values is short[])
|
||||
{
|
||||
comparer = MonoEnumInfo.short_comparer;
|
||||
}
|
||||
else if (info.values is sbyte[])
|
||||
{
|
||||
comparer = MonoEnumInfo.sbyte_comparer;
|
||||
}
|
||||
else if (info.values is long[])
|
||||
{
|
||||
comparer = MonoEnumInfo.long_comparer;
|
||||
}
|
||||
}
|
||||
Array.Sort(info.values, info.names, comparer);
|
||||
if (info.names.Length > 50)
|
||||
{
|
||||
info.name_hash = new Hashtable(info.names.Length);
|
||||
for (int i = 0; i < info.names.Length; i++)
|
||||
{
|
||||
info.name_hash[info.names[i]] = i;
|
||||
}
|
||||
}
|
||||
MonoEnumInfo monoEnumInfo = new MonoEnumInfo(info);
|
||||
object obj3 = MonoEnumInfo.global_cache_monitor;
|
||||
lock (obj3)
|
||||
{
|
||||
MonoEnumInfo.global_cache[enumType] = monoEnumInfo;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040018D3 RID: 6355
|
||||
internal Type utype;
|
||||
|
||||
// Token: 0x040018D4 RID: 6356
|
||||
internal Array values;
|
||||
|
||||
// Token: 0x040018D5 RID: 6357
|
||||
internal string[] names;
|
||||
|
||||
// Token: 0x040018D6 RID: 6358
|
||||
internal Hashtable name_hash;
|
||||
|
||||
// Token: 0x040018D7 RID: 6359
|
||||
[ThreadStatic]
|
||||
private static Hashtable cache;
|
||||
|
||||
// Token: 0x040018D8 RID: 6360
|
||||
private static Hashtable global_cache = new Hashtable();
|
||||
|
||||
// Token: 0x040018D9 RID: 6361
|
||||
private static object global_cache_monitor = new object();
|
||||
|
||||
// Token: 0x040018DA RID: 6362
|
||||
internal static MonoEnumInfo.SByteComparer sbyte_comparer = new MonoEnumInfo.SByteComparer();
|
||||
|
||||
// Token: 0x040018DB RID: 6363
|
||||
internal static MonoEnumInfo.ShortComparer short_comparer = new MonoEnumInfo.ShortComparer();
|
||||
|
||||
// Token: 0x040018DC RID: 6364
|
||||
internal static MonoEnumInfo.IntComparer int_comparer = new MonoEnumInfo.IntComparer();
|
||||
|
||||
// Token: 0x040018DD RID: 6365
|
||||
internal static MonoEnumInfo.LongComparer long_comparer = new MonoEnumInfo.LongComparer();
|
||||
|
||||
// Token: 0x02000662 RID: 1634
|
||||
internal class SByteComparer : IComparer<sbyte>, IComparer
|
||||
{
|
||||
// Token: 0x06003E1B RID: 15899 RVA: 0x000D3638 File Offset: 0x000D1838
|
||||
public int Compare(object x, object y)
|
||||
{
|
||||
sbyte b = (sbyte)x;
|
||||
sbyte b2 = (sbyte)y;
|
||||
return (int)((byte)b - (byte)b2);
|
||||
}
|
||||
|
||||
// Token: 0x06003E1C RID: 15900 RVA: 0x000D3658 File Offset: 0x000D1858
|
||||
public int Compare(sbyte ix, sbyte iy)
|
||||
{
|
||||
return (int)((byte)ix - (byte)iy);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x02000663 RID: 1635
|
||||
internal class ShortComparer : IComparer<short>, IComparer
|
||||
{
|
||||
// Token: 0x06003E1E RID: 15902 RVA: 0x000D3668 File Offset: 0x000D1868
|
||||
public int Compare(object x, object y)
|
||||
{
|
||||
short num = (short)x;
|
||||
short num2 = (short)y;
|
||||
return (int)((ushort)num - (ushort)num2);
|
||||
}
|
||||
|
||||
// Token: 0x06003E1F RID: 15903 RVA: 0x000D3688 File Offset: 0x000D1888
|
||||
public int Compare(short ix, short iy)
|
||||
{
|
||||
return (int)((ushort)ix - (ushort)iy);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x02000664 RID: 1636
|
||||
internal class IntComparer : IComparer<int>, IComparer
|
||||
{
|
||||
// Token: 0x06003E21 RID: 15905 RVA: 0x000D3698 File Offset: 0x000D1898
|
||||
public int Compare(object x, object y)
|
||||
{
|
||||
int num = (int)x;
|
||||
int num2 = (int)y;
|
||||
if (num == num2)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (num < num2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Token: 0x06003E22 RID: 15906 RVA: 0x000D36C8 File Offset: 0x000D18C8
|
||||
public int Compare(int ix, int iy)
|
||||
{
|
||||
if (ix == iy)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (ix < iy)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x02000665 RID: 1637
|
||||
internal class LongComparer : IComparer<long>, IComparer
|
||||
{
|
||||
// Token: 0x06003E24 RID: 15908 RVA: 0x000D36E8 File Offset: 0x000D18E8
|
||||
public int Compare(object x, object y)
|
||||
{
|
||||
long num = (long)x;
|
||||
long num2 = (long)y;
|
||||
if (num == num2)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (num < num2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Token: 0x06003E25 RID: 15909 RVA: 0x000D3718 File Offset: 0x000D1918
|
||||
public int Compare(long ix, long iy)
|
||||
{
|
||||
if (ix == iy)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (ix < iy)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user