当前位置: 首页>>代码示例>>C#>>正文


C# XUri.WithScheme方法代码示例

本文整理汇总了C#中MindTouch.Dream.XUri.WithScheme方法的典型用法代码示例。如果您正苦于以下问题:C# XUri.WithScheme方法的具体用法?C# XUri.WithScheme怎么用?C# XUri.WithScheme使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MindTouch.Dream.XUri的用法示例。


在下文中一共展示了XUri.WithScheme方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SqsClientConfig

        //--- Constructors ---
        /// <summary>
        /// Constructor for creating an instance.
        /// </summary>
        /// <param name="privateKey">Private AWS key.</param>
        /// <param name="publicKey">Public AWS key.</param>
        /// <param name="accountId">AWS account ID.</param>
        /// <param name="endpoint">Region name or custom SQS endpoint to use.</param>
        /// <param name="secure">Boolean indicating if HTTPS should be used.</param>
        /// <param name="proxyHost">The proxy host if any.</param>
        /// <param name="proxyPort">The proxy port if any.</param>
        public SqsClientConfig(string privateKey, string publicKey, string accountId, string endpoint, bool secure, string proxyHost = null, int? proxyPort = 0)
        {
            if(string.IsNullOrEmpty(accountId)) {
                throw new ArgumentNullException("accountId");
            }
            if(string.IsNullOrEmpty(endpoint)) {
                throw new ArgumentNullException("endpoint");
            }
            this.PrivateKey = privateKey;
            this.PublicKey = publicKey;
            this.AccountId = accountId;
            this.ProxyHost = proxyHost;
            this.ProxyPort = proxyPort;

            // read end-point settings
            XUri uri;
            switch(endpoint) {
            case "default":
            case "us-east-1":

                // US East (N. Virginia)
                uri = new XUri("http://sqs.us-east-1.amazonaws.com");
                break;
            case "us-west-2":

                // US West (Oregon)
                uri = new XUri("http://sqs.us-west-2.amazonaws.com");
                break;
            case "us-west-1":

                // US West (N. California)
                uri = new XUri("http://sqs.us-west-1.amazonaws.com");
                break;
            case "eu-west-1":

                // EU (Ireland)
                uri = new XUri("http://sqs.eu-west-1.amazonaws.com");
                break;
            case "eu-central-1":

                // EU (Frankfurt)
                uri = new XUri("http://sqs.eu-central-1.amazonaws.com");
                break;
            case "ap-southeast-1":

                // Asia Pacific (Singapore)
                uri = new XUri("http://sqs.ap-southeast-1.amazonaws.com");
                break;
            case "ap-southeast-2":

                // Asia Pacific (Sydney)
                uri = new XUri("http://sqs.ap-southeast-2.amazonaws.com");
                break;
            case "ap-northeast-1":

                // Asia Pacific (Tokyo)
                uri = new XUri("http://sqs.ap-northeast-1.amazonaws.com");
                break;
            case "sa-east-1":

                // South America (Sao Paulo)
                uri = new XUri("http://sqs.sa-east-1.amazonaws.com");
                break;
            default:
                uri = XUri.TryParse(endpoint);
                break;
            }
            if(uri == null) {
                throw new ArgumentException("invalid value for SQS end-point", "endpoint");
            }
            if(secure) {
                uri = uri.WithScheme("https");
            }
            this.Endpoint = uri;
        }
开发者ID:bjorg,项目名称:DReAM,代码行数:86,代码来源:SqsClientConfig.cs

示例2: FetchFeed

        private Result<DreamMessage> FetchFeed(XUri uri) {

            // replace the invalid feed:// scheme with http://
            if(uri.Scheme.EqualsInvariantIgnoreCase("feed")) {
                uri = uri.WithScheme("http");
            }
            lock(_feeds) {

                // check if we have a cached result
                XDoc feed;
                if(_feeds.TryGetValue(uri, out feed)) {
                    Result<DreamMessage> result = new Result<DreamMessage>();
                    result.Return(DreamMessage.Ok(feed));
                    return result;
                }
            }
            Plug plug = Plug.New(uri, TimeSpan.FromSeconds(Config["timeout"].AsDouble ?? Plug.DEFAULT_TIMEOUT.TotalSeconds));
            return plug.GetAsync();
        }
开发者ID:heran,项目名称:DekiWiki,代码行数:19,代码来源:FeedService.cs


注:本文中的MindTouch.Dream.XUri.WithScheme方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。