public async Task Play(string trackPath) { await this._loadProxiesTask; Model.Proxy newProxy = this.GetNewProxy(); IList <string> options = this.GetOptions(newProxy.FullPath); this.InitWebDriver(options); this.DoPlay(trackPath); await Task.Delay(SleepMilliseconds); this._webDriver.Quit(); }
private Model.Proxy GetNewProxy() { bool isTheProxyWorking = false; Model.Proxy proxy = null; while (!isTheProxyWorking) { int proxyIndex = this._random.Next(this._proxies.Count); proxy = this._proxies.ElementAt(proxyIndex); this._proxies.RemoveAt(proxyIndex); isTheProxyWorking = WebDriverProvider.TestProxy(Browser, proxy.FullPath); } return(proxy); }