Exemplo n.º 1
0
 public override void Serialize(NetworkWriter writer)
 {
     writer.Write((ushort)this.scripts.Length);
     CRCMessageEntry[] array = this.scripts;
     for (int i = 0; i < array.Length; i++)
     {
         CRCMessageEntry cRCMessageEntry = array[i];
         writer.Write(cRCMessageEntry.name);
         writer.Write(cRCMessageEntry.channel);
     }
 }
Exemplo n.º 2
0
 private void Dump(CRCMessageEntry[] remoteScripts)
 {
     foreach (string str in this.m_Scripts.Keys)
     {
         Debug.Log(string.Concat(new object[] { "CRC Local Dump ", str, " : ", this.m_Scripts[str] }));
     }
     foreach (CRCMessageEntry entry in remoteScripts)
     {
         Debug.Log(string.Concat(new object[] { "CRC Remote Dump ", entry.name, " : ", entry.channel }));
     }
 }
Exemplo n.º 3
0
        public override void Deserialize(NetworkReader reader)
        {
            int numScripts = reader.ReadUInt16();

            scripts = new CRCMessageEntry[numScripts];
            for (int i = 0; i < scripts.Length; ++i)
            {
                var entry = new CRCMessageEntry();
                entry.name    = reader.ReadString();
                entry.channel = reader.ReadByte();
                scripts[i]    = entry;
            }
        }
Exemplo n.º 4
0
        public override void Deserialize(NetworkReader reader)
        {
            int num = (int)reader.ReadUInt16();

            this.scripts = new CRCMessageEntry[num];
            for (int i = 0; i < this.scripts.Length; i++)
            {
                CRCMessageEntry crcmessageEntry = default(CRCMessageEntry);
                crcmessageEntry.name    = reader.ReadString();
                crcmessageEntry.channel = reader.ReadByte();
                this.scripts[i]         = crcmessageEntry;
            }
        }
Exemplo n.º 5
0
 private bool ValidateInternal(CRCMessageEntry[] remoteScripts, int numChannels)
 {
     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);
         return false;
     }
     for (int i = 0; i < remoteScripts.Length; i++)
     {
         CRCMessageEntry entry = remoteScripts[i];
         if (LogFilter.logDebug)
         {
             Debug.Log(string.Concat(new object[] { "Script: ", entry.name, " Channel: ", entry.channel }));
         }
         if (this.m_Scripts.ContainsKey(entry.name))
         {
             int num2 = this.m_Scripts[entry.name];
             if (num2 != entry.channel)
             {
                 if (LogFilter.logError)
                 {
                     Debug.LogError(string.Concat(new object[] { "HLAPI CRC Channel Mismatch. Script: ", entry.name, " LocalChannel: ", num2, " RemoteChannel: ", entry.channel }));
                 }
                 this.Dump(remoteScripts);
                 return false;
             }
         }
         if (entry.channel >= numChannels)
         {
             if (LogFilter.logError)
             {
                 Debug.LogError(string.Concat(new object[] { "HLAPI CRC channel out of range! Script: ", entry.name, " Channel: ", entry.channel }));
             }
             this.Dump(remoteScripts);
             return false;
         }
     }
     return true;
 }
Exemplo n.º 6
0
 private bool ValidateInternal(CRCMessageEntry[] remoteScripts, int numChannels)
 {
     if (this.m_Scripts.Count != remoteScripts.Length)
     {
         if (LogFilter.logError)
         {
             Debug.LogError(string.Concat(new object[] { "HLAPI CRC channel count error local: ", this.m_Scripts.Count, " remote: ", remoteScripts.Length }));
         }
         this.Dump(remoteScripts);
         return false;
     }
     foreach (CRCMessageEntry entry in remoteScripts)
     {
         if (LogFilter.logDebug)
         {
             Debug.Log(string.Concat(new object[] { "Script: ", entry.name, " Channel: ", entry.channel }));
         }
         if (this.m_Scripts.ContainsKey(entry.name))
         {
             int num2 = this.m_Scripts[entry.name];
             if (num2 != entry.channel)
             {
                 if (LogFilter.logError)
                 {
                     Debug.LogError(string.Concat(new object[] { "HLAPI CRC Channel Mismatch. Script: ", entry.name, " LocalChannel: ", num2, " RemoteChannel: ", entry.channel }));
                 }
                 this.Dump(remoteScripts);
                 return false;
             }
         }
         if (entry.channel >= numChannels)
         {
             if (LogFilter.logError)
             {
                 Debug.LogError(string.Concat(new object[] { "HLAPI CRC channel out of range! Script: ", entry.name, " Channel: ", entry.channel }));
             }
             this.Dump(remoteScripts);
             return false;
         }
     }
     return true;
 }
Exemplo n.º 7
0
 internal static bool Validate(CRCMessageEntry[] scripts, int numChannels)
 {
     return singleton.ValidateInternal(scripts, numChannels);
 }
Exemplo n.º 8
0
 private bool ValidateInternal(CRCMessageEntry[] remoteScripts, int numChannels)
 {
   if (this.m_Scripts.Count != remoteScripts.Length)
   {
     if (LogFilter.logWarn)
       Debug.LogWarning((object) "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);
     return false;
   }
   foreach (CRCMessageEntry remoteScript in remoteScripts)
   {
     if (LogFilter.logDebug)
       Debug.Log((object) ("Script: " + remoteScript.name + " Channel: " + (object) remoteScript.channel));
     if (this.m_Scripts.ContainsKey(remoteScript.name))
     {
       int script = this.m_Scripts[remoteScript.name];
       if (script != (int) remoteScript.channel)
       {
         if (LogFilter.logError)
           Debug.LogError((object) ("HLAPI CRC Channel Mismatch. Script: " + remoteScript.name + " LocalChannel: " + (object) script + " RemoteChannel: " + (object) remoteScript.channel));
         this.Dump(remoteScripts);
         return false;
       }
     }
     if ((int) remoteScript.channel >= numChannels)
     {
       if (LogFilter.logError)
         Debug.LogError((object) ("HLAPI CRC channel out of range! Script: " + remoteScript.name + " Channel: " + (object) remoteScript.channel));
       this.Dump(remoteScripts);
       return false;
     }
   }
   return true;
 }
Exemplo n.º 9
0
 private void Dump(CRCMessageEntry[] remoteScripts)
 {
   using (Dictionary<string, int>.KeyCollection.Enumerator enumerator = this.m_Scripts.Keys.GetEnumerator())
   {
     while (enumerator.MoveNext())
     {
       string current = enumerator.Current;
       Debug.Log((object) ("CRC Local Dump " + current + " : " + (object) this.m_Scripts[current]));
     }
   }
   foreach (CRCMessageEntry remoteScript in remoteScripts)
     Debug.Log((object) ("CRC Remote Dump " + remoteScript.name + " : " + (object) remoteScript.channel));
 }
Exemplo n.º 10
0
 internal bool Validate(CRCMessageEntry[] scripts, int numChannels)
 {
     if (NetworkCRC.singleton.scripts.Count != scripts.Length)
       {
     if (LogFilter.logError)
     {
       object[] objArray = new object[4];
       int index1 = 0;
       string str1 = "HLAPI CRC channel count error local: ";
       objArray[index1] = (object) str1;
       int index2 = 1;
       // ISSUE: variable of a boxed type
       __Boxed<int> local1 = (ValueType) NetworkCRC.singleton.scripts.Count;
       objArray[index2] = (object) local1;
       int index3 = 2;
       string str2 = " remote: ";
       objArray[index3] = (object) str2;
       int index4 = 3;
       // ISSUE: variable of a boxed type
       __Boxed<int> local2 = (ValueType) scripts.Length;
       objArray[index4] = (object) local2;
       Debug.LogError((object) string.Concat(objArray));
     }
     this.Dump(scripts);
     return false;
       }
       foreach (CRCMessageEntry crcMessageEntry in scripts)
       {
     if (LogFilter.logDebug)
     {
       object[] objArray = new object[4];
       int index1 = 0;
       string str1 = "Script: ";
       objArray[index1] = (object) str1;
       int index2 = 1;
       string str2 = crcMessageEntry.name;
       objArray[index2] = (object) str2;
       int index3 = 2;
       string str3 = " Channel: ";
       objArray[index3] = (object) str3;
       int index4 = 3;
       // ISSUE: variable of a boxed type
       __Boxed<byte> local = (ValueType) crcMessageEntry.channel;
       objArray[index4] = (object) local;
       Debug.Log((object) string.Concat(objArray));
     }
     if (NetworkCRC.singleton.scripts.ContainsKey(crcMessageEntry.name))
     {
       int num = NetworkCRC.singleton.scripts[crcMessageEntry.name];
       if (num != (int) crcMessageEntry.channel)
       {
     if (LogFilter.logError)
     {
       object[] objArray = new object[6];
       int index1 = 0;
       string str1 = "HLAPI CRC Channel Mismatch. Script: ";
       objArray[index1] = (object) str1;
       int index2 = 1;
       string str2 = crcMessageEntry.name;
       objArray[index2] = (object) str2;
       int index3 = 2;
       string str3 = " LocalChannel: ";
       objArray[index3] = (object) str3;
       int index4 = 3;
       // ISSUE: variable of a boxed type
       __Boxed<int> local1 = (ValueType) num;
       objArray[index4] = (object) local1;
       int index5 = 4;
       string str4 = " RemoteChannel: ";
       objArray[index5] = (object) str4;
       int index6 = 5;
       // ISSUE: variable of a boxed type
       __Boxed<byte> local2 = (ValueType) crcMessageEntry.channel;
       objArray[index6] = (object) local2;
       Debug.LogError((object) string.Concat(objArray));
     }
     this.Dump(scripts);
     return false;
       }
     }
     if ((int) crcMessageEntry.channel >= numChannels)
     {
       if (LogFilter.logError)
       {
     object[] objArray = new object[4];
     int index1 = 0;
     string str1 = "HLAPI CRC channel out of range! Script: ";
     objArray[index1] = (object) str1;
     int index2 = 1;
     string str2 = crcMessageEntry.name;
     objArray[index2] = (object) str2;
     int index3 = 2;
     string str3 = " Channel: ";
     objArray[index3] = (object) str3;
     int index4 = 3;
     // ISSUE: variable of a boxed type
     __Boxed<byte> local = (ValueType) crcMessageEntry.channel;
     objArray[index4] = (object) local;
     Debug.LogError((object) string.Concat(objArray));
       }
       this.Dump(scripts);
       return false;
     }
       }
       return true;
 }
Exemplo n.º 11
0
 private void Dump(CRCMessageEntry[] scripts)
 {
     using (Dictionary<string, int>.KeyCollection.Enumerator enumerator = this.m_Scripts.Keys.GetEnumerator())
       {
     while (enumerator.MoveNext())
     {
       string current = enumerator.Current;
       object[] objArray = new object[4];
       int index1 = 0;
       string str1 = "CRC Local Dump ";
       objArray[index1] = (object) str1;
       int index2 = 1;
       string str2 = current;
       objArray[index2] = (object) str2;
       int index3 = 2;
       string str3 = " : ";
       objArray[index3] = (object) str3;
       int index4 = 3;
       // ISSUE: variable of a boxed type
       __Boxed<int> local = (ValueType) this.m_Scripts[current];
       objArray[index4] = (object) local;
       Debug.Log((object) string.Concat(objArray));
     }
       }
       foreach (CRCMessageEntry crcMessageEntry in scripts)
       {
     object[] objArray = new object[4];
     int index1 = 0;
     string str1 = "CRC Remote Dump ";
     objArray[index1] = (object) str1;
     int index2 = 1;
     string str2 = crcMessageEntry.name;
     objArray[index2] = (object) str2;
     int index3 = 2;
     string str3 = " : ";
     objArray[index3] = (object) str3;
     int index4 = 3;
     // ISSUE: variable of a boxed type
     __Boxed<byte> local = (ValueType) crcMessageEntry.channel;
     objArray[index4] = (object) local;
     Debug.Log((object) string.Concat(objArray));
       }
 }