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


C# HttpHelper.OpenRead方法代码示例

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


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

示例1: GetStringFrom

 private static string GetStringFrom(string url)
 {
     var helper = new HttpHelper(url);
     helper.HttpWebRequest.AutomaticDecompression = System.Net.DecompressionMethods.GZip | System.Net.DecompressionMethods.Deflate;
     helper.HttpWebRequest.Proxy = null;
     helper.HttpWebRequest.ServicePoint.ConnectionLimit = Int32.MaxValue;
     helper.HttpWebRequest.ContentType = "text/html; charset=utf-8";
     using (var stream = helper.OpenRead())
     {
         using (var reader = new StreamReader(stream))
         {
             return reader.ReadToEnd();
         }
     }
 }
开发者ID:vosen,项目名称:Juiz.Shared,代码行数:15,代码来源:Extract.cs

示例2: IsNugetAvailable

        /// <summary>
        /// Checks if there is a Nuget avilable for the repository with the specified <paramref name="name"/>
        /// </summary>
        /// <param name="name">The name of the repository.</param>
        /// <returns><see langword="true" /> if there is a Nuget available, otherwise <see langword="false" />.</returns>
        public bool IsNugetAvailable(string name)
        {
            var url =
                string.Format(@" http://nuget.org/api/v2/Packages?$filter=Id%20eq%20'{0}'", name);

            var client =
                new HttpHelper(url);

            using (var stream = client.OpenRead())
            {
                using (var reader = new StreamReader(stream))
                {
                    var content =
                        reader.ReadToEnd();

                    return content.IndexOf("<entry>", StringComparison.OrdinalIgnoreCase) >= 0;
                }
            }
        }
开发者ID:jcolebrand,项目名称:Nancy.Demo.Samples,代码行数:24,代码来源:DefaultRepositoryNugetChecker.cs

示例3: RetrieveResponse

        private dynamic RetrieveResponse(string url)
        {
            var httpHelper =
                new HttpHelper(url);

            using (var stream = httpHelper.OpenRead())
            {
                using (var reader = new StreamReader(stream))
                {
                    var json = 
                        reader.ReadToEnd();
                    
                    var result = 
                        SimpleJson.DeserializeObject(json);

                    this.cache.Add(
                        url,
                        result,
                        DateTime.Now.AddMinutes(5));

                    return result;
                }
            }
        }
开发者ID:grumpydev,项目名称:Nancy.Demo.Samples,代码行数:24,代码来源:DefaultGithubHttpClient.cs

示例4: DownloadName

 public static NameResult DownloadName(int id)
 {
     string site;
     var helper = new HttpHelper(@"http://myanimelist.net/showclubs.php?id=" + id);
     helper.HttpWebRequest.AutomaticDecompression = System.Net.DecompressionMethods.GZip | System.Net.DecompressionMethods.Deflate;
     helper.HttpWebRequest.Proxy = null;
     helper.HttpWebRequest.ServicePoint.ConnectionLimit = Int32.MaxValue;
     using (var stream = helper.OpenRead())
     {
         using (var reader = new StreamReader(stream))
         {
             return NameFromClublist(reader.ReadToEnd());
         }
     }
 }
开发者ID:vosen,项目名称:Juiz.Shared,代码行数:15,代码来源:Extract.cs


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