Festelo

Untitled

May 3rd, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.06 KB | None | 0 0
  1. using System.IO;
  2. using System.Diagnostics;
  3. using System.Threading;
  4. using System.Windows.Forms;
  5.  
  6. namespace ConsoleApplication2
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             if (args.Length == 0) { MessageBox.Show("ERROR#1","Компилятор // Festelo"); return; }
  13.             Process.Start(@"C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe", "\"" + args[0] + "\"");
  14.             bool A = false;
  15.             Process process = new Process();
  16.             int i = 0;
  17.             while (!A)
  18.             {
  19.                 try
  20.                 {
  21.                     process = Process.Start("\"" + args[0].Replace(".dev", ".exe" + "\""));
  22.                     A = true;
  23.                 }
  24.                 catch { A = false; Thread.Sleep(50); i++; if (i == 100) { MessageBox.Show("ERROR#2: Превышено время ожидания", "Компилятор // Festelo"); return; } }
  25.             }
  26.             process.WaitForExit();
  27.             File.Delete(args[0].Replace(".dev", ".exe"));
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment