//*** OPTIONS PAGE ******* private void OptionsPagePrintHandler(Service data) { Console.SetCursorPosition(10, 5); Console.WriteLine("Target Executables: "); ConsoleEx.WriteLine(); exeViewList.Items.Clear(); exeViewList.X = 10; exeViewList.Y = Console.CursorTop; exeViewList.Width = Console.WindowWidth - (exeViewList.X * 2); exeViewList.Height = Console.WindowHeight - exeViewList.Y - 7; /////DEBUG///// //if (service.Executables.Count == 0) //{ // for (int i = 0; i < 10000; i++) // { // service.Executables.Add(new Executable("exe.displayname_" + i + ".exe", "#" + i + " [exe.displayname]")); // } //} /////DEBUG///// foreach (Executable exe in service.Executables) { exeViewList.Items.Add(exe.DisplayName); } exeViewList.Print(); Console.SetCursorPosition(0, Console.WindowHeight - 6); if (service.Executables.Count > 0) { ConsoleEx.WriteLine(" " + ConsoleEx.CutText(service.Executables[exeViewList.SelectionIndex].ExecutablePath, exeViewList.Width), ConsoleColor.White); } else { ConsoleEx.WriteLine(); } }
//*** ADD EXE PAGE ******* private void AddExePagePrintHandler(Service data) { string exeName = "(none)"; string windowTitle = ""; if (data.CapturedExecutableAvailable) { exeName = data.LastCapturedExecutable.DisplayName; windowTitle = data.GetWindowTitle(data.LastCapturedWindowHandle); } if (windowTitle.Equals("")) windowTitle = "(none)"; else windowTitle = ConsoleEx.CutText(windowTitle, Console.WindowWidth - 20); Console.SetCursorPosition(0, 6); ConsoleEx.WriteKeyValueLine(" Executable", exeName, ConsoleColor.White); ConsoleEx.WriteLine(); ConsoleEx.WriteKeyValueLine(" Window title", windowTitle, ConsoleColor.White); ConsoleEx.WriteLine(); ConsoleEx.WriteLine(); ConsoleEx.WriteLine(); ConsoleEx.WriteLineCenter("- Switch to the program, which should be added to the list -", ConsoleColor.Yellow); ConsoleEx.WriteLine(); ConsoleEx.WriteLine(); ConsoleEx.WriteLine(); }
//*** MAIN PAGE ********** private void MainPagePrintHandler(Service data) { string exeName = data.CurrentExecutable.DisplayName; if (data.CurrentExecutable.Equals(data.ServiceExecutable)) exeName = "(this)"; Console.SetCursorPosition(0, 6); ConsoleEx.WriteKeyValueLine(" State", service.Active ? "Active" : "Stoped", service.Active ? ConsoleColor.Green : ConsoleColor.Red); ConsoleEx.WriteLine(); ConsoleEx.WriteKeyValueLine(" Executable", exeName, ConsoleColor.White); ConsoleEx.WriteLine(); ConsoleEx.WriteKeyValueLine(" Cursor Lock", service.IsLockActive ? "Active" : "Inactive", service.IsLockActive ? ConsoleColor.Yellow : ConsoleColor.White); ConsoleEx.WriteLine(); ConsoleEx.WriteKeyValueLine(" Cursor", String.Format("{0,5}, {1,5}", service.CursorPosition.X, service.CursorPosition.Y), ConsoleColor.White); ConsoleEx.WriteLine(); if (data.IsCurrentExecutableMatching) { ConsoleEx.WriteKeyValueLine(" Bounds", String.Format("{0,5}, {1,5}, {2,5}, {3,5}", service.CurrentWindowBounds.Left, service.CurrentWindowBounds.Top, service.CurrentWindowBounds.Right, service.CurrentWindowBounds.Bottom), ConsoleColor.White); ConsoleEx.WriteLine(); } else { ConsoleEx.WriteLine(); } }