Ejemplo n.º 1
0
        public static void MergeAll(List <string> files, string output, IProgressLog log)
        {
            BOMFile result = null;

            foreach (string fileName in files)
            {
                BOMFile bomFile = new BOMFile();
                log.AddString(String.Format("Reading {0}", fileName));
                bomFile.Load(fileName);
                log.AddString(String.Format("Merging {0}", fileName));
                if (result == null)
                {
                    result = bomFile;
                }
                else
                {
                    result.Merge(bomFile);
                }
            }
            log.AddString(String.Format("Writing {0}", output));
            result.WriteCsv(output);
        }
Ejemplo n.º 2
0
        public void Merge(BOMFile other)
        {
            List <BOMLine> updatedComponents = other.UpdateReferences(ComputeAllDesignators());

            foreach (BOMLine element in updatedComponents)
            {
                BOMLine existingElement;
                if (components.TryGetValue(element, out existingElement))
                {
                    existingElement.designators.AddRange(element.designators);
                }
                else
                {
                    components.Add(element);
                }
            }
            foreach (var h in other.header)
            {
                if (!header.ContainsKey(h.Key))
                {
                    header[h.Key] = h.Value;
                }
            }
        }