private void tmrUpdate_Tick(object sender, EventArgs e) { if (dsProcess == null) { if (DSProcess.GetProcess(out dsProcess)) { lblAttachedValue.Text = dsProcess.Remastered ? "DSR" : "PTDE"; tmrUpdate.Interval = (int)(1000.0 / (double)nudHertz.Value); } } else { if (dsProcess.Alive()) { updateDataGrids(); } else { dsProcess.Close(); dsProcess = null; lblAttachedValue.Text = "None"; tmrUpdate.Interval = 1000; } } }
public static bool GetProcess(out DSProcess dsProcess) { foreach (Process process in Process.GetProcesses()) { try { if (process.MainWindowTitle == "DARK SOULS") { dsProcess = new DSProcess(process, false); return(true); } else if (process.MainWindowTitle == "DARK SOULS™: REMASTERED") { dsProcess = new DSProcess(process, true); return(true); } } catch { } } dsProcess = null; return(false); }