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