public TagIndex(CacheStream cache, IReadOnlyList <string> paths) : base(cache) { var binaryReader = new BinaryReader(cache); _classes = new List <TagClassHeirarchy>(new TagClassHeirarchy[classArrayCount]); for (var i = 0; i < classArrayCount; i++) { _classes[i] = new TagClassHeirarchy(binaryReader.ReadTagClass(), binaryReader.ReadTagClass(), binaryReader.ReadTagClass()); } _data = new List <TagDatum>(new TagDatum[datumArrayCount]); var cacheKey = CacheKey.Create(cache); for (var i = 0; i < datumArrayCount && i < paths.Count; i++) { TagDatum data; do { data = new TagDatum { Class = binaryReader.ReadTagClass( ), Identifier = binaryReader.ReadTagIdent( ), VirtualAddress = binaryReader.ReadInt32( ), Length = binaryReader.ReadInt32( ), CacheKey = cacheKey }; } while (TagDatum.IsNull(data)); data.Path = paths[i]; _data[i] = data; } }
private static void WriteTagHeirarchy(BinaryWriter binaryWriter, TagClassHeirarchy tagClassHeirarchy) { binaryWriter.Write(tagClassHeirarchy.Class); binaryWriter.Write(tagClassHeirarchy.Parent); binaryWriter.Write(tagClassHeirarchy.Root); }