コード例 #1
0
 public void Serialize(IoBuffer output, ISerializationContext context)
 {
     output.PutUInt32(outfit_id);
     output.PutUInt64(asset_id);
     output.PutInt32(sale_price);
     output.PutInt32(purchase_price);
     output.PutEnum(owner_type);
     output.PutUInt32(owner_id);
     output.Put(outfit_type);
     output.PutEnum(outfit_source);
 }
コード例 #2
0
 public override void Serialize(IoBuffer output, ISerializationContext context)
 {
     output.PutUInt16(MajorVersion);
     output.PutUInt16(MinorVersion);
     output.PutUInt16(PointVersion);
     output.PutUInt16(ArtVersion);
     output.PutUInt64(this.Timestamp);
     output.Put(NumberOfAttempts);
     output.Put(LastExitCode);
     output.Put(LastFailureType);
     output.Put(FailureCount);
     output.Put(IsRunning);
     output.Put(IsReLogging);
 }
コード例 #3
0
ファイル: cTSOSerializer.cs プロジェクト: jwofles/ForkSO
        private cTSOValue SerializeValue(uint type, object value)
        {
            var      result = new cTSOValue();
            IoBuffer buffer = null;

            switch (type)
            {
            case 0x48BC841E:
                if (!(value is sbyte) && !(value is Enum))
                {
                    return(null);
                }
                result.Type  = cTSOValue_sint8;
                result.Value = new sbyte[] { Convert.ToSByte(value) };
                break;

            case 0x74336731:
                if (!(value is ushort))
                {
                    return(null);
                }

                buffer = AbstractVoltronPacket.Allocate(2);
                buffer.PutUInt16((ushort)value);
                buffer.Flip();

                result.Type  = cTSOValue_uint16;
                result.Value = buffer;
                break;

            case 0xF192ECA6:
                if (!(value is short))
                {
                    return(null);
                }

                buffer = AbstractVoltronPacket.Allocate(2);
                buffer.PutInt16((short)value);
                buffer.Flip();

                result.Type  = cTSOValue_sint16;
                result.Value = buffer;
                break;

            case 0xE0463A2F:
                if (!(value is uint))
                {
                    return(null);
                }

                buffer = AbstractVoltronPacket.Allocate(4);
                buffer.PutUInt32((uint)value);
                buffer.Flip();

                result.Type  = cTSOValue_uint32;
                result.Value = buffer;
                break;

            case 0xA0587098:
                if (!(value is int))
                {
                    return(null);
                }

                buffer = AbstractVoltronPacket.Allocate(4);
                buffer.PutInt32((int)value);
                buffer.Flip();

                result.Type  = cTSOValue_sint32;
                result.Value = buffer;
                break;

            case 0x385070C9:
                if (!(value is ulong))
                {
                    return(null);
                }

                buffer = AbstractVoltronPacket.Allocate(8);
                buffer.PutUInt64((ulong)value);
                buffer.Flip();

                result.Type  = cTSOValue_uint64;
                result.Value = buffer;
                break;

            case 0x90D315F7:
                if (!(value is long))
                {
                    return(null);
                }

                buffer = AbstractVoltronPacket.Allocate(8);
                buffer.PutInt64((long)value);
                buffer.Flip();

                result.Type  = cTSOValue_sint64;
                result.Value = buffer;
                break;

            default:
                //It may be a struct
                var _struct = Format.Structs.FirstOrDefault(x => x.ID == type);
                if (_struct != null)
                {
                    var body = new cITSOProperty();
                    body.StructType   = _struct.ID;
                    body.StructFields = new List <cITSOField>();

                    foreach (var field in _struct.Fields)
                    {
                        object fieldValue = GetFieldValue(value, field.Name);
                        if (fieldValue == null)
                        {
                            continue;
                        }

                        body.StructFields.Add(new cITSOField {
                            ID    = field.ID,
                            Value = SerializeValue(field.TypeID, fieldValue)
                        });
                    }

                    result.Type  = cTSOValue_property;
                    result.Value = body;
                    return(result);
                }

                return(null);
            }

            return(result);
        }
コード例 #4
0
 public void Serialize(IoBuffer output, object value, ISerializationContext serializer)
 {
     output.PutUInt64((ulong)value);
 }
コード例 #5
0
        public void Serialize(IoBuffer output, ISerializationContext context)
        {
            output.PutUInt32(AvatarId);
            output.PutPascalVLCString("A");
            output.PutPascalVLCString("B");

            output.PutInt16(AvatarSkills_Logic);
            output.PutInt16(AvatarSkills_LockLv_Logic);
            output.PutInt16(AvatarSkills_Body);
            output.PutInt16(AvatarSkills_LockLv_Body);
            output.PutInt16(AvatarSkills_LockLv_Mechanical);
            output.PutInt16(AvatarSkills_LockLv_Creativity);
            output.PutInt16(AvatarSkills_LockLv_Cooking);
            output.PutInt16(AvatarSkills_Cooking);
            output.PutInt16(AvatarSkills_Charisma);
            output.PutInt16(AvatarSkills_LockLv_Charisma);
            output.PutInt16(AvatarSkills_Mechanical);
            output.PutInt16(AvatarSkills_Creativity);

            //Unknown
            output.PutUInt32(0x28292a2b);
            output.PutUInt32(0x2c2d2e2f);
            output.PutUInt32(0x30313233);
            output.PutUInt32(0x34353637);
            output.PutUInt32(0x38393a3b);
            output.PutUInt32(0x3c3d3e3f);
            output.PutUInt32(0x40414243);
            output.Put(0x44);
            output.Put(0x45);

            output.PutUInt32(Cash);

            //Unknown
            output.PutUInt32(0x4a4b4c4d);
            output.PutUInt32(0x4e4f5051);
            output.Put(0x52);

            output.PutPascalVLCString("C");
            output.PutPascalVLCString("D");
            output.PutPascalVLCString("E");
            output.PutPascalVLCString("F");
            output.PutPascalVLCString("G");

            output.PutUInt32(0x54555657);
            output.PutUInt32(0x58595A5B);
            output.PutUInt32(0x5C5D5E5F);
            output.PutUInt32(0x60616263);
            output.PutUInt32(0x64656667);
            output.PutUInt32(0x68696A6B);
            output.PutUInt32(0x6C6D6E6F);
            output.PutUInt32(0x70717273);
            output.PutUInt32(0x74757677);

            //Bonus count
            if (Bonus == null)
            {
                output.PutUInt32(0);
            }
            else
            {
                output.PutUInt32((uint)Bonus.Count);
                for (var i = 0; i < Bonus.Count; i++)
                {
                    var bonus = Bonus[i];

                    //Unknown
                    output.PutUInt32(0x7C7D7E7F);
                    output.PutUInt32(0x80818283);

                    //Sim bonus
                    output.PutUInt32(bonus.SimBonus);

                    //Property bonus
                    output.PutUInt32(bonus.PropertyBonus);

                    //Visitor bonus
                    output.PutUInt32(bonus.VisitorBonus);

                    //Date string
                    output.PutPascalVLCString(bonus.Date);
                }
            }


            //Unknown
            //count
            output.PutUInt32(0x01);
            output.PutUInt32(0x94959697);
            output.PutUInt64(0x98999a9b9c9d9e9f);

            //Unknown
            //count
            output.PutUInt32(0x01);
            output.PutUInt32(0xa5a6a7a8);
            output.PutUInt32(0xa9aaabac);

            //Unknown
            //count
            output.PutUInt32(0x01);
            output.PutUInt16(0xb1b2);
            output.PutUInt16(0xb3b4);
            output.PutUInt32(0xb5b6b7b8);
            output.PutUInt16(0xb9ba);

            output.PutUInt16(0xbbbc);
            output.PutUInt16(0xbdbe);
            output.PutUInt32(0xbfc0c1c2);
            output.PutUInt32(0xc3c4c5c6);

            //Unknown
            //count
            output.PutUInt32(0x01);
            output.PutUInt32(0xcbcccdce);
            output.PutUInt32(0xcfd0d1d2);
            output.PutUInt32(0xd3d4d5d6);
            output.Put(0xd7);
            output.Put(0xd8);
            output.PutUInt32(0xd9dadbdc);
            output.PutUInt32(0xdddedfe0);
            output.PutUInt32(0xe1e2e3e4);

            //Unknown
            //count
            output.PutUInt32(0x01);
            output.PutUInt32(0xe9eaebec);
            output.PutUInt32(0xedeeeff0);
            output.PutUInt32(0xf1f2f3f4);
            output.Put(0xf5);
            output.Put(0xf6);
            output.PutUInt32(0xf7f8f9fa);
            output.PutUInt32(0xfbfcfdfe);
            output.PutUInt32(0xff808182);

            //Unknown
            //count
            output.PutUInt32(0x01);

            output.PutUInt32(0x8788898a);
            output.PutUInt16(0x8b8c);
            output.PutUInt32(0x8d8e8f90);
            output.PutUInt32(0x91929394);
            output.PutUInt32(0x95969798);
            output.PutUInt32(0x999a9b9c);

            //Unknown
            //count
            output.PutUInt32(0x01);
            output.PutUInt16(0x7071);
            output.PutUInt64(0x7273747576777879);

            //Unknown
            output.PutUInt32(0x7a7b7c7d);
            output.PutUInt32(0x7e7f6061);
            output.PutUInt32(0x62636465);
            output.PutUInt32(0x66676869);
            output.PutUInt32(0x6a6b6c6d);
            output.PutUInt32(0x6e6f5051);
            output.PutUInt32(0x52535455);
            output.PutUInt32(0x56575859);
            output.PutUInt32(0x69f4d5e8);
            output.PutUInt32(0x5e5f4041);
        }