Skip to content

Commit 044770f

Browse files
author
Samson
committed
Fixed file building, hopefully.
1 parent 44fdac0 commit 044770f

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

Ev3DL/Build.cs

+10-8
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,32 @@ public BuildFrm(string filename)
2323
}
2424
private void btnBrowse_Click(object sender, EventArgs e)
2525
{
26-
openFileDialog1.ShowDialog(this);
27-
}
28-
private void openFileDialog1_FileOk(object sender , CancelEventArgs e)
29-
{
30-
var v = sender as OpenFileDialog;
31-
tbFile.Text = v.FileName;
26+
DialogResult r = openFileDialog1.ShowDialog(this);
27+
if (r == DialogResult.OK)
28+
tbFile.Text = openFileDialog1.FileName;
3229
}
3330

3431
private void btnBuild_Click(object sender, EventArgs e)
3532
{
33+
var substrstart= tbFile.Text.LastIndexOf("\\")+1;
34+
var oname = tbFile.Text.Substring(substrstart,tbFile.Text.LastIndexOf(".")-substrstart);
3635
System.Diagnostics.Process BuildProcess = new System.Diagnostics.Process();
3736
BuildProcess.StartInfo.FileName = @"C:\CSLITE\bin\arm-none-linux-gnueabi-g++.exe";
38-
BuildProcess.StartInfo.Arguments = "--version";
37+
BuildProcess.StartInfo.Arguments = "-o "+oname+".o "+ tbFile.Text;
3938
BuildProcess.StartInfo.CreateNoWindow = true;
4039
BuildProcess.StartInfo.UseShellExecute = false;
4140
BuildProcess.StartInfo.RedirectStandardOutput = true;
41+
BuildProcess.StartInfo.RedirectStandardError = true;
4242
BuildProcess.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(BuildOutputHandler);
43+
BuildProcess.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(BuildOutputHandler);
4344
BuildProcess.Start();
4445
BuildProcess.BeginOutputReadLine();
46+
BuildProcess.BeginErrorReadLine();
4547
BuildProcess.WaitForExit();
4648
}
4749
void BuildOutputHandler(object sender, System.Diagnostics.DataReceivedEventArgs e)
4850
{
49-
this.BeginInvoke(new MethodInvoker(() => { tbBuildOutput.AppendText(e.Data ?? string.Empty); }));
51+
this.BeginInvoke(new MethodInvoker(() => { tbBuildOutput.AppendText(e.Data ?? string.Empty);}));
5052
}
5153
}
5254
}

0 commit comments

Comments
 (0)