diff --git a/TorrentBrowser/Form1.cs b/TorrentBrowser/Form1.cs index ffb70a0..ec07e1c 100644 --- a/TorrentBrowser/Form1.cs +++ b/TorrentBrowser/Form1.cs @@ -14,21 +14,13 @@ public Form1() InitializeComponent(); } - private void downloadCurrentSearchToolStripMenuItem_Click(object sender, EventArgs e) - { - string sourcePage = webBrowser1.DocumentText; - - List torrents = GetTorrents(sourcePage); - DownloadTorrents(torrents); - } - - private static List GetTorrents(string sourcePage) + private static List GetTorrents(string sourcePage, string searchTerm) { List torrents = new List(); int index = 0; do { - index = sourcePage.IndexOf("magnet:?", index); + index = sourcePage.IndexOf(searchTerm, index); if (index != -1) { var endOfMagnetLink = sourcePage.IndexOf("\"", index); @@ -56,5 +48,21 @@ private void Form1_Load(object sender, EventArgs e) { webBrowser1.Navigate("https://nyaa.pantsu.cat/search?c=3_5&s=&sort=torrent_id&order=desc&max=300&q="); } + + private void torrentFileToolStripMenuItem_Click(object sender, EventArgs e) + { + string sourcePage = webBrowser1.DocumentText; + + List torrents = GetTorrents(sourcePage, "http://anicache.com"); + DownloadTorrents(torrents); + } + + private void downloadCurrentSearchToolStripMenuItem_Click(object sender, EventArgs e) + { + string sourcePage = webBrowser1.DocumentText; + + List torrents = GetTorrents(sourcePage, "magnet:?"); + DownloadTorrents(torrents); + } } } diff --git a/TorrentBrowser/Form1.designer.cs b/TorrentBrowser/Form1.designer.cs index fe2251b..743ea9b 100644 --- a/TorrentBrowser/Form1.designer.cs +++ b/TorrentBrowser/Form1.designer.cs @@ -32,6 +32,7 @@ private void InitializeComponent() this.webBrowser1 = new System.Windows.Forms.WebBrowser(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.downloadCurrentSearchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.downloadTorrentFilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // @@ -47,7 +48,8 @@ private void InitializeComponent() // menuStrip1 // this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.downloadCurrentSearchToolStripMenuItem}); + this.downloadCurrentSearchToolStripMenuItem, + this.downloadTorrentFilesToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Size = new System.Drawing.Size(1384, 24); @@ -57,10 +59,16 @@ private void InitializeComponent() // downloadCurrentSearchToolStripMenuItem // this.downloadCurrentSearchToolStripMenuItem.Name = "downloadCurrentSearchToolStripMenuItem"; - this.downloadCurrentSearchToolStripMenuItem.Size = new System.Drawing.Size(151, 20); - this.downloadCurrentSearchToolStripMenuItem.Text = "Download current results"; + this.downloadCurrentSearchToolStripMenuItem.Size = new System.Drawing.Size(147, 20); + this.downloadCurrentSearchToolStripMenuItem.Text = "Download Magnet Links"; this.downloadCurrentSearchToolStripMenuItem.Click += new System.EventHandler(this.downloadCurrentSearchToolStripMenuItem_Click); // + // downloadTorrentFilesToolStripMenuItem + // + this.downloadTorrentFilesToolStripMenuItem.Name = "downloadTorrentFilesToolStripMenuItem"; + this.downloadTorrentFilesToolStripMenuItem.Size = new System.Drawing.Size(141, 20); + this.downloadTorrentFilesToolStripMenuItem.Text = "Download Torrent Files"; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -85,6 +93,7 @@ private void InitializeComponent() private System.Windows.Forms.WebBrowser webBrowser1; private System.Windows.Forms.MenuStrip menuStrip1; private System.Windows.Forms.ToolStripMenuItem downloadCurrentSearchToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem downloadTorrentFilesToolStripMenuItem; } } diff --git a/TorrentBrowser/Properties/AssemblyInfo.cs b/TorrentBrowser/Properties/AssemblyInfo.cs index 3a276e4..0224cf6 100644 --- a/TorrentBrowser/Properties/AssemblyInfo.cs +++ b/TorrentBrowser/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.0.0")] -[assembly: AssemblyFileVersion("1.1.0.0")] +[assembly: AssemblyVersion("1.2.0.0")] +[assembly: AssemblyFileVersion("1.2.0.0")]