예제 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     TorrentReader file = new TorrentReader("C:\\test2.torrent");
     TcpClient client = new TcpClient();
     client.Connect("127.0.0.1", 7646);
     Stream st = client.GetStream();
     KeepAlive message2 = new KeepAlive();
     Handshake message1 = new Handshake(file.getRawInfoHash(), "-WT0010-135729995916");
     st.Write(message1.getMessageBytes(), 0, message1.getMessageBytes().Length);
     st.Flush();
     byte[] readed = new byte[1024];
     st.Read(readed, 0, 3);
 }
예제 #2
0
 private void btnBrowse_Click(object sender, EventArgs e)
 {
     openDialog.Filter = "torrents (*.torrent)|*.torrent";
     if (openDialog.ShowDialog() == DialogResult.OK)
     {
         file = new TorrentReader(openDialog.FileName);
         this.txtPath.Text = openDialog.FileName;
     }
     if (file != null)
     {
         this.txtName.Text = file.getFileName();
         this.txtComment.Text = file.getComment();
         this.txtHash.Text = file.getInfoHash();
         this.txtEncoding.Text = file.getEncoding();
         this.txtLength.Text = file.getContentLength();
         this.txtCreatedBy.Text = file.getCreatedBy();
         this.txtTracker.Text = file.getAnnounceURL();
     }
 }