@@ -23,30 +23,32 @@ public BuildFrm(string filename)
23
23
}
24
24
private void btnBrowse_Click ( object sender , EventArgs e )
25
25
{
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 ;
32
29
}
33
30
34
31
private void btnBuild_Click ( object sender , EventArgs e )
35
32
{
33
+ var substrstart = tbFile . Text . LastIndexOf ( "\\ " ) + 1 ;
34
+ var oname = tbFile . Text . Substring ( substrstart , tbFile . Text . LastIndexOf ( "." ) - substrstart ) ;
36
35
System . Diagnostics . Process BuildProcess = new System . Diagnostics . Process ( ) ;
37
36
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 ;
39
38
BuildProcess . StartInfo . CreateNoWindow = true ;
40
39
BuildProcess . StartInfo . UseShellExecute = false ;
41
40
BuildProcess . StartInfo . RedirectStandardOutput = true ;
41
+ BuildProcess . StartInfo . RedirectStandardError = true ;
42
42
BuildProcess . OutputDataReceived += new System . Diagnostics . DataReceivedEventHandler ( BuildOutputHandler ) ;
43
+ BuildProcess . ErrorDataReceived += new System . Diagnostics . DataReceivedEventHandler ( BuildOutputHandler ) ;
43
44
BuildProcess . Start ( ) ;
44
45
BuildProcess . BeginOutputReadLine ( ) ;
46
+ BuildProcess . BeginErrorReadLine ( ) ;
45
47
BuildProcess . WaitForExit ( ) ;
46
48
}
47
49
void BuildOutputHandler ( object sender , System . Diagnostics . DataReceivedEventArgs e )
48
50
{
49
- this . BeginInvoke ( new MethodInvoker ( ( ) => { tbBuildOutput . AppendText ( e . Data ?? string . Empty ) ; } ) ) ;
51
+ this . BeginInvoke ( new MethodInvoker ( ( ) => { tbBuildOutput . AppendText ( e . Data ?? string . Empty ) ; } ) ) ;
50
52
}
51
53
}
52
54
}
0 commit comments