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); } }
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); }