Exemplo n.º 1
0
        /// <summary>
        /// Writes the contents of a binary loyc file to the current output stream.
        /// </summary>
        /// <param name="Nodes"></param>
        public void WriteFileContents(IReadOnlyList <LNode> Nodes)
        {
            using (var memStream = new MemoryStream())
                using (var childWriter = new LoycBinaryWriter(memStream, this))
                {
                    var state = new WriterState();
                    childWriter.WriteList(Nodes, node => childWriter.WritePrefixedNode(state, node));

                    memStream.Seek(0, SeekOrigin.Begin);

                    WriteHeader(state);
                    memStream.CopyTo(Writer.BaseStream);
                }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Writes a reference to the given node template.
 /// </summary>
 /// <param name="State"></param>
 /// <param name="Value"></param>
 public void WriteReference(WriterState State, NodeTemplate Value)
 {
     WriteULeb128((uint)State.GetIndex(Value));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Writes the given header to the output stream.
 /// </summary>
 /// <param name="Header"></param>
 public void WriteHeader(WriterState Header)
 {
     WriteSymbolTable(Header.Symbols);
     WriteTemplateTable(Header.Templates);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Writes a reference to the given string.
 /// </summary>
 /// <param name="State"></param>
 /// <param name="Value"></param>
 public void WriteReference(WriterState State, string Value)
 {
     WriteULeb128((uint)State.GetIndex(Value));
 }