Exemple #1
0
        private static void MultiMerge(string file1, List <string> otherfiles, string output, ProgressLog Log)
        {
            int MM = Log.PushActivity("Excellon MultiMerge");

            if (File.Exists(file1) == false)
            {
                Log.AddString(String.Format("{0} not found! stopping process!", file1));
                Log.PopActivity(MM);
                return;
            }
            foreach (var otherfile in otherfiles)
            {
                if (File.Exists(otherfile) == false)
                {
                    Log.AddString(String.Format("{0} not found! stopping process!", otherfile));
                    Log.PopActivity(MM);
                    return;
                }
            }

            Log.AddString(String.Format("Reading {0}:", file1));
            ExcellonFile File1Parsed = new ExcellonFile();

            File1Parsed.Load(Log, file1);
            List <ExcellonFile> OtherFilesParsed = new List <ExcellonFile>();

            foreach (var otherfile in otherfiles)
            {
                Log.AddString(String.Format("Reading {0}:", otherfile));
                ExcellonFile OtherFileParsed = new ExcellonFile();
                OtherFileParsed.Load(Log, otherfile);
                OtherFilesParsed.Add(OtherFileParsed);
            }
            int MaxID = 0;

            foreach (var D in File1Parsed.Tools)
            {
                if (D.Value.ID > MaxID)
                {
                    MaxID = D.Value.ID + 1;
                }
            }
            foreach (var F in OtherFilesParsed)
            {
                foreach (var D in F.Tools)
                {
                    File1Parsed.AddToolWithHoles(D.Value);;
                    //                D.Value.ID += MaxID;
                    //              File1Parsed.Tools[D.Value.ID] = D.Value;
                }
            }
            File1Parsed.Write(output, 0, 0, 0, 0);

            Log.PopActivity(MM);
        }
Exemple #2
0
        private static void MultiMerge(string file1, List <string> otherfiles, string output, IProgressLog log)
        {
            if (File.Exists(file1) == false)
            {
                Console.WriteLine("{0} not found! stopping process!", file1);
                return;
            }
            foreach (var otherfile in otherfiles)
            {
                if (File.Exists(otherfile) == false)
                {
                    Console.WriteLine("{0} not found! stopping process!", otherfile);
                    return;
                }
            }

            Console.WriteLine("*** Reading {0}:", file1);
            ExcellonFile file1Parsed = new ExcellonFile();

            file1Parsed.Load(file1);
            List <ExcellonFile> otherFilesParsed = new List <ExcellonFile>();

            foreach (var otherfile in otherfiles)
            {
                Console.WriteLine("*** Reading {0}:", otherfile);
                ExcellonFile otherFileParsed = new ExcellonFile();
                otherFileParsed.Load(otherfile);
                otherFilesParsed.Add(otherFileParsed);
            }
            int maxID = 0;

            foreach (var D in file1Parsed.Tools)
            {
                if (D.Value.ID > maxID)
                {
                    maxID = D.Value.ID + 1;
                }
            }
            foreach (var F in otherFilesParsed)
            {
                foreach (var D in F.Tools)
                {
                    file1Parsed.AddToolWithHoles(D.Value);;
                    // D.Value.ID += MaxID;
                    // File1Parsed.Tools[D.Value.ID] = D.Value;
                }
            }
            file1Parsed.Write(output, 0, 0, 0, 0);
        }