private async void Button1_Click(object sender, EventArgs e) { mainForm.TopMost = true; DialogResult dr1 = MessageBox.Show("This automated process can take up to 10 minutes or more.\n" + "Please have at least ~1.5GB of disk space available." + "\nPress Yes to start install.", "RePlaysTV Installer", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information); if (dr1 == DialogResult.Yes) { await Installer.DownloadSetup(mainForm.richTextBox1); Installer.ListInstalledAntivirusProducts(mainForm.richTextBox1); Installer.StartExtract(SW); } mainForm.TopMost = false; }
static void Main(string[] args) { if (args.Length == 0) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Main(VERSION)); } else { // run as console app Console.WriteLine("Initializing Updater"); p = new Process(); p.StartInfo.FileName = "cmd.exe"; p.StartInfo.UseShellExecute = false; p.StartInfo.CreateNoWindow = true; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; p.StartInfo.StandardOutputEncoding = Encoding.UTF8; p.StartInfo.StandardErrorEncoding = Encoding.UTF8; p.OutputDataReceived += new DataReceivedEventHandler(SortOutputHandler); p.ErrorDataReceived += new DataReceivedEventHandler(SortOutputHandler); p.Start(); SW = p.StandardInput; SW.WriteLine("chcp 65001"); //set encoding p.BeginOutputReadLine(); p.BeginErrorReadLine(); workDirectory = args[0]; //args[0] - working dir passed from replays client //await Installer.DownloadSetup(); Installer.ListInstalledAntivirusProducts(); Installer.StartExtract(SW, workDirectory); mre.WaitOne(); } }