public static ANode Deserialize(System.IO.BinaryReader aReader) { BinaryTag type = (BinaryTag)aReader.ReadByte(); switch (type) { case BinaryTag.Array: { int count = aReader.ReadInt32(); Array tmp = new Array(); for (int i = 0; i < count; i++) { tmp.Add(Deserialize(aReader)); } return(tmp); } case BinaryTag.Class: { int count = aReader.ReadInt32(); Class tmp = new Class(); for (int i = 0; i < count; i++) { string key = aReader.ReadString(); var val = Deserialize(aReader); tmp.Add(key, val); } return(tmp); } case BinaryTag.Value: { return(new Data(aReader.ReadString())); } case BinaryTag.IntValue: { return(new Data(aReader.ReadInt32())); } case BinaryTag.DoubleValue: { return(new Data(aReader.ReadDouble())); } case BinaryTag.BoolValue: { return(new Data(aReader.ReadBoolean())); } case BinaryTag.FloatValue: { return(new Data(aReader.ReadSingle())); } default: { throw new Exception("Error deserializing Unknown tag: " + type); } } }
private void InnerWrite(BinaryTag tag, byte[] buffer) { this.InnerWrite(tag); this.InnerWrite(buffer); }
/// <summary>Handles the base input for a tag.</summary> /// <param name="data">The tag data.</param> /// <returns>The correct object.</returns> public static BinaryTag HandleOne(TagData data) { return(BinaryTag.CreateFor(data.GetModifierObjectCurrent(), data)); }
private void InnerWrite(BinaryTag tag) { this._Stream.WriteByte((byte)tag); }