Exemple #1
0
        private void ParseMultipleFiles()
        {
            ValueDictionary info = (ValueDictionary)data["info"];
            ValueList files = (ValueList)info["files"];
            torrentFiles = null;
            torrentFiles = new Collection<TorrentFile>();
            foreach (ValueDictionary o in files)
            {
                ValueList components = (ValueList)o["path"];
                bool first = true;
                string path = "";
                foreach (ValueString vs in components)
                {
                    if (!first) path += "/";
                    first = false;
                    path += vs.String;
                }

                _totalLength += (ulong)((ValueNumber)o["length"]).Integer;
                TorrentFile f = new TorrentFile(((ValueNumber)o["length"]).Integer, path);
                torrentFiles.Add(f);
            }
        }
Exemple #2
0
 private void ParseSingleFile()
 {
     ValueDictionary info = (ValueDictionary)data["info"];
     _totalLength = (ulong)((ValueNumber)info["length"]).Integer;
     TorrentFile f = new TorrentFile(((ValueNumber)info["length"]).Integer, ((ValueString)info["name"]).String);
     torrentFiles.Add(f);
 }