public bool GetTorrentList(ref List<Torrent> torrents) { torrents = new List<Torrent>(); if (!ValidCredentials()) { logger.Warn("Credentials are not valid for uTorrent"); return false; } string url = ""; try { UTorrentHelperVM.Instance.ConnectionStatus = "Getting torrent list..."; //http://[IP]:[PORT]/gui/?list=1 url = string.Format(urlTorrentList, AppSettings.UTorrentAddress, AppSettings.UTorrentPort, token); string output = GetWebResponse(url); if (output.Length == 0) { UTorrentHelperVM.Instance.ConnectionStatus = "Error!"; return false; } //BaseConfig.MyAnimeLog.Write("Torrent List JSON: {0}", output); TorrentList torList = JSONHelper.Deserialize<TorrentList>(output); foreach (object[] obj in torList.torrents) { Torrent tor = new Torrent(obj); torrents.Add(tor); } OnListRefreshedEvent(new ListRefreshedEventArgs(torrents)); UTorrentHelperVM.Instance.ConnectionStatus = "Connected."; return true; } catch (Exception ex) { logger.Error("Error in GetTorrentList: {0} - {1}", url, ex.ToString()); return false; } }
private void ShowTorrentDetails(Torrent tor) { SetAttachedSeries(null); dgTorrentFiles.ItemsSource = null; if (!torrentDetailsWorker.IsBusy) torrentDetailsWorker.RunWorkerAsync(tor); }