Exemplo n.º 1
0
        public void Start()
        {
            switch (Setting.Instance.Mode)
            {
            case ProxyMode.Disable:
                Stop();
                View.DisableToggle = true;
                View.GlobalToggle  = false;
                View.PACToggle     = false;
                break;

            case ProxyMode.Global:
                Stop();
                remoteClient?.Start();
                SystemProxy.EnableGlobal(Setting.Instance.RemotePort);
                View.DisableToggle = false;
                View.GlobalToggle  = true;
                View.PACToggle     = false;
                break;

            case ProxyMode.PAC:
                Stop();
                pacServer?.Start();
                remoteClient.Start();
                SystemProxy.EnablePAC(pacServer.pac_url);
                View.DisableToggle = false;
                View.GlobalToggle  = false;
                View.PACToggle     = true;
                break;
            }
        }
Exemplo n.º 2
0
        public static void SwitchProxyMode(ProxyMode mode)
        {
            switch (mode)
            {
            case ProxyMode.Global:
                SystemProxy.EnableGlobal($"http://127.0.0.1:{Setting.HttpPort}");
                break;

            case ProxyMode.PAC:
                SystemProxy.EnablePac(Pac.PacScriptURL);
                break;

            case ProxyMode.Disable:
                SystemProxy.Disable();
                break;

            case ProxyMode.KeepSystemProxy:
            default:
                break;
            }
            NotifyIcon.SwitchProxyMode(mode);
            Setting.Mode = mode;
            Setting.Save();
        }