예제 #1
0
        }                                                                                                           // 0x0000000180A02590-0x0000000180A02860

        public override object Deserialize(StreamBuffer din, byte type) => default;                                 // 0x0000000180A00A00-0x0000000180A013D0
예제 #2
0
        private Array DeserializeArray(StreamBuffer din)
        {
            short num   = this.DeserializeShort(din);
            byte  b     = din.ReadByte();
            Array array = null;

            switch (b)
            {
            case 121:
            {
                Array array3 = this.DeserializeArray(din);
                Type  type   = array3.GetType();
                array = Array.CreateInstance(type, num);
                array.SetValue(array3, 0);
                for (short num4 = 1; num4 < num; num4 = (short)(num4 + 1))
                {
                    array3 = this.DeserializeArray(din);
                    array.SetValue(array3, num4);
                }
                goto IL_0226;
            }

            case 120:
                array = Array.CreateInstance(typeof(byte[]), num);
                for (short num5 = 0; num5 < num; num5 = (short)(num5 + 1))
                {
                    Array value = this.DeserializeByteArray(din, -1);
                    array.SetValue(value, num5);
                }
                goto IL_0226;

            case 98:
                array = this.DeserializeByteArray(din, num);
                goto IL_0226;

            case 105:
                array = this.DeserializeIntArray(din, num);
                goto IL_0226;

            case 99:
            {
                byte       b2         = din.ReadByte();
                CustomType customType = default(CustomType);
                if (Protocol.CodeDict.TryGetValue(b2, out customType))
                {
                    array = Array.CreateInstance(customType.Type, num);
                    for (int i = 0; i < num; i++)
                    {
                        short num3 = this.DeserializeShort(din);
                        if (customType.DeserializeStreamFunction == null)
                        {
                            byte[] array2 = new byte[num3];
                            din.Read(array2, 0, num3);
                            array.SetValue(customType.DeserializeFunction(array2), i);
                        }
                        else
                        {
                            array.SetValue(customType.DeserializeStreamFunction(din, num3), i);
                        }
                    }
                    goto IL_0226;
                }
                throw new Exception("Cannot find deserializer for custom type: " + b2);
            }

            case 68:
            {
                Array result = null;
                this.DeserializeDictionaryArray(din, num, out result);
                return(result);
            }

            default:
            {
                array = this.CreateArrayByType(b, num);
                for (short num2 = 0; num2 < num; num2 = (short)(num2 + 1))
                {
                    array.SetValue(this.Deserialize(din, b), num2);
                }
                goto IL_0226;
            }
IL_0226:
                return(array);
            }
        }
예제 #3
0
        public override void Serialize(StreamBuffer dout, object serObject, bool setType)
        {
            if (serObject == null)
            {
                if (setType)
                {
                    dout.WriteByte(42);
                }
            }
            else
            {
                switch (this.GetCodeOfType(serObject.GetType()))
                {
                case GpType.Byte:
                    this.SerializeByte(dout, (byte)serObject, setType);
                    break;

                case GpType.String:
                    this.SerializeString(dout, (string)serObject, setType);
                    break;

                case GpType.Boolean:
                    this.SerializeBoolean(dout, (bool)serObject, setType);
                    break;

                case GpType.Short:
                    this.SerializeShort(dout, (short)serObject, setType);
                    break;

                case GpType.Integer:
                    this.SerializeInteger(dout, (int)serObject, setType);
                    break;

                case GpType.Long:
                    this.SerializeLong(dout, (long)serObject, setType);
                    break;

                case GpType.Float:
                    this.SerializeFloat(dout, (float)serObject, setType);
                    break;

                case GpType.Double:
                    this.SerializeDouble(dout, (double)serObject, setType);
                    break;

                case GpType.Hashtable:
                    this.SerializeHashTable(dout, (ExitGames.Client.Photon.Hashtable)serObject, setType);
                    break;

                case GpType.ByteArray:
                    this.SerializeByteArray(dout, (byte[])serObject, setType);
                    break;

                case GpType.ObjectArray:
                    this.SerializeObjectArray(dout, (IList)serObject, setType);
                    break;

                case GpType.Array:
                    if (serObject is int[])
                    {
                        this.SerializeIntArrayOptimized(dout, (int[])serObject, setType);
                    }
                    else if (serObject.GetType().GetElementType() == typeof(object))
                    {
                        this.SerializeObjectArray(dout, serObject as object[], setType);
                    }
                    else
                    {
                        this.SerializeArray(dout, (Array)serObject, setType);
                    }
                    break;

                case GpType.Dictionary:
                    this.SerializeDictionary(dout, (IDictionary)serObject, setType);
                    break;

                case GpType.EventData:
                    this.SerializeEventData(dout, (EventData)serObject, setType);
                    break;

                case GpType.OperationResponse:
                    this.SerializeOperationResponse(dout, (OperationResponse)serObject, setType);
                    break;

                case GpType.OperationRequest:
                    this.SerializeOperationRequest(dout, (OperationRequest)serObject, setType);
                    break;

                default:
                    if (serObject is ArraySegment <byte> )
                    {
                        ArraySegment <byte> arraySegment = (ArraySegment <byte>)serObject;
                        this.SerializeByteArraySegment(dout, arraySegment.Array, arraySegment.Offset, arraySegment.Count, setType);
                        break;
                    }
                    if (this.SerializeCustom(dout, serObject))
                    {
                        break;
                    }
                    throw new Exception("cannot serialize(): " + serObject.GetType());
                }
            }
        }
예제 #4
0
        }                                                                                                  // 0x0000000180A03EB0-0x0000000180A03F30

        public override OperationRequest DeserializeOperationRequest(StreamBuffer din) => default;         // 0x0000000180A003E0-0x0000000180A00490
예제 #5
0
        }                                                                                                       // 0x0000000180A03F70-0x0000000180A04050

        public override OperationResponse DeserializeOperationResponse(StreamBuffer stream) => default;         // 0x0000000180A00490-0x0000000180A005B0
예제 #6
0
        }                              // 0x0000000180A04DD0-0x0000000180A04E50

        // Methods
        private bool SerializeCustom(StreamBuffer dout, object serObject) => default;       // 0x0000000180A02190-0x0000000180A02590
예제 #7
0
        private Array CreateArrayByType(byte arrayType, short length) => default;           // 0x00000001809FE810-0x00000001809FE840

        private void SerializeOperationRequest(StreamBuffer stream, OperationRequest serObject, bool setType)
        {
        }                                                                                                                // 0x0000000180A03F30-0x0000000180A03F70
예제 #8
0
 private long DeserializeLong(StreamBuffer din) => default;                                                  // 0x0000000180A00020-0x0000000180A002B0
 private float DeserializeFloat(StreamBuffer din) => default;                                                // 0x00000001809FFAC0-0x00000001809FFCD0
예제 #9
0
 private float DeserializeFloat(StreamBuffer din) => default;                                                // 0x00000001809FFAC0-0x00000001809FFCD0
 private double DeserializeDouble(StreamBuffer din) => default;                                              // 0x00000001809FF730-0x00000001809FFA00
예제 #10
0
 public override short DeserializeShort(StreamBuffer din) => default;                                        // 0x0000000180A006B0-0x0000000180A007E0
 private int DeserializeInteger(StreamBuffer din) => default;                                                // 0x00000001809FFEB0-0x0000000180A00020
예제 #11
0
 private int DeserializeInteger(StreamBuffer din) => default;                                                // 0x00000001809FFEB0-0x0000000180A00020
 private long DeserializeLong(StreamBuffer din) => default;                                                  // 0x0000000180A00020-0x0000000180A002B0
예제 #12
0
 private bool DeserializeBoolean(StreamBuffer din) => default;                                               // 0x00000001809FED00-0x00000001809FED30
 public override short DeserializeShort(StreamBuffer din) => default;                                        // 0x0000000180A006B0-0x0000000180A007E0
예제 #13
0
 public override byte DeserializeByte(StreamBuffer din) => default;                                          // 0x00000001809FEDD0-0x00000001809FEDF0
 private bool DeserializeBoolean(StreamBuffer din) => default;                                               // 0x00000001809FED00-0x00000001809FED30
예제 #14
0
 public override object Deserialize(StreamBuffer din, byte type) => default;                                 // 0x0000000180A00A00-0x0000000180A013D0
 public override byte DeserializeByte(StreamBuffer din) => default;                                          // 0x00000001809FEDD0-0x00000001809FEDF0
예제 #15
0
 private Hashtable DeserializeHashTable(StreamBuffer din) => default;                                        // 0x00000001809FFCD0-0x00000001809FFDE0
 private IDictionary DeserializeDictionary(StreamBuffer din) => default;                                     // 0x00000001809FF430-0x00000001809FF730
예제 #16
0
 private double DeserializeDouble(StreamBuffer din) => default;                                              // 0x00000001809FF730-0x00000001809FFA00
 private string DeserializeString(StreamBuffer din) => default;                                              // 0x0000000180A008F0-0x0000000180A00A00
예제 #17
0
        private IDictionary DeserializeDictionary(StreamBuffer din) => default;                                     // 0x00000001809FF430-0x00000001809FF730

        private bool DeserializeDictionaryArray(StreamBuffer din, short size, out Array arrayResult)
        {
            arrayResult = default;
            return(default);
예제 #18
0
 private string DeserializeString(StreamBuffer din) => default;                                              // 0x0000000180A008F0-0x0000000180A00A00
 private Array DeserializeArray(StreamBuffer din) => default;                                                // 0x00000001809FE840-0x00000001809FED00
예제 #19
0
 private bool SerializeCustom(StreamBuffer dout, object serObject) => default;       // 0x0000000180A02190-0x0000000180A02590
 private object DeserializeCustom(StreamBuffer din, byte customTypeCode) => default; // 0x00000001809FEDF0-0x00000001809FEFD0
예제 #20
0
        private Array DeserializeArray(StreamBuffer din) => default;                                                // 0x00000001809FE840-0x00000001809FED00

        private byte[] DeserializeByteArray(StreamBuffer din, int size = -1 /* Metadata: 0x0064D678 */) => default; // 0x00000001809FED30-0x00000001809FEDD0
예제 #21
0
        }                                                                                                                // 0x0000000180A03F30-0x0000000180A03F70

        public override void SerializeOperationRequest(StreamBuffer stream, byte operationCode, Dictionary <byte, object> parameters, bool setType)
        {
        }                                                                                                  // 0x0000000180A03EB0-0x0000000180A03F30
예제 #22
0
        private byte[] DeserializeByteArray(StreamBuffer din, int size = -1 /* Metadata: 0x0064D678 */) => default; // 0x00000001809FED30-0x00000001809FEDD0

        private int[] DeserializeIntArray(StreamBuffer din, int size = -1 /* Metadata: 0x0064D67C */) => default;   // 0x00000001809FFDE0-0x00000001809FFEB0
예제 #23
0
        public override OperationRequest DeserializeOperationRequest(StreamBuffer din) => default;         // 0x0000000180A003E0-0x0000000180A00490

        public override void SerializeOperationResponse(StreamBuffer stream, OperationResponse serObject, bool setType)
        {
        }                                                                                                       // 0x0000000180A03F70-0x0000000180A04050
예제 #24
0
        private int[] DeserializeIntArray(StreamBuffer din, int size = -1 /* Metadata: 0x0064D67C */) => default;   // 0x00000001809FFDE0-0x00000001809FFEB0

        private string[] DeserializeStringArray(StreamBuffer din) => default;                                       // 0x0000000180A007E0-0x0000000180A008F0
예제 #25
0
        public override OperationResponse DeserializeOperationResponse(StreamBuffer stream) => default;         // 0x0000000180A00490-0x0000000180A005B0

        public override void SerializeEventData(StreamBuffer stream, EventData serObject, bool setType)
        {
        }                                                                                                                                                                                        // 0x0000000180A02F90-0x0000000180A03000
예제 #26
0
        private string[] DeserializeStringArray(StreamBuffer din) => default;                                       // 0x0000000180A007E0-0x0000000180A008F0

        private object[] DeserializeObjectArray(StreamBuffer din) => default;                                       // 0x0000000180A002B0-0x0000000180A003E0
예제 #27
0
 private void SerializeOperationRequest(StreamBuffer stream, OperationRequest serObject, bool setType)
 {
     this.SerializeOperationRequest(stream, serObject.OperationCode, serObject.Parameters, setType);
 }
예제 #28
0
 private object[] DeserializeObjectArray(StreamBuffer din) => default;                                       // 0x0000000180A002B0-0x0000000180A003E0
 private Hashtable DeserializeHashTable(StreamBuffer din) => default;                                        // 0x00000001809FFCD0-0x00000001809FFDE0
예제 #29
0
        private void SerializeArray(StreamBuffer dout, Array serObject, bool setType)
        {
            if (setType)
            {
                dout.WriteByte(121);
            }
            if (serObject.Length > 32767)
            {
                throw new NotSupportedException("String[] that exceed 32767 (short.MaxValue) entries are not supported. Yours is: " + serObject.Length);
            }
            this.SerializeShort(dout, (short)serObject.Length, false);
            Type   elementType = serObject.GetType().GetElementType();
            GpType codeOfType  = this.GetCodeOfType(elementType);

            if (codeOfType != 0)
            {
                dout.WriteByte((byte)codeOfType);
                if (codeOfType == GpType.Dictionary)
                {
                    bool setKeyType   = default(bool);
                    bool setValueType = default(bool);
                    this.SerializeDictionaryHeader(dout, (object)serObject, out setKeyType, out setValueType);
                    for (int i = 0; i < serObject.Length; i++)
                    {
                        object value = serObject.GetValue(i);
                        this.SerializeDictionaryElements(dout, value, setKeyType, setValueType);
                    }
                }
                else
                {
                    for (int j = 0; j < serObject.Length; j++)
                    {
                        object value2 = serObject.GetValue(j);
                        this.Serialize(dout, value2, false);
                    }
                }
                return;
            }
            CustomType customType = default(CustomType);

            if (Protocol.TypeDict.TryGetValue(elementType, out customType))
            {
                dout.WriteByte(99);
                dout.WriteByte(customType.Code);
                int   num = 0;
                short num2;
                long  num3;
                while (true)
                {
                    if (num < serObject.Length)
                    {
                        object value3 = serObject.GetValue(num);
                        if (customType.SerializeStreamFunction == null)
                        {
                            byte[] array = customType.SerializeFunction(value3);
                            this.SerializeShort(dout, (short)array.Length, false);
                            dout.Write(array, 0, array.Length);
                        }
                        else
                        {
                            int position = dout.Position;
                            dout.Position += 2;
                            num2           = customType.SerializeStreamFunction(dout, value3);
                            num3           = dout.Position;
                            dout.Position  = position;
                            this.SerializeShort(dout, num2, false);
                            dout.Position += num2;
                            if (dout.Position != num3)
                            {
                                break;
                            }
                        }
                        num++;
                        continue;
                    }
                    return;
                }
                throw new Exception("Serialization failed. Stream position corrupted. Should be " + num3 + " is now: " + dout.Position + " serializedLength: " + num2);
            }
            throw new NotSupportedException("cannot serialize array of type " + elementType);
        }
예제 #30
0
        }         // 0x0000000180A02890-0x0000000180A02BD0

        private void SerializeDictionaryElements(StreamBuffer writer, object dict, bool setKeyType, bool setValueType)
        {
        }                                                                                                           // 0x0000000180A02590-0x0000000180A02860