Example #1
0
        /// <summary>
        /// A fully featured upload-event handler
        /// </summary>
        protected virtual UploadHandlerReturnVal UploadHandler(TraceListenerUploadableBase Sender, string LogTitle,
                                                               string LogDetails, string UploadToWithoutPageNumber, List <LogEntry> LinksToLog, bool OpenInBrowser,
                                                               bool AddToWatchlist, string Username, string LogHeader, string EditSummary,
                                                               string LogSummaryEditSummary, WikiFunctions.Plugin.IAutoWikiBrowser AWB,
                                                               UsernamePassword LoginDetails)
        {
            UploadHandlerReturnVal retval = new UploadHandlerReturnVal();

            retval.Success = false;

            if (StartingUpload(Sender))
            {
                string pageName = UploadToWithoutPageNumber + " " + Sender.TraceStatus.PageNumber.ToString();
                UploadingPleaseWaitForm waitForm = new UploadingPleaseWaitForm();
                LogUploader             uploader = new LogUploader();

                waitForm.Show();

                try
                {
                    uploader.LogIn(LoginDetails);
                    Application.DoEvents();

                    retval.PageRetVals = uploader.LogIt(Sender.TraceStatus.LogUpload, LogTitle, LogDetails, pageName, LinksToLog,
                                                        Sender.TraceStatus.PageNumber, Sender.TraceStatus.StartDate, OpenInBrowser,
                                                        AddToWatchlist, Username, "{{log|name=" + UploadToWithoutPageNumber + "|page=" +
                                                        Sender.TraceStatus.PageNumber.ToString() + "}}" + System.Environment.NewLine + LogHeader,
                                                        false, EditSummary, LogSummaryEditSummary, ApplicationName, true, AWB);

                    retval.Success = true;
                }
                catch (Exception ex)
                {
                    ErrorHandler.Handle(ex);

                    retval.Success = false;
                }
                finally
                {
                    if (retval.Success)
                    {
                        Sender.WriteCommentAndNewLine("Log uploaded to " + pageName);
                    }
                    else
                    {
                        Sender.WriteCommentAndNewLine(
                            "LOG UPLOADING FAILED. Please manually upload this section to " + pageName);
                    }
                }

                waitForm.Dispose();
                FinishedUpload();
            }
            return(retval);
        }
        /// <summary>
        /// A fully featured upload-event handler
        /// </summary>
        protected virtual UploadHandlerReturnVal UploadHandler(TraceListenerUploadableBase sender, string logTitle,
                                                               string logDetails, string uploadToWithoutPageNumber, List <LogEntry> linksToLog, bool openInBrowser,
                                                               bool addToWatchlist, string username, string logHeader, string editSummary,
                                                               string logSummaryEditSummary, Plugin.IAutoWikiBrowser awb,
                                                               UsernamePassword loginDetails)
        {
            UploadHandlerReturnVal retval = new UploadHandlerReturnVal {
                Success = false
            };

            if (StartingUpload(sender))
            {
                string pageName = uploadToWithoutPageNumber + " " + sender.TraceStatus.PageNumber;
                UploadingPleaseWaitForm waitForm = new UploadingPleaseWaitForm();
                LogUploader             uploader = new LogUploader(awb.TheSession.Editor);

                waitForm.Show();

                try
                {
                    uploader.LogIn(loginDetails);
                    Application.DoEvents();

                    retval.PageRetVals = uploader.LogIt(sender.TraceStatus.LogUpload, logTitle, logDetails, pageName, linksToLog,
                                                        sender.TraceStatus.PageNumber, sender.TraceStatus.StartDate, openInBrowser,
                                                        addToWatchlist, username, "{{log|name=" + uploadToWithoutPageNumber + "|page=" +
                                                        sender.TraceStatus.PageNumber + "}}" + Environment.NewLine + logHeader,
                                                        false, editSummary, logSummaryEditSummary, ApplicationName, true, awb);

                    retval.Success = true;
                }
                catch (Exception ex)
                {
                    ErrorHandler.Handle(ex);

                    retval.Success = false;
                }
                finally
                {
                    if (retval.Success)
                    {
                        sender.WriteCommentAndNewLine("Log uploaded to " + pageName);
                    }
                    else
                    {
                        sender.WriteCommentAndNewLine(
                            "LOG UPLOADING FAILED. Please manually upload this section to " + pageName);
                    }
                }

                waitForm.Dispose();
                FinishedUpload();
            }
            return(retval);
        }
Example #3
0
        private void TraceUploadEventHandler(TraceListenerUploadableBase sender, ref bool success)
        {
            ValidateUploadProfile();
            UploadHandlerReturnVal retval = base.UploadHandler(sender, LoggingSettings.Settings.LogTitle, 
                LoggingSettings.Settings.WikifiedCategory, LoggingSettings.Settings.GlobbedUploadLocation + "/" + 
                sender.PageName.Replace(LoggingSettings.Props.ConUploadCategoryIsJobName, 
                LoggingSettings.Settings.Category), LoggingSettings.Settings.LinksToLog(), 
                LoggingSettings.Settings.UploadOpenInBrowser, LoggingSettings.Settings.UploadAddToWatchlist, 
                LoggingSettings.Props.UserName, Variables.AWBVersionString(Program.AWB.AWBVersionString) +
                Plugins.Plugin.GetPluginsWikiTextBlock(), Variables.AWBLoggingEditSummary +
                Variables.UploadingLogDefaultEditSummary, Variables.AWBLoggingEditSummary +
                Variables.UploadingLogEntryDefaultEditSummary, Program.AWB, LoggingSettings.LoginDetails);
            success = retval.Success;

            if (success)
                ((TraceStatus)sender.TraceStatus).UploadsCount += 1;

            if (LoggingSettings.Settings.DebugUploading)
                base.WriteUploadLog(retval.PageRetVals, LogFolder);
        }
Example #4
0
        protected override bool StartingUpload(TraceListenerUploadableBase sender)
        {
            if (sender.TraceStatus.LogName != conWiki)
                return false;

            mIsUploading = true;
            LoggingSettings.LedColour = WikiFunctions.Controls.Colour.Blue;
            Application.DoEvents();
            return true;
        }
 protected abstract bool StartingUpload(TraceListenerUploadableBase sender);
        /// <summary>
        /// A fully featured upload-event handler
        /// </summary>
        protected virtual UploadHandlerReturnVal UploadHandler(TraceListenerUploadableBase sender, string logTitle, 
            string logDetails, string uploadToWithoutPageNumber, List<LogEntry> linksToLog, bool openInBrowser,
            bool addToWatchlist, string username, string logHeader, string editSummary,
            string logSummaryEditSummary, Plugin.IAutoWikiBrowser awb, 
            UsernamePassword loginDetails)
        {
            UploadHandlerReturnVal retval = new UploadHandlerReturnVal {Success = false};

            if (StartingUpload(sender))
            {
                string pageName = uploadToWithoutPageNumber + " " + sender.TraceStatus.PageNumber;
                UploadingPleaseWaitForm waitForm = new UploadingPleaseWaitForm();
                LogUploader uploader = new LogUploader(awb.TheSession.Editor);

                waitForm.Show();

                try
                {
                    uploader.LogIn(loginDetails);
                    Application.DoEvents();

                    retval.PageRetVals = uploader.LogIt(sender.TraceStatus.LogUpload, logTitle, logDetails, pageName, linksToLog,
                        sender.TraceStatus.PageNumber, sender.TraceStatus.StartDate, openInBrowser,
                        addToWatchlist, username, "{{log|name=" + uploadToWithoutPageNumber + "|page=" +
                        sender.TraceStatus.PageNumber + "}}" + Environment.NewLine + logHeader,
                        false, editSummary, logSummaryEditSummary, ApplicationName, true, awb);

                    retval.Success = true;
                }
                catch (Exception ex)
                {
                    ErrorHandler.Handle(ex);

                    retval.Success = false;
                }
                finally
                {
                    if (retval.Success)                       
                        sender.WriteCommentAndNewLine("Log uploaded to " + pageName);
                    else
                        sender.WriteCommentAndNewLine(
                           "LOG UPLOADING FAILED. Please manually upload this section to " + pageName);
                }

                waitForm.Dispose();
                FinishedUpload();
            }
            return retval;
        }
Example #7
0
 protected abstract bool StartingUpload(TraceListenerUploadableBase Sender);
        /// <summary>
        /// A fully featured upload-event handler
        /// </summary>
        protected virtual UploadHandlerReturnVal UploadHandler(TraceListenerUploadableBase Sender, string LogTitle, 
            string LogDetails, string UploadToWithoutPageNumber, List<LogEntry> LinksToLog, bool OpenInBrowser,
            bool AddToWatchlist, string Username, string LogHeader, string EditSummary,
            string LogSummaryEditSummary, WikiFunctions.Plugin.IAutoWikiBrowser AWB, 
            UsernamePassword LoginDetails)
        {
            UploadHandlerReturnVal retval = new UploadHandlerReturnVal();
            retval.Success = false;

            if (StartingUpload(Sender))
            {
                string pageName = UploadToWithoutPageNumber + " " + Sender.TraceStatus.PageNumber.ToString();
                UploadingPleaseWaitForm waitForm = new UploadingPleaseWaitForm();
                LogUploader uploader = new LogUploader();

                waitForm.Show();

                try
                {
                    uploader.LogIn(LoginDetails);
                    Application.DoEvents();

                    retval.PageRetVals = uploader.LogIt(Sender.TraceStatus.LogUpload, LogTitle, LogDetails, pageName, LinksToLog,
                        Sender.TraceStatus.PageNumber, Sender.TraceStatus.StartDate, OpenInBrowser,
                        AddToWatchlist, Username, "{{log|name=" + UploadToWithoutPageNumber + "|page=" +
                        Sender.TraceStatus.PageNumber.ToString() + "}}" + System.Environment.NewLine + LogHeader,
                        false, EditSummary, LogSummaryEditSummary, ApplicationName, true, AWB);

                    retval.Success = true;
                }
                catch (Exception ex)
                {
                    ErrorHandler.Handle(ex);

                    retval.Success = false;
                }
                finally
                {
                    if (retval.Success)                       
                        Sender.WriteCommentAndNewLine("Log uploaded to " + pageName);
                    else
                        Sender.WriteCommentAndNewLine(
                           "LOG UPLOADING FAILED. Please manually upload this section to " + pageName);
                }

                waitForm.Dispose();
                FinishedUpload();
            }
            return retval;
        }