/// <summary> /// Reads the "FileHeader" section which contains the list of components that /// exist in the current library file. /// </summary> /// <returns></returns> private List <string> ReadFileHeader() { var refNames = new List <string>(); BeginContext("FileHeader"); using (var reader = Cf.GetStream("FileHeader").GetBinaryReader()) { var parameters = ReadBlock(reader, size => ReadParameters(reader, size)); Header = new SchLibHeader(); Header.ImportFromParameters(parameters); if (reader.BaseStream.Position == reader.BaseStream.Length) { // If we're at the end of the stream then read components // from the parameters list refNames.AddRange(Header.Comp.Select(c => c.LibRef)); } else { // Otherwise we can read the binary list of components var count = reader.ReadUInt32(); for (var i = 0; i < count; ++i) { var componentRefName = ReadStringBlock(reader); refNames.Add(componentRefName); } } } EndContext(); return(refNames); }
public SchLibRenderer(SchLibHeader header, Dictionary <string, Image> embeddedImages) { _header = header; _embeddedImages = embeddedImages; Part = 1; }