private static void UploadResult(string result) { if (string.IsNullOrEmpty(Common.CheckOperation(result))) { UploadedThisSession += EditsAndIgnored; if (CurrentlyUploadingSaved.Count > 0) { SavedPages.RemoveRange(0, CurrentlyUploadingSaved.Count - 1); CurrentlyUploadingSaved.Clear(); } if (CurrentlyUploadingSkipped.Count > 0) { SkippedPages.RemoveRange(0, CurrentlyUploadingSkipped.Count - 1); CurrentlyUploadingSkipped.Clear(); } if (CurrentlyUploadingReasons.Count > 0) { SkippedReasons.RemoveRange(0, CurrentlyUploadingReasons.Count - 1); CurrentlyUploadingReasons.Clear(); } if ((UploadedThisSession % 100) == 0) { CheckoutTime = DateTime.Now; } } AWB.StopProgressBar(); AWB.StatusLabelText = ""; IsUploading = false; }
//TODO:No point passing a number of literal strings for the skip reasons... We should use an ID or something, and pass it once /// <summary> /// /// </summary> private static void UploadFinishedArticlesToServer() { if (IsUploading || EditAndIgnoredPages == 0) { return; } IsUploading = true; EditsAndIgnored = EditAndIgnoredPages; AWB.StartProgressBar(); AWB.StatusLabelText = "Uploading " + EditsAndIgnored + " TypoScan articles to server..."; CurrentlyUploadingSaved.AddRange(SavedPages); CurrentlyUploadingSkipped.AddRange(SkippedPages); CurrentlyUploadingReasons.AddRange(SkippedReasons); NameValueCollection postVars = new NameValueCollection { { "articles", string.Join(",", CurrentlyUploadingSaved.ToArray()) }, { "skipped", string.Join(",", CurrentlyUploadingSkipped.ToArray()) }, { "skipreason", string.Join(",", CurrentlyUploadingReasons.ToArray()) }, { "user", AWB.Privacy ? "[withheld]" : AWB.TheSession.User.Name } }; if (!AWB.Shutdown) { Thread.PostData(Common.GetUrlFor("finished"), postVars); } else { UploadResult(Tools.PostData(postVars, Common.GetUrlFor("finished"))); } }