public override void Read(System.IO.BinaryReader reader) { base.Read(reader); guid = new uidkey(reader); lastLogin = new DateTime(reader.ReadInt64()); createDate = new DateTime(reader.ReadInt64()); email = reader.ReadString(); password = reader.ReadString(); }
public void Write(BinaryWriter writer) { if (obj == null) { return; } Type type = obj.GetType(); if (type == typeof(uidkey)) { writer.Write((byte)ValueTypeID.UIDKey); uidkey k = Cast <uidkey>(); writer.Write(k.a); writer.Write(k.b); writer.Write(k.c); writer.Write(k.d); return; } if (type == typeof(int)) { writer.Write((byte)ValueTypeID.Int); writer.Write(Cast <int>()); return; } if (type == typeof(bool)) { writer.Write((byte)ValueTypeID.Bool); writer.Write(Cast <bool>()); return; } if (type == typeof(float)) { writer.Write((byte)ValueTypeID.Float); writer.Write(Cast <float>()); return; } if (type == typeof(uint)) { writer.Write((byte)ValueTypeID.UInt); writer.Write(Cast <uint>()); return; } if (type == typeof(ulong)) { writer.Write((byte)ValueTypeID.ULong); writer.Write(Cast <ulong>()); return; } if (type == typeof(string)) { writer.Write((byte)ValueTypeID.String); writer.Write(Cast <string>()); return; } if (type == typeof(Transform3D)) { writer.Write((byte)ValueTypeID.Transform3D); { Vector3 v = Cast <Transform3D>().position; writer.Write(v.x); writer.Write(v.y); writer.Write(v.z); } { Quaternion v = Cast <Transform3D>().rotation; writer.Write(v.x); writer.Write(v.y); writer.Write(v.z); writer.Write(v.w); } { Vector3 v = Cast <Transform3D>().localScale; writer.Write(v.x); writer.Write(v.y); writer.Write(v.z); } return; } if (type == typeof(Value[])) { writer.Write((byte)ValueTypeID.Array); Value[] array = Cast <Value[]>(); writer.Write((int)array.Length); for (int i = 0; i < array.Length; i++) { array[i].Write(writer); } return; } if (type == typeof(ValueMap)) { writer.Write((byte)ValueTypeID.ValueMap); byte[] data = Cast <ValueMap>().ToByteArray(); writer.Write((int)data.Length); writer.Write(data); return; } #if UNITY_ENGINE if (type == typeof(Color)) { writer.Write((byte)ValueTypeID.Color); Color c = Cast <Color>(); writer.Write(c.r); writer.Write(c.g); writer.Write(c.b); writer.Write(c.a); } if (type == typeof(Vector2)) { writer.Write((byte)ValueTypeID.Vector2); Vector2 v = Cast <Vector2>(); writer.Write(v.x); writer.Write(v.y); } if (type == typeof(Vector3)) { writer.Write((byte)ValueTypeID.Vector3); Vector3 v = Cast <Vector3>(); writer.Write(v.x); writer.Write(v.y); writer.Write(v.z); } if (type == typeof(Quaternion)) { writer.Write((byte)ValueTypeID.Quaternion); Quaternion v = Cast <Quaternion>(); writer.Write(v.x); writer.Write(v.y); writer.Write(v.z); writer.Write(v.w); } #endif }