コード例 #1
0
        /// <summary>
        /// Load preferences object
        /// </summary>
        private void LoadPrefs(UserPrefs p)
        {
            chkRegExTypo.Checked = false;
            SetProject(p.LanguageCode, p.Project, p.CustomProject, p.Protocol);
            chkRegExTypo.Checked  = p.Editprefs.RegexTypoFix;
            Variables.LoginDomain = p.LoginDomain;

            FindAndReplace.Clear();
            chkFindandReplace.Checked      = p.FindAndReplace.Enabled;
            FindAndReplace.IgnoreLinks     = p.FindAndReplace.IgnoreSomeText;
            FindAndReplace.IgnoreMore      = p.FindAndReplace.IgnoreMoreText;
            FindAndReplace.AppendToSummary = p.FindAndReplace.AppendSummary;
            FindAndReplace.AddNew(p.FindAndReplace.Replacements);

            RplcSpecial.Clear();
            RplcSpecial.AddNewRule(p.FindAndReplace.AdvancedReps);

            SubstTemplates.Clear();
            SubstTemplates.TemplateList      = p.FindAndReplace.SubstTemplates;
            SubstTemplates.ExpandRecursively = p.FindAndReplace.ExpandRecursively;
            SubstTemplates.IgnoreUnformatted = p.FindAndReplace.IgnoreUnformatted;
            SubstTemplates.IncludeComments   = p.FindAndReplace.IncludeComments;

            FindAndReplace.MakeList();

            listMaker.SourceText       = p.List.ListSource;
            listMaker.SelectedProvider = p.List.SelectedProvider;

            _saveArticleList = p.General.SaveArticleList;

            IgnoreNoBots = p.General.IgnoreNoBots;
            ClearPageListOnProjectChange = p.General.ClearPageListOnProjectChange;

            chkGeneralFixes.Checked   = p.Editprefs.GeneralFixes;
            chkAutoTagger.Checked     = p.Editprefs.Tagger;
            chkUnicodifyWhole.Checked = p.Editprefs.Unicodify;

            cmboCategorise.SelectedIndex = p.Editprefs.Recategorisation;
            txtNewCategory.Text          = p.Editprefs.NewCategory;
            txtNewCategory2.Text         = p.Editprefs.NewCategory2;

            cmboImages.SelectedIndex = p.Editprefs.ReImage;
            txtImageReplace.Text     = p.Editprefs.ImageFind;
            txtImageWith.Text        = p.Editprefs.Replace;

            chkSkipNoCatChange.Checked = p.Editprefs.SkipIfNoCatChange;
            chkRemoveSortKey.Checked   = p.Editprefs.RemoveSortKey;
            chkSkipNoImgChange.Checked = p.Editprefs.SkipIfNoImgChange;

            chkAppend.Checked             = p.Editprefs.AppendText;
            chkAppendMetaDataSort.Checked = p.Editprefs.AppendTextMetaDataSort;
            rdoAppend.Checked             = p.Editprefs.Append;
            rdoPrepend.Checked            = !p.Editprefs.Append;
            txtAppendMessage.Text         = p.Editprefs.Text;
            udNewlineChars.Value          = p.Editprefs.Newlines;

            nudBotSpeed.Value      = p.Editprefs.AutoDelay;
            botEditsStop.Value     = p.Editprefs.BotMaxEdits;
            chkSuppressTag.Checked = p.Editprefs.SupressTag;

            radSkipNonExistent.Checked       = p.SkipOptions.SkipNonexistent;
            radSkipExistent.Checked          = p.SkipOptions.Skipexistent;
            radSkipNone.Checked              = p.SkipOptions.SkipDontCare;
            chkSkipNoChanges.Checked         = p.SkipOptions.SkipWhenNoChanges;
            chkSkipSpamFilter.Checked        = p.SkipOptions.SkipSpamFilterBlocked;
            chkSkipIfInuse.Checked           = p.SkipOptions.SkipInuse;
            chkSkipWhitespace.Checked        = p.SkipOptions.SkipWhenOnlyWhitespaceChanged;
            chkSkipCasing.Checked            = p.SkipOptions.SkipOnlyCasingChanged;
            chkSkipGeneralFixes.Checked      = p.SkipOptions.SkipOnlyGeneralFixChanges;
            chkSkipMinorGeneralFixes.Checked = p.SkipOptions.SkipOnlyMinorGeneralFixChanges;
            chkSkipCosmetic.Checked          = p.SkipOptions.SkipOnlyCosmetic;
            chkSkipIfRedirect.Checked        = p.SkipOptions.SkipIfRedirect;
            chkSkipIfNoAlerts.Checked        = p.SkipOptions.SkipIfNoAlerts;

            skipIfContains.CheckEnabled    = p.SkipOptions.SkipDoes;
            skipIfContains.CheckText       = p.SkipOptions.SkipDoesText;
            skipIfContains.IsRegex         = p.SkipOptions.SkipDoesRegex;
            skipIfContains.IsCaseSensitive = p.SkipOptions.SkipDoesCaseSensitive;
            skipIfContains.After           = p.SkipOptions.SkipDoesAfterProcessing;

            skipIfNotContains.CheckEnabled    = p.SkipOptions.SkipDoesNot;
            skipIfNotContains.CheckText       = p.SkipOptions.SkipDoesNotText;
            skipIfNotContains.IsRegex         = p.SkipOptions.SkipDoesNotRegex;
            skipIfNotContains.IsCaseSensitive = p.SkipOptions.SkipDoesNotCaseSensitive;
            skipIfNotContains.After           = p.SkipOptions.SkipDoesNotAfterProcessing;

            chkSkipWhenNoFAR.Checked     = p.SkipOptions.SkipNoFindAndReplace;
            chkSkipOnlyMinorFaR.Checked  = p.SkipOptions.SkipMinorFindAndReplace;
            chkSkipIfNoRegexTypo.Checked = p.SkipOptions.SkipNoRegexTypoFix;
            Skip.SelectedItems           = p.SkipOptions.GeneralSkipList;
            chkSkipNoDab.Checked         = p.SkipOptions.SkipNoDisambiguation;
            chkSkipNoPageLinks.Checked   = p.SkipOptions.SkipNoLinksOnPage;

            cmboEditSummary.Items.Clear();

            if (p.General.Summaries.Count == 0)
            {
                LoadDefaultEditSummaries();
            }
            else
            {
                foreach (string s in p.General.Summaries)
                {
                    cmboEditSummary.Items.Add(s);
                }
            }

            chkLock.Checked    = p.General.LockSummary;
            EditToolBarVisible = p.General.EditToolbarEnabled;

            cmboEditSummary.Text = p.General.SelectedSummary;

            if (chkLock.Checked)
            {
                lblSummary.Text = p.General.SelectedSummary;
            }

            for (int i = 0; i < 10; ++i)
            {
                SetPasteMoreText(i, p.General.PasteMore[i]);
            }

            txtFind.Text                 = p.General.FindText;
            chkFindRegex.Checked         = p.General.FindRegex;
            chkFindCaseSensitive.Checked = p.General.FindCaseSensitive;

            wordWrapToolStripMenuItem1.Checked = p.General.WordWrap;
            EnableToolBar = p.General.ToolBarEnabled;
            followRedirectsToolStripMenuItem.Checked            = p.General.BypassRedirect;
            autoSaveSettingsToolStripMenuItem.Checked           = p.General.AutoSaveSettings;
            preParseModeToolStripMenuItem.Checked               = p.General.PreParseMode;
            noSectionEditSummaryToolStripMenuItem.Checked       = p.General.noSectionEditSummary;
            restrictDefaultsortChangesToolStripMenuItem.Checked = p.General.restrictDefaultsortAddition;
            restrictOrphanTaggingToolStripMenuItem.Checked      = p.General.restrictOrphanTagging;
            noMOSComplianceFixesToolStripMenuItem.Checked       = p.General.noMOSComplianceFixes;
            syntaxHighlightEditBoxToolStripMenuItem.Checked     = p.General.syntaxHighlightEditBox;
            highlightAllFindToolStripMenuItem.Checked           = p.General.highlightAllFind;
            automaticallyDoAnythingToolStripMenuItem.Checked    = !p.General.NoAutoChanges;
            actionOnLoad                 = p.General.OnLoadAction;
            doDiffInBotMode              = p.General.DiffInBotMode;
            chkMinor.Checked             = p.General.Minor;
            addToWatchList.SelectedIndex = p.General.AddToWatchlist;
            ShowMovingAverageTimer       = p.General.TimerEnabled;
            alertPreferences             = p.General.AlertPreferences;

            sortAlphabeticallyToolStripMenuItem.Checked          = listMaker.AutoAlpha = p.General.SortListAlphabetically;
            displayfalsePositivesButtonToolStripMenuItem.Checked = p.General.AddIgnoredToLog;

            _autoSaveEditBoxEnabled = p.General.AutoSaveEdit.Enabled;
            AutoSaveEditBoxPeriod   = p.General.AutoSaveEdit.SavePeriod;
            _autoSaveEditBoxFile    = p.General.AutoSaveEdit.SaveFile;

            _suppressUsingAWB = p.General.SuppressUsingAWB;
            Article.AddUsingAWBOnArticleAction = p.General.AddUsingAWBToActionSummaries;

            filterOutNonMainSpaceToolStripMenuItem.Checked = p.General.filterNonMainSpace;
            removeDuplicatesToolStripMenuItem.Checked      = listMaker.FilterDuplicates = p.General.AutoFilterDuplicates;

            alphaSortInterwikiLinksToolStripMenuItem.Checked = p.General.SortInterWikiOrder;
            replaceReferenceTagsToolStripMenuItem.Checked    = p.General.ReplaceReferenceTags;
            focusAtEndOfEditTextBoxToolStripMenuItem.Checked = p.General.FocusAtEndOfEditBox;
            scrollToAlertsToolStripMenuItem.Checked          = p.General.scrollToUnbalancedBrackets;

            txtEdit.Font = new System.Drawing.Font(p.General.TextBoxFont, p.General.TextBoxSize);

            loggingEnabled = p.General.LoggingEnabled;

            LowThreadPriority = p.General.LowThreadPriority;
            _flash            = p.General.Flash;
            _beep             = p.General.Beep;

            _minimize = p.General.Minimize;

            chkEnableDab.Checked = p.Disambiguation.Enabled;
            txtDabLink.Text      = p.Disambiguation.Link;
            txtDabVariants.Lines = p.Disambiguation.Variants;
            udContextChars.Value = p.Disambiguation.ContextChars;

            listMaker.SpecialFilterSettings = p.Special;
            // ensure listmaker is only populated once listmaker filter settings (remove non-mainpace etc.) have been loaded
            listMaker.Add(p.List.ArticleList);

            CModule.Language = p.Module.Language;
            CModule.Code     = p.Module.Code.Replace("\n", "\r\n");
            // Don't enable custom module until code loaded, prevents phantom compile error
            CModule.ModuleEnabled = p.Module.Enabled;
            if (!CModule.ModuleEnabled)
            {
                CModule.SetModuleNotBuilt();
            }

            ExtProgram.Settings = p.ExternalProgram;

            _listComparerUseCurrentArticleList = p.Tool.ListComparerUseCurrentArticleList;
            _listSplitterUseCurrentArticleList = p.Tool.ListSplitterUseCurrentArticleList;
            _dbScannerUseCurrentArticleList    = p.Tool.DatabaseScannerUseCurrentArticleList;

            foreach (PluginPrefs pp in p.Plugin)
            {
                IAWBPlugin plugin;
                if (Plugin.AWBPlugins.TryGetValue(pp.Name, out plugin))
                {
                    plugin.LoadSettings(pp.PluginSettings);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Load preferences object
        /// </summary>
        private void LoadPrefs(UserPrefs p)
        {
            SetProject(p.LanguageCode, p.Project, p.CustomProject);

            FindAndReplace.Clear();
            chkFindandReplace.Checked      = p.FindAndReplace.Enabled;
            FindAndReplace.IgnoreLinks     = p.FindAndReplace.IgnoreSomeText;
            FindAndReplace.IgnoreMore      = p.FindAndReplace.IgnoreMoreText;
            FindAndReplace.AppendToSummary = p.FindAndReplace.AppendSummary;
            FindAndReplace.AfterOtherFixes = p.FindAndReplace.AfterOtherFixes;
            FindAndReplace.AddNew(p.FindAndReplace.Replacements);

            RplcSpecial.Clear();
            RplcSpecial.AddNewRule(p.FindAndReplace.AdvancedReps);

            SubstTemplates.Clear();
            SubstTemplates.TemplateList      = p.FindAndReplace.SubstTemplates;
            SubstTemplates.ExpandRecursively = p.FindAndReplace.ExpandRecursively;
            SubstTemplates.IgnoreUnformatted = p.FindAndReplace.IgnoreUnformatted;
            SubstTemplates.IncludeComments   = p.FindAndReplace.IncludeComments;

            FindAndReplace.MakeList();

            listMaker.SourceText     = p.List.ListSource;
            listMaker.SelectedSource = p.List.SourceIndex;

            SaveArticleList = p.General.SaveArticleList;

            IgnoreNoBots = p.General.IgnoreNoBots;

            listMaker.Add(p.List.ArticleList);

            chkGeneralFixes.Checked   = p.Editprefs.GeneralFixes;
            chkAutoTagger.Checked     = p.Editprefs.Tagger;
            chkUnicodifyWhole.Checked = p.Editprefs.Unicodify;

            cmboCategorise.SelectedIndex = p.Editprefs.Recategorisation;
            txtNewCategory.Text          = p.Editprefs.NewCategory;
            txtNewCategory2.Text         = p.Editprefs.NewCategory2;

            cmboImages.SelectedIndex = p.Editprefs.ReImage;
            txtImageReplace.Text     = p.Editprefs.ImageFind;
            txtImageWith.Text        = p.Editprefs.Replace;

            chkSkipNoCatChange.Checked = p.Editprefs.SkipIfNoCatChange;
            chkRemoveSortKey.Checked   = p.Editprefs.RemoveSortKey;
            chkSkipNoImgChange.Checked = p.Editprefs.SkipIfNoImgChange;

            chkAppend.Checked     = p.Editprefs.AppendText;
            rdoAppend.Checked     = p.Editprefs.Append;
            rdoPrepend.Checked    = !p.Editprefs.Append;
            txtAppendMessage.Text = p.Editprefs.Text;
            udNewlineChars.Value  = p.Editprefs.Newlines;

            nudBotSpeed.Value      = p.Editprefs.AutoDelay;
            chkSuppressTag.Checked = p.Editprefs.SupressTag;

            chkRegExTypo.Checked = p.Editprefs.RegexTypoFix;

            radSkipNonExistent.Checked       = p.SkipOptions.SkipNonexistent;
            radSkipExistent.Checked          = p.SkipOptions.Skipexistent;
            chkSkipNoChanges.Checked         = p.SkipOptions.SkipWhenNoChanges;
            chkSkipSpamFilter.Checked        = p.SkipOptions.SkipSpamFilterBlocked;
            chkSkipIfInuse.Checked           = p.SkipOptions.SkipInuse;
            chkSkipWhitespace.Checked        = p.SkipOptions.SkipWhenOnlyWhitespaceChanged;
            chkSkipCasing.Checked            = p.SkipOptions.SkipOnlyCasingChanged;
            chkSkipGeneralFixes.Checked      = p.SkipOptions.SkipOnlyGeneralFixChanges;
            chkSkipMinorGeneralFixes.Checked = p.SkipOptions.SkipOnlyMinorGeneralFixChanges;
            chkSkipIfRedirect.Checked        = p.SkipOptions.SkipIfRedirect;
            chkSkipIfNoAlerts.Checked        = p.SkipOptions.SkipIfNoAlerts;

            chkSkipIfContains.Checked    = p.SkipOptions.SkipDoes;
            chkSkipIfNotContains.Checked = p.SkipOptions.SkipDoesNot;

            txtSkipIfContains.Text    = p.SkipOptions.SkipDoesText;
            txtSkipIfNotContains.Text = p.SkipOptions.SkipDoesNotText;

            chkSkipIsRegex.Checked       = p.SkipOptions.Regex;
            chkSkipCaseSensitive.Checked = p.SkipOptions.CaseSensitive;

            chkSkipWhenNoFAR.Checked     = p.SkipOptions.SkipNoFindAndReplace;
            chkSkipIfNoRegexTypo.Checked = p.SkipOptions.SkipNoRegexTypoFix;
            Skip.SelectedItems           = p.SkipOptions.GeneralSkipList;
            chkSkipNoDab.Checked         = p.SkipOptions.SkipNoDisambiguation;
            chkSkipNoPageLinks.Checked   = p.SkipOptions.SkipNoLinksOnPage;

            cmboEditSummary.Items.Clear();

            if (p.General.Summaries.Count == 0)
            {
                LoadDefaultEditSummaries();
            }
            else
            {
                foreach (string s in p.General.Summaries)
                {
                    cmboEditSummary.Items.Add(s);
                }
            }

            chkLock.Checked    = p.General.LockSummary;
            EditToolBarVisible = p.General.EditToolbarEnabled;

            cmboEditSummary.Text = p.General.SelectedSummary;

            if (chkLock.Checked)
            {
                lblSummary.Text = p.General.SelectedSummary;
            }

            PasteMore1.Text  = p.General.PasteMore[0];
            PasteMore2.Text  = p.General.PasteMore[1];
            PasteMore3.Text  = p.General.PasteMore[2];
            PasteMore4.Text  = p.General.PasteMore[3];
            PasteMore5.Text  = p.General.PasteMore[4];
            PasteMore6.Text  = p.General.PasteMore[5];
            PasteMore7.Text  = p.General.PasteMore[6];
            PasteMore8.Text  = p.General.PasteMore[7];
            PasteMore9.Text  = p.General.PasteMore[8];
            PasteMore10.Text = p.General.PasteMore[9];

            txtFind.Text                 = p.General.FindText;
            chkFindRegex.Checked         = p.General.FindRegex;
            chkFindCaseSensitive.Checked = p.General.FindCaseSensitive;

            wordWrapToolStripMenuItem1.Checked = p.General.WordWrap;
            EnableToolBar = p.General.ToolBarEnabled;
            bypassRedirectsToolStripMenuItem.Checked            = p.General.BypassRedirect;
            autoSaveSettingsToolStripMenuItem.Checked           = p.General.AutoSaveSettings;
            preParseModeToolStripMenuItem.Checked               = p.General.PreParseMode;
            noSectionEditSummaryToolStripMenuItem.Checked       = p.General.noSectionEditSummary;
            restrictDefaultsortChangesToolStripMenuItem.Checked = p.General.restrictDefaultsortAddition;
            noMOSComplianceFixesToolStripMenuItem.Checked       = p.General.noMOSComplianceFixes;
            syntaxHighlightEditBoxToolStripMenuItem.Checked     = p.General.syntaxHighlightEditBox;
            automaticallyDoAnythingToolStripMenuItem.Checked    = !p.General.NoAutoChanges;
            toolStripComboOnLoad.SelectedIndex = p.General.OnLoadAction;
            chkMinor.Checked = p.General.Minor;
            addAllToWatchlistToolStripMenuItem.Checked  = p.General.Watch;
            dontAddToWatchlistToolStripMenuItem.Checked = p.General.DoNotWatch;
            ShowMovingAverageTimer = p.General.TimerEnabled;

            sortAlphabeticallyToolStripMenuItem.Checked          = p.General.SortListAlphabetically;
            displayfalsePositivesButtonToolStripMenuItem.Checked = p.General.AddIgnoredToLog;

            AutoSaveEditBoxEnabled = p.General.AutoSaveEdit.Enabled;
            AutoSaveEditBoxPeriod  = p.General.AutoSaveEdit.SavePeriod;
            AutoSaveEditBoxFile    = p.General.AutoSaveEdit.SaveFile;

            SuppressUsingAWB           = p.General.SuppressUsingAWB;
            AddUsingAWBOnArticleAction = p.General.AddUsingAWBToActionSummaries;

            filterOutNonMainSpaceToolStripMenuItem.Checked = p.General.filterNonMainSpace;
            removeDuplicatesToolStripMenuItem.Checked      = p.General.AutoFilterDuplicates;

            alphaSortInterwikiLinksToolStripMenuItem.Checked    = p.General.SortInterWikiOrder;
            replaceReferenceTagsToolStripMenuItem.Checked       = p.General.ReplaceReferenceTags;
            focusAtEndOfEditTextBoxToolStripMenuItem.Checked    = p.General.FocusAtEndOfEditBox;
            scrollToUnbalancedBracketsToolStripMenuItem.Checked = p.General.scrollToUnbalancedBrackets;

            txtEdit.Font = new System.Drawing.Font(p.General.TextBoxFont, p.General.TextBoxSize);

            LowThreadPriority = p.General.LowThreadPriority;
            Flash             = p.General.Flash;
            Beep = p.General.Beep;

            Minimize = p.General.Minimize;
            TimeOut  = p.General.TimeOutLimit;
            webBrowserEdit.TimeoutLimit = int.Parse(TimeOut.ToString());

            chkEnableDab.Checked = p.Disambiguation.Enabled;
            txtDabLink.Text      = p.Disambiguation.Link;
            txtDabVariants.Lines = p.Disambiguation.Variants;
            udContextChars.Value = p.Disambiguation.ContextChars;

            listMaker.SpecialFilterSettings = p.Special;

            loggingSettings1.SerialisableSettings = p.Logging;

            CModule.ModuleEnabled = p.Module.Enabled;
            CModule.Language      = p.Module.Language;
            CModule.Code          = p.Module.Code.Replace("\n", "\r\n");
            if (CModule.ModuleEnabled)
            {
                CModule.MakeModule();
            }
            else
            {
                CModule.SetModuleNotBuilt();
            }

            ExtProgram.Settings = p.ExternalProgram;

            foreach (PluginPrefs pp in p.Plugin)
            {
                if (Plugin.Items.ContainsKey(pp.Name))
                {
                    Plugin.Items[pp.Name].LoadSettings(pp.PluginSettings);
                }
            }
        }