static internal DefaultProxySectionInternal GetSection()
        {
            lock (DefaultProxySectionInternal.ClassSyncObject)
            {
#if MONO
                var res = new DefaultProxySectionInternal();
                res.webProxy = GetDefaultProxy_UsingOldMonoCode();
                return(res);
#else
                DefaultProxySection section = PrivilegedConfigurationManager.GetSection(ConfigurationStrings.DefaultProxySectionPath) as DefaultProxySection;
                if (section == null)
                {
                    return(null);
                }

                try
                {
                    return(new DefaultProxySectionInternal(section));
                }
                catch (Exception exception)
                {
                    if (NclUtilities.IsFatal(exception))
                    {
                        throw;
                    }

                    throw new ConfigurationErrorsException(SR.GetString(SR.net_config_proxy), exception);
                }
#endif
            }
        }
예제 #2
0
        internal static DefaultProxySectionInternal GetSection()
        {
            DefaultProxySectionInternal internal2;

            lock (ClassSyncObject)
            {
                DefaultProxySection section = System.Configuration.PrivilegedConfigurationManager.GetSection(ConfigurationStrings.DefaultProxySectionPath) as DefaultProxySection;
                if (section == null)
                {
                    internal2 = null;
                }
                else
                {
                    try
                    {
                        internal2 = new DefaultProxySectionInternal(section);
                    }
                    catch (Exception exception)
                    {
                        if (NclUtilities.IsFatal(exception))
                        {
                            throw;
                        }
                        throw new ConfigurationErrorsException(System.SR.GetString("net_config_proxy"), exception);
                    }
                }
            }
            return(internal2);
        }
예제 #3
0
        static internal DefaultProxySectionInternal GetSection()
        {
            lock (DefaultProxySectionInternal.ClassSyncObject)
            {
#if MONO
                var res = new DefaultProxySectionInternal();
                res.webProxy = GetDefaultProxy_UsingOldMonoCode ();
                return res;
#else
                DefaultProxySection section = PrivilegedConfigurationManager.GetSection(ConfigurationStrings.DefaultProxySectionPath) as DefaultProxySection;
                if (section == null)
                    return null;

                try
                {
                    return new DefaultProxySectionInternal(section);
                }
                catch (Exception exception)
                {
                    if (NclUtilities.IsFatal(exception)) throw;

                    throw new ConfigurationErrorsException(SR.GetString(SR.net_config_proxy), exception);
                }
#endif
            }
        }
 internal static DefaultProxySectionInternal GetSection()
 {
     DefaultProxySectionInternal internal2;
     lock (ClassSyncObject)
     {
         DefaultProxySection section = System.Configuration.PrivilegedConfigurationManager.GetSection(ConfigurationStrings.DefaultProxySectionPath) as DefaultProxySection;
         if (section == null)
         {
             internal2 = null;
         }
         else
         {
             try
             {
                 internal2 = new DefaultProxySectionInternal(section);
             }
             catch (Exception exception)
             {
                 if (NclUtilities.IsFatal(exception))
                 {
                     throw;
                 }
                 throw new ConfigurationErrorsException(System.SR.GetString("net_config_proxy"), exception);
             }
         }
     }
     return internal2;
 }