// Comment the next line to get GOLD settings //#define SimplIQ_Settings using System; using System.Collections.Generic; using System.Linq; using System.Text; using ElmoMotionControlComponents.Drive.EASComponents.DriveCompiler; using System.Threading; using System.Diagnostics; namespace DriveDotNetCompileUserProgram { class Program { static bool Done = true; static Random _r = new Random(); static readonly int MAX_OPTIONS = 6; static void Main(string[] args) { int count = 50000; ConsoleKeyInfo k = new ConsoleKeyInfo(); while (k.KeyChar != 'x' && count > 0) { while (!Done) { Thread.Sleep(200); } int num = _r.Next() % MAX_OPTIONS; CompilerSettings settings = CreateSettings(num); var resp = DriveCompiler.Build(settings, OnCompilerRespopnce); if (resp != null && resp.Response == ResponseType.InProcess) { while (!Done) { Thread.Sleep(100); } Console.WriteLine("Exit Compile ... }"); } else { Console.WriteLine(resp.ToString()); Thread.Sleep(200); } while (!Done) { Thread.Sleep(200); } count--; } } private static CompilerSettings CreateSettings(int num) { CompilerSettings ret; switch (num) { case 0: Console.WriteLine("# {0} - SimplIQ Compile", num); ret = new CompilerSettings() { ProgramPath = @"..\..\Data\000000.ehl", PersonalityPath = @"..\..\Data\SimplIQ_2.02.09.50 09Aug2012.xml", CompilerFolder = @"c:\temp\compilers\dspcompiler", ApplyPersonalityInfo = false, ForceRecreationOfCompilerFiles = false, ProgramImagePath = @"c:\temp\output\000000.img", }; break; case 1: Console.WriteLine("# {0} - SimplIQ Compile", num); ret = new CompilerSettings() { ProgramPath = @"..\..\Data\MoveProject.ehl", PersonalityPath = @"..\..\Data\SimplIQ_2.02.09.50 09Aug2012.xml", CompilerFolder = @"c:\temp\compilers\dspcompiler", ApplyPersonalityInfo = false, ForceRecreationOfCompilerFiles = false, ProgramImagePath = @"c:\temp\output\MoveProject.img", }; break; case 2: Console.WriteLine("# {0} - Gold_01.01.04.83 17June2012B02G", num); ret = new CompilerSettings() { ProgramPath = @"..\..\Data\000000.ehl", PersonalityPath = @"..\..\Data\Gold_01.01.04.83 17June2012B02G.xml", CompilerFolder = @"c:\temp\compilers\1", ApplyPersonalityInfo = true, ForceRecreationOfCompilerFiles = true, ProgramImagePath = @"c:\temp\output\000000.img", }; break; case 3: Console.WriteLine("# {0} - Gold_01.01.04.83 17June2012B02G", num); ret = new CompilerSettings() { ProgramPath = @"..\..\Data\MoveProject.ehl", PersonalityPath = @"..\..\Data\Gold_01.01.04.83 17June2012B02G.xml", CompilerFolder = @"c:\temp\compilers\1", ApplyPersonalityInfo = true, ForceRecreationOfCompilerFiles = true, ProgramImagePath = @"c:\temp\output\MoveProject.img", }; break; case 4: Console.WriteLine("# {0} - Gold_01.01.04.83 17June2012B02G", num); ret = new CompilerSettings() { ProgramPath = @"..\..\Data\MoveProject.ehl", PersonalityPath = @"..\..\Data\Gold_01.01.04.83 17June2012B02G.xml", CompilerFolder = @"c:\temp\compilers\1", ApplyPersonalityInfo = true, ForceRecreationOfCompilerFiles = true, ProgramImagePath = @"c:\temp\output\MoveProject.img", DebugMode=false, }; break; default: Console.WriteLine("# {0} - Gold_01.01.04.83 17June2012B02G",num); ret = new CompilerSettings() { ProgramPath = @"..\..\Data\MoveProject.ehl", PersonalityPath = @"..\..\Data\Gold_01.01.04.83 17June2012B02G.xml", CompilerFolder = @"c:\temp\compilers\Default", ApplyPersonalityInfo = true, ForceRecreationOfCompilerFiles = true, ProgramImagePath = @"c:\temp\output\MoveProject.img", }; break; } return ret; } private static void OnCompilerRespopnce(CompileResponse response) { ConsoleColor oldColor = Console.ForegroundColor; try { if (response.Response == ResponseType.Error) { Console.ForegroundColor = ConsoleColor.Red; } string msg = string.Format("{2} >>>{0}>>> {1}", response.Id, response.ToString(),DateTime.Now.ToString("hh:mm:ss.FFF")); Console.WriteLine(msg); Debug.WriteLine(msg); //if (response.Response == ResponseType.Success || response.Response == ResponseType.Error) // Done = true; if (response.Response == ResponseType.Finish) { Console.WriteLine("finished compiling"); Done = true; } } finally { Console.ForegroundColor = oldColor; } } } }