using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Text; using System.Threading; namespace ExitGames.Client.Photon { // Token: 0x02000009 RID: 9 public class SupportClass { // Token: 0x06000074 RID: 116 RVA: 0x00006EB8 File Offset: 0x000050B8 public static uint CalculateCrc(byte[] buffer, int length) { uint num = uint.MaxValue; uint num2 = 3988292384U; for (int i = 0; i < length; i++) { byte b = buffer[i]; num ^= (uint)b; for (int j = 0; j < 8; j++) { bool flag = (num & 1U) > 0U; if (flag) { num = (num >> 1) ^ num2; } else { num >>= 1; } } } return num; } // Token: 0x06000075 RID: 117 RVA: 0x00006F24 File Offset: 0x00005124 public static List GetMethods(Type type, Type attribute) { List list = new List(); bool flag = type == null; List list2; if (flag) { list2 = list; } else { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { bool flag2 = attribute == null || methodInfo.IsDefined(attribute, false); if (flag2) { list.Add(methodInfo); } } list2 = list; } return list2; } // Token: 0x06000076 RID: 118 RVA: 0x00006F94 File Offset: 0x00005194 public static int GetTickCount() { return SupportClass.IntegerMilliseconds(); } // Token: 0x06000077 RID: 119 RVA: 0x00006FB0 File Offset: 0x000051B0 [Obsolete("Use StartBackgroundCalls() instead. It works with StopBackgroundCalls().")] public static byte CallInBackground(Func myThread, int millisecondsInterval = 100, string taskName = "") { return SupportClass.StartBackgroundCalls(myThread, millisecondsInterval, null); } // Token: 0x06000078 RID: 120 RVA: 0x00006FCC File Offset: 0x000051CC public static byte StartBackgroundCalls(Func myThread, int millisecondsInterval = 100, string taskName = "") { bool flag = SupportClass.threadList == null; if (flag) { SupportClass.threadList = new List(); } Thread thread = new Thread(delegate { while (myThread()) { Thread.Sleep(millisecondsInterval); } }); bool flag2 = !string.IsNullOrEmpty(taskName); if (flag2) { thread.Name = taskName; } thread.IsBackground = true; thread.Start(); SupportClass.threadList.Add(thread); return (byte)(SupportClass.threadList.Count - 1); } // Token: 0x06000079 RID: 121 RVA: 0x00007060 File Offset: 0x00005260 public static bool StopBackgroundCalls(byte id) { bool flag = SupportClass.threadList == null || (int)id > SupportClass.threadList.Count || SupportClass.threadList[(int)id] == null; bool flag2; if (flag) { flag2 = false; } else { SupportClass.threadList[(int)id].Abort(); flag2 = true; } return flag2; } // Token: 0x0600007A RID: 122 RVA: 0x000070B4 File Offset: 0x000052B4 public static bool StopAllBackgroundCalls() { bool flag = SupportClass.threadList == null; bool flag2; if (flag) { flag2 = false; } else { foreach (Thread thread in SupportClass.threadList) { thread.Abort(); } flag2 = true; } return flag2; } // Token: 0x0600007B RID: 123 RVA: 0x00007124 File Offset: 0x00005324 public static void WriteStackTrace(Exception throwable, TextWriter stream) { bool flag = stream != null; if (flag) { stream.WriteLine(throwable.ToString()); stream.WriteLine(throwable.StackTrace); stream.Flush(); } else { Debug.WriteLine(throwable.ToString()); Debug.WriteLine(throwable.StackTrace); } } // Token: 0x0600007C RID: 124 RVA: 0x00007179 File Offset: 0x00005379 public static void WriteStackTrace(Exception throwable) { SupportClass.WriteStackTrace(throwable, null); } // Token: 0x0600007D RID: 125 RVA: 0x00007184 File Offset: 0x00005384 public static string DictionaryToString(IDictionary dictionary) { return SupportClass.DictionaryToString(dictionary, true); } // Token: 0x0600007E RID: 126 RVA: 0x000071A0 File Offset: 0x000053A0 public static string DictionaryToString(IDictionary dictionary, bool includeTypes) { bool flag = dictionary == null; string text; if (flag) { text = "null"; } else { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("{"); foreach (object obj in dictionary.Keys) { bool flag2 = stringBuilder.Length > 1; if (flag2) { stringBuilder.Append(", "); } bool flag3 = dictionary[obj] == null; Type type; string text2; if (flag3) { type = typeof(object); text2 = "null"; } else { type = dictionary[obj].GetType(); text2 = dictionary[obj].ToString(); } bool flag4 = typeof(IDictionary) == type || typeof(Hashtable) == type; if (flag4) { text2 = SupportClass.DictionaryToString((IDictionary)dictionary[obj]); } bool flag5 = typeof(string[]) == type; if (flag5) { text2 = string.Format("{{{0}}}", string.Join(",", (string[])dictionary[obj])); } bool flag6 = typeof(byte[]) == type; if (flag6) { text2 = string.Format("byte[{0}]", ((byte[])dictionary[obj]).Length); } if (includeTypes) { stringBuilder.AppendFormat("({0}){1}=({2}){3}", new object[] { obj.GetType().Name, obj, type.Name, text2 }); } else { stringBuilder.AppendFormat("{0}={1}", obj, text2); } } stringBuilder.Append("}"); text = stringBuilder.ToString(); } return text; } // Token: 0x0600007F RID: 127 RVA: 0x000073A0 File Offset: 0x000055A0 [Obsolete("Use DictionaryToString() instead.")] public static string HashtableToString(Hashtable hash) { return SupportClass.DictionaryToString(hash); } // Token: 0x06000080 RID: 128 RVA: 0x000073B8 File Offset: 0x000055B8 public static string ByteArrayToString(byte[] list) { bool flag = list == null; string text; if (flag) { text = string.Empty; } else { text = BitConverter.ToString(list); } return text; } // Token: 0x04000011 RID: 17 private static List threadList; // Token: 0x04000012 RID: 18 protected internal static SupportClass.IntegerMillisecondsDelegate IntegerMilliseconds = () => Environment.TickCount; // Token: 0x0200003E RID: 62 // (Invoke) Token: 0x060002C7 RID: 711 public delegate int IntegerMillisecondsDelegate(); // Token: 0x0200003F RID: 63 public class ThreadSafeRandom { // Token: 0x060002CA RID: 714 RVA: 0x0001410C File Offset: 0x0001230C public static int Next() { Random r = SupportClass.ThreadSafeRandom._r; int num; lock (r) { num = SupportClass.ThreadSafeRandom._r.Next(); } return num; } // Token: 0x04000191 RID: 401 private static readonly Random _r = new Random(); } } }