BitTorrent.Torrent.LoadTorrent C# (CSharp) Method

LoadTorrent() private method

private LoadTorrent ( ) : void
return void
        private void LoadTorrent()
        {
            if (data.Contains("announce") == false) throw new IncompleteTorrentData("No tracker URL");

            if (data.Contains("info") == false) throw new IncompleteTorrentData("No internal torrent information");

            ValueDictionary info = (ValueDictionary)data["info"];
            pieceLength = ((ValueNumber)info["piece length"]).Integer;

            if (info.Contains("pieces") == false) throw new IncompleteTorrentData("No piece hash data");

            ValueString pieces = (ValueString)info["pieces"];

            if ((pieces.Length % 20) != 0) throw new IncompleteTorrentData("Missing or damaged piece hash codes");

            // Parse out the hash codes
            ParsePieceHashes(pieces.Bytes);

            // if (info.Contains("length") == true)

            // if (data.Contains("files") == true)
            // throw new Exception("This is not a single file");

            // SingleFile = true;

            // Determine what files are in the torrent
            if (SingleFile) ParseSingleFile();
            else ParseMultipleFiles();
            infohash = InfoHash;
        }