Esempio n. 1
0
        /// <summary>
        /// Dont forget to close streams after read.
        /// </summary>
        /// <param name="headerStream"></param>
        /// <param name="indexStream"></param>
        /// <returns>Processed node count</returns>
        public int Build()
        {
            PrepareForBuild();

            TrieSerializer.SerializeHeaderWithJsonSerializer(_headerStream, _header);

            var processedNodeCount = TrieSerializer.SerializeIndexWithBinaryWriter(_trie.Root, _header, _indexStream);

            return(processedNodeCount);
        }
Esempio n. 2
0
        public static void CreateHeaderFile(this TrieIndexHeader header, string path)
        {
            Stream stream = new FileStream(
                path,
                FileMode.OpenOrCreate,
                FileAccess.Write,
                FileShare.None
                );

            TrieSerializer.SerializeHeaderWithJsonSerializer(stream, header);

            //stream.Close();
            stream.Dispose();
            stream = null;
        }