public static Document ReadDocument(StarReader reader) { Document doc = new Document(); doc.Name = reader.ReadString(); reader.ReadByte(); doc.Version = DataConverter.BigEndian.GetInt32(reader.ReadBytes(4), 0); doc.Data = (StarVariant)PacketSerializer.Deserialize(reader, typeof(StarVariant)); return(doc); }
public Metadata GetMetadata() { if (Metadata != null) { return(Metadata); } using (StarReader reader = new StarReader(GetRaw(new byte[] { 0, 0, 0 }))) { var unpacked = DataConverter.Unpack("^ii", reader.ReadBytes(8), 0); //unknown Document doc = Document.ReadDocument(reader); if (doc.Name != "WorldMetadata") { throw new Exception("Invalid world data!"); } Metadata = new Metadata(doc.Data, doc.Version); return(Metadata); } }