예제 #1
0
 private void AddStatsObjects(DataScheme statsObject)
 {
     statsObject.PutChild(new DataScheme("uploadedBytes", typeof(int), null));
     statsObject.PutChild(new DataScheme("downloadedBytes", typeof(int), null));
     statsObject.PutChild(new DataScheme("filesAdded", typeof(int), null));
     statsObject.PutChild(new DataScheme("sessionCount", typeof(int), null));
     statsObject.PutChild(new DataScheme("secondsActive", typeof(int), null));
 }
예제 #2
0
        private void AddComplexObjects()
        {
            DataScheme files = new DataScheme("files", typeof(List <IDataScheme>), APIMethods.TorrentGet);

            files.PutChild(new DataScheme("bytesCompleted", typeof(int), null));
            files.PutChild(new DataScheme("length", typeof(int), null));
            files.PutChild(new DataScheme("name", typeof(string), null));

            list.Add(files);

            DataScheme fileStats = new DataScheme("fileStats", typeof(List <IDataScheme>), APIMethods.TorrentGet);

            fileStats.PutChild(new DataScheme("bytesCompleted", typeof(int), null));
            fileStats.PutChild(new DataScheme("wanted", typeof(bool), null));
            fileStats.PutChild(new DataScheme("priority", typeof(int), null));

            list.Add(fileStats);

            DataScheme labels = new DataScheme("labels", typeof(IDataScheme), APIMethods.TorrentGet, APIMethods.TorrentSet);

            labels.PutChild(new DataScheme("label", typeof(string[]), null));

            list.Add(labels);

            DataScheme peers = new DataScheme("peers", typeof(List <IDataScheme>), APIMethods.TorrentGet);

            peers.PutChild(new DataScheme("address", typeof(string), null));
            peers.PutChild(new DataScheme("clientName", typeof(string), null));
            peers.PutChild(new DataScheme("clientIsChoked", typeof(bool), null));
            peers.PutChild(new DataScheme("clientIsInterested", typeof(bool), null));
            peers.PutChild(new DataScheme("flagStr", typeof(string), null));
            peers.PutChild(new DataScheme("isDownloadingFrom", typeof(bool), null));
            peers.PutChild(new DataScheme("isEncrypted", typeof(bool), null));
            peers.PutChild(new DataScheme("isIncoming", typeof(bool), null));
            peers.PutChild(new DataScheme("isUploadingTo", typeof(bool), null));
            peers.PutChild(new DataScheme("isUTP", typeof(bool), null));
            peers.PutChild(new DataScheme("peerIsChoked", typeof(bool), null));
            peers.PutChild(new DataScheme("peerIsInterested", typeof(bool), null));
            peers.PutChild(new DataScheme("port", typeof(int), null));
            peers.PutChild(new DataScheme("progress", typeof(double), null));
            peers.PutChild(new DataScheme("rateToClient (B/s)", typeof(int), null));
            peers.PutChild(new DataScheme("rateToPeer (B/s)", typeof(int), null));

            list.Add(peers);

            DataScheme peersFrom = new DataScheme("peersFrom", typeof(IDataScheme), APIMethods.TorrentGet);

            peersFrom.PutChild(new DataScheme("fromCache", typeof(int), null));
            peersFrom.PutChild(new DataScheme("fromDht", typeof(int), null));
            peersFrom.PutChild(new DataScheme("fromIncoming", typeof(int), null));
            peersFrom.PutChild(new DataScheme("fromLpd", typeof(int), null));
            peersFrom.PutChild(new DataScheme("fromLtep", typeof(int), null));
            peersFrom.PutChild(new DataScheme("fromPex", typeof(int), null));
            peersFrom.PutChild(new DataScheme("fromTracker", typeof(int), null));

            list.Add(peersFrom);

            DataScheme trackers = new DataScheme("trackers", typeof(List <IDataScheme>), APIMethods.TorrentGet);

            trackers.PutChild(new DataScheme("announce", typeof(string), null));
            trackers.PutChild(new DataScheme("id", typeof(int), null));
            trackers.PutChild(new DataScheme("scrape", typeof(string), null));
            trackers.PutChild(new DataScheme("tier", typeof(int), null));

            list.Add(trackers);

            DataScheme trackerStats = new DataScheme("trackerStats", typeof(List <IDataScheme>), APIMethods.TorrentGet);

            trackerStats.PutChild(new DataScheme("announce", typeof(string), null));
            trackerStats.PutChild(new DataScheme("announceState", typeof(int), null));
            trackerStats.PutChild(new DataScheme("downloadCount", typeof(int), null));
            trackerStats.PutChild(new DataScheme("hasAnnounced", typeof(bool), null));
            trackerStats.PutChild(new DataScheme("hasScraped", typeof(bool), null));
            trackerStats.PutChild(new DataScheme("host", typeof(string), null));
            trackerStats.PutChild(new DataScheme("id", typeof(int), null));
            trackerStats.PutChild(new DataScheme("isBackup", typeof(bool), null));
            trackerStats.PutChild(new DataScheme("lastAnnouncePeerCount", typeof(int), null));
            trackerStats.PutChild(new DataScheme("lastAnnounceResult", typeof(string), null));
            trackerStats.PutChild(new DataScheme("lastAnnounceStartTime", typeof(int), null));
            trackerStats.PutChild(new DataScheme("lastAnnounceSucceeded", typeof(bool), null));
            trackerStats.PutChild(new DataScheme("lastAnnounceTime", typeof(int), null));
            trackerStats.PutChild(new DataScheme("lastAnnounceTimedOut", typeof(bool), null));
            trackerStats.PutChild(new DataScheme("lastScrapeResult", typeof(string), null));
            trackerStats.PutChild(new DataScheme("lastScrapeStartTime", typeof(int), null));
            trackerStats.PutChild(new DataScheme("lastScrapeSucceeded", typeof(bool), null));
            trackerStats.PutChild(new DataScheme("lastScrapeTime", typeof(int), null));
            trackerStats.PutChild(new DataScheme("lastScrapeTimedOut", typeof(bool), null));
            trackerStats.PutChild(new DataScheme("leecherCount", typeof(int), null));
            trackerStats.PutChild(new DataScheme("nextAnnounceTime", typeof(int), null));
            trackerStats.PutChild(new DataScheme("nextScrapeTime", typeof(int), null));
            trackerStats.PutChild(new DataScheme("scrape", typeof(string), null));
            trackerStats.PutChild(new DataScheme("scrapeState", typeof(int), null));
            trackerStats.PutChild(new DataScheme("seederCount", typeof(int), null));
            trackerStats.PutChild(new DataScheme("tier", typeof(int), null));

            list.Add(trackerStats);

            DataScheme webseeds = new DataScheme("webseeds", typeof(IDataScheme), APIMethods.TorrentGet);

            webseeds.PutChild(new DataScheme("webseed", typeof(string[]), null));

            list.Add(webseeds);

            DataScheme units = new DataScheme("units", typeof(IDataScheme), APIMethods.SessionGet, APIMethods.SessionSet);

            units.PutChild(new DataScheme("speed-units", typeof(string[]), null));
            units.PutChild(new DataScheme("speed-bytes", typeof(int), null));
            units.PutChild(new DataScheme("size-units", typeof(string[]), null));
            units.PutChild(new DataScheme("size-bytes", typeof(int), null));
            units.PutChild(new DataScheme("memory-units", typeof(string[]), null));
            units.PutChild(new DataScheme("memory-bytes", typeof(int), null));

            list.Add(units);

            DataScheme cumulativeStats = new DataScheme("cumulative-stats", typeof(IDataScheme), APIMethods.SessionStats);

            AddStatsObjects(cumulativeStats);

            list.Add(cumulativeStats);

            DataScheme currentStats = new DataScheme("current-stats", typeof(IDataScheme), APIMethods.SessionStats);

            AddStatsObjects(currentStats);

            list.Add(currentStats);
        }