void ReleaseDesignerOutlets() { if (CboAdvancedManifestRefresh != null) { CboAdvancedManifestRefresh.Dispose(); CboAdvancedManifestRefresh = null; } if (CboDnsSwitchMode != null) { CboDnsSwitchMode.Dispose(); CboDnsSwitchMode = null; } if (CboGeneralOsxInterfaceStyle != null) { CboGeneralOsxInterfaceStyle.Dispose(); CboGeneralOsxInterfaceStyle = null; } if (CboIpV6 != null) { CboIpV6.Dispose(); CboIpV6 = null; } if (LblIPv6 != null) { LblIPv6.Dispose(); LblIPv6 = null; } if (CboLockIncoming != null) { CboLockIncoming.Dispose(); CboLockIncoming = null; } if (CboLockMode != null) { CboLockMode.Dispose(); CboLockMode = null; } if (CboLockOutgoing != null) { CboLockOutgoing.Dispose(); CboLockOutgoing = null; } if (CboNetworkEntryInterface != null) { CboNetworkEntryInterface.Dispose(); CboNetworkEntryInterface = null; } if (CboOpenVpnDirectivesHelp != null) { CboOpenVpnDirectivesHelp.Dispose(); CboOpenVpnDirectivesHelp = null; } if (CboOpenVpnDirectivesSkipDefault != null) { CboOpenVpnDirectivesSkipDefault.Dispose(); CboOpenVpnDirectivesSkipDefault = null; } if (CboOpenVpnRcvBuf != null) { CboOpenVpnRcvBuf.Dispose(); CboOpenVpnRcvBuf = null; } if (CboOpenVpnSndBuf != null) { CboOpenVpnSndBuf.Dispose(); CboOpenVpnSndBuf = null; } if (CboProtocolIPEntry != null) { CboProtocolIPEntry.Dispose(); CboProtocolIPEntry = null; } if (CboProxyAuthentication != null) { CboProxyAuthentication.Dispose(); CboProxyAuthentication = null; } if (CboProxyType != null) { CboProxyType.Dispose(); CboProxyType = null; } if (LblNetworkIPv4Mode != null) { LblNetworkIPv4Mode.Dispose(); LblNetworkIPv4Mode = null; } if (LblNetworkIPv6Mode != null) { LblNetworkIPv6Mode.Dispose(); LblNetworkIPv6Mode = null; } if (CboNetworkIPv4Mode != null) { CboNetworkIPv4Mode.Dispose(); CboNetworkIPv4Mode = null; } if (CboNetworkIPv6Mode != null) { CboNetworkIPv6Mode.Dispose(); CboNetworkIPv6Mode = null; } if (CboProxyWhen != null) { CboProxyWhen.Dispose(); CboProxyWhen = null; } if (LblRoutesOtherwise != null) { LblRoutesOtherwise.Dispose(); LblRoutesOtherwise = null; } if (CboRoutesOtherwise != null) { CboRoutesOtherwise.Dispose(); CboRoutesOtherwise = null; } if (CboUiUnit != null) { CboUiUnit.Dispose(); CboUiUnit = null; } if (ChkAdvancedCheckRoute != null) { ChkAdvancedCheckRoute.Dispose(); ChkAdvancedCheckRoute = null; } if (ChkAdvancedExpertMode != null) { ChkAdvancedExpertMode.Dispose(); ChkAdvancedExpertMode = null; } if (ChkAdvancedNetworkLocking != null) { ChkAdvancedNetworkLocking.Dispose(); ChkAdvancedNetworkLocking = null; } if (ChkAdvancedPingerEnabled != null) { ChkAdvancedPingerEnabled.Dispose(); ChkAdvancedPingerEnabled = null; } if (ChkAdvancedProviders != null) { ChkAdvancedProviders.Dispose(); ChkAdvancedProviders = null; } if (ChkAdvancedSkipAlreadyRun != null) { ChkAdvancedSkipAlreadyRun.Dispose(); ChkAdvancedSkipAlreadyRun = null; } if (ChkConnect != null) { ChkConnect.Dispose(); ChkConnect = null; } if (ChkDnsCheck != null) { ChkDnsCheck.Dispose(); ChkDnsCheck = null; } if (ChkExitConfirm != null) { ChkExitConfirm.Dispose(); ChkExitConfirm = null; } if (ChkGeneralOsxNotifications != null) { ChkGeneralOsxNotifications.Dispose(); ChkGeneralOsxNotifications = null; } if (ChkGeneralOsxVisible != null) { ChkGeneralOsxVisible.Dispose(); ChkGeneralOsxVisible = null; } if (ChkGeneralStartLast != null) { ChkGeneralStartLast.Dispose(); ChkGeneralStartLast = null; } if (ChkLockAllowDNS != null) { ChkLockAllowDNS.Dispose(); ChkLockAllowDNS = null; } if (ChkLockAllowPing != null) { ChkLockAllowPing.Dispose(); ChkLockAllowPing = null; } if (ChkLockAllowPrivate != null) { ChkLockAllowPrivate.Dispose(); ChkLockAllowPrivate = null; } if (ChkLoggingEnabled != null) { ChkLoggingEnabled.Dispose(); ChkLoggingEnabled = null; } if (ChkLogLevelDebug != null) { ChkLogLevelDebug.Dispose(); ChkLogLevelDebug = null; } if (ChkNetLock != null) { ChkNetLock.Dispose(); ChkNetLock = null; } if (ChkProtocolsAutomatic != null) { ChkProtocolsAutomatic.Dispose(); ChkProtocolsAutomatic = null; } if (ChkRouteRemoveDefaultGateway != null) { ChkRouteRemoveDefaultGateway.Dispose(); ChkRouteRemoveDefaultGateway = null; } if (ChkUiIEC != null) { ChkUiIEC.Dispose(); ChkUiIEC = null; } if (ChkUiSystemBarShowInfo != null) { ChkUiSystemBarShowInfo.Dispose(); ChkUiSystemBarShowInfo = null; } if (ChkUiSystemBarShowServer != null) { ChkUiSystemBarShowServer.Dispose(); ChkUiSystemBarShowServer = null; } if (ChkUiSystemBarShowSpeed != null) { ChkUiSystemBarShowSpeed.Dispose(); ChkUiSystemBarShowSpeed = null; } if (CmdAdvancedEventsClear != null) { CmdAdvancedEventsClear.Dispose(); CmdAdvancedEventsClear = null; } if (CmdAdvancedEventsEdit != null) { CmdAdvancedEventsEdit.Dispose(); CmdAdvancedEventsEdit = null; } if (CmdAdvancedHelp != null) { CmdAdvancedHelp.Dispose(); CmdAdvancedHelp = null; } if (CmdAdvancedOpenVpnPath != null) { CmdAdvancedOpenVpnPath.Dispose(); CmdAdvancedOpenVpnPath = null; } if (CmdCancel != null) { CmdCancel.Dispose(); CmdCancel = null; } if (CmdDnsAdd != null) { CmdDnsAdd.Dispose(); CmdDnsAdd = null; } if (CmdDnsEdit != null) { CmdDnsEdit.Dispose(); CmdDnsEdit = null; } if (CmdDnsRemove != null) { CmdDnsRemove.Dispose(); CmdDnsRemove = null; } if (CmdGeneralTos != null) { CmdGeneralTos.Dispose(); CmdGeneralTos = null; } if (CmdLockHelp != null) { CmdLockHelp.Dispose(); CmdLockHelp = null; } if (CmdLoggingOpen != null) { CmdLoggingOpen.Dispose(); CmdLoggingOpen = null; } if (CmdOpenVpnDirectivesCustomPathBrowse != null) { CmdOpenVpnDirectivesCustomPathBrowse.Dispose(); CmdOpenVpnDirectivesCustomPathBrowse = null; } if (CmdOpenVpnDirectivesHelp != null) { CmdOpenVpnDirectivesHelp.Dispose(); CmdOpenVpnDirectivesHelp = null; } if (CmdProtocolsHelp1 != null) { CmdProtocolsHelp1.Dispose(); CmdProtocolsHelp1 = null; } if (CmdProtocolsHelp2 != null) { CmdProtocolsHelp2.Dispose(); CmdProtocolsHelp2 = null; } if (CmdProxyTorHelp != null) { CmdProxyTorHelp.Dispose(); CmdProxyTorHelp = null; } if (CmdProxyTorTest != null) { CmdProxyTorTest.Dispose(); CmdProxyTorTest = null; } if (CmdResetToDefault != null) { CmdResetToDefault.Dispose(); CmdResetToDefault = null; } if (CmdRouteAdd != null) { CmdRouteAdd.Dispose(); CmdRouteAdd = null; } if (CmdRouteEdit != null) { CmdRouteEdit.Dispose(); CmdRouteEdit = null; } if (CmdRouteRemove != null) { CmdRouteRemove.Dispose(); CmdRouteRemove = null; } if (CmdSave != null) { CmdSave.Dispose(); CmdSave = null; } if (LblAdvancedProviders != null) { LblAdvancedProviders.Dispose(); LblAdvancedProviders = null; } if (LblDnsServers != null) { LblDnsServers.Dispose(); LblDnsServers = null; } if (LblLockRoutingOutWarning != null) { LblLockRoutingOutWarning.Dispose(); LblLockRoutingOutWarning = null; } if (LblLoggingHelp != null) { LblLoggingHelp.Dispose(); LblLoggingHelp = null; } if (LblOpenVpnRcvBuf != null) { LblOpenVpnRcvBuf.Dispose(); LblOpenVpnRcvBuf = null; } if (LblOpenVpnSndBuf != null) { LblOpenVpnSndBuf.Dispose(); LblOpenVpnSndBuf = null; } if (LblRoutesNetworkLockWarning != null) { LblRoutesNetworkLockWarning.Dispose(); LblRoutesNetworkLockWarning = null; } if (TableAdvancedEvents != null) { TableAdvancedEvents.Dispose(); TableAdvancedEvents = null; } if (TableDnsServers != null) { TableDnsServers.Dispose(); TableDnsServers = null; } if (TableProtocols != null) { TableProtocols.Dispose(); TableProtocols = null; } if (TableRoutes != null) { TableRoutes.Dispose(); TableRoutes = null; } if (TableTabs != null) { TableTabs.Dispose(); TableTabs = null; } if (TabMain != null) { TabMain.Dispose(); TabMain = null; } if (TxtAdvancedOpenVpnDirectivesCustom != null) { TxtAdvancedOpenVpnDirectivesCustom.Dispose(); TxtAdvancedOpenVpnDirectivesCustom = null; } if (TxtAdvancedOpenVpnDirectivesDefault != null) { TxtAdvancedOpenVpnDirectivesDefault.Dispose(); TxtAdvancedOpenVpnDirectivesDefault = null; } if (TxtAdvancedOpenVpnPath != null) { TxtAdvancedOpenVpnPath.Dispose(); TxtAdvancedOpenVpnPath = null; } if (TxtLockAllowedIPS != null) { TxtLockAllowedIPS.Dispose(); TxtLockAllowedIPS = null; } if (TxtLoggingComputedPath != null) { TxtLoggingComputedPath.Dispose(); TxtLoggingComputedPath = null; } if (TxtLoggingPath != null) { TxtLoggingPath.Dispose(); TxtLoggingPath = null; } if (TxtOpenVpnDirectivesCustomPath != null) { TxtOpenVpnDirectivesCustomPath.Dispose(); TxtOpenVpnDirectivesCustomPath = null; } if (TxtProxyHost != null) { TxtProxyHost.Dispose(); TxtProxyHost = null; } if (TxtProxyLogin != null) { TxtProxyLogin.Dispose(); TxtProxyLogin = null; } if (TxtProxyPassword != null) { TxtProxyPassword.Dispose(); TxtProxyPassword = null; } if (TxtProxyPort != null) { TxtProxyPort.Dispose(); TxtProxyPort = null; } if (TxtProxyTorControlPassword != null) { TxtProxyTorControlPassword.Dispose(); TxtProxyTorControlPassword = null; } if (TxtProxyTorControlPort != null) { TxtProxyTorControlPort.Dispose(); TxtProxyTorControlPort = null; } }
void ReadOptions() { Storage s = Engine.Instance.Storage; // General GuiUtils.SetCheck(ChkConnect, s.GetBool("connect")); GuiUtils.SetCheck(ChkNetLock, s.GetBool("netlock")); GuiUtils.SetCheck(ChkGeneralStartLast, s.GetBool("servers.startlast")); GuiUtils.SetCheck(ChkGeneralOsxVisible, s.GetBool("gui.osx.visible")); // GuiUtils.SetCheck (ChkGeneralOsxDock, s.GetBool ("gui.osx.dock")); // See this FAQ: https://airvpn.org/topic/13331-its-possible-to-hide-the-icon-in-dock-bar-under-os-x/ GuiUtils.SetCheck(ChkGeneralOsxNotifications, s.GetBool("gui.osx.notifications")); GuiUtils.SetCheck(ChkUiSystemBarShowInfo, s.GetBool("gui.osx.sysbar.show_info")); GuiUtils.SetCheck(ChkUiSystemBarShowSpeed, s.GetBool("gui.osx.sysbar.show_speed")); GuiUtils.SetCheck(ChkUiSystemBarShowServer, s.GetBool("gui.osx.sysbar.show_server")); GuiUtils.SetCheck(ChkExitConfirm, s.GetBool("gui.exit_confirm")); // UI string uiUnit = s.Get("ui.unit"); if (uiUnit == "bytes") { GuiUtils.SetSelected(CboUiUnit, Messages.WindowsSettingsUiUnit1); } else if (uiUnit == "bits") { GuiUtils.SetSelected(CboUiUnit, Messages.WindowsSettingsUiUnit2); } else { GuiUtils.SetSelected(CboUiUnit, Messages.WindowsSettingsUiUnit0); } GuiUtils.SetCheck(ChkUiIEC, s.GetBool("ui.iec")); /* * string interfaceMode = GuiUtils.InterfaceColorMode (); * if (interfaceMode == "Dark") * GuiUtils.SetSelected (CboGeneralOsxInterfaceStyle,"Dark"); * else * GuiUtils.SetSelected (CboGeneralOsxInterfaceStyle,"Default"); */ // Protocols String protocol = s.Get("mode.protocol").ToUpperInvariant(); int port = s.GetInt("mode.port"); int entryIP = s.GetInt("mode.alt"); if (protocol == "AUTO") { GuiUtils.SetCheck(ChkProtocolsAutomatic, true); } else { bool found = false; int iRow = 0; foreach (TableProtocolsControllerItem itemProtocol in TableProtocolsController.Items) { if ((itemProtocol.Protocol == protocol) && (itemProtocol.Port == port) && (itemProtocol.IP == entryIP)) { found = true; TableProtocols.SelectRow(iRow, false); TableProtocols.ScrollRowToVisible(iRow); break; } iRow++; } if (found == false) { GuiUtils.SetCheck(ChkProtocolsAutomatic, true); } else { GuiUtils.SetCheck(ChkProtocolsAutomatic, false); } } // Proxy GuiUtils.SetSelected(CboProxyType, s.Get("proxy.mode")); if (s.Get("proxy.when") == "always") { GuiUtils.SetSelected(CboProxyWhen, Messages.WindowsSettingsProxyWhenAlways); } else if (s.Get("proxy.when") == "web") { GuiUtils.SetSelected(CboProxyWhen, Messages.WindowsSettingsProxyWhenWeb); } else if (s.Get("proxy.when") == "openvpn") { GuiUtils.SetSelected(CboProxyWhen, Messages.WindowsSettingsProxyWhenOpenVPN); } else if (s.Get("proxy.when") == "none") { GuiUtils.SetSelected(CboProxyWhen, Messages.WindowsSettingsProxyWhenNone); } else { GuiUtils.SetSelected(CboProxyWhen, Messages.WindowsSettingsProxyWhenAlways); } TxtProxyHost.StringValue = s.Get("proxy.host"); TxtProxyPort.StringValue = s.Get("proxy.port"); GuiUtils.SetSelected(CboProxyAuthentication, s.Get("proxy.auth")); TxtProxyLogin.StringValue = s.Get("proxy.login"); TxtProxyPassword.StringValue = s.Get("proxy.password"); TxtProxyTorControlPort.StringValue = s.Get("proxy.tor.control.port"); TxtProxyTorControlPassword.StringValue = s.Get("proxy.tor.control.password"); // Routes GuiUtils.SetSelected(CboRoutesOtherwise, RouteDirectionToDescription(s.Get("routes.default"))); string routes = s.Get("routes.custom"); string[] routes2 = routes.Split(';'); foreach (string route in routes2) { string[] routeEntries = route.Split(','); if (routeEntries.Length < 2) { continue; } TableRoutingControllerItem item = new TableRoutingControllerItem(); item.Ip = routeEntries[0]; item.Action = routeEntries[1]; item.Icon = routeEntries[1]; if (routeEntries.Length == 3) { item.Notes = routeEntries[2]; } TableRoutingController.Items.Add(item); } TableRoutingController.RefreshUI(); // Advanced - General GuiUtils.SetCheck(ChkAdvancedExpertMode, s.GetBool("advanced.expert")); GuiUtils.SetCheck(ChkAdvancedCheckRoute, s.GetBool("advanced.check.route")); string ipV6Mode = s.Get("ipv6.mode"); if (ipV6Mode == "none") { GuiUtils.SetSelected(CboIpV6, "None"); } else if (ipV6Mode == "disable") { GuiUtils.SetSelected(CboIpV6, "Disable"); } else { GuiUtils.SetSelected(CboIpV6, "None"); } GuiUtils.SetCheck(ChkAdvancedPingerEnabled, s.GetBool("pinger.enabled")); GuiUtils.SetCheck(ChkRouteRemoveDefaultGateway, s.GetBool("routes.remove_default")); TxtAdvancedOpenVpnPath.StringValue = s.Get("tools.openvpn.path"); GuiUtils.SetCheck(ChkAdvancedSkipAlreadyRun, s.GetBool("advanced.skip_alreadyrun")); GuiUtils.SetCheck(ChkAdvancedProviders, s.GetBool("advanced.providers")); int manifestRefresh = s.GetInt("advanced.manifest.refresh"); if (manifestRefresh == 60) { GuiUtils.SetSelected(CboAdvancedManifestRefresh, "Every one hour"); } else if (manifestRefresh == 10) { GuiUtils.SetSelected(CboAdvancedManifestRefresh, "Every ten minute"); } else if (manifestRefresh == 1) { GuiUtils.SetSelected(CboAdvancedManifestRefresh, "Every minute"); } else if (manifestRefresh == 0) { GuiUtils.SetSelected(CboAdvancedManifestRefresh, "Never"); } else { GuiUtils.SetSelected(CboAdvancedManifestRefresh, "Automatic"); } int openVpnSndBuf = s.GetInt("openvpn.sndbuf"); if (openVpnSndBuf == -2) { GuiUtils.SetSelected(CboOpenVpnSndBuf, Messages.Automatic); } else if (openVpnSndBuf == -1) { GuiUtils.SetSelected(CboOpenVpnSndBuf, Messages.WindowsSettingsOpenVpnDefault); } else if (openVpnSndBuf == 1024 * 8) { GuiUtils.SetSelected(CboOpenVpnSndBuf, "8 KB"); } else if (openVpnSndBuf == 1024 * 16) { GuiUtils.SetSelected(CboOpenVpnSndBuf, "16 KB"); } else if (openVpnSndBuf == 1024 * 32) { GuiUtils.SetSelected(CboOpenVpnSndBuf, "32 KB"); } else if (openVpnSndBuf == 1024 * 64) { GuiUtils.SetSelected(CboOpenVpnSndBuf, "64 KB"); } else if (openVpnSndBuf == 1024 * 128) { GuiUtils.SetSelected(CboOpenVpnSndBuf, "128 KB"); } else if (openVpnSndBuf == 1024 * 256) { GuiUtils.SetSelected(CboOpenVpnSndBuf, "256 KB"); } else if (openVpnSndBuf == 1024 * 512) { GuiUtils.SetSelected(CboOpenVpnSndBuf, "512 KB"); } int openVpnRcvBuf = s.GetInt("openvpn.rcvbuf"); if (openVpnRcvBuf == -2) { GuiUtils.SetSelected(CboOpenVpnRcvBuf, Messages.Automatic); } else if (openVpnRcvBuf == -1) { GuiUtils.SetSelected(CboOpenVpnRcvBuf, Messages.WindowsSettingsOpenVpnDefault); } else if (openVpnRcvBuf == 1024 * 8) { GuiUtils.SetSelected(CboOpenVpnRcvBuf, "8 KB"); } else if (openVpnRcvBuf == 1024 * 16) { GuiUtils.SetSelected(CboOpenVpnRcvBuf, "16 KB"); } else if (openVpnRcvBuf == 1024 * 32) { GuiUtils.SetSelected(CboOpenVpnRcvBuf, "32 KB"); } else if (openVpnRcvBuf == 1024 * 64) { GuiUtils.SetSelected(CboOpenVpnRcvBuf, "64 KB"); } else if (openVpnRcvBuf == 1024 * 128) { GuiUtils.SetSelected(CboOpenVpnRcvBuf, "128 KB"); } else if (openVpnRcvBuf == 1024 * 256) { GuiUtils.SetSelected(CboOpenVpnRcvBuf, "256 KB"); } else if (openVpnRcvBuf == 1024 * 512) { GuiUtils.SetSelected(CboOpenVpnRcvBuf, "512 KB"); } // Advanced - DNS string dnsMode = s.Get("dns.mode"); if (dnsMode == "none") { GuiUtils.SetSelected(CboDnsSwitchMode, "Disabled"); } else { GuiUtils.SetSelected(CboDnsSwitchMode, "Automatic"); } GuiUtils.SetCheck(ChkDnsCheck, s.GetBool("dns.check")); TableDnsServersController.Clear(); string[] dnsServers = s.Get("dns.servers").Split(','); foreach (string dnsServer in dnsServers) { if (IpAddress.IsIP(dnsServer)) { TableDnsServersController.Add(dnsServer); } } // Advanced - Lock string lockMode = s.Get("netlock.mode"); GuiUtils.SetSelected(CboLockMode, "None"); if (lockMode == "auto") { GuiUtils.SetSelected(CboLockMode, "Automatic"); } else { foreach (NetworkLockPlugin lockPlugin in Engine.Instance.NetworkLockManager.Modes) { if (lockPlugin.GetCode() == lockMode) { GuiUtils.SetSelected(CboLockMode, lockPlugin.GetName()); } } } GuiUtils.SetCheck(ChkLockAllowPrivate, s.GetBool("netlock.allow_private")); GuiUtils.SetCheck(ChkLockAllowPing, s.GetBool("netlock.allow_ping")); GuiUtils.SetCheck(ChkLockAllowDNS, s.GetBool("netlock.allow_dns")); TxtLockAllowedIPS.StringValue = s.Get("netlock.allowed_ips"); // Advanced - Logging GuiUtils.SetCheck(ChkLoggingEnabled, s.GetBool("log.file.enabled")); GuiUtils.SetCheck(ChkLogLevelDebug, s.GetBool("log.level.debug")); TxtLoggingPath.StringValue = s.Get("log.file.path"); // Advanced - OVPN Directives GuiUtils.SetSelected(CboOpenVpnDirectivesSkipDefault, (s.GetBool("openvpn.skip_defaults") ? Messages.WindowsSettingsOpenVpnDirectivesDefaultSkip2 : Messages.WindowsSettingsOpenVpnDirectivesDefaultSkip1)); TxtAdvancedOpenVpnDirectivesDefault.StringValue = s.Get("openvpn.directives"); TxtAdvancedOpenVpnDirectivesCustom.StringValue = s.Get("openvpn.custom"); TxtOpenVpnDirectivesCustomPath.StringValue = s.Get("openvpn.directives.path"); // Advanced - Events ReadOptionsEvent("app.start", 0); ReadOptionsEvent("app.stop", 1); ReadOptionsEvent("session.start", 2); ReadOptionsEvent("session.stop", 3); ReadOptionsEvent("vpn.pre", 4); ReadOptionsEvent("vpn.up", 5); ReadOptionsEvent("vpn.down", 6); TableAdvancedEventsController.RefreshUI(); }