Beispiel #1
0
        public void Write(NodeWriter writer, NodeEntry node)
        {
            var data = (ItemDropStorage)node.Value;

            writer.WritePackedString(data.UnknownString);
            writer.Write(data.HeaderBytes);
            InventoryParser.WriteSubInventory(writer, data.Inventory);
        }
        public object Read(NodeEntry node, BinaryReader reader, List <INodeParser> parsers)
        {
            var result = new ItemDropStorage();

            reader.Skip(4); // Skip Id

            result.UnknownString = ParserUtils.ReadString(reader);
            result.HeaderBytes   = reader.ReadBytes(25);
            result.Inventory     = InventoryParser.ReadSubInventory(node, 0, reader, parsers);

            return(result);
        }
Beispiel #3
0
        public object Read(NodeEntry node, BinaryReader reader, List <INodeParser> parsers)
        {
            node.Parser = this;
            node.WritesOwnTrailingSize = false;
            var result = new ItemDropStorage();

            reader.Skip(4); // Skip Id

            result.UnknownString = reader.ReadPackedString();
            result.HeaderBytes   = reader.ReadBytes(25);
            result.Inventory     = InventoryParser.ReadSubInventory(node, 0, reader, parsers);

            result.Node = node;
            return(result);
        }
        public byte[] Write(NodeEntry node, List <INodeParser> parsers)
        {
            byte[] result;
            var    data = (ItemDropStorage)node.Value;

            using (var stream = new MemoryStream())
            {
                using (var writer = new BinaryWriter(stream, Encoding.ASCII))
                {
                    writer.Write(node.Id);
                    ParserUtils.WriteString(writer, data.UnknownString);
                    writer.Write(data.HeaderBytes);
                    InventoryParser.WriteSubInventory(node, 0, writer, data.Inventory, parsers);
                }
                result = stream.ToArray();
            }
            return(result);
        }