public static AccountSettings Load()
        {
            //setup an AccountSettings object with endpoint, accessKeyId, and accessKeySecret
            var accountSettings = new AccountSettings
            {
                OssEndpoint = Config.Endpoint,
                OssAccessKeyId = Config.AccessKeyId,
                OssAccessKeySecret = Config.AccessKeySecret
            };
            //check if proxyHost and proxyPort has been configured, if yes, set proxyHost and proxyPort values
            if (string.IsNullOrEmpty(Config.ProxyHost) || string.IsNullOrEmpty(Config.ProxyPort))
                return accountSettings;

            accountSettings.ProxyHost = Config.ProxyHost;
            int proxyPort;
            if (!Int32.TryParse(Config.ProxyPort, out proxyPort))
            {
                throw new Exception("ProxyPort in configuration is not configured as a valid integer");
            }
            accountSettings.ProxyPort = proxyPort;
            accountSettings.ProxyUser = Config.ProxyUser;
            accountSettings.ProxyPassword = Config.ProxyPassword;

            return accountSettings;
        }
 public static IOss CreateOssClientWithProxy(AccountSettings settings)
 {
     return CreateOssClientWithProxy(settings.OssEndpoint,
                                     settings.OssAccessKeyId,
                                     settings.OssAccessKeySecret,
                                     settings.ProxyHost,
                                     settings.ProxyPort,
                                     settings.ProxyUser,
                                     settings.ProxyPassword);
 }
 public static IOss CreateOssClient(AccountSettings settings)
 {
     var clientConfiguration = new ClientConfiguration();
     if (!String.IsNullOrEmpty(settings.ProxyHost))
     {
         clientConfiguration.ProxyHost =  settings.ProxyHost;
         clientConfiguration.ProxyPort = settings.ProxyPort;
     }
     return new OssClient(settings.OssEndpoint,
                          settings.OssAccessKeyId,
                          settings.OssAccessKeySecret);
 }
        public static IOss CreateOssClientUseHttps(AccountSettings settings)
        {
            string endpoint = settings.OssEndpoint.Trim().ToLower();

            if (endpoint.StartsWith(HttpProto))
            {
                endpoint = settings.OssEndpoint.Trim().Replace(HttpProto, HttpsProto);
            }
            else if (endpoint.StartsWith(HttpsProto))
            {
                endpoint = settings.OssEndpoint.Trim();
            }
            else
            {
                endpoint = HttpsProto + settings.OssEndpoint.Trim();
            }

            return(new OssClient(endpoint, settings.OssAccessKeyId, settings.OssAccessKeySecret));
        }
        public static IOss CreateOssClientUseHttps(AccountSettings settings)
        {
            string endpoint = settings.OssEndpoint.Trim().ToLower();

            if (endpoint.StartsWith(HttpProto))
            {
                endpoint = settings.OssEndpoint.Trim().Replace(HttpProto, HttpsProto);
            }
            else if (endpoint.StartsWith(HttpsProto))
            {
                endpoint = settings.OssEndpoint.Trim();
            }
            else
            {
                endpoint = HttpsProto + settings.OssEndpoint.Trim();
            }

            return new OssClient(endpoint, settings.OssAccessKeyId, settings.OssAccessKeySecret);
        }
 public static IOss CreateOssClient(AccountSettings settings)
 {
     return(new OssClient(settings.OssEndpoint,
                          settings.OssAccessKeyId,
                          settings.OssAccessKeySecret));
 }
 public static IOss CreateOssClientEnableMD5(bool enableMD5Check)
 {
     return(CreateOssClientEnableMD5(AccountSettings.Load(), enableMD5Check));
 }
 public static IOss CreateOssClientWithProxy()
 {
     return(CreateOssClientWithProxy(AccountSettings.Load()));
 }
 public static IOss CreateOssClientUseHttps()
 {
     return(CreateOssClientUseHttps(AccountSettings.Load()));
 }
 public static IOss CreateOssClient(AccountSettings settings)
 {
     return new OssClient(settings.OssEndpoint,
                          settings.OssAccessKeyId,
                          settings.OssAccessKeySecret);
 }
 public static IOss CreateOssClient(AccountSettings settings)
 {
     return(CreateOssClient(settings, new ClientConfiguration()));
 }
 public static IOss CreateOssClient(ClientConfiguration conf)
 {
     return(CreateOssClient(AccountSettings.Load(), conf));
 }