static void Main(string[] args) { start: var ps = new ProxySelector(); while (true) { if (!UpdateProxySelector(ps)) { Console.WriteLine("获取代理列表失败,10秒后重试"); } else { break; } } var proxy = new NeteaseProxy(ps); proxy.StartProxy(); Console.WriteLine("请设置网易云音乐代理为127.0.0.1,端口15213"); Console.WriteLine("如果播放失败,按回车切换到下一个代理服务器"); while (true) { var aproxy = ps.GetTopProxies(1); if (aproxy.Count == 0) { Console.WriteLine("没有可用代理,重新搜索"); proxy.Stop(); goto start; } Console.WriteLine("现在使用的是:" + aproxy[0]); Console.ReadLine(); ps.RemoveTopProxy(); } }
static void Main(string[] args) { start: Console.OutputEncoding = Encoding.UTF8; var ps = new ProxySelector(); while (!UpdateProxySelector(ps)) { Console.WriteLine("Failed retriving proxy list"); Console.ReadLine(); } var proxy = new NeteaseProxy(ps); proxy.Start(); Console.WriteLine("Please change proxy of Netease Music to address 127.0.0.1,port 15213"); Console.WriteLine("Press enter to use the next proxy"); while (true) { var aproxy = ps.GetTop(); if (aproxy == null) { Console.WriteLine("No available proxy, retrying"); proxy.Stop(); goto start; } Console.WriteLine("Using: " + aproxy); Console.ReadLine(); ps.Remove(aproxy); } }
static void Main(string[] args) { start: var ps = new ProxySelector(); if (!UpdateProxySelector(ps)) { Console.WriteLine("获取代理列表失败"); Console.ReadLine(); return; } var proxy = new NeteaseProxy(ps); proxy.Start(); Console.WriteLine("请设置网易云音乐代理为127.0.0.1,端口15213"); Console.WriteLine("如果播放失败,按回车切换到下一个代理服务器"); while (true) { var aproxy = ps.GetTop(); if (aproxy == null) { Console.WriteLine("没有可用代理,重新搜索"); proxy.Stop(); goto start; } Console.WriteLine("现在使用的是:" + aproxy); Console.ReadLine(); ps.Remove(aproxy); } }
public NeteaseProxy(ProxySelector proxySelector) { proxyServer = new ProxyServer { TrustRootCertificate = true }; this.proxySelector = proxySelector; }
static bool UpdateProxySelector(ProxySelector ps) { Console.WriteLine("Retriving proxy list"); ps.UpdateList(); Console.WriteLine(ps.Proxies.Count + " results, measuring speed"); ps.UpdateLatency(); return(ps.Proxies.Count >= 1 && ps.Proxies[0].latency != int.MaxValue); }
static bool UpdateProxySelector(ProxySelector ps) { Console.WriteLine("获取代理列表"); ps.UpdateList(); Console.WriteLine("共" + ps.Proxies.Count + "条结果,测试速度"); ps.UpdateLatency(); return(ps.Proxies.Count >= 1 && ps.Proxies[0].latency != int.MaxValue); }
public NeteaseProxy(ProxySelector ps) { proxyServer = new ProxyServer(); proxyServer.TrustRootCertificate = true; this.ps = ps; }
public NeteaseProxy(ProxySelector proxySelector) { proxyServer = new ProxyServer(); this.proxySelector = proxySelector; proxiedAddresses = File.ReadLines("ProxyPaths.txt").Where(l => l.Length > 0).ToArray(); }