Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.IO;
- using System.Diagnostics;
- using System.Threading;
- using System.Windows.Forms;
- namespace ConsoleApplication2
- {
- class Program
- {
- static void Main(string[] args)
- {
- if (args.Length == 0) { MessageBox.Show("ERROR#1","Компилятор // Festelo"); return; }
- Process.Start(@"C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe", "\"" + args[0] + "\"");
- bool A = false;
- Process process = new Process();
- int i = 0;
- while (!A)
- {
- try
- {
- process = Process.Start("\"" + args[0].Replace(".dev", ".exe" + "\""));
- A = true;
- }
- catch { A = false; Thread.Sleep(50); i++; if (i == 100) { MessageBox.Show("ERROR#2: Превышено время ожидания", "Компилятор // Festelo"); return; } }
- }
- process.WaitForExit();
- File.Delete(args[0].Replace(".dev", ".exe"));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment