Skip to content

Commit

Permalink
fixed some bugs and finished the new download list
Browse files Browse the repository at this point in the history
  • Loading branch information
fireshaper committed Sep 21, 2018
1 parent e14f326 commit b7c5c3c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
11 changes: 9 additions & 2 deletions Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 21 additions & 8 deletions Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ namespace Omnibus
{
public partial class Form1 : Form
{
private string url = "https://getcomics.info/?s=";
private String url = "https://getcomics.info/?s=";
private int cancelled = 0;
private int complete;
private bool status;
private String pbID;
private int idCount = 0;

private IEnumerable<HtmlNode> nodes, descNodes, ulNodes;
Expand Down Expand Up @@ -106,7 +108,10 @@ private void btnSearch_Click(object sender, EventArgs e)
string node = n.InnerHtml;
string[] a = node.Split('"');

lbComics.Items.Add(a[5]);
string aTitle = a[5];
string title = aTitle.Replace("&#8211;", "-");

lbComics.Items.Add(title);
}

descNodes = doc.DocumentNode.Descendants(0).Where(n => n.HasClass("post-info"));
Expand Down Expand Up @@ -210,7 +215,9 @@ private void btnDownload_Click(object sender, EventArgs e)
string tnode = n.InnerHtml;
string[] ta = node.Split('"');

string title = ta[5];
string aTitle = ta[5];
string title = aTitle.Replace("&#8211;", "-");


//add item to listview
AddLVItem("0", title);
Expand Down Expand Up @@ -238,7 +245,9 @@ private void btnDownload_Click(object sender, EventArgs e)
int fIndex = t0[0].LastIndexOf('(');
int length = fIndex - index;

string title = t0[0].Substring(index, length - 1);
string titleSub = t0[0].Substring(index, length - 1);

string title = titleSub.Replace("&#8211;", "-");

Regex iRegex = new Regex("href=\"https://mega.nz/.+\"", RegexOptions.IgnoreCase);
Match iMatch;
Expand Down Expand Up @@ -302,18 +311,20 @@ private void AddLVItem(string id, string title)
async private void DownloadComic(int idCount)
{
complete = 1;
status = true;
String id = idCount.ToString();
Group group = downloadList[0];
string[] g1 = group.ToString().Split('"');

string title = titleList[0];
string filename = title + ".cbr";
//string filename = title + ".cbr";

Uri myStringWebResource = new Uri(g1[1]);

INodeInfo node = mClient.GetNodeFromLink(myStringWebResource);
string filename = node.Name;
downloadPath = Properties.Settings.Default.DownloadLocation + filename;

IProgress<double> progressHandler = new Progress<double>(x => UpdateItemValue(id, (int)x));

Console.WriteLine("Downloading " + filename);
Expand Down Expand Up @@ -372,13 +383,15 @@ private void UpdateItemValue(string id, int value)
{
pb.Value = value;

if (value == 1)
if (value == 1 && status == true)
{
lvi.SubItems[1].Text = "Downloading";
status = false;
}
else if (value >= 100)
{
lvi.SubItems[1].Text = "Complete";
lvDownloads.Controls.Remove(pb);
complete = 1;
}

Expand Down Expand Up @@ -511,10 +524,10 @@ private void DownloadComplete()

downloadList.RemoveAt(0);
titleList.RemoveAt(0);
idCount++;

if (downloadList.Count > 0)
{
idCount++;
DownloadComic(idCount);
}
else
Expand Down
Binary file not shown.

0 comments on commit b7c5c3c

Please sign in to comment.