Пример #1
0
        public void ReadFile(String fileName)
        {
            FileName = fileName;
            StreamReader libFile = new StreamReader(FileName);

            Version = libFile.ReadLine();
            Components.Clear();
            do
            {
                KicadLibComponent component = new KicadLibComponent();
                if (component.Parse(libFile))
                {
                    Components.Add(component);
                }
            } while (!libFile.EndOfStream);
            libFile.Close();
            //read documentation file

            FileInfo fInfo    = new FileInfo(fileName);
            String   docuFile = fInfo.Directory + "\\" + fInfo.Name.Replace(fInfo.Extension, ".dcm");

            if (File.Exists(docuFile))
            {
                libFile  = new StreamReader(docuFile);
                Version2 = libFile.ReadLine();
                //Documentation.Clear();
                do
                {
                    KicadLibDocu component = new KicadLibDocu();
                    if (component.Parse(libFile))
                    {
                        // Documentation.Add(component);
                        foreach (KicadLibComponent cmp in Components)
                        {
                            if (cmp.Definition.Name == component.CmpName)
                            {
                                cmp.Documentation = component;
                            }
                        }
                    }
                } while (!libFile.EndOfStream);
                libFile.Close();
            }
        }
Пример #2
0
 public void AddComponent(KicadLibComponent component)
 {
     Components.Add(component);
 }