示例#1
0
文件: Proxy.cs 项目: Arsslensoft/WKDV
 internal void CollectConnectoidAndGatewayInfo()
 {
     this.oAllConnectoids = new WinINETConnectoids();
     this.piPrior         = this.oAllConnectoids.GetDefaultConnectionGatewayInfo();
     if (Browser.bForwardToGateway && ((this.piPrior.sPACScriptLocation != null) || this.piPrior.bAutoDetect))
     {
         this.oAutoProxy = new WinHTTPAutoProxy(this.piPrior.bAutoDetect, this.piPrior.sPACScriptLocation);
     }
     else if (this.oAutoProxy != null)
     {
         this.oAutoProxy.Dispose();
         this.oAutoProxy = null;
     }
     if (Browser.bForwardToGateway && this.piPrior.bUseManualProxies)
     {
         this._DetermineGatewayIPEndPoints();
         if (string.IsNullOrEmpty(this.piPrior.sHostsThatBypass))
         {
             this.oBypassList = null;
         }
         else
         {
             this.oBypassList = new ProxyBypassList(this.piPrior.sHostsThatBypass);
             if (!this.oBypassList.HasEntries)
             {
                 this.oBypassList = null;
             }
         }
     }
     else
     {
         this._ipepFtpGateway = this._ipepHttpGateway = (IPEndPoint)(this._ipepHttpsGateway = null);
         this.oBypassList     = null;
     }
 }
示例#2
0
文件: Proxy.cs 项目: Arsslensoft/WKDV
 internal bool Attach(bool bCollectGWInfo)
 {
     if (!this._bIsAttached)
     {
         if (bCollectGWInfo)
         {
             this.CollectConnectoidAndGatewayInfo();
         }
         WinINETProxyInfo oNewInfo = new WinINETProxyInfo();
         oNewInfo.bUseManualProxies = true;
         oNewInfo.bAllowDirect      = true;
         oNewInfo.sHttpProxy        = Browser.sSDVPListenHostPort;
         if (Browser.bCaptureCONNECT)
         {
             oNewInfo.sHttpsProxy = Browser.sSDVPListenHostPort;
         }
         else if (this.piPrior != null)
         {
             oNewInfo.sHttpsProxy = this.piPrior.sHttpsProxy;
         }
         if ((this.piPrior != null) && this.piPrior.bUseManualProxies)
         {
             oNewInfo.sFtpProxy   = this.piPrior.sFtpProxy;
             oNewInfo.sSocksProxy = this.piPrior.sSocksProxy;
         }
         if (Browser.bCaptureFTP)
         {
             oNewInfo.sFtpProxy = Browser.sSDVPListenHostPort;
         }
         oNewInfo.sHostsThatBypass = Browser.sHostsThatBypassSDVP;
         if (Browser.bHookWithPAC)
         {
             if (SDVPApplication.Prefs.GetBoolPref("SDVP.proxy.pacfile.usefileprotocol", true))
             {
                 oNewInfo.sPACScriptLocation = "file://" + Browser.GetPath("Pac");
             }
             else
             {
                 oNewInfo.sPACScriptLocation = "http://" + Browser.sSDVPListenHostPort + "/proxy.pac";
             }
         }
         if (!Browser.bIsViewOnly)
         {
             if (this.oAllConnectoids.HookConnections(oNewInfo))
             {
                 this._bIsAttached = true;
                 SDVPApplication.OnSDVPAttach();
                 this.WriteAutoProxyPACFile(true);
             }
             else
             {
                 SDVPApplication.DoNotifyUser("Failed to register SDVP as the system proxy.", "Error");
                 _setDynamicRegistryKey(false);
                 return(false);
             }
             _setDynamicRegistryKey(true);
         }
     }
     return(true);
 }
示例#3
0
        public static WinINETProxyInfo CreateFromNamedConnection(string sConnectionName)
        {
            WinINETProxyInfo info = new WinINETProxyInfo();

            if (info.GetFromWinINET(sConnectionName))
            {
                return(info);
            }
            return(null);
        }
示例#4
0
        internal bool HookConnections(WinINETProxyInfo oNewInfo)
        {
            if (Browser.bIsViewOnly)
            {
                return(false);
            }
            bool flag = false;

            foreach (WinINETConnectoid connectoid in this._oConnectoids.Values)
            {
                if ((Browser.bHookAllConnections || (connectoid.sConnectionName == Browser.sHookConnectionNamed)) && oNewInfo.SetToWinINET(connectoid.sConnectionName))
                {
                    flag = true;
                    connectoid.bIsHooked = true;
                }
            }
            return(flag);
        }
示例#5
0
 public WinINETConnectoids()
 {
     foreach (string str in RASInfo.GetConnectionNames())
     {
         if (!this._oConnectoids.ContainsKey(str))
         {
             WinINETProxyInfo info = WinINETProxyInfo.CreateFromNamedConnection(str);
             if (info != null)
             {
                 WinINETConnectoid connectoid = new WinINETConnectoid();
                 connectoid.sConnectionName = str;
                 if ((info.sHttpProxy != null) && info.sHttpProxy.Contains(Browser.sSDVPListenHostPort))
                 {
                     info.sHttpProxy        = info.sHttpsProxy = (string)(info.sFtpProxy = null);
                     info.bUseManualProxies = false;
                     info.bAllowDirect      = true;
                 }
                 connectoid.oOriginalProxyInfo = info;
                 this._oConnectoids.Add(str, connectoid);
             }
         }
     }
 }