private void SessionStop() { if (m_threadSession != null) { try { m_threadSession.RequestStopSync(); m_threadSession = null; } catch (Exception e) { Log(LogType.Fatal, e); } OnSessionStop(); WaitMessageClear(); Engine.Log(Engine.LogType.InfoImportant, Messages.SessionStop); //ConsoleExit(); } }
private void SessionStart() { try { Engine.Log(Engine.LogType.Info, Messages.SessionStart); Engine.Instance.WaitMessageSet(Messages.CheckingEnvironment, true); if (CheckEnvironment() == false) { WaitMessageClear(); } else { // Check Driver if (Platform.Instance.GetDriverAvailable() == "") { if (Platform.Instance.CanInstallDriver()) { Engine.Instance.WaitMessageSet(Messages.OsDriverInstall, false); Engine.Log(Engine.LogType.InfoImportant, Messages.OsDriverInstall); Platform.Instance.InstallDriver(); if (Platform.Instance.GetDriverAvailable() == "") throw new Exception(Messages.OsDriverFailed); } else throw new Exception(Messages.OsDriverCannotInstall); } if (m_threadSession != null) throw new Exception("Daemon already running."); if (Storage.UpdateManifestNeed(true)) { Engine.Instance.WaitMessageSet(Messages.RetrievingManifest, true); Engine.Log(Engine.LogType.Info, Messages.RetrievingManifest); string result = Engine.WaitManifestUpdate(); if (result != "") { if (Storage.UpdateManifestNeed(false)) { throw new Exception(result); } else { Log(LogType.Warning, Messages.ManifestFailedContinue); } } } OnSessionStart(); if (NextServer == null) { if (Engine.Storage.GetBool("servers.startlast")) NextServer = Engine.PickServer(Engine.Storage.Get("servers.last"), false); } m_threadSession = new Threads.Session(); } } catch (Exception e) { Log(LogType.Fatal, e); WaitMessageClear(); //ConsoleExit(); } }