public void Deactivation(bool onExit) { if (m_current != null) { if (onExit == false) { Engine.Instance.WaitMessageSet(Messages.NetworkLockDeactivation, false); Engine.Instance.Log(Engine.LogType.InfoImportant, Messages.NetworkLockDeactivation); } else { Engine.Instance.Log(Engine.LogType.Verbose, Messages.NetworkLockDeactivation); } try { m_current.Deactivation(); } catch (Exception e) { Engine.Instance.Log(e); } m_current = null; } // TOCLEAN, < 2.9 /* * if(onExit == false) * Engine.Instance.Storage.SetBool("netlock", false); */ Recovery.Save(); }
public virtual bool OnRouteDefaultRemoveRestore() { if (m_routeDefaultRemove != null) { m_routeDefaultRemove.Add(); m_routeDefaultRemove = null; Recovery.Save(); } return(true); }
public void Activation() { try { if (m_current != null) { throw new Exception(Messages.NetworkLockUnexpectedAlreadyActive); } NetworkLockPlugin nextCurrent = null; string requestedMode = Engine.Instance.Storage.Get("netlock.mode"); if (requestedMode != "none") { foreach (NetworkLockPlugin plugin in Modes) { if ((requestedMode == "auto") || (requestedMode == plugin.GetCode())) { nextCurrent = plugin; break; } } } if (nextCurrent == null) { Engine.Instance.Log(Engine.LogType.Fatal, Messages.NetworkLockNoMode); } else { string message = Messages.NetworkLockActivation + " - " + nextCurrent.GetName(); Engine.Instance.WaitMessageSet(message, false); Engine.Instance.Log(Engine.LogType.InfoImportant, message); nextCurrent.Activation(); m_current = nextCurrent; } // Engine.Instance.Storage.SetBool("netlock", true); // TOCLEAN, < 2.9 } catch (Exception e) { Engine.Instance.Log(Engine.LogType.Fatal, e); // Engine.Instance.Storage.SetBool("netlock", false); // TOCLEAN, < 2.9 } Recovery.Save(); }
public virtual void OnVpnDisconnected() { if (m_current != null) { try { m_current.OnVpnDisconnected(); Recovery.Save(); } catch (Exception e) { Engine.Instance.Log(e); } } }
public void OnUpdateIps() { if (m_current != null) { try { m_current.OnUpdateIps(); Recovery.Save(); } catch (Exception e) { Engine.Instance.Log(e); } } }
public virtual bool OnRouteDefaultRemoveDo() { List <RouteEntry> routeEntries = RouteList(); foreach (RouteEntry routeEntry in routeEntries) { if (routeEntry.Mask.ToString() == "0.0.0.0") { m_routeDefaultRemove = routeEntry; routeEntry.Remove(); Recovery.Save(); } } return(true); }