C# Class WikiFunctions.Parse.FindandReplace

Provides a form and functions for setting and applying multiple find and replacements on a text string.
Inheritance: System.Windows.Forms.Form
Mostra file Open project: reedy/AutoWikiBrowser Class Usage Examples

Private Properties

Property Type Description
ChangeChecked void
Decode string
Encode string
FindAndReplaceContextMenu_Opening void
FindandReplace_FormClosing void
FindandReplace_Shown void
FindandReplace_VisibleChanged void
InitializeComponent void
PrepareReplacePart string
RowToReplacement Replacement
SelectRowAndFocusColumn void
addRowToolStripMenuItem_Click void
allCaseSensitiveToolStripMenuItem_Click void
btnCancel_Click void
btnClear_Click void
btnDone_Click void
btnSearch_Click void
checkAllBeforeOrAfterToolStripMenuItem_Click void
checkAllMinorToolStripMenuItem_Click void
checkAllMultlineToolStripMenuItem_Click void
checkAllRegularExpressionsToolStripMenuItem_Click void
checkAllSinglelineToolStripMenuItem_Click void
chkIgnoreMore_CheckedChanged void
createRetfRuleToolStripMenuItem_Click void
dataGridView1_RowsAdded void
deleteRowToolStripMenuItem_Click void
disableAllToolStripMenuItem_Click void
enableAllToolStripMenuItem_Click void
lblMsdn_LinkClicked void
linkLabel2_LinkClicked void
moveDownToolStripMenuItem_Click void
moveToBottomToolStripMenuItem_Click void
moveToTopToolStripMenuItem_Click void
moveUpToolStripMenuItem_Click void
testRegexToolStripMenuItem_Click void
txtSearch_KeyPress void
txtSearch_TextChanged void
uncheckAllBeforeOrAfterToolStripMenuItem_Click void
uncheckAllCaseSensitiveToolStripMenuItem_Click void
uncheckAllMinorToolStripMenuItem_Click void
uncheckAllMultilineToolStripMenuItem_Click void
uncheckAllRegularExpressionsToolStripMenuItem_Click void
uncheckAllSinglelineToolStripMenuItem_Click void

Public Methods

Method Description
AddNew ( List rList ) : void

Loads list of replacement entries into the find and replace data grid

AddNew ( Replacement r ) : void

Loads a single replacement entry into the find and replace data grid

AddNew ( Replacement r, bool decodeRequired ) : void

Loads a single replacement entry into the find and replace data grid

Clear ( ) : void

Clears the set replacements.

FindandReplace ( ) : System
GetList ( ) : List

Gets the find and replace settings.

HasProcessingReplacements ( bool after ) : bool

Returns whether any of the enabled find & replace entries are specified to be run at before/after as input

MakeList ( ) : void

Builds backup list of find and replace entries in case user later wants to restore them

MultipleFindAndReplace ( string articleText, string strTitle, bool beforeOrAfter, string &editSummary, bool &majorChangesMade ) : string

Applies a series of defined find and replacements to the supplied article text.

PerformFindAndReplace ( Replacement rep, string articleText, string articleTitle, bool &changeMade ) : string

Executes a single find & replace rule against the article text. First applies keywords to the find and replace portions of the rule, then executes the rule. Edit summary is generated from the first match of the rule that changes the article text on replacement. Count of changes is replacements affecting article, not total matches i.e. no-change replacements are not counted in the edit summary

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Clean up any resources being used.

Private Methods

Method Description
ChangeChecked ( string col, bool value ) : void
Decode ( string text ) : string

Decode the specified text, replacing LF newline with \r\n text

Encode ( string text ) : string

Encode the specified text, replacing \r\n text with actual CRLF newline

FindAndReplaceContextMenu_Opening ( object sender, System e ) : void
FindandReplace_FormClosing ( object sender, FormClosingEventArgs e ) : void
FindandReplace_Shown ( object sender, EventArgs e ) : void
FindandReplace_VisibleChanged ( object sender, EventArgs e ) : void
InitializeComponent ( ) : void

Required method for Designer support - do not modify the contents of this method with the code editor.

PrepareReplacePart ( string replace ) : string
RowToReplacement ( System.Windows.Forms.DataGridViewRow dataGridRow ) : Replacement
SelectRowAndFocusColumn ( int row ) : void

After a user has just moved a row: selects the moved row and returns focus to the previously selected column

addRowToolStripMenuItem_Click ( object sender, EventArgs e ) : void
allCaseSensitiveToolStripMenuItem_Click ( object sender, EventArgs e ) : void
btnCancel_Click ( object sender, EventArgs e ) : void
btnClear_Click ( object sender, EventArgs e ) : void
btnDone_Click ( object sender, EventArgs e ) : void
btnSearch_Click ( object sender, EventArgs e ) : void
checkAllBeforeOrAfterToolStripMenuItem_Click ( object sender, EventArgs e ) : void
checkAllMinorToolStripMenuItem_Click ( object sender, EventArgs e ) : void
checkAllMultlineToolStripMenuItem_Click ( object sender, EventArgs e ) : void
checkAllRegularExpressionsToolStripMenuItem_Click ( object sender, EventArgs e ) : void
checkAllSinglelineToolStripMenuItem_Click ( object sender, EventArgs e ) : void
chkIgnoreMore_CheckedChanged ( object sender, EventArgs e ) : void
createRetfRuleToolStripMenuItem_Click ( object sender, EventArgs e ) : void
dataGridView1_RowsAdded ( object sender, System.Windows.Forms.DataGridViewRowsAddedEventArgs e ) : void
deleteRowToolStripMenuItem_Click ( object sender, EventArgs e ) : void
disableAllToolStripMenuItem_Click ( object sender, EventArgs e ) : void
enableAllToolStripMenuItem_Click ( object sender, EventArgs e ) : void
lblMsdn_LinkClicked ( object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e ) : void
linkLabel2_LinkClicked ( object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e ) : void
moveDownToolStripMenuItem_Click ( object sender, EventArgs e ) : void
moveToBottomToolStripMenuItem_Click ( object sender, EventArgs e ) : void
moveToTopToolStripMenuItem_Click ( object sender, EventArgs e ) : void
moveUpToolStripMenuItem_Click ( object sender, EventArgs e ) : void
testRegexToolStripMenuItem_Click ( object sender, EventArgs e ) : void
txtSearch_KeyPress ( object sender, KeyPressEventArgs e ) : void
txtSearch_TextChanged ( object sender, EventArgs e ) : void
uncheckAllBeforeOrAfterToolStripMenuItem_Click ( object sender, EventArgs e ) : void
uncheckAllCaseSensitiveToolStripMenuItem_Click ( object sender, EventArgs e ) : void
uncheckAllMinorToolStripMenuItem_Click ( object sender, EventArgs e ) : void
uncheckAllMultilineToolStripMenuItem_Click ( object sender, EventArgs e ) : void
uncheckAllRegularExpressionsToolStripMenuItem_Click ( object sender, EventArgs e ) : void
uncheckAllSinglelineToolStripMenuItem_Click ( object sender, EventArgs e ) : void

Method Details

AddNew() public method

Loads list of replacement entries into the find and replace data grid
public AddNew ( List rList ) : void
rList List
return void

AddNew() public method

Loads a single replacement entry into the find and replace data grid
public AddNew ( Replacement r ) : void
r Replacement
return void

AddNew() public method

Loads a single replacement entry into the find and replace data grid
public AddNew ( Replacement r, bool decodeRequired ) : void
r Replacement The red component.
decodeRequired bool Whether decoding of newlines in find and replace text required. Required when loading settings from XML. NOT required when restoring from backup after Cancel
return void

Clear() public method

Clears the set replacements.
public Clear ( ) : void
return void

Dispose() protected method

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool true if managed resources should be disposed; otherwise, false.
return void

FindandReplace() public method

public FindandReplace ( ) : System
return System

GetList() public method

Gets the find and replace settings.
public GetList ( ) : List
return List

HasProcessingReplacements() public method

Returns whether any of the enabled find & replace entries are specified to be run at before/after as input
public HasProcessingReplacements ( bool after ) : bool
after bool
return bool

MakeList() public method

Builds backup list of find and replace entries in case user later wants to restore them
public MakeList ( ) : void
return void

MultipleFindAndReplace() public method

Applies a series of defined find and replacements to the supplied article text.
public MultipleFindAndReplace ( string articleText, string strTitle, bool beforeOrAfter, string &editSummary, bool &majorChangesMade ) : string
articleText string The wiki text of the article.
strTitle string
beforeOrAfter bool False if "before", true if "after"
editSummary string
majorChangesMade bool
return string

PerformFindAndReplace() public method

Executes a single find & replace rule against the article text. First applies keywords to the find and replace portions of the rule, then executes the rule. Edit summary is generated from the first match of the rule that changes the article text on replacement. Count of changes is replacements affecting article, not total matches i.e. no-change replacements are not counted in the edit summary
public PerformFindAndReplace ( Replacement rep, string articleText, string articleTitle, bool &changeMade ) : string
rep Replacement F&R rule to execute
articleText string The article text
articleTitle string The article title
changeMade bool Whether the F&R rule caused changes to the article text
return string