private void UpdateLoop() { bool lastHooked = false; while (true) { try { bool hooked = memory.HookProcess(); if (lastHooked != hooked) { lastHooked = hooked; this.Invoke((Action) delegate() { EnableStudio(hooked); }); } if (lastChanged.AddSeconds(0.6) < DateTime.Now) { lastChanged = DateTime.Now; this.Invoke((Action) delegate() { if ((!string.IsNullOrEmpty(tasText.LastFileName) || !string.IsNullOrEmpty(tasText.SaveToFileName)) && tasText.IsChanged) { tasText.SaveFile(); } }); } if (hooked) { UpdateValues(); } Thread.Sleep(14); } catch { } } }