Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
vDeggial committed Nov 29, 2014
1 parent 8727fad commit 98f1621
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions Tumblr Tool UI/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public partial class mainForm : Form
private TimeSpan ts;
private TumblrStats tumblrStats;
private string version = "Beta 0.14.1128";
private processingCodes uiProcessingState = processingCodes.OK;

public mainForm()
{
InitializeComponent();
Expand Down Expand Up @@ -388,6 +390,7 @@ private void crawlUIWorker_AfterDone(object sender, RunWorkerCompletedEventArgs

private void crawlUIWorker_DoWork(object sender, DoWorkEventArgs e)
{
uiProcessingState = processingCodes.Starting;
while (ripper == null)
{
}
Expand All @@ -414,23 +417,29 @@ private void crawlUIWorker_DoWork(object sender, DoWorkEventArgs e)
{
TimeSpan ts = stopWatch.Elapsed;


if (ripper.statusCode == processingCodes.Initializing)
{
uiProcessingState = processingCodes.Initializing;
this.Invoke((MethodInvoker)delegate
{
updateStatusText("Initializing ...");
updateWorkStatusText("Initializing ... ");
});
}

if (ripper.statusCode == processingCodes.checkingConnection)
{
uiProcessingState = processingCodes.checkingConnection;
this.Invoke((MethodInvoker)delegate
{
updateWorkStatusText("Checking for internet connection ...");
});
}

if (ripper.statusCode == processingCodes.connectionOK)
{
uiProcessingState = processingCodes.connectionOK;
this.Invoke((MethodInvoker)delegate
{
updateWorkStatusText("Internet Connection found ...");
Expand All @@ -439,6 +448,7 @@ private void crawlUIWorker_DoWork(object sender, DoWorkEventArgs e)
}
if (ripper.statusCode == processingCodes.connectionError)
{
uiProcessingState = processingCodes.connectionError;
this.Invoke((MethodInvoker)delegate
{
updateStatusText("Error");
Expand All @@ -453,6 +463,7 @@ private void crawlUIWorker_DoWork(object sender, DoWorkEventArgs e)

if (ripper.statusCode == processingCodes.gettingBlogInfo)
{
uiProcessingState = processingCodes.gettingBlogInfo;
this.Invoke((MethodInvoker)delegate
{
updateWorkStatusText("Getting Blog info ...");
Expand All @@ -461,6 +472,7 @@ private void crawlUIWorker_DoWork(object sender, DoWorkEventArgs e)

if (ripper.statusCode == processingCodes.blogInfoOK)
{
uiProcessingState = processingCodes.blogInfoOK;
this.Invoke((MethodInvoker)delegate
{
lbl_PostCount.Text = "0 / 0";
Expand All @@ -473,6 +485,7 @@ private void crawlUIWorker_DoWork(object sender, DoWorkEventArgs e)

if (ripper.statusCode == processingCodes.Starting)
{
uiProcessingState = processingCodes.Starting;
this.Invoke((MethodInvoker)delegate
{
updateWorkStatusText("Starting crawling Tumblr @ " + txt_TumblrURL.Text + " ... ");
Expand All @@ -489,6 +502,7 @@ private void crawlUIWorker_DoWork(object sender, DoWorkEventArgs e)
}
if (ripper.statusCode == processingCodes.Crawling)
{
uiProcessingState = processingCodes.Crawling;
percent = ripper.percentComplete;

if (percent > 100)
Expand All @@ -514,6 +528,7 @@ private void crawlUIWorker_DoWork(object sender, DoWorkEventArgs e)

if (ripper.statusCode == processingCodes.invalidURL)
{
uiProcessingState = processingCodes.invalidURL;
this.Invoke((MethodInvoker)delegate
{
updateStatusText("Error");
Expand All @@ -534,6 +549,7 @@ private void crawlWorker_AfterDone(object sender, RunWorkerCompletedEventArgs e)
{
if (ripper.statusCode == processingCodes.Done)
{
uiProcessingState = processingCodes.Done;
saveFile.blog = ripper.blog;

if (!optionsForm.parseOnly)
Expand All @@ -559,6 +575,12 @@ private void crawlWorker_DoWork(object sender, DoWorkEventArgs e)
this.ripper = new ImageRipper(tumblrBlog, txt_SaveLocation.Text, optionsForm.generateLog, optionsForm.parsePhotoSets, optionsForm.parseJPEG, optionsForm.parsePNG, optionsForm.parseGIF, 0);
ripper.statusCode = processingCodes.Initializing;

while (uiProcessingState != processingCodes.Initializing)
{
//
}


ts = stopWatch.Elapsed;

// Format and display the TimeSpan value.
Expand All @@ -567,10 +589,22 @@ private void crawlWorker_DoWork(object sender, DoWorkEventArgs e)
ts.Milliseconds / 10);

ripper.statusCode = processingCodes.checkingConnection;

while (uiProcessingState != processingCodes.checkingConnection)
{
//
}


if (WebHelper.CheckForInternetConnection())
{
ripper.statusCode = processingCodes.connectionOK;

while (uiProcessingState != processingCodes.connectionOK)
{
//
}

this.ts = stopWatch.Elapsed;

// Format and display the TimeSpan value.
Expand All @@ -586,10 +620,22 @@ private void crawlWorker_DoWork(object sender, DoWorkEventArgs e)
if (ripper.isValidTumblr())
{
ripper.statusCode = processingCodes.gettingBlogInfo;

while (uiProcessingState != processingCodes.gettingBlogInfo)
{
//
}


if (this.ripper.setBlogInfo())
{
ripper.statusCode = processingCodes.blogInfoOK;

while (uiProcessingState != processingCodes.blogInfoOK)
{
//
}

if (saveFile == null && !saveTumblrFile(this.ripper.blog.name))
{
ripper.statusCode = processingCodes.saveFileError;
Expand All @@ -605,6 +651,13 @@ private void crawlWorker_DoWork(object sender, DoWorkEventArgs e)
mode = select_Mode.SelectedIndex + 1;
});
ripper.statusCode = processingCodes.Starting;

while (uiProcessingState != processingCodes.Starting)
{
//
}


tumblrBlog = this.ripper.parseBlogPosts(mode);
}
}
Expand Down

0 comments on commit 98f1621

Please sign in to comment.