Exemple #1
0
 public static void add(Simple_event eve)
 {
     if (eve == null || eve.run == null) return;
     simple_events.Add(eve);
     if (timer.IsEnabled == false)
     {
         timer.Tick += timer_Tick;
         timer.Start();
     }
 }
Exemple #2
0
 public Process e(String file_name, String arguments, Simple_event checker, DataReceivedEventHandler output, DataReceivedEventHandler error)
 {
     ProcessStartInfo psi = new ProcessStartInfo();
     Process p = new Process();
     psi.FileName = file_name;
     psi.RedirectStandardInput = true;
     if (output != null)
     {
         psi.RedirectStandardOutput = true;
         psi.StandardOutputEncoding = Encoding.UTF8;
         p.OutputDataReceived += output;
     }
     else psi.RedirectStandardOutput = false;
     if (error != null)
     {
         psi.RedirectStandardError = true;
         psi.StandardErrorEncoding = Encoding.UTF8;
         p.ErrorDataReceived += error;
     }
     psi.UseShellExecute = false;
     psi.CreateNoWindow = true;
     psi.Arguments = arguments;
     p.StartInfo = psi;
     p.Start();
     if (output != null) p.BeginOutputReadLine();
     if (error != null) p.BeginErrorReadLine();
     GlobalEvent.add(checker);
     return p;
 }