From 044770f7ec4f527b2788b2f3120d22b03176c53a Mon Sep 17 00:00:00 2001 From: Samson Date: Mon, 9 Nov 2015 11:44:51 -0500 Subject: [PATCH] Fixed file building, hopefully. --- Ev3DL/Build.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Ev3DL/Build.cs b/Ev3DL/Build.cs index 7529c71..9a6422f 100644 --- a/Ev3DL/Build.cs +++ b/Ev3DL/Build.cs @@ -23,30 +23,32 @@ public BuildFrm(string filename) } private void btnBrowse_Click(object sender, EventArgs e) { - openFileDialog1.ShowDialog(this); - } - private void openFileDialog1_FileOk(object sender , CancelEventArgs e) - { - var v = sender as OpenFileDialog; - tbFile.Text = v.FileName; + DialogResult r = openFileDialog1.ShowDialog(this); + if (r == DialogResult.OK) + tbFile.Text = openFileDialog1.FileName; } private void btnBuild_Click(object sender, EventArgs e) { + var substrstart= tbFile.Text.LastIndexOf("\\")+1; + var oname = tbFile.Text.Substring(substrstart,tbFile.Text.LastIndexOf(".")-substrstart); System.Diagnostics.Process BuildProcess = new System.Diagnostics.Process(); BuildProcess.StartInfo.FileName = @"C:\CSLITE\bin\arm-none-linux-gnueabi-g++.exe"; - BuildProcess.StartInfo.Arguments = "--version"; + BuildProcess.StartInfo.Arguments = "-o "+oname+".o "+ tbFile.Text; BuildProcess.StartInfo.CreateNoWindow = true; BuildProcess.StartInfo.UseShellExecute = false; BuildProcess.StartInfo.RedirectStandardOutput = true; + BuildProcess.StartInfo.RedirectStandardError = true; BuildProcess.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(BuildOutputHandler); + BuildProcess.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(BuildOutputHandler); BuildProcess.Start(); BuildProcess.BeginOutputReadLine(); + BuildProcess.BeginErrorReadLine(); BuildProcess.WaitForExit(); } void BuildOutputHandler(object sender, System.Diagnostics.DataReceivedEventArgs e) { - this.BeginInvoke(new MethodInvoker(() => { tbBuildOutput.AppendText(e.Data ?? string.Empty); })); + this.BeginInvoke(new MethodInvoker(() => { tbBuildOutput.AppendText(e.Data ?? string.Empty);})); } } }