using System; using System.Collections.Generic; using System.Reflection; using UnityEngine.Networking.NetworkSystem; namespace UnityEngine.Networking { // Token: 0x02000041 RID: 65 public class NetworkCRC { // Token: 0x1700003F RID: 63 // (get) Token: 0x060001D5 RID: 469 RVA: 0x0000A9F4 File Offset: 0x00008BF4 internal static NetworkCRC singleton { get { if (NetworkCRC.s_Singleton == null) { NetworkCRC.s_Singleton = new NetworkCRC(); } return NetworkCRC.s_Singleton; } } // Token: 0x17000040 RID: 64 // (get) Token: 0x060001D6 RID: 470 RVA: 0x0000AA24 File Offset: 0x00008C24 public Dictionary scripts { get { return this.m_Scripts; } } // Token: 0x17000041 RID: 65 // (get) Token: 0x060001D7 RID: 471 RVA: 0x0000AA40 File Offset: 0x00008C40 // (set) Token: 0x060001D8 RID: 472 RVA: 0x0000AA5F File Offset: 0x00008C5F public static bool scriptCRCCheck { get { return NetworkCRC.singleton.m_ScriptCRCCheck; } set { NetworkCRC.singleton.m_ScriptCRCCheck = value; } } // Token: 0x060001D9 RID: 473 RVA: 0x0000AA70 File Offset: 0x00008C70 public static void ReinitializeScriptCRCs(Assembly callingAssembly) { NetworkCRC.singleton.m_Scripts.Clear(); foreach (Type type in callingAssembly.GetTypes()) { if (type.GetBaseType() == typeof(NetworkBehaviour)) { MethodInfo method = type.GetMethod(".cctor", BindingFlags.Static); if (method != null) { method.Invoke(null, new object[0]); } } } } // Token: 0x060001DA RID: 474 RVA: 0x0000AAE8 File Offset: 0x00008CE8 public static void RegisterBehaviour(string name, int channel) { NetworkCRC.singleton.m_Scripts[name] = channel; } // Token: 0x060001DB RID: 475 RVA: 0x0000AAFC File Offset: 0x00008CFC internal static bool Validate(CRCMessageEntry[] scripts, int numChannels) { return NetworkCRC.singleton.ValidateInternal(scripts, numChannels); } // Token: 0x060001DC RID: 476 RVA: 0x0000AB20 File Offset: 0x00008D20 private bool ValidateInternal(CRCMessageEntry[] remoteScripts, int numChannels) { bool flag; if (this.m_Scripts.Count != remoteScripts.Length) { if (LogFilter.logWarn) { Debug.LogWarning("Network configuration mismatch detected. The number of networked scripts on the client does not match the number of networked scripts on the server. This could be caused by lazy loading of scripts on the client. This warning can be disabled by the checkbox in NetworkManager Script CRC Check."); } this.Dump(remoteScripts); flag = false; } else { foreach (CRCMessageEntry crcmessageEntry in remoteScripts) { if (LogFilter.logDebug) { Debug.Log(string.Concat(new object[] { "Script: ", crcmessageEntry.name, " Channel: ", crcmessageEntry.channel })); } if (this.m_Scripts.ContainsKey(crcmessageEntry.name)) { int num = this.m_Scripts[crcmessageEntry.name]; if (num != (int)crcmessageEntry.channel) { if (LogFilter.logError) { Debug.LogError(string.Concat(new object[] { "HLAPI CRC Channel Mismatch. Script: ", crcmessageEntry.name, " LocalChannel: ", num, " RemoteChannel: ", crcmessageEntry.channel })); } this.Dump(remoteScripts); return false; } } if ((int)crcmessageEntry.channel >= numChannels) { if (LogFilter.logError) { Debug.LogError(string.Concat(new object[] { "HLAPI CRC channel out of range! Script: ", crcmessageEntry.name, " Channel: ", crcmessageEntry.channel })); } this.Dump(remoteScripts); return false; } } flag = true; } return flag; } // Token: 0x060001DD RID: 477 RVA: 0x0000ACD8 File Offset: 0x00008ED8 private void Dump(CRCMessageEntry[] remoteScripts) { foreach (string text in this.m_Scripts.Keys) { Debug.Log(string.Concat(new object[] { "CRC Local Dump ", text, " : ", this.m_Scripts[text] })); } foreach (CRCMessageEntry crcmessageEntry in remoteScripts) { Debug.Log(string.Concat(new object[] { "CRC Remote Dump ", crcmessageEntry.name, " : ", crcmessageEntry.channel })); } } // Token: 0x04000105 RID: 261 internal static NetworkCRC s_Singleton; // Token: 0x04000106 RID: 262 private Dictionary m_Scripts = new Dictionary(); // Token: 0x04000107 RID: 263 private bool m_ScriptCRCCheck; } }