Пример #1
0
        /// <summary>
        /// 获取远程hosts
        /// </summary>
        /// <returns></returns>
        public Dictionary <string, string> GetRemoteDictionary()
        {
            var dic  = new Dictionary <string, string>();
            var list = GetAllHostsSource();

            if (list != null)
            {
                //排序
                list = list.Where(d => d.IsEnabled == 1).OrderBy(d => d.Id).ToList();
                foreach (var hostsSource in list)
                {
                    var d = ExtentionClass.DownloaHosts(hostsSource.Url);
                    foreach (KeyValuePair <string, string> pair in d)
                    {
                        if (!dic.ContainsKey(pair.Key))
                        {
                            dic.Add(pair.Key, pair.Value);
                        }
                    }
                }
            }
            return(dic);
        }
Пример #2
0
 public void TestMethod1()
 {
     var list = ExtentionClass.DownloaHosts("https://raw.githubusercontent.com/racaljk/hosts/master/hosts");
 }