public MainGui createMainMenu() { //original ManagedSpy menu var fileMenu = this.menuStrip1.add_MenuItem("File") .add_MenuItem("Start as Admin ", () => Application.ExecutablePath.str().startProcess_AsAdmin()) .add_MenuItem("Exit", () => Application.Exit()); var viewMenu = this.menuStrip1.add_MenuItem("View") //.add_MenuItem("Filter Events", () => this.filterEventsToolStripMenuItem_Click(null, null)) .add_MenuItem("Show Window", () => this.showWindowToolStripMenuItem_Click(null, null)) .add_MenuItem("Refresh", () => this.RefreshWindows()); this.ShowNative = viewMenu.add_MenuItem("Show Native Windows", () => { }); this.ShowNative.CheckOnClick = true; var helpMenu = this.menuStrip1.add_MenuItem("Help") .add_MenuItem("About ManagedSpy", () => this.aboutManagedSpyToolStripMenuItem_Click(null, null));; //Extra menu items this.menuStrip1.add_MenuItem("Sample Apps") .add_MenuItem("Open Simple TextEditor", () => MainGui_ExtensionMethods.TestFile1.startProcess()); this.menuStrip1.add_MenuItem("REPL") .add_MenuItem("REPL CurrentProcess", () => Current_Process.script_Me()) .add_MenuItem("REPL MainGui", () => this.script_Me()) .add_MenuItem("Insert MainGui REPL in Gui", () => this.insert_Below_Script_Me(this)) .add_MenuItem("Log Viewer", () => open.logViewer()); return(this); }
public MainGui createProcessListContextMenu() { this.treeWindow.add_ContextMenu() .add_MenuItem("Main Window - Always on Top", true, () => Current_Process.MainWindowHandle.window_AlwaysOnTop()) .add_MenuItem("Start new Process ", true, () => Current_Process.MainModule.FileName.startProcess()) .add_MenuItem("Start new Process (as Admin)", true, () => Current_Process.MainModule.FileName.startProcess_AsAdmin()) .add_MenuItem("Stop Process", true, () => Current_Process.Kill()) ; return(this); }
private void Web_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) { if (Current_Process.InvokeRequired) { Current_Process.Invoke(new Action(() => { Current_Process.Value = int.Parse(e.BytesReceived.ToString()); })); Total_Progress.Invoke(new Action(() => { Total_Progress.Value = before + int.Parse(e.BytesReceived.ToString()); })); Total_Downloaded.Invoke(new Action(() => { Total_Downloaded.Text = Downloaded_Amount_Neat(Total_Progress.Value, Total_Downloaded.Text); })); } else { Current_Process.Value = int.Parse(e.BytesReceived.ToString()); Total_Progress.Value = before + int.Parse(e.BytesReceived.ToString()); Total_Downloaded.Text = Downloaded_Amount_Neat(Total_Progress.Value, Total_Downloaded.Text); } taskbar.SetProgressValue(Total_Progress.Value, Total_Progress.Maximum); }
private void Wait_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e) { Speed.Start(); taskbar.SetProgressState(TaskbarProgressBarState.Normal); if (Current_Process.InvokeRequired) { Current_Process.Invoke(new Action(() => { Current_Process.Style = ProgressBarStyle.Continuous; })); } else { Current_Process.Style = ProgressBarStyle.Continuous; } if (Files != null) { ChangeProcessText("Deleting old program files"); Current_Process.Maximum = Files.Length; foreach (string file in Files) { File.Delete(file); Current_Process.Value++; } } Download.RunWorkerAsync(); }
private void Download_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { using (WebClient web = new WebClient()) { string type = "https"; string rem = ""; int max; ChangeProcessText("Getting update info"); try { rem = web.DownloadString($"{type}://jacobtech.org/Programs/Files/{RemoteDir}"); } catch (Exception ex) { if (ex.Message == "Unable to connect to the remote server") { try { type = "http"; rem = web.DownloadString($"{type}://jacobtech.org/Programs/Files/{RemoteDir}"); } catch (Exception ex2) { MessageBox.Show(ex2.Message); } } else { MessageBox.Show(ex.Message); } } try { max = int.Parse(web.DownloadString($"{type}://jacobtech.org/Programs/GetSize/{RemoteDir}")); web.DownloadProgressChanged += Web_DownloadProgressChanged; web.DownloadFileCompleted += Web_DownloadFileCompleted; Total_Downloaded.Invoke(new Action(() => { Total_Downloaded.Text = TotalDownloadAmmountNeat(max); })); foreach (string file in rem.Split('|')) { bool good = true; while (good) { while (!web.IsBusy) { string[] split = file.Split('.'); string fill = ""; foreach (string fillll in split) { fill = fill + fillll + Uri.EscapeDataString("|"); } fill = fill.Remove(fill.Length - Uri.EscapeDataString("|").Length, Uri.EscapeDataString("|").Length); string uri = $"{type}://jacobtech.org/Programs/GetFileSize/{RemoteDir}{Uri.EscapeDataString("|")}{fill}"; fil = int.Parse(web.DownloadString(uri)); if (Current_Process.InvokeRequired) { Total_Progress.Invoke(new Action(() => { Total_Progress.Maximum = max; })); string file2 = Uri.UnescapeDataString(file); Current_Process.Invoke(new Action(() => { Current_Process.Maximum = int.Parse(web.DownloadString(uri)); })); } else { Total_Progress.Maximum = max; Current_Process.Maximum = int.Parse(web.DownloadString(uri)); } string name = file.Replace("%20", " ").Replace("%28", "(").Replace("%29", ")"); Uri u = new Uri($"{type}://jacobtech.org/Programs/{RemoteDir}/Files/{file}"); ChangeProcessText($"Downloading {name}"); web.DownloadFileAsync(u, name); good = false; break; } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }