Let's see...
Some preliminary considerations before actually getting into runnung the compiler:
If you've ever used DarkEDIT, you know how under the menu options EDIT > Edit Options > DarkBASIC Options, the user can input the location of the DarkBASIC main program : DB.exe? Well, somewhere in the setup of your IDE, you should have something similar where the user can setup the location of this file. You want your IDE to know where this file is located, so maybe this information is stored in an .ini file or some custom file that you create.
Anyway, once the IDE has the location of the DB.exe file, you can program the IDE to make the necessary batch files or run the compiler when a key pressed.
Let's say you want to check the syntax of the DBC code that's being worked on (compile using F4). The sequence of events should go something like this:
The user presses F4 and
1. Automatically save a copy of code being worked on with some kind of temporary extension. This is so the code can be tested without saving the REAL code yet. So let's say your temporary extension is .tmp , you could save the name of this file as
darkcreator.tmp (everytime you save a temporary file you would use this name)
2. Instead of using a batch file, let's invoke the compiler directly using the full path to DB.exe , the command switch, and the input file (the temporary file). Let's say Db.exe is in C:\DarkBASIC . The code in C# might look like this:
System.Diagnostics.Process.Start(@"C:\DarkBASIC\DB.exe -c darkcreator.tmp");
I'm assuming darkcreator.tmp is being saved in the current directory - if you want, you can include the full path wherever that may be:
System.Diagnostics.Process.Start(@"C:\DarkBASIC\DB.exe -c C:\DarkCREATOR\darkcreator.tmp");
If you want to create a batch file, then create a text file with the top line reading:
"C:\DarkBASIC\DB.exe -c darkcreator.tmp"
and save it as DC.bat
Then run the C# code:
System.Diagnostics.Process.Start(@"C:\DC.bat");
Of course you'll want to include the proper directory of where ever you saved DC.bat
Enjoy your day.