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; }
public TaskManager(CharacterProfile profile) { Profile = profile; WowManager = new WowManager(profile); HonorbuddyManager = new HonorbuddyManager(profile); Tasks = profile.Tasks; StartupSequenceIsComplete = IsRunning = false; HonorbuddyManager.OnStartupSequenceIsComplete += HonorbuddyManager_OnStartupSequenceIsComplete; }
public void Dispose() { lock (LockObject) { if (_wowProcess != null && !_wowProcess.HasExitedSafe()) { _wowProcess.Kill(); } _wowProcess = null; _launcherPid = 0; _lockOwner = null; } }
private WowLockToken(string key, DateTime startTime, WowManager lockOwner) { _startTime = startTime; _lockOwner = lockOwner; _key = key; }
public ConfigWtf(WowManager wowManager, string path) { _wowManager = wowManager; _path = path; Load(); }