public int Replace(string from, string to, FindReplaceExpression expression) { int count = 0; switch (expression) { case FindReplaceExpression.FirstFound: { count = Replace(Search(from, expression)); break; } case FindReplaceExpression.InThisPage: { count = Replace(Search(from, expression)); break; } case FindReplaceExpression.InThisParagraph: { count = Replace(Search(from, expression)); break; } case FindReplaceExpression.InThisBook: { count = Replace(Search(from, expression)); break; } } return(count); }
private int Replace(string from, string to, FindReplaceExpression expression) { int count = 0; switch (expression) { case FindReplaceExpression.FirstFound: { var list = new List <SearchResult>(); list.Add(SearchSelector.rezults.ElementAt(activeFindIndex)); count = Replace(list, to); if (count > 0) { GetSearchResalt(from); // SearchSelector.rezults.Remove(SearchSelector.rezults.ElementAt(activeFindIndex)); } break; } case FindReplaceExpression.InThisPage: { count = ReplaceAllWords(Search(from, expression), to); break; } case FindReplaceExpression.InThisParagraph: { count = 0; break; } case FindReplaceExpression.InThisBook: { count = ReplaceAllWords(Search(from, expression), to); // SearchSelector.RestoreOriginalState(this); break; } } //SearchSelector.rezults.ForEach(item => // item.Position += FlowPosition); // ParentControl.BrowseProject.OpenFile(ParentControl.BrowseProject.CurentFile, System.IO.Path.GetFileNameWithoutExtension(ParentControl.BrowseProject.CurentFile)); // ParentControl.NotesBrowser.MainControl.Items.Refresh(); return(count); }
public List <SearchResult> Search(string therm, FindReplaceExpression expression) { var list = new List <SearchResult>(); switch (expression) { case FindReplaceExpression.InThisPage: { var temp = FindAll(therm, BrowseProject.CurentFile); foreach (var rezult in temp) { list.Add(rezult); } break; } case FindReplaceExpression.InThisBook: { string project = new FileInfo(BrowseProject.CurentFile).Directory.Parent.Name; if (!BrowseProject.Notes.ContainsKey(project)) { break; } foreach (var file in BrowseProject.Notes[project].Files) { var temp = FindAll(therm, file.Path); foreach (var rezult in temp) { list.Add(rezult); } } break; } } return(list); }
public List <Point> Search(string therm, FindReplaceExpression expression) { return(null); }