public void IsUserInput_FindAndReplace1word_worldTouniverse() { FindAndReplace testFindAndReplace = new FindAndReplace("Hello world.", "world", "universe"); string replacedWords = testFindAndReplace.ReplaceWords(); Console.WriteLine(replacedWords); Assert.AreEqual("Hello universe.", replacedWords); }
public void oneWord_Replace() { //Arrange string sentence = "my name is manasa"; string word = "manasa"; string wordReplace = "murali"; Assert.AreEqual("my name is murali", FindAndReplace.AfterReplaced(sentence, word, wordReplace)); }
public ActionResult Result() { string text = Request.Form["text"]; string find = Request.Form["find"]; string replace = Request.Form["replace"]; FindAndReplace newFind = new FindAndReplace(text, find, replace); newFind.ReplaceAll(); return(View("Result", newFind)); }
public ActionResult ReplaceWord() { string userWord = Request.Form["word"]; string replaceThis = Request.Form["replace"]; string userSentence = Request.Form["sentence"]; FindAndReplace newFindAndReplace = new FindAndReplace(userSentence, replaceThis, userWord); return(View("Index", newFindAndReplace)); }
public void Replace_Is_Null() { string input = "I love my country!"; string find = "country"; string replace = null; var result = new FindAndReplace().FirstTry(input, find, replace); Assert.Null(result); }
public void Input_Is_Null() { string input = null; string find = "country"; string replace = "nation"; var result = new FindAndReplace().FirstTry(input, find, replace); Assert.Null(result); }
public void Replacing_The_Last_Word() { string input = "I love my country"; string find = "country"; string replace = "nation"; var result = new FindAndReplace().FirstTry(input, find, replace); Assert.Equal("I love my nation", result); }
public void Replacing_The_Same_Word_Together() { string input = "countrycountry"; string find = "country"; string replace = "nation"; var result = new FindAndReplace().FirstTry(input, find, replace); Assert.Equal("nationnation", result); }
public void Replacing_Two_Words() { string input = "1country I love my country!"; string find = "country"; string replace = "nation"; var result = new FindAndReplace().FirstTry(input, find, replace); Assert.Equal("1nation I love my nation!", result); }
public void Replace_To_A_Greater_String() { string input = "I love my country!"; string find = "country"; string replace = "beautiful home"; var result = new FindAndReplace().FirstTry(input, find, replace); Assert.Equal("I love my beautiful home!", result); }
public void Replace_Is_StringEmpty() { string input = "I love my country!"; string find = "country"; string replace = string.Empty; var result = new FindAndReplace().FirstTry(input, find, replace); Assert.Equal("I love my !", result); }
public void GetText_ConstructorTest() { //Arrange FindAndReplace findReplace = new FindAndReplace("Great Big Text", "Big", "Large"); //Act string result = findReplace.GetText(); //Assert Assert.AreEqual("Great Big Text", result); }
private void OpenReplaceDialog(object sender, EventArgs e) { if (FindAndReplace.Active) { return; } FindAndReplace far = new FindAndReplace(MainWindow.THIS); far.Show(); }
public void ReplaceAll_ReplaceAllOccurrencesOfFind() { //Arrange FindAndReplace findReplace = new FindAndReplace("BIg Great biG Text big", "Big", "Large"); //Act string result = findReplace.ReplaceAll(); //Assert Assert.AreEqual("Large Great Large Text Large", result); }
public void GetIndex_ReturnIndex() { //Arrange FindAndReplace findReplace = new FindAndReplace("Great Big Text", "Big", "Large"); //Act int result = findReplace.GetIndex(0); //Assert Assert.AreEqual(6, result); }
public HomeModule() { Get["/"] = _ => { return(View["index.cshtml"]); }; Post["/results"] = _ => { FindAndReplace newFindAndReplace = new FindAndReplace(Request.Form["phrase"], Request.Form["word1"], Request.Form["word2"]); return(View["results.cshtml", newFindAndReplace]); }; }
public ActionResult IndexPost() { string function = Request.Form["function"]; string inputPalindrome = Request.Form["palindromeinputString"]; string inputFR = Request.Form["inputFR"]; string find = Request.Form["findFR"]; string replace = Request.Form["replaceFR"]; string rpsPlayerOne = Request.Form["rpsPlayerOne"]; string rpsPlayerTwo = Request.Form["rpsPlayerTwo"]; string anagramField = Request.Form["anagram"]; string inputScrabble = Request.Form["scrabble"]; if (function == "palindromes") { Palindrome newModel = new Palindrome(inputPalindrome); return(View("Index", newModel)); } else if (function == "fr") { FindAndReplace newModel = new FindAndReplace(inputFR, find, replace); // Console.WriteLine("RPSAI"); return(View("Index", newModel)); } else if (function == "rpsai") { RockPaperScissors newModel = new RockPaperScissors(rpsPlayerOne, ""); newModel.AIPlay(); // Console.WriteLine("RPS"); return(View("Index", newModel)); } else if (function == "rps") { RockPaperScissors newModel = new RockPaperScissors(rpsPlayerOne, rpsPlayerTwo); // Console.WriteLine("Palindrome"); return(View("Index", newModel)); } else if (function == "anagram") { Anagram newModel = new Anagram(anagramField); // Console.WriteLine("Anagram"); return(View("Index", newModel)); } else if (function == "scrabble") { Scrabble newModel = new Scrabble(inputScrabble); // Console.WriteLine("Scrabble"); return(View("Index", newModel)); } else { } return(View("Index")); }
public void LocateFindWord_FindTheWord_True() { // Arrange string userInput = "Hello world"; string word1 = "world"; string word2 = "universe"; // Act FindAndReplace newFindAndReplace = new FindAndReplace(userInput, word1, word2); // Assert Assert.Equal(true, newFindAndReplace.LocateFindWord()); }
public void FindAndReplace_Constructor_Result() { // Arrange string userInput = "Hello world"; string word1 = "world"; string word2 = "universe"; // Act FindAndReplace newFindAndReplace = new FindAndReplace(userInput, word1, word2); // Assert Assert.Equal(userInput, newFindAndReplace.GetUserString()); Assert.Equal(word1, newFindAndReplace.GetFindWord()); Assert.Equal(word2, newFindAndReplace.GetReplaceWord()); }
public void ReplaceFindWord_ReplaceTheFindeWord_ReplaceWord() { // Arrange string userInput = "Hello world"; string word1 = "world"; string word2 = "universe"; string expectedResults = "Hello universe"; // Act FindAndReplace newFindAndReplace = new FindAndReplace(userInput, word1, word2); // Assert Assert.Equal(expectedResults, newFindAndReplace.ReplaceFindWord()); }
public HomeModule() { Get["/"] = _ => { return(View["index.cshtml"]); }; Post["/replace"] = _ => { string userManyWords = Request.Form["userManyWords"]; string userTarget = Request.Form["userTarget"]; string userReplace = Request.Form["userReplace"]; FindAndReplace newFindAndReplace = new FindAndReplace(userManyWords, userTarget, userReplace); return(View["result.cshtml", newFindAndReplace]); }; }
void updateMatches(int increment) { matches = FindAndReplace.Find(textBox.Text, txtFindText.Text, chkMatchCase.Checked, chkWholeWordsOnly.Checked); if (increment != 1 && increment != 0 && increment != -1) { throw (new ArgumentException()); } index += increment; position = matches[index]; if (matches.Count == 0) { lblMatchesFound.Text = "No matches found."; } else if (matches.Count == 1) { lblMatchesFound.Text = "1 match found."; } else { lblMatchesFound.Text = matches.Count + " matches found."; } }
private static IComponentInitMode <Form> getInitFormRelation(DefaultNameEnum name) { IComponentInitMode <Form> mode = null; if (DefaultNameEnum.CREAD_JAVA_ENTITY.Equals(name)) { mode = new CreadJavaEntity(); } else if (DefaultNameEnum.ADD_CHARS_FORM.Equals(name)) { mode = new AddCharsForm(); } else if (DefaultNameEnum.FIND_REPLACE_FORM.Equals(name)) { mode = new FindAndReplace(); } else if (DefaultNameEnum.SPLIT_CHARS_FORM.Equals(name)) { mode = new SplitCharsForm(); } else if (DefaultNameEnum.ROW_GOTO_FORM.Equals(name)) { mode = new RowGoToForm(); } else if (DefaultNameEnum.SET_CODING_FORM.Equals(name)) { mode = new SetCodingForm(); } else if (DefaultNameEnum.THEREOF_FORM.Equals(name)) { mode = new ThereofForm(); } else if (DefaultNameEnum.CHARS_STATISTICS.Equals(name)) { mode = new CharsStatistics(getPageTextBox()); } return(mode); }
/// <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); } } }
private void createWordDocument(object filename) { Application wordApp = new Application(); Document doc = null; //check the template is exist or not if (File.Exists((string)filename)) { FindAndReplace findAndReplace = new FindAndReplace(); object readOnly = false; //default object isVisible = false; //make the doc visible object replaceAll = WdReplace.wdReplaceAll; object missing = Missing.Value; wordApp.Visible = false; //open the template doc = wordApp.Documents.Open(ref filename, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing); //create a new doc same as the template doc.Activate(); //insert the value to the new doc follow the id //findAndReplace.replace(wordApp, "<Title>", txtTitle.Text); //findAndReplace.replace(wordApp, "<name>", txtName.Text); wordApp.Selection.Find.Execute("<name>", missing, missing, missing, missing, missing, missing, missing, missing, txtName.Text); wordApp.Selection.Find.Execute("<Title>", missing, missing, missing, missing, missing, missing, missing, missing, txtName.Text); //edit Header and footer foreach (Section section in doc.Sections) { //find the footer and replace Range footerRange = section.Footers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range; footerRange.Find.Text = "<Date>"; footerRange.Find.Replacement.Text = DateTime.Now.ToString("dd-MMM-yyyy HH:mm:ss").ToString(); footerRange.Find.Execute(ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref replaceAll, ref missing, ref missing, ref missing, ref missing); //find the Header and replace Range headerRange = section.Headers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range; headerRange.Find.Text = "<CompanyName>"; headerRange.Find.Replacement.Text = "冰冰无限公司"; headerRange.Find.Execute(ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref replaceAll, ref missing, ref missing, ref missing, ref missing); } object tempFile = Server.MapPath("Temp/" + DateTime.Now.ToString("ddmmyyyyhhmmssffffff") + ".doc"); //save the new doc in temp file doc.SaveAs2(ref tempFile, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing); //close all the doc doc.Close(ref missing, ref missing, ref missing); //let the user download the doc Response.ContentType = "Application/msword"; Response.AddHeader("Content-Disposition", "attachment;filename=" + tempFile); Response.TransmitFile(Path.Combine(tempFile.ToString())); Response.End(); } }
/// <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); } } }
static void Main(string[] args) { FindAndReplace.FindNext("book"); Console.ReadKey(); }
public override void Dispose() { base.Dispose(); DisposeTextBlock(TextBlock1); TextBlock1 = null; DisposeTextBlock(TextBlock2); TextBlock2 = null; DisposeTextBlock(TextBlock3); TextBlock3 = null; DisposeTextBlock(TextBlock4); TextBlock4 = null; DisposeTextBlock(TextBlock5); TextBlock5 = null; DisposeTextBlock(TextBlock6); TextBlock6 = null; DisposeTextBlock(TextBlock7); TextBlock7 = null; DisposeTextBlock(TextBlock8); TextBlock8 = null; DisposeTextBlock(TextBlock9); TextBlock9 = null; DisposeTextBlock(TextBlock10); TextBlock10 = null; DisposeTextBlock(TextBlock11); TextBlock11 = null; DisposeTextBlock(TextBlock12); TextBlock12 = null; DisposeTextBlock(TextBlock13); TextBlock13 = null; DisposeTextBlock(TextBlock14); TextBlock14 = null; DisposeTextBlock(TextBlock15); TextBlock15 = null; DisposeTextBlock(TextBlock16); TextBlock16 = null; DisposeTextBlock(TextBlock17); TextBlock17 = null; DisposeTextBlock(TextBlock18); TextBlock18 = null; DisposeTextBox(InputFile1); InputFile1 = null; DisposeTextBox(FindTextBox); FindTextBox = null; DisposeTextBox(ReplaceTextBox); ReplaceTextBox = null; DisposeCheckBox(chkBoxMatchCase); chkBoxMatchCase = null; DisposeCheckBox(chkBoxWholeWord); chkBoxWholeWord = null; Button1.Click -= Button_Click_3; DisposeButton(Button1); Button1 = null; generateButton.Click -= Button_Click_1; DisposeButton(generateButton); generateButton = null; DisposeRadioButton(rdDoc); rdDoc = null; DisposeRadioButton(rdDocx); rdDocx = null; stackPnlOptions.ClearValue(StackPanel.OrientationProperty); stackPnlOptions.ClearValue(StackPanel.HorizontalAlignmentProperty); stackPnlOptions = null; FindAndReplace.ClearValue(Grid.BackgroundProperty); FindAndReplace.ClearValue(Grid.PaddingProperty); FindAndReplace.Children.Clear(); FindAndReplace.ColumnDefinitions.Clear(); FindAndReplace.RowDefinitions.Clear(); FindAndReplace = null; }
private void MenuFind_Click(object sender, RoutedEventArgs e) { //List<Word> words = new List<Word>(); ////txtMainArea.Text.Split(new[] { Environment.NewLine },StringSplitOptions.None).ToList().ForEach(a => words.Add(new Word(a))); //using (System.IO.StringReader reader = new System.IO.StringReader(txtMainArea.Text)) //{ // while(true) // { // var temp = reader.ReadLine(); // if(temp != null) // { // words.Add(new Word(temp)); // } // else // { // break; // } // } //} //int index = 0; ////Lista stringow w kazdej liscie poszukaj zadanej frazy. I wez pierwszy element //foreach(var word in words) //{ // if(word.FindElement("F")) // { // break; // } // index++; //} ////index +=1; //for(int i = 0;i<index;i++) //{ // MainScroll.LineDown(); //} if (canOpenFindAndReplace) { FindAndReplace findAndReplace = new FindAndReplace(); findAndReplace.Show(); canOpenFindAndReplace = false; } //int numberOfColumns = txtMainArea.LineCount; //for(int i = 0;i<=numberOfColumns;i++) //{ // //var c = txtMainArea.GetCharacterIndexFromLineIndex(i); //} //MainScroll.Focus(); //MainScroll.HorizontalOffset //MainScroll.LineDown(); //MainScroll.ScrollToVerticalOffset(); //txtMainArea.Text.First(a => a == 'f'); //MainScroll.ScrollToVerticalOffset(7); }