uTorrentNotifier.WebUIAPI.ListTorrents C# (CSharp) Method

ListTorrents() private method

private ListTorrents ( ) : List
return List
        private List<TorrentFile> ListTorrents()
        {
            List<TorrentFile> torrents = new List<TorrentFile>();

            List<KeyValuePair<string, string>> args = new List<KeyValuePair<string, string>>();

            args.Add(new KeyValuePair<string, string>("list", "1"));
            args.Add(new KeyValuePair<string, string>("token", this.Token));

            string json = this.Send(args.ToArray());

            if (!String.IsNullOrEmpty(json))
            {
                JObject o = JObject.Parse(json);
                IList<JToken> results = o["torrents"].Children().ToList();

                foreach (JToken result in results)
                {
                    TorrentFile f = TorrentFile.ConvertStringArray(JsonConvert.DeserializeObject<string[]>(result.ToString()));
                    torrents.Add(f);
                }
            }
            else
            {
                return null;
            }

            this.UpdatedList(torrents);

            return torrents;
        }