static void Main(string[] args) { System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone(); customCulture.NumberFormat.NumberDecimalSeparator = "."; System.Threading.Thread.CurrentThread.CurrentCulture = customCulture; try { int num; if (int.TryParse(args[2], out num)) { Module_Main.StartConversion(args[0], args[1], double.Parse(args[2])); } else if (args[2] != null) { if (File.Exists(args[0]) && Directory.Exists(args[1].Substring(0, args[1].LastIndexOf("\\")))) { if (Module_Main.IsHPGL(args[0]) && !args[0].Contains(".cnc") && !args[0].Contains(".nc")) { Module_Main.StartConversion(args[0], args[1], double.Parse(args[2])); } else { Module_Main.RelativeArc = (args[2].ToLower() == "true") ? true : false; Converter conv = new Converter(new FileReader(args[0]).Lines, double.Parse(args[3])); ErrorHandler.FileName = args[0].Substring(0, args[0].IndexOf('.')) + ".txt"; conv.CreateProgram(); Class_Output outp = new Class_Output(); outp.OpenFile(args[1]); outp.OutputFileHeader(args[1]); for (int i = 0; i < conv.GetProgram.Count; i++) { conv.GetProgram[i].Write(outp); } outp.OutputFileEnd(); outp.CloseFile(); ErrorHandler.WriteOutputFile(); } } } else { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form_Main()); } } catch { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form_Main()); } }
public Conversion(string FileName, Class_Program Prog, Class_Output Output, BaseFunctions Functions, Dictionary <string, Func <string, bool> > FunctionDic) { this.FileName = FileName; this.Prog = Prog; this.Output = Output; TextHndlr = new HPGLTextHandler(); this.Functions = Functions; this.FunctionDic = FunctionDic; LogFile = new LogFileOutput(FileName); }
public Conversion(string FileName, Class_Program Prog, Class_Output Output) { this.FileName = FileName; this.Prog = Prog; this.Output = Output; TextHndlr = new HPGLTextHandler(); Functions = new BaseFunctions(this.Output); FunctionDic = TextHndlr.ConstructDictionary(Functions); LogFile = new LogFileOutput(FileName); }
public Conversion(string FileName, Class_Program Prog, Class_Output Ouput, BaseFunctions Functions) { this.FileName = FileName; this.Prog = Prog; this.Output = Module_Main.outp; TextHndlr = new HPGLTextHandler(); this.Functions = Functions; FunctionDic = TextHndlr.ConstructDictionary(Functions); LogFile = new LogFileOutput(FileName.Substring(0, FileName.IndexOf('.')) + ".txt"); }
public BaseFunctions(Class_Output Output) { TextHndlr = new TextHandler(); this.Output = Output; PenDown = false; RelativeCoord = false; SubFirst = true; SubOpen = false; BoxOpen = true; SubColors = new Dictionary <string, int>(); SubColors.Add("Zero", 0); }
private void btnOK_Click(object sender, EventArgs e) { try { if (File.Exists(txtboxInput.Text) && Directory.Exists(txtboxOutput.Text.Substring(0, txtboxOutput.Text.LastIndexOf("\\")))) { if (Module_Main.IsHPGL(txtboxInput.Text) && !txtboxInput.Text.Contains(".cnc") && !txtboxInput.Text.Contains(".nc")) { Module_Main.StartConversion(txtboxInput.Text, txtboxOutput.Text, double.Parse(txtboxScaling.Text)); } else { CNCType = cBoxCNC.Text; Converter conv = new Converter(new FileReader(txtboxInput.Text).Lines, double.Parse(txtboxScaling.Text)); ErrorHandler.FileName = txtboxInput.Text.Substring(0, txtboxInput.Text.IndexOf('.')) + ".txt"; conv.CreateProgram(); Class_Output outp = new Class_Output(); outp.OpenFile(txtboxOutput.Text); outp.OutputFileHeader(txtboxOutput.Text); for (int i = 0; i < conv.GetProgram.Count; i++) { conv.GetProgram[i].Write(outp); } outp.OutputFileEnd(); outp.CloseFile(); ErrorHandler.WriteOutputFile(); } MessageBox.Show("File succesfully converted.\nSaved file as " + txtboxOutput.Text + "\nLogfile saved as:" + txtboxOutput.Text.Substring(0, txtboxOutput.Text.Length - 1) + "txt\nDate: " + DateTime.UtcNow.ToLocalTime().ToString(), "(C) BCSI Systems BV CNC and HPGL Converter"); } else { MessageBox.Show("Input file or output folder was not found.", "(C) BCSI Systems BV CNC and HPGL Converter"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } Module_Main.types.Clear(); //Application.Restart(); }
public CNCFunctions(Class_Output Output) : base(Output) { this.Output = Output; }
public override void Write(Class_Output output) { output.OutputLine(Origen.X, Origen.Y, Destination.X, Destination.Y, Color, Depth); }
public override void Write(Class_Output output) { output.OutputArc(LastOrigen.X, LastOrigen.Y, Origen.X, Origen.Y, Distance.X, Distance.Y, Radius, Color, Depth); }
public virtual void Write(Class_Output output) { }
public HPGLFunctions(Class_Output Output, double Factor) : base(Output) { this.Factor = Factor; TextHndlr = new HPGLTextHandler(); }
public HPGLFunctions(Class_Output Output) : base(Output) { Factor = 100d; TextHndlr = new HPGLTextHandler(); }
public override void Write(Class_Output output) { try { switch (Program) { case SubPrograms.BOX: output.OutputBoxStart(Name.ToString()); if (InitializeNull) { output.OutputNullInstance(); } if (InnerSection) { output.OutputSectionStart(Name, Name); } break; case SubPrograms.SECTION: output.OutputSectionStart(Name, Name); break; default: output.OutputSectionStart(Name, Name); break; } for (int i = 0; i < Content.Length; i++) { if (Content[i] != null) { Content[i].Write(output); } } switch (Program) { case SubPrograms.BOX: if (InnerSection) { output.OutputSectionEnd(); } output.OutputBoxEnd(); break; case SubPrograms.SECTION: output.OutputSectionEnd(); break; default: output.OutputSectionEnd(); break; } } catch (Exception e) { ErrorHandler.AddMessage(e); } }
public override void Write(Class_Output output) { output.OutputInstance(Index, Origen.X, Origen.Y); }