private void UploadTorrent(RequestInfo ri) { this.Status = "Status: Retrieving user cookie"; this.userCookie = this.RetrieveUserCookie(); if (this.userCookie == null) { this.Status = "Login Failed! Incorrect username and password!"; } else { this.Status = "Status: Uploading to tracker"; HttpWebMultipartRequest request = new HttpWebMultipartRequest(this.UploadURL, this.userCookie); request.AddField("MAX_FILE_SIZE", "1048576"); request.AddFile("file", ri.FilePath, "application/x-bittorrent", new FileInfo(ri.FilePath).OpenRead()); request.AddField("name", ri.Name); request.AddFile("nfo", ri.NFO, "application/octet-stream", new FileInfo(ri.NFO).OpenRead()); request.AddField("url", ri.URL); request.AddField("descr", ri.Description); request.AddField("strip", "1"); request.AddField("type", ri.Type); //if (this.rbUserName.Checked) //{ // request.AddField("upas", "self"); //} //else //{ // request.AddField("upas", "anon"); //} new FileInfo(ri.FilePath).Delete(); string htmlCode = new StreamReader(request.GetResponse().GetResponseStream()).ReadToEnd(); if (!htmlCode.Contains("Successfully uploaded!")) { // new WebBrowser(htmlCode).Show(); this.Status = "Status: Upload unsuccessfull"; } else { string str2 = this.HomePageURL; int index = htmlCode.IndexOf("href=\"/download.php"); int num2 = htmlCode.IndexOf('"', index + 7); HttpWebRequest request2 = (HttpWebRequest)WebRequest.Create(str2 + htmlCode.Substring(index + 7, num2 - (index + 7))); request2.CookieContainer = this.userCookie; request2.Method = "GET"; request2.ContentType = "application/x-www-form-urlencoded"; HttpWebResponse response = (HttpWebResponse)request2.GetResponse(); FileStream writeStream = new FileStream(ri.FilePath, FileMode.Create); this.ReadWriteStream(response.GetResponseStream(), writeStream); writeStream.Close(); //Process.Start(Path[Path.Length - 1] + ".torrent"); this.Status = "Status: Upload complete"; // this.button2.Enabled = false; } } }