public void ProcessIsRunningReturnsFalseForNonExistantProcess() { var processFinder = new ProcessFinder(); var result = processFinder.ProcessIsRunning(-1, Guid.NewGuid().ToString()); Assert.That(result, Is.EqualTo(GetExpectedResult())); }
public th06(Process Game) { this.Game = Game; ClientID = "446970252773949440"; SubTitle = "Embodiment of Scarlet Devil"; ProgramName = "th06"; StageOffset = 0x29D6D4; CharacterOffset = 0x29D4BD; SpellOffset = 0x29D4BE; DifficultyOffset = 0x29BCB0; IsPauseOffset = 0x29D4BF; StatusOffset = 0x29D4C1; IsInGameOffset = 0x29D4C1; Init(); WorkerTimer.Elapsed += (sender, e) => { if (Game.HasExited) { WorkerTimer.Stop(); ProcessFinder.ProcessClose(); return; } bool isPause = IsPause; if (IsInGame || isPause) { if (!IsPlaying) { IsPlaying = true; Presence.Details = StatusString + " " + CharSpellString; Presence.Timestamps.Start = PlayTime = DateTime.UtcNow; return; } Presence.State = DiffChap; if (!WasPause && isPause) { WasPause = true; Presence.Details = "Pausing " + CharSpellString; Presence.Timestamps.Start = DateTime.UtcNow; } else if (WasPause && !isPause) { WasPause = false; Presence.Details = StatusString + " " + CharSpellString; Presence.Timestamps.Start = (PlayTime += DateTime.UtcNow - Presence.Timestamps.Start); } } else { IsPlaying = false; Presence.Details = "In Main Menu"; Presence.Timestamps.Start = PlayTime = null; Presence.State = null; } UpdatePresence(); }; WorkerTimer.Start(); }
public void ProcessIsRunningReturnsTrueForCurrentProcess() { var processFinder = new ProcessFinder(); var currentProcess = System.Diagnostics.Process.GetCurrentProcess(); var result = processFinder.ProcessIsRunning(currentProcess.Id, currentProcess.ProcessName); Assert.That(result, Is.True); }
static void Main(string[] args) { var cSharpMem = new cSharpMemory(ProcessFinder.GetProcessByName("portal_knights_x64")); IntPtr address = new IntPtr(0x17FC1B8CBE0); cSharpMem.WriteASCII(address, "Hello"); Console.ReadLine(); }
private void processCBox_DropDownOpened(object sender, EventArgs e) { ProcessFinder procList = new ProcessFinder(processCBox.Text); string[] procNames = procList.GetProcList(); foreach (string procName in procNames) { processCBox.Items.Add(procName); } }
public int KillIEProcesses() { var killCount = 0; var processFinder = new ProcessFinder(); var processes = processFinder.FindByName("iexplore"); foreach (var ieProcess in processes) { ieProcess.Kill(); killCount++; } return(killCount); }
private void Application_Startup(object sender, StartupEventArgs e) { if (ProcessFinder.IsProcessAlreadyRunning()) { //if (e.Args.Any() // Check if args contain any data // && e.Args[0].StartsWith("nxm", StringComparison.OrdinalIgnoreCase)) // Check to see if it contains correct data //{ // NamedPipes.SendMessage(e.Args[0]); //} //// We only want one instance of Automaton running at one time //Environment.Exit(0); } }
public void ProcessFinderTests_NoDefaultShellPath_ReturnsDefaultPlatformSpecificShell() { var procFinder = new ProcessFinder(new RepositoryManagementConfiguration()); using (var shell = procFinder.GetShell()) { shell.Start(); if (System.Environment.OSVersion.Platform == PlatformID.Win32NT) { Assert.AreEqual("cmd", shell.ProcessName); } else { Assert.AreEqual("bash", shell.ProcessName); } } }
public async Task CheckForVPN() { ProcessFinder pFndr = new ProcessFinder(processCBox.Text); if (pFndr.found) // if we find the vpn. { content = "Found the VPN!"; runningLbl.Content = "FOUND"; runningLbl.Foreground = Brushes.Red; } else if (!pFndr.found) { content = "Didn't find VPN. Fap on..."; runningLbl.Content = "NOT FND"; runningLbl.Foreground = Brushes.Green; } //det = new VPNDetection(); }
private string DescribeCLRVersions(IProcessInfo process) { try { var versions = ProcessFinder.EnumerateClrVersions(process).Select(v => $"{v.Major}.{v.Minor}").Distinct().ToArray(); if (!versions.Any()) { return("-"); } return(String.Join(", ", versions)); } catch (Requires32BitEnvironmentException) { return("(unknown, 32-bit)"); } catch (Requires64BitEnvironmentException) { return("(unknown, 64-bit)"); } }
/// <summary> /// Sends a message, regardless to the auto type and it's settings.. /// </summary> /// <param name="text"></param> /// <param name="OnlyInSpecificProcess"> </param> /// <returns>Succeeded sending the message to the specific process. if OnlyInSpecificProcess = false, returns true always</returns> public bool SendMessage(string text, bool OnlyInSpecificProcess = false) { if (Disposed || (OnlyInSpecificProcess == true && ProcessBeingFocused == null)) { return(false); } var FocusedProc = ProcessFinder.GetForegroundProcess(); if (Process.GetCurrentProcess().Id == FocusedProc.Id) { return(false); } if (!OnlyInSpecificProcess || FocusedProc.Id == ProcessBeingFocused.UniqueID) { KeySender.SendText(text); KeySender.PressKey(KeyCode.Return); return(true); } return(false); }
/// <summary> /// Handles a key press event /// </summary> private void OnKeyPress(BaseKeyboardManager sender, HotkeyEventArgs args) { //handles which process was it hit on, var topmost = ProcessFinder.GetForegroundProcess().ToProcessInfo(); var topmost_log = ActiveLogs.FirstOrDefault(log => log.Process.Equals(topmost)); if (topmost_log == null) { ActiveLogs.Add(topmost_log = new ProcessLog() { Process = topmost }); topmost_log.LineClosed += line => LineClosed?.Invoke(line); } //Convert Hotkey to LogKey - includes in keyboardlayout var lk = new LogKey { Key = args.Hotkey.Key, Modifiers = args.Hotkey.Modifiers, KeyboardLayout = KeyboardLanguage.GetCurrentKeyboardLayout() }; //67699721 hebrew? topmost_log.AddContent(lk); }
private void processSelectBox_Changed(object sender, SelectionChangedEventArgs e) { ProcessFinder pFndr = new ProcessFinder(processCBox.Text); }