コード例 #1
0
ファイル: SchLibReader.cs プロジェクト: vehar/AltiumSharp
        /// <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);
        }
コード例 #2
0
ファイル: SchLibRenderer.cs プロジェクト: Fermium/AltiumSharp
 public SchLibRenderer(SchLibHeader header, Dictionary <string, Image> embeddedImages)
 {
     _header         = header;
     _embeddedImages = embeddedImages;
     Part            = 1;
 }