public static WowLockToken RequestLock(WowManager wowManager, out string reason) { reason = string.Empty; WowLockToken ret; string key = wowManager.Settings.WowPath.ToUpper(); lock (LockObject) { var now = DateTime.Now; bool throttled = now - _lastLockTime < TimeSpan.FromSeconds(HbRelogManager.Settings.WowDelay); if (throttled) { reason = "Waiting to start WoW"; return null; } if (LockInfos.ContainsKey(key)) { var lockInfo = LockInfos[key]; var locked = lockInfo._lockOwner != null && lockInfo._lockOwner != wowManager; if (locked) { reason = string.Format("Waiting on profile: {0} to release lock", lockInfo._lockOwner.Profile.Settings.ProfileName); return null; } } _lastLockTime = now; ret = LockInfos[key] = new WowLockToken(key, DateTime.Now, wowManager); } return ret; }