public void Write(BinaryWriter bw) { bw.Write((byte)BINUtilities.PackType(this.EntryType)); bw.Write(GetContentSize()); bw.Write(this.Values.Count); foreach (BINValue value in this.Values) { value.Write(bw, false); } }
public void Write(BinaryWriter bw) { bw.Write((byte)this.KeyType); bw.Write((byte)BINUtilities.PackType(this.ValueType)); bw.Write(GetContentSize()); bw.Write(this.Values.Count); foreach (KeyValuePair <BINValue, BINValue> pair in this.Values) { pair.Key.Write(bw, false); pair.Value.Write(bw, false); } }
public void Write(BinaryWriter bw, bool writeType) { if (writeType) { bw.Write(this.Property); bw.Write((byte)BINUtilities.PackType(this.Type.Value)); } if (this.Type == BINValueType.None) { } else if (this.Type == BINValueType.Boolean) { bw.Write((bool)this.Value); } else if (this.Type == BINValueType.SByte) { bw.Write((sbyte)this.Value); } else if (this.Type == BINValueType.Byte) { bw.Write((byte)this.Value); } else if (this.Type == BINValueType.Int16) { bw.Write((short)this.Value); } else if (this.Type == BINValueType.UInt16) { bw.Write((ushort)this.Value); } else if (this.Type == BINValueType.Int32) { bw.Write((int)this.Value); } else if (this.Type == BINValueType.UInt32) { bw.Write((uint)this.Value); } else if (this.Type == BINValueType.Int64) { bw.Write((long)this.Value); } else if (this.Type == BINValueType.UInt64) { bw.Write((ulong)this.Value); } else if (this.Type == BINValueType.Float) { bw.Write((float)this.Value); } else if (this.Type == BINValueType.FloatVector2) { ((Vector2)this.Value).Write(bw); } else if (this.Type == BINValueType.FloatVector3) { ((Vector2)this.Value).Write(bw); } else if (this.Type == BINValueType.FloatVector4) { (this.Value as Vector4).Write(bw); } else if (this.Type == BINValueType.Matrix44) { (this.Value as R3DMatrix44).Write(bw); } else if (this.Type == BINValueType.Color) { bw.WriteColor((Color)(this.Value), ColorFormat.RgbaU8); } else if (this.Type == BINValueType.String) { string value = this.Value as string; bw.Write((ushort)value.Length); bw.Write(Encoding.ASCII.GetBytes(value)); } else if (this.Type == BINValueType.Hash) { bw.Write((uint)this.Value); } else if (this.Type == BINValueType.Container) { (this.Value as BINContainer).Write(bw); } else if (this.Type == BINValueType.Structure || this.Type == BINValueType.Embedded) { (this.Value as BINStructure).Write(bw); } else if (this.Type == BINValueType.LinkOffset) { bw.Write((uint)this.Value); } else if (this.Type == BINValueType.Optional) { (this.Value as BINOptional).Write(bw); } else if (this.Type == BINValueType.Map) { (this.Value as BINMap).Write(bw); } else if (this.Type == BINValueType.FlagsBoolean) { bw.Write((bool)this.Value); } }
public void Write(BinaryWriter bw) { bw.Write((byte)BINUtilities.PackType(this.Type)); bw.Write(this.Value == null ? (byte)0 : (byte)1); this.Value?.Write(bw, false); }