public void Main() { Thread.Sleep(1000); if ((Boolean)(ActGlobals.oFormActMain.GetType().GetField("inCombat", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(ActGlobals.oFormActMain))) { return; } c.UpdateText("Cleared encounters at " + DateTime.Now.ToString(CultureInfo.CurrentCulture)); ActGlobals.oFormActMain.GetType().GetMethod("btnClear_Click", BindingFlags.NonPublic | BindingFlags.Instance) .Invoke(ActGlobals.oFormActMain, new object[] { null, null }); }
public void Main() { while (true) { Process[] p = Process.GetProcessesByName("ffxiv_dx11"); if (p.Length == 0) { p = Process.GetProcessesByName("ffxiv"); } if (p.Length > 0) { c.UpdateText("Process found " + p[0].ProcessName + "(" + p[0].Id + "), now waiting for exit"); p[0].WaitForExit(); ActGlobals.oFormActMain.Close(); break; } else { c.UpdateText("Process not found, waiting for process"); Thread.Sleep(3000); } } }