├── .gitattributes ├── .gitignore ├── .gitmodules ├── EditTools ├── DoubleMetaphone.cs ├── EditingTools.csproj ├── ImportDialog.Designer.cs ├── ImportDialog.cs ├── ImportDialog.resx ├── InputDialog.Designer.cs ├── InputDialog.cs ├── ManageBoiler.Designer.cs ├── ManageBoiler.cs ├── ManageBoiler.resx ├── ManageSearches.Designer.cs ├── ManageSearches.cs ├── ManageSearches.resx ├── ProgressDialog.Designer.cs ├── ProgressDialog.cs ├── ProgressDialog.resx ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Ribbon1.Designer.cs ├── Ribbon1.cs ├── Ribbon1.resx ├── SettingsClasses.cs ├── SettingsDialog.Designer.cs ├── SettingsDialog.cs ├── SettingsDialog.resx ├── ShortDoubleMetaphone.cs ├── TextHelpers.cs ├── ThisAddIn.Designer.cs ├── ThisAddIn.Designer.xml ├── ThisAddIn.cs ├── app.config ├── help.html └── packages.config ├── EditingTools.sln ├── README.md ├── deploy ├── helpfile │ └── help.html └── make-installer.iss └── screen-capture.png /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | 65 | *.manifest binary 66 | *.application binary 67 | *.deploy binary 68 | *.vsto binary 69 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | deploy/releases 2 | 3 | ## Ignore Visual Studio temporary files, build results, and 4 | ## files generated by popular Visual Studio add-ons. 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | [Xx]64/ 21 | [Xx]86/ 22 | [Bb]uild/ 23 | bld/ 24 | [Bb]in/ 25 | [Oo]bj/ 26 | 27 | # Visual Studio 2015 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # MSTest test Results 33 | [Tt]est[Rr]esult*/ 34 | [Bb]uild[Ll]og.* 35 | 36 | # NUNIT 37 | *.VisualState.xml 38 | TestResult.xml 39 | 40 | # Build Results of an ATL Project 41 | [Dd]ebugPS/ 42 | [Rr]eleasePS/ 43 | dlldata.c 44 | 45 | # DNX 46 | project.lock.json 47 | artifacts/ 48 | 49 | *_i.c 50 | *_p.c 51 | *_i.h 52 | *.ilk 53 | *.meta 54 | *.obj 55 | *.pch 56 | *.pdb 57 | *.pgc 58 | *.pgd 59 | *.rsp 60 | *.sbr 61 | *.tlb 62 | *.tli 63 | *.tlh 64 | *.tmp 65 | *.tmp_proj 66 | *.log 67 | *.vspscc 68 | *.vssscc 69 | .builds 70 | *.pidb 71 | *.svclog 72 | *.scc 73 | 74 | # Chutzpah Test files 75 | _Chutzpah* 76 | 77 | # Visual C++ cache files 78 | ipch/ 79 | *.aps 80 | *.ncb 81 | *.opendb 82 | *.opensdf 83 | *.sdf 84 | *.cachefile 85 | *.VC.db 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # NCrunch 114 | _NCrunch_* 115 | .*crunch*.local.xml 116 | nCrunchTemp_* 117 | 118 | # MightyMoose 119 | *.mm.* 120 | AutoTest.Net/ 121 | 122 | # Web workbench (sass) 123 | .sass-cache/ 124 | 125 | # Installshield output folder 126 | [Ee]xpress/ 127 | 128 | # DocProject is a documentation generator add-in 129 | DocProject/buildhelp/ 130 | DocProject/Help/*.HxT 131 | DocProject/Help/*.HxC 132 | DocProject/Help/*.hhc 133 | DocProject/Help/*.hhk 134 | DocProject/Help/*.hhp 135 | DocProject/Help/Html2 136 | DocProject/Help/html 137 | 138 | # Click-Once directory 139 | publish/ 140 | 141 | # Publish Web Output 142 | *.[Pp]ublish.xml 143 | *.azurePubxml 144 | 145 | # TODO: Un-comment the next line if you do not want to checkin 146 | # your web deploy settings because they may include unencrypted 147 | # passwords 148 | #*.pubxml 149 | *.publishproj 150 | 151 | # NuGet Packages 152 | *.nupkg 153 | # The packages folder can be ignored because of Package Restore 154 | **/packages/* 155 | # except build/, which is used as an MSBuild target. 156 | !**/packages/build/ 157 | # Uncomment if necessary however generally it will be regenerated when needed 158 | #!**/packages/repositories.config 159 | # NuGet v3's project.json files produces more ignoreable files 160 | *.nuget.props 161 | *.nuget.targets 162 | 163 | # Microsoft Azure Build Output 164 | csx/ 165 | *.build.csdef 166 | 167 | # Microsoft Azure Emulator 168 | ecf/ 169 | rcf/ 170 | 171 | # Microsoft Azure ApplicationInsights config file 172 | ApplicationInsights.config 173 | 174 | # Windows Store app package directory 175 | AppPackages/ 176 | BundleArtifacts/ 177 | 178 | # Visual Studio cache files 179 | # files ending in .cache can be ignored 180 | *.[Cc]ache 181 | # but keep track of directories ending in .cache 182 | !*.[Cc]ache/ 183 | 184 | # Others 185 | ClientBin/ 186 | [Ss]tyle[Cc]op.* 187 | ~$* 188 | *~ 189 | *.dbmdl 190 | *.dbproj.schemaview 191 | *.pfx 192 | *.publishsettings 193 | node_modules/ 194 | orleans.codegen.cs 195 | 196 | # RIA/Silverlight projects 197 | Generated_Code/ 198 | 199 | # Backup & report files from converting an old project file 200 | # to a newer Visual Studio version. Backup files are not needed, 201 | # because we have git ;-) 202 | _UpgradeReport_Files/ 203 | Backup*/ 204 | UpgradeLog*.XML 205 | UpgradeLog*.htm 206 | 207 | # SQL Server files 208 | *.mdf 209 | *.ldf 210 | 211 | # Business Intelligence projects 212 | *.rdl.data 213 | *.bim.layout 214 | *.bim_*.settings 215 | 216 | # Microsoft Fakes 217 | FakesAssemblies/ 218 | 219 | # GhostDoc plugin setting file 220 | *.GhostDoc.xml 221 | 222 | # Node.js Tools for Visual Studio 223 | .ntvs_analysis.dat 224 | 225 | # Visual Studio 6 build log 226 | *.plg 227 | 228 | # Visual Studio 6 workspace options file 229 | *.opt 230 | 231 | # Visual Studio LightSwitch build output 232 | **/*.HTMLClient/GeneratedArtifacts 233 | **/*.DesktopClient/GeneratedArtifacts 234 | **/*.DesktopClient/ModelManifest.xml 235 | **/*.Server/GeneratedArtifacts 236 | **/*.Server/ModelManifest.xml 237 | _Pvt_Extensions 238 | 239 | # LightSwitch generated files 240 | GeneratedArtifacts/ 241 | ModelManifest.xml 242 | 243 | # Paket dependency manager 244 | .paket/paket.exe 245 | 246 | # FAKE - F# Make 247 | .fake/ -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "deploy/VstoAddinInstaller"] 2 | path = deploy/VstoAddinInstaller 3 | url = https://github.com/bovender/VstoAddinInstaller.git 4 | -------------------------------------------------------------------------------- /EditTools/EditingTools.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 21 | 22 | {BAA0C2D2-18E2-41B9-852F-F413020CAA33};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 23 | Debug 24 | AnyCPU 25 | {FFD516B4-0FAA-4609-A454-755FA36DFAB4} 26 | Library 27 | false 28 | EditTools 29 | EditingTools 30 | v4.5.2 31 | VSTO40 32 | True 33 | true 34 | publish\ 35 | https://raw.githubusercontent.com/Perlkonig/editing-tools/master/EditTools/publish/ 36 | en 37 | 1.0.0.1 38 | true 39 | true 40 | 7 41 | days 42 | Editing Tools 43 | Aaron Dalton 44 | https://github.com/Perlkonig/editing-tools 45 | EditingTools 46 | 47 | 3 48 | 49 | 50 | 51 | False 52 | Microsoft .NET Framework 4.5.2 %28x86 and x64%29 53 | true 54 | 55 | 56 | False 57 | .NET Framework 3.5 SP1 58 | false 59 | 60 | 61 | False 62 | Microsoft Visual Studio 2010 Tools for Office Runtime %28x86 and x64%29 63 | true 64 | 65 | 66 | False 67 | Windows Installer 4.5 68 | true 69 | 70 | 71 | 72 | 76 | Word 77 | 78 | 94 | 95 | true 96 | full 97 | false 98 | bin\Debug\ 99 | false 100 | $(DefineConstants);DEBUG;TRACE 101 | 4 102 | 103 | 119 | 120 | pdbonly 121 | true 122 | bin\Release\ 123 | false 124 | $(DefineConstants);TRACE 125 | 4 126 | 127 | 130 | 131 | 132 | 133 | ..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | True 155 | 156 | 157 | 158 | 159 | False 160 | true 161 | 162 | 163 | False 164 | true 165 | 166 | 167 | False 168 | 169 | 170 | 180 | 181 | 182 | 183 | Form 184 | 185 | 186 | ImportDialog.cs 187 | 188 | 189 | Form 190 | 191 | 192 | InputDialog.cs 193 | 194 | 195 | Form 196 | 197 | 198 | ManageBoiler.cs 199 | 200 | 201 | Form 202 | 203 | 204 | ManageSearches.cs 205 | 206 | 207 | Form 208 | 209 | 210 | ProgressDialog.cs 211 | 212 | 213 | Code 214 | 215 | 216 | ImportDialog.cs 217 | 218 | 219 | ManageBoiler.cs 220 | 221 | 222 | ManageSearches.cs 223 | 224 | 225 | ProgressDialog.cs 226 | 227 | 228 | ResXFileCodeGenerator 229 | Resources.Designer.cs 230 | Designer 231 | 232 | 233 | True 234 | Resources.resx 235 | True 236 | 237 | 238 | Ribbon1.cs 239 | 240 | 241 | SettingsDialog.cs 242 | 243 | 244 | 245 | 246 | 247 | SettingsSingleFileGenerator 248 | Settings.Designer.cs 249 | 250 | 251 | True 252 | Settings.settings 253 | True 254 | 255 | 256 | Component 257 | 258 | 259 | Ribbon1.cs 260 | 261 | 262 | Form 263 | 264 | 265 | SettingsDialog.cs 266 | 267 | 268 | 269 | 270 | 271 | Code 272 | 273 | 274 | ThisAddIn.cs 275 | 276 | 277 | ThisAddIn.Designer.xml 278 | 279 | 280 | 281 | 282 | 283 | Always 284 | 285 | 286 | 287 | 288 | 289 | 290 | 10.0 291 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 292 | 293 | 294 | true 295 | 296 | 297 | EditTools_TemporaryKey.pfx 298 | 299 | 300 | F6BB1F7C916489C3FFFE43280FC050779F540FAC 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | -------------------------------------------------------------------------------- /EditTools/ImportDialog.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace EditTools 2 | { 3 | partial class ImportDialog 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.label1 = new System.Windows.Forms.Label(); 32 | this.txt_ImportFile = new System.Windows.Forms.TextBox(); 33 | this.btn_ImportSelect = new System.Windows.Forms.Button(); 34 | this.btn_Cancel = new System.Windows.Forms.Button(); 35 | this.btn_Import = new System.Windows.Forms.Button(); 36 | this.radio_Replace = new System.Windows.Forms.RadioButton(); 37 | this.radio_MergeNew = new System.Windows.Forms.RadioButton(); 38 | this.radio_MergeReplace = new System.Windows.Forms.RadioButton(); 39 | this.grp_Duplicates = new System.Windows.Forms.GroupBox(); 40 | this.grp_Duplicates.SuspendLayout(); 41 | this.SuspendLayout(); 42 | // 43 | // label1 44 | // 45 | this.label1.AutoSize = true; 46 | this.label1.Location = new System.Drawing.Point(13, 13); 47 | this.label1.Name = "label1"; 48 | this.label1.Size = new System.Drawing.Size(104, 13); 49 | this.label1.TabIndex = 0; 50 | this.label1.Text = "Settings file to import"; 51 | // 52 | // txt_ImportFile 53 | // 54 | this.txt_ImportFile.Location = new System.Drawing.Point(16, 30); 55 | this.txt_ImportFile.Name = "txt_ImportFile"; 56 | this.txt_ImportFile.Size = new System.Drawing.Size(175, 20); 57 | this.txt_ImportFile.TabIndex = 1; 58 | // 59 | // btn_ImportSelect 60 | // 61 | this.btn_ImportSelect.Location = new System.Drawing.Point(197, 27); 62 | this.btn_ImportSelect.Name = "btn_ImportSelect"; 63 | this.btn_ImportSelect.Size = new System.Drawing.Size(75, 23); 64 | this.btn_ImportSelect.TabIndex = 2; 65 | this.btn_ImportSelect.Text = "Select"; 66 | this.btn_ImportSelect.UseVisualStyleBackColor = true; 67 | this.btn_ImportSelect.Click += new System.EventHandler(this.btn_ImportSelect_Click); 68 | // 69 | // btn_Cancel 70 | // 71 | this.btn_Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; 72 | this.btn_Cancel.Location = new System.Drawing.Point(196, 195); 73 | this.btn_Cancel.Name = "btn_Cancel"; 74 | this.btn_Cancel.Size = new System.Drawing.Size(75, 23); 75 | this.btn_Cancel.TabIndex = 3; 76 | this.btn_Cancel.Text = "Cancel"; 77 | this.btn_Cancel.UseVisualStyleBackColor = true; 78 | // 79 | // btn_Import 80 | // 81 | this.btn_Import.DialogResult = System.Windows.Forms.DialogResult.OK; 82 | this.btn_Import.Location = new System.Drawing.Point(115, 195); 83 | this.btn_Import.Name = "btn_Import"; 84 | this.btn_Import.Size = new System.Drawing.Size(75, 23); 85 | this.btn_Import.TabIndex = 4; 86 | this.btn_Import.Text = "Import"; 87 | this.btn_Import.UseVisualStyleBackColor = true; 88 | // 89 | // radio_Replace 90 | // 91 | this.radio_Replace.AutoSize = true; 92 | this.radio_Replace.Location = new System.Drawing.Point(6, 26); 93 | this.radio_Replace.Name = "radio_Replace"; 94 | this.radio_Replace.Size = new System.Drawing.Size(164, 17); 95 | this.radio_Replace.TabIndex = 5; 96 | this.radio_Replace.TabStop = true; 97 | this.radio_Replace.Text = "Replace with the selected file"; 98 | this.radio_Replace.UseVisualStyleBackColor = true; 99 | // 100 | // radio_MergeNew 101 | // 102 | this.radio_MergeNew.AutoSize = true; 103 | this.radio_MergeNew.Checked = true; 104 | this.radio_MergeNew.Location = new System.Drawing.Point(6, 49); 105 | this.radio_MergeNew.Name = "radio_MergeNew"; 106 | this.radio_MergeNew.Size = new System.Drawing.Size(127, 17); 107 | this.radio_MergeNew.TabIndex = 6; 108 | this.radio_MergeNew.TabStop = true; 109 | this.radio_MergeNew.Text = "Add new records only"; 110 | this.radio_MergeNew.UseVisualStyleBackColor = true; 111 | // 112 | // radio_MergeReplace 113 | // 114 | this.radio_MergeReplace.AutoSize = true; 115 | this.radio_MergeReplace.Location = new System.Drawing.Point(6, 72); 116 | this.radio_MergeReplace.Name = "radio_MergeReplace"; 117 | this.radio_MergeReplace.Size = new System.Drawing.Size(185, 17); 118 | this.radio_MergeReplace.TabIndex = 7; 119 | this.radio_MergeReplace.TabStop = true; 120 | this.radio_MergeReplace.Text = "Add new and overwrite duplicates"; 121 | this.radio_MergeReplace.UseVisualStyleBackColor = true; 122 | // 123 | // grp_Duplicates 124 | // 125 | this.grp_Duplicates.Controls.Add(this.radio_Replace); 126 | this.grp_Duplicates.Controls.Add(this.radio_MergeReplace); 127 | this.grp_Duplicates.Controls.Add(this.radio_MergeNew); 128 | this.grp_Duplicates.Location = new System.Drawing.Point(16, 72); 129 | this.grp_Duplicates.Name = "grp_Duplicates"; 130 | this.grp_Duplicates.Size = new System.Drawing.Size(255, 100); 131 | this.grp_Duplicates.TabIndex = 8; 132 | this.grp_Duplicates.TabStop = false; 133 | this.grp_Duplicates.Text = "Duplicate Handling"; 134 | // 135 | // ImportDialog 136 | // 137 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 138 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 139 | this.ClientSize = new System.Drawing.Size(284, 229); 140 | this.Controls.Add(this.grp_Duplicates); 141 | this.Controls.Add(this.btn_Import); 142 | this.Controls.Add(this.btn_Cancel); 143 | this.Controls.Add(this.btn_ImportSelect); 144 | this.Controls.Add(this.txt_ImportFile); 145 | this.Controls.Add(this.label1); 146 | this.Name = "ImportDialog"; 147 | this.Text = "Import Settings"; 148 | this.grp_Duplicates.ResumeLayout(false); 149 | this.grp_Duplicates.PerformLayout(); 150 | this.ResumeLayout(false); 151 | this.PerformLayout(); 152 | 153 | } 154 | 155 | #endregion 156 | 157 | private System.Windows.Forms.Label label1; 158 | private System.Windows.Forms.TextBox txt_ImportFile; 159 | private System.Windows.Forms.Button btn_ImportSelect; 160 | private System.Windows.Forms.Button btn_Cancel; 161 | private System.Windows.Forms.Button btn_Import; 162 | private System.Windows.Forms.RadioButton radio_Replace; 163 | private System.Windows.Forms.RadioButton radio_MergeNew; 164 | private System.Windows.Forms.RadioButton radio_MergeReplace; 165 | private System.Windows.Forms.GroupBox grp_Duplicates; 166 | } 167 | } -------------------------------------------------------------------------------- /EditTools/ImportDialog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Xml; 4 | using System.Collections.Specialized; 5 | using System.Windows.Forms; 6 | 7 | namespace EditTools 8 | { 9 | public partial class ImportDialog : Form 10 | { 11 | public enum Modes { REPLACE, MERGE, NEW }; 12 | 13 | public ImportDialog() 14 | { 15 | InitializeComponent(); 16 | } 17 | 18 | private void btn_ImportSelect_Click(object sender, EventArgs e) 19 | { 20 | OpenFileDialog ofd = new OpenFileDialog(); 21 | ofd.CheckFileExists = true; 22 | ofd.CheckPathExists = true; 23 | ofd.DefaultExt = "json"; 24 | ofd.Filter = "JSON files (*.json)|*.json|All files|*.*"; 25 | ofd.Title = "Settings file to import"; 26 | 27 | if (ofd.ShowDialog() == DialogResult.OK) 28 | { 29 | txt_ImportFile.Text = ofd.FileName; 30 | } 31 | } 32 | 33 | public string GetFileName() 34 | { 35 | return txt_ImportFile.Text; 36 | } 37 | 38 | public Modes GetMode() 39 | { 40 | if (radio_Replace.Checked) 41 | { 42 | return Modes.REPLACE; 43 | } 44 | else if (radio_MergeReplace.Checked) 45 | { 46 | return Modes.MERGE; 47 | } 48 | else if (radio_MergeNew.Checked) 49 | { 50 | return Modes.NEW; 51 | } 52 | else 53 | { 54 | throw new InvalidOperationException("None of the radio buttons were selected. This should *never* happen!"); 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /EditTools/ImportDialog.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /EditTools/InputDialog.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace EditTools 2 | { 3 | partial class InputDialog 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 33 | this.Text = "InputDialog"; 34 | } 35 | 36 | #endregion 37 | } 38 | } -------------------------------------------------------------------------------- /EditTools/InputDialog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace EditTools 11 | { 12 | public partial class InputDialog : Form 13 | { 14 | public InputDialog() 15 | { 16 | InitializeComponent(); 17 | } 18 | 19 | public static string ShowDialog(string text, string caption) 20 | { 21 | Form prompt = new Form() 22 | { 23 | Width = 500, 24 | Height = 150, 25 | FormBorderStyle = FormBorderStyle.FixedDialog, 26 | Text = caption, 27 | StartPosition = FormStartPosition.CenterScreen 28 | }; 29 | Label textLabel = new Label() { Left = 50, Top = 20, Width = 400, Text = text }; 30 | TextBox textBox = new TextBox() { Left = 50, Top = 50, Width = 400 }; 31 | Button confirmation = new Button() { Text = "Ok", Left = 350, Width = 100, Top = 70, DialogResult = DialogResult.OK }; 32 | confirmation.Click += (sender, e) => { prompt.Close(); }; 33 | prompt.Controls.Add(textBox); 34 | prompt.Controls.Add(confirmation); 35 | prompt.Controls.Add(textLabel); 36 | prompt.AcceptButton = confirmation; 37 | 38 | return prompt.ShowDialog() == DialogResult.OK ? textBox.Text : ""; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /EditTools/ManageBoiler.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace EditTools 2 | { 3 | partial class ManageBoiler 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); 32 | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); 33 | this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); 34 | this.dgv_Boiler = new System.Windows.Forms.DataGridView(); 35 | this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); 36 | this.btn_BoilerSave = new System.Windows.Forms.Button(); 37 | this.btn_BoilerExport = new System.Windows.Forms.Button(); 38 | this.btn_BoilerImport = new System.Windows.Forms.Button(); 39 | this.Label = new System.Windows.Forms.DataGridViewTextBoxColumn(); 40 | this.Comment = new System.Windows.Forms.DataGridViewTextBoxColumn(); 41 | this.label1 = new System.Windows.Forms.Label(); 42 | this.tableLayoutPanel1.SuspendLayout(); 43 | ((System.ComponentModel.ISupportInitialize)(this.dgv_Boiler)).BeginInit(); 44 | this.flowLayoutPanel1.SuspendLayout(); 45 | this.SuspendLayout(); 46 | // 47 | // tableLayoutPanel1 48 | // 49 | this.tableLayoutPanel1.ColumnCount = 1; 50 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); 51 | this.tableLayoutPanel1.Controls.Add(this.dgv_Boiler, 0, 1); 52 | this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 2); 53 | this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); 54 | this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; 55 | this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); 56 | this.tableLayoutPanel1.Name = "tableLayoutPanel1"; 57 | this.tableLayoutPanel1.RowCount = 3; 58 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 59 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 92.66666F)); 60 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 7.333334F)); 61 | this.tableLayoutPanel1.Size = new System.Drawing.Size(977, 450); 62 | this.tableLayoutPanel1.TabIndex = 0; 63 | // 64 | // dgv_Boiler 65 | // 66 | this.dgv_Boiler.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; 67 | this.dgv_Boiler.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells; 68 | this.dgv_Boiler.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; 69 | this.dgv_Boiler.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { 70 | this.Label, 71 | this.Comment}); 72 | dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; 73 | dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Window; 74 | dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 75 | dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.ControlText; 76 | dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; 77 | dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; 78 | dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; 79 | this.dgv_Boiler.DefaultCellStyle = dataGridViewCellStyle1; 80 | this.dgv_Boiler.Dock = System.Windows.Forms.DockStyle.Fill; 81 | this.dgv_Boiler.Location = new System.Drawing.Point(3, 23); 82 | this.dgv_Boiler.Name = "dgv_Boiler"; 83 | dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; 84 | dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control; 85 | dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 86 | dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText; 87 | dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; 88 | dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; 89 | dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; 90 | this.dgv_Boiler.RowHeadersDefaultCellStyle = dataGridViewCellStyle2; 91 | this.dgv_Boiler.Size = new System.Drawing.Size(971, 392); 92 | this.dgv_Boiler.TabIndex = 1; 93 | // 94 | // flowLayoutPanel1 95 | // 96 | this.flowLayoutPanel1.Controls.Add(this.btn_BoilerSave); 97 | this.flowLayoutPanel1.Controls.Add(this.btn_BoilerExport); 98 | this.flowLayoutPanel1.Controls.Add(this.btn_BoilerImport); 99 | this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; 100 | this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; 101 | this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 421); 102 | this.flowLayoutPanel1.Name = "flowLayoutPanel1"; 103 | this.flowLayoutPanel1.Size = new System.Drawing.Size(971, 26); 104 | this.flowLayoutPanel1.TabIndex = 0; 105 | // 106 | // btn_BoilerSave 107 | // 108 | this.btn_BoilerSave.Location = new System.Drawing.Point(893, 3); 109 | this.btn_BoilerSave.Name = "btn_BoilerSave"; 110 | this.btn_BoilerSave.Size = new System.Drawing.Size(75, 23); 111 | this.btn_BoilerSave.TabIndex = 0; 112 | this.btn_BoilerSave.Text = "Save"; 113 | this.btn_BoilerSave.UseVisualStyleBackColor = true; 114 | this.btn_BoilerSave.Click += new System.EventHandler(this.btn_BoilerSave_Click); 115 | // 116 | // btn_BoilerExport 117 | // 118 | this.btn_BoilerExport.Location = new System.Drawing.Point(812, 3); 119 | this.btn_BoilerExport.Name = "btn_BoilerExport"; 120 | this.btn_BoilerExport.Size = new System.Drawing.Size(75, 23); 121 | this.btn_BoilerExport.TabIndex = 1; 122 | this.btn_BoilerExport.Text = "Export"; 123 | this.btn_BoilerExport.UseVisualStyleBackColor = true; 124 | this.btn_BoilerExport.Click += new System.EventHandler(this.btn_BoilerExport_Click); 125 | // 126 | // btn_BoilerImport 127 | // 128 | this.btn_BoilerImport.Location = new System.Drawing.Point(731, 3); 129 | this.btn_BoilerImport.Name = "btn_BoilerImport"; 130 | this.btn_BoilerImport.Size = new System.Drawing.Size(75, 23); 131 | this.btn_BoilerImport.TabIndex = 2; 132 | this.btn_BoilerImport.Text = "Import"; 133 | this.btn_BoilerImport.UseVisualStyleBackColor = true; 134 | this.btn_BoilerImport.Click += new System.EventHandler(this.btn_BoilerImport_Click); 135 | // 136 | // Label 137 | // 138 | this.Label.FillWeight = 35F; 139 | this.Label.HeaderText = "Label"; 140 | this.Label.Name = "Label"; 141 | this.Label.ToolTipText = "The name of the comment that will appear in the drop-down menu"; 142 | // 143 | // Comment 144 | // 145 | this.Comment.HeaderText = "Comment"; 146 | this.Comment.Name = "Comment"; 147 | this.Comment.ToolTipText = "The comment that will be inserted"; 148 | // 149 | // label1 150 | // 151 | this.label1.AutoSize = true; 152 | this.label1.Dock = System.Windows.Forms.DockStyle.Top; 153 | this.label1.Location = new System.Drawing.Point(3, 0); 154 | this.label1.Name = "label1"; 155 | this.label1.Size = new System.Drawing.Size(971, 13); 156 | this.label1.TabIndex = 2; 157 | this.label1.Text = "To create mutli-line comments, use Shift+Enter. Row heights will adjust once you " + 158 | "finish editing the cell."; 159 | // 160 | // ManageBoiler 161 | // 162 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 163 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 164 | this.ClientSize = new System.Drawing.Size(977, 450); 165 | this.Controls.Add(this.tableLayoutPanel1); 166 | this.Name = "ManageBoiler"; 167 | this.Text = "Manage Boilerplate"; 168 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ManageBoiler_FormClosing); 169 | this.Load += new System.EventHandler(this.ManageBoiler_Load); 170 | this.tableLayoutPanel1.ResumeLayout(false); 171 | this.tableLayoutPanel1.PerformLayout(); 172 | ((System.ComponentModel.ISupportInitialize)(this.dgv_Boiler)).EndInit(); 173 | this.flowLayoutPanel1.ResumeLayout(false); 174 | this.ResumeLayout(false); 175 | 176 | } 177 | 178 | #endregion 179 | 180 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; 181 | private System.Windows.Forms.DataGridView dgv_Boiler; 182 | private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; 183 | private System.Windows.Forms.Button btn_BoilerSave; 184 | private System.Windows.Forms.Button btn_BoilerExport; 185 | private System.Windows.Forms.Button btn_BoilerImport; 186 | private System.Windows.Forms.DataGridViewTextBoxColumn Label; 187 | private System.Windows.Forms.DataGridViewTextBoxColumn Comment; 188 | private System.Windows.Forms.Label label1; 189 | } 190 | } -------------------------------------------------------------------------------- /EditTools/ManageBoiler.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Diagnostics; 5 | using System.ComponentModel; 6 | using System.Data; 7 | using System.Drawing; 8 | using System.IO; 9 | using System.Linq; 10 | using System.Text; 11 | using System.Threading.Tasks; 12 | using System.Windows.Forms; 13 | 14 | namespace EditTools 15 | { 16 | public partial class ManageBoiler : Form 17 | { 18 | public ManageBoiler() 19 | { 20 | InitializeComponent(); 21 | } 22 | 23 | private void ManageBoiler_Load(object sender, EventArgs e) 24 | { 25 | RefreshDisplay(); 26 | } 27 | 28 | private void RefreshDisplay() 29 | { 30 | dgv_Boiler.Rows.Clear(); 31 | Boilerplate bp = Properties.Settings.Default.newboiler; 32 | 33 | if (bp != null) 34 | { 35 | foreach (KeyValuePair boiler in bp.Dict) 36 | { 37 | int idx = dgv_Boiler.Rows.Add(); 38 | DataGridViewRow row = dgv_Boiler.Rows[idx]; 39 | row.Cells["Label"].Value = boiler.Key; 40 | row.Cells["Comment"].Value = boiler.Value.Text; 41 | } 42 | } 43 | 44 | } 45 | 46 | private void btn_BoilerSave_Click(object sender, EventArgs e) 47 | { 48 | Boilerplate bp = ConvertRows(); 49 | Properties.Settings.Default.newboiler = bp; 50 | Properties.Settings.Default.Save(); 51 | } 52 | 53 | private Boilerplate ConvertRows() 54 | { 55 | Boilerplate bp = new Boilerplate(); 56 | foreach (DataGridViewRow row in dgv_Boiler.Rows) 57 | { 58 | if (row.IsNewRow) 59 | { 60 | continue; 61 | } 62 | string key = ""; 63 | if (row.Cells["Label"].Value == null) 64 | { 65 | throw new InvalidOperationException("Each row must have a unique name."); 66 | } 67 | else 68 | { 69 | key = row.Cells["Label"].Value.ToString(); 70 | } 71 | Comment comment = new Comment(); 72 | if ((row.Cells["Comment"].Value == null) || (String.IsNullOrEmpty(row.Cells["Comment"].Value.ToString()))) 73 | { 74 | throw new InvalidOperationException("Each row must have something in the 'Comment' field."); 75 | } 76 | else 77 | { 78 | comment.Text = row.Cells["Comment"].Value.ToString(); 79 | } 80 | bp.Dict.Add(key, comment); 81 | } 82 | return bp; 83 | } 84 | 85 | private void btn_BoilerExport_Click(object sender, EventArgs e) 86 | { 87 | SaveFileDialog sfd = new SaveFileDialog(); 88 | sfd.AddExtension = true; 89 | sfd.DefaultExt = "json"; 90 | sfd.CheckPathExists = true; 91 | sfd.Filter = "JSON files (*.json)|*.json"; 92 | sfd.InitialDirectory = System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop); 93 | sfd.OverwritePrompt = true; 94 | sfd.Title = "Export Boilerplate"; 95 | sfd.FileName = "boilerplate.json"; 96 | //sfd.RestoreDirectory = false; 97 | 98 | if (sfd.ShowDialog() == DialogResult.OK) 99 | { 100 | string serialized = JsonConvert.SerializeObject(Properties.Settings.Default.newboiler.Dict, Formatting.Indented); 101 | Debug.WriteLine(serialized); 102 | File.WriteAllText(sfd.FileName, serialized); 103 | MessageBox.Show("Boilerplate exported to " + sfd.FileName + "."); 104 | } 105 | else 106 | { 107 | MessageBox.Show("Export cancelled."); 108 | } 109 | } 110 | 111 | private void btn_BoilerImport_Click(object sender, EventArgs e) 112 | { 113 | Boilerplate bp = Properties.Settings.Default.newboiler; 114 | ImportDialog id = new ImportDialog(); 115 | var result = id.ShowDialog(); 116 | 117 | if (result == DialogResult.OK) 118 | { 119 | string injson = File.ReadAllText(id.GetFileName()); 120 | Boilerplate inbp = new Boilerplate(); 121 | inbp.Dict = JsonConvert.DeserializeObject>(injson); 122 | 123 | switch (id.GetMode()) 124 | { 125 | case ImportDialog.Modes.MERGE: 126 | foreach (var kvpair in inbp.Dict) 127 | { 128 | if (bp.Dict.ContainsKey(kvpair.Key)) 129 | { 130 | bp.Dict[kvpair.Key] = kvpair.Value; 131 | } 132 | else 133 | { 134 | bp.Dict.Add(kvpair.Key, kvpair.Value); 135 | } 136 | } 137 | break; 138 | case ImportDialog.Modes.NEW: 139 | foreach (var kvpair in inbp.Dict) 140 | { 141 | if (bp.Dict.ContainsKey(kvpair.Key)) 142 | { 143 | continue; 144 | } 145 | else 146 | { 147 | bp.Dict.Add(kvpair.Key, kvpair.Value); 148 | } 149 | } 150 | break; 151 | case ImportDialog.Modes.REPLACE: 152 | bp = inbp; 153 | break; 154 | default: 155 | throw new ArgumentOutOfRangeException("Unrecognized import mode. Aborting."); 156 | } 157 | 158 | Properties.Settings.Default.newboiler = bp; 159 | Properties.Settings.Default.Save(); 160 | RefreshDisplay(); 161 | MessageBox.Show("Import complete."); 162 | 163 | } 164 | else 165 | { 166 | MessageBox.Show("Import cancelled."); 167 | } 168 | } 169 | 170 | private void ManageBoiler_FormClosing(object sender, FormClosingEventArgs e) 171 | { 172 | Boilerplate bp = ConvertRows(); 173 | Properties.Settings.Default.newboiler = bp; 174 | Properties.Settings.Default.Save(); 175 | } 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /EditTools/ManageBoiler.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | True 122 | 123 | 124 | True 125 | 126 | -------------------------------------------------------------------------------- /EditTools/ManageSearches.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace EditTools 2 | { 3 | partial class ManageSearches 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); 32 | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); 33 | this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); 34 | this.dgv_Searches = new System.Windows.Forms.DataGridView(); 35 | this.Key = new System.Windows.Forms.DataGridViewTextBoxColumn(); 36 | this.MatchCase = new System.Windows.Forms.DataGridViewCheckBoxColumn(); 37 | this.Wildcards = new System.Windows.Forms.DataGridViewCheckBoxColumn(); 38 | this.Find = new System.Windows.Forms.DataGridViewTextBoxColumn(); 39 | this.HandleReplace = new System.Windows.Forms.DataGridViewCheckBoxColumn(); 40 | this.Replace = new System.Windows.Forms.DataGridViewTextBoxColumn(); 41 | this.ReplaceAll = new System.Windows.Forms.DataGridViewCheckBoxColumn(); 42 | this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); 43 | this.btn_SearchesSave = new System.Windows.Forms.Button(); 44 | this.btn_SearchesExport = new System.Windows.Forms.Button(); 45 | this.btn_SearchesImport = new System.Windows.Forms.Button(); 46 | this.label1 = new System.Windows.Forms.Label(); 47 | this.tableLayoutPanel1.SuspendLayout(); 48 | ((System.ComponentModel.ISupportInitialize)(this.dgv_Searches)).BeginInit(); 49 | this.flowLayoutPanel1.SuspendLayout(); 50 | this.SuspendLayout(); 51 | // 52 | // tableLayoutPanel1 53 | // 54 | this.tableLayoutPanel1.ColumnCount = 1; 55 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); 56 | this.tableLayoutPanel1.Controls.Add(this.dgv_Searches, 0, 1); 57 | this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 2); 58 | this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); 59 | this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; 60 | this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); 61 | this.tableLayoutPanel1.Name = "tableLayoutPanel1"; 62 | this.tableLayoutPanel1.RowCount = 3; 63 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 64 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 92.66666F)); 65 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 7.333333F)); 66 | this.tableLayoutPanel1.Size = new System.Drawing.Size(977, 450); 67 | this.tableLayoutPanel1.TabIndex = 0; 68 | // 69 | // dgv_Searches 70 | // 71 | this.dgv_Searches.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; 72 | this.dgv_Searches.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.DisplayedCells; 73 | this.dgv_Searches.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; 74 | this.dgv_Searches.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { 75 | this.Key, 76 | this.MatchCase, 77 | this.Wildcards, 78 | this.Find, 79 | this.HandleReplace, 80 | this.Replace, 81 | this.ReplaceAll}); 82 | dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; 83 | dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Window; 84 | dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 85 | dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.ControlText; 86 | dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; 87 | dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; 88 | dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.False; 89 | this.dgv_Searches.DefaultCellStyle = dataGridViewCellStyle1; 90 | this.dgv_Searches.Dock = System.Windows.Forms.DockStyle.Fill; 91 | this.dgv_Searches.Location = new System.Drawing.Point(3, 23); 92 | this.dgv_Searches.Name = "dgv_Searches"; 93 | dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; 94 | dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control; 95 | dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 96 | dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText; 97 | dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; 98 | dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; 99 | dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; 100 | this.dgv_Searches.RowHeadersDefaultCellStyle = dataGridViewCellStyle2; 101 | this.dgv_Searches.Size = new System.Drawing.Size(971, 392); 102 | this.dgv_Searches.TabIndex = 1; 103 | this.dgv_Searches.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgv_Searches_CellValueChanged); 104 | // 105 | // Key 106 | // 107 | this.Key.HeaderText = "Name"; 108 | this.Key.Name = "Key"; 109 | this.Key.ToolTipText = "The name of the search as it will appear in the drop-down menu"; 110 | // 111 | // MatchCase 112 | // 113 | this.MatchCase.FillWeight = 35F; 114 | this.MatchCase.HeaderText = "Match Case?"; 115 | this.MatchCase.Name = "MatchCase"; 116 | this.MatchCase.Resizable = System.Windows.Forms.DataGridViewTriState.True; 117 | this.MatchCase.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; 118 | this.MatchCase.ToolTipText = "Is the search case sensitive?"; 119 | // 120 | // Wildcards 121 | // 122 | this.Wildcards.FillWeight = 35F; 123 | this.Wildcards.HeaderText = "Wildcards?"; 124 | this.Wildcards.Name = "Wildcards"; 125 | this.Wildcards.ToolTipText = "Check if this search uses Word\'s wildcard features"; 126 | // 127 | // Find 128 | // 129 | this.Find.HeaderText = "Find"; 130 | this.Find.Name = "Find"; 131 | this.Find.ToolTipText = "The text you\'re searching for"; 132 | // 133 | // HandleReplace 134 | // 135 | this.HandleReplace.FillWeight = 35F; 136 | this.HandleReplace.HeaderText = "Replace?"; 137 | this.HandleReplace.Name = "HandleReplace"; 138 | this.HandleReplace.ToolTipText = "Check if you want to replace text"; 139 | // 140 | // Replace 141 | // 142 | this.Replace.HeaderText = "Replace"; 143 | this.Replace.Name = "Replace"; 144 | this.Replace.ReadOnly = true; 145 | this.Replace.ToolTipText = "The text you want to replace the found text with"; 146 | // 147 | // ReplaceAll 148 | // 149 | this.ReplaceAll.FillWeight = 35F; 150 | this.ReplaceAll.HeaderText = "Replace All?"; 151 | this.ReplaceAll.Name = "ReplaceAll"; 152 | this.ReplaceAll.ReadOnly = true; 153 | this.ReplaceAll.ToolTipText = "If checked, executing this search will replace all instances at once"; 154 | // 155 | // flowLayoutPanel1 156 | // 157 | this.flowLayoutPanel1.Controls.Add(this.btn_SearchesSave); 158 | this.flowLayoutPanel1.Controls.Add(this.btn_SearchesExport); 159 | this.flowLayoutPanel1.Controls.Add(this.btn_SearchesImport); 160 | this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; 161 | this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; 162 | this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 421); 163 | this.flowLayoutPanel1.Name = "flowLayoutPanel1"; 164 | this.flowLayoutPanel1.Size = new System.Drawing.Size(971, 26); 165 | this.flowLayoutPanel1.TabIndex = 0; 166 | // 167 | // btn_SearchesSave 168 | // 169 | this.btn_SearchesSave.Location = new System.Drawing.Point(893, 3); 170 | this.btn_SearchesSave.Name = "btn_SearchesSave"; 171 | this.btn_SearchesSave.Size = new System.Drawing.Size(75, 23); 172 | this.btn_SearchesSave.TabIndex = 0; 173 | this.btn_SearchesSave.Text = "Save"; 174 | this.btn_SearchesSave.UseVisualStyleBackColor = true; 175 | this.btn_SearchesSave.Click += new System.EventHandler(this.btn_SearchesSave_Click); 176 | // 177 | // btn_SearchesExport 178 | // 179 | this.btn_SearchesExport.Location = new System.Drawing.Point(812, 3); 180 | this.btn_SearchesExport.Name = "btn_SearchesExport"; 181 | this.btn_SearchesExport.Size = new System.Drawing.Size(75, 23); 182 | this.btn_SearchesExport.TabIndex = 1; 183 | this.btn_SearchesExport.Text = "Export"; 184 | this.btn_SearchesExport.UseVisualStyleBackColor = true; 185 | this.btn_SearchesExport.Click += new System.EventHandler(this.btn_SearchesExport_Click); 186 | // 187 | // btn_SearchesImport 188 | // 189 | this.btn_SearchesImport.Location = new System.Drawing.Point(731, 3); 190 | this.btn_SearchesImport.Name = "btn_SearchesImport"; 191 | this.btn_SearchesImport.Size = new System.Drawing.Size(75, 23); 192 | this.btn_SearchesImport.TabIndex = 2; 193 | this.btn_SearchesImport.Text = "Import"; 194 | this.btn_SearchesImport.UseVisualStyleBackColor = true; 195 | this.btn_SearchesImport.Click += new System.EventHandler(this.btn_SearchesImport_Click); 196 | // 197 | // label1 198 | // 199 | this.label1.AutoSize = true; 200 | this.label1.Dock = System.Windows.Forms.DockStyle.Top; 201 | this.label1.Location = new System.Drawing.Point(3, 0); 202 | this.label1.Name = "label1"; 203 | this.label1.Size = new System.Drawing.Size(971, 13); 204 | this.label1.TabIndex = 2; 205 | this.label1.Text = "Hover over a column for more information."; 206 | // 207 | // ManageSearches 208 | // 209 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 210 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 211 | this.ClientSize = new System.Drawing.Size(977, 450); 212 | this.Controls.Add(this.tableLayoutPanel1); 213 | this.Name = "ManageSearches"; 214 | this.Text = "Manage Searches"; 215 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ManageSearches_FormClosing); 216 | this.Load += new System.EventHandler(this.ManageSearches_Load); 217 | this.tableLayoutPanel1.ResumeLayout(false); 218 | this.tableLayoutPanel1.PerformLayout(); 219 | ((System.ComponentModel.ISupportInitialize)(this.dgv_Searches)).EndInit(); 220 | this.flowLayoutPanel1.ResumeLayout(false); 221 | this.ResumeLayout(false); 222 | 223 | } 224 | 225 | #endregion 226 | 227 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; 228 | private System.Windows.Forms.DataGridView dgv_Searches; 229 | private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; 230 | private System.Windows.Forms.Button btn_SearchesSave; 231 | private System.Windows.Forms.Button btn_SearchesExport; 232 | private System.Windows.Forms.Button btn_SearchesImport; 233 | private System.Windows.Forms.DataGridViewTextBoxColumn Key; 234 | private System.Windows.Forms.DataGridViewCheckBoxColumn MatchCase; 235 | private System.Windows.Forms.DataGridViewCheckBoxColumn Wildcards; 236 | private System.Windows.Forms.DataGridViewTextBoxColumn Find; 237 | private System.Windows.Forms.DataGridViewCheckBoxColumn HandleReplace; 238 | private System.Windows.Forms.DataGridViewTextBoxColumn Replace; 239 | private System.Windows.Forms.DataGridViewCheckBoxColumn ReplaceAll; 240 | private System.Windows.Forms.Label label1; 241 | } 242 | } -------------------------------------------------------------------------------- /EditTools/ManageSearches.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Diagnostics; 5 | using System.ComponentModel; 6 | using System.Data; 7 | using System.Drawing; 8 | using System.IO; 9 | using System.Linq; 10 | using System.Text; 11 | using System.Threading.Tasks; 12 | using System.Windows.Forms; 13 | 14 | namespace EditTools 15 | { 16 | public partial class ManageSearches : Form 17 | { 18 | public ManageSearches() 19 | { 20 | InitializeComponent(); 21 | } 22 | 23 | private void ManageSearches_Load(object sender, EventArgs e) 24 | { 25 | RefreshDisplay(); 26 | } 27 | 28 | private void RefreshDisplay() 29 | { 30 | dgv_Searches.Rows.Clear(); 31 | Searches searches = Properties.Settings.Default.searches; 32 | 33 | if (searches != null) 34 | { 35 | foreach (KeyValuePair search in searches.Dict) 36 | { 37 | int idx = dgv_Searches.Rows.Add(); 38 | DataGridViewRow row = dgv_Searches.Rows[idx]; 39 | row.Cells["Key"].Value = search.Key; 40 | row.Cells["MatchCase"].Value = search.Value.CaseSensitive; 41 | row.Cells["Wildcards"].Value = search.Value.Wildcards; 42 | row.Cells["Find"].Value = search.Value.Find; 43 | if (search.Value.Replace == null) 44 | { 45 | row.Cells["HandleReplace"].Value = false; 46 | } 47 | else 48 | { 49 | row.Cells["HandleReplace"].Value = true; 50 | row.Cells["Replace"].Value = search.Value.Replace; 51 | row.Cells["ReplaceAll"].Value = search.Value.ReplaceAll; 52 | } 53 | } 54 | } 55 | 56 | } 57 | 58 | private void dgv_Searches_CellValueChanged(object sender, DataGridViewCellEventArgs e) 59 | { 60 | if ( (e.RowIndex >= 0) && (e.ColumnIndex == 4) ) 61 | { 62 | bool ischecked = (bool)dgv_Searches.Rows[e.RowIndex].Cells[e.ColumnIndex].Value; 63 | if (!ischecked) 64 | { 65 | dgv_Searches.Rows[e.RowIndex].Cells["Replace"].Value = ""; 66 | dgv_Searches.Rows[e.RowIndex].Cells["Replace"].ReadOnly = true; 67 | dgv_Searches.Rows[e.RowIndex].Cells["ReplaceAll"].Value = false; 68 | dgv_Searches.Rows[e.RowIndex].Cells["ReplaceAll"].ReadOnly = true; 69 | } 70 | else 71 | { 72 | dgv_Searches.Rows[e.RowIndex].Cells["Replace"].ReadOnly = false; 73 | dgv_Searches.Rows[e.RowIndex].Cells["ReplaceAll"].ReadOnly = false; 74 | } 75 | } 76 | } 77 | 78 | private void btn_SearchesSave_Click(object sender, EventArgs e) 79 | { 80 | Searches searches = ConvertRows(); 81 | Properties.Settings.Default.searches = searches; 82 | Properties.Settings.Default.Save(); 83 | } 84 | 85 | private Searches ConvertRows() 86 | { 87 | Searches searches = new Searches(); 88 | foreach (DataGridViewRow row in dgv_Searches.Rows) 89 | { 90 | if (row.IsNewRow) 91 | { 92 | continue; 93 | } 94 | string key = ""; 95 | if (row.Cells["Key"].Value == null) 96 | { 97 | throw new InvalidOperationException("Each row must have a unique name."); 98 | } 99 | else 100 | { 101 | key = row.Cells["Key"].Value.ToString(); 102 | } 103 | Search search = new Search(); 104 | if (row.Cells["MatchCase"].Value == null) 105 | { 106 | search.CaseSensitive = false; 107 | } 108 | else 109 | { 110 | search.CaseSensitive = (bool)row.Cells["MatchCase"].Value; 111 | } 112 | if (row.Cells["Wildcards"].Value == null) 113 | { 114 | search.Wildcards = false; 115 | } 116 | else 117 | { 118 | search.Wildcards = (bool)row.Cells["Wildcards"].Value; 119 | } 120 | if ((row.Cells["Find"].Value == null) || (String.IsNullOrEmpty(row.Cells["Find"].Value.ToString()))) 121 | { 122 | throw new InvalidOperationException("Each row must have something in the 'Find' column."); 123 | } 124 | else 125 | { 126 | search.Find = row.Cells["Find"].Value.ToString(); 127 | } 128 | bool replace = false; 129 | if (row.Cells["HandleReplace"].Value != null) 130 | { 131 | replace = (bool)row.Cells["HandleReplace"].Value; 132 | } 133 | if (replace) 134 | { 135 | if (row.Cells["Replace"].Value == null) 136 | { 137 | search.Replace = String.Empty; 138 | } 139 | else 140 | { 141 | search.Replace = row.Cells["Replace"].Value.ToString(); 142 | } 143 | if (row.Cells["ReplaceAll"].Value == null) 144 | { 145 | search.ReplaceAll = false; 146 | } 147 | else 148 | { 149 | search.ReplaceAll = (bool)row.Cells["ReplaceAll"].Value; 150 | } 151 | } 152 | searches.Dict.Add(key, search); 153 | } 154 | return searches; 155 | } 156 | 157 | private void btn_SearchesExport_Click(object sender, EventArgs e) 158 | { 159 | SaveFileDialog sfd = new SaveFileDialog(); 160 | sfd.AddExtension = true; 161 | sfd.DefaultExt = "json"; 162 | sfd.CheckPathExists = true; 163 | sfd.Filter = "JSON files (*.json)|*.json"; 164 | sfd.InitialDirectory = System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop); 165 | sfd.OverwritePrompt = true; 166 | sfd.Title = "Export Saved Searches"; 167 | sfd.FileName = "searches.json"; 168 | //sfd.RestoreDirectory = false; 169 | 170 | if (sfd.ShowDialog() == DialogResult.OK) 171 | { 172 | string serialized = JsonConvert.SerializeObject(Properties.Settings.Default.searches.Dict, Formatting.Indented); 173 | Debug.WriteLine(serialized); 174 | File.WriteAllText(sfd.FileName, serialized); 175 | MessageBox.Show("Saved searches exported to " + sfd.FileName + "."); 176 | } 177 | else 178 | { 179 | MessageBox.Show("Export cancelled."); 180 | } 181 | } 182 | 183 | private void btn_SearchesImport_Click(object sender, EventArgs e) 184 | { 185 | Searches searches = Properties.Settings.Default.searches; 186 | ImportDialog id = new ImportDialog(); 187 | var result = id.ShowDialog(); 188 | 189 | if (result == DialogResult.OK) 190 | { 191 | string injson = File.ReadAllText(id.GetFileName()); 192 | Searches insearches = new Searches(); 193 | insearches.Dict = JsonConvert.DeserializeObject>(injson); 194 | 195 | switch (id.GetMode()) 196 | { 197 | case ImportDialog.Modes.MERGE: 198 | foreach (var kvpair in insearches.Dict) 199 | { 200 | if (searches.Dict.ContainsKey(kvpair.Key)) 201 | { 202 | searches.Dict[kvpair.Key] = kvpair.Value; 203 | } 204 | else 205 | { 206 | searches.Dict.Add(kvpair.Key, kvpair.Value); 207 | } 208 | } 209 | break; 210 | case ImportDialog.Modes.NEW: 211 | foreach (var kvpair in insearches.Dict) 212 | { 213 | if (searches.Dict.ContainsKey(kvpair.Key)) 214 | { 215 | continue; 216 | } 217 | else 218 | { 219 | searches.Dict.Add(kvpair.Key, kvpair.Value); 220 | } 221 | } 222 | break; 223 | case ImportDialog.Modes.REPLACE: 224 | searches = insearches; 225 | break; 226 | default: 227 | throw new ArgumentOutOfRangeException("Unrecognized import mode. Aborting."); 228 | } 229 | 230 | Properties.Settings.Default.searches = searches; 231 | Properties.Settings.Default.Save(); 232 | RefreshDisplay(); 233 | MessageBox.Show("Import complete."); 234 | 235 | } 236 | else 237 | { 238 | MessageBox.Show("Import cancelled."); 239 | } 240 | } 241 | 242 | private void ManageSearches_FormClosing(object sender, FormClosingEventArgs e) 243 | { 244 | Searches searches = ConvertRows(); 245 | Properties.Settings.Default.searches = searches; 246 | Properties.Settings.Default.Save(); 247 | } 248 | } 249 | } 250 | -------------------------------------------------------------------------------- /EditTools/ManageSearches.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | True 122 | 123 | 124 | True 125 | 126 | 127 | True 128 | 129 | 130 | True 131 | 132 | 133 | True 134 | 135 | 136 | True 137 | 138 | 139 | True 140 | 141 | -------------------------------------------------------------------------------- /EditTools/ProgressDialog.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace EditTools 2 | { 3 | partial class ProgressDialog 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.progressBar1 = new System.Windows.Forms.ProgressBar(); 32 | this.SuspendLayout(); 33 | // 34 | // progressBar1 35 | // 36 | this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 37 | | System.Windows.Forms.AnchorStyles.Left) 38 | | System.Windows.Forms.AnchorStyles.Right))); 39 | this.progressBar1.Location = new System.Drawing.Point(12, 12); 40 | this.progressBar1.Name = "progressBar1"; 41 | this.progressBar1.Size = new System.Drawing.Size(395, 20); 42 | this.progressBar1.TabIndex = 0; 43 | // 44 | // ProgressDialog 45 | // 46 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 47 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 48 | this.ClientSize = new System.Drawing.Size(419, 44); 49 | this.ControlBox = false; 50 | this.Controls.Add(this.progressBar1); 51 | this.Cursor = System.Windows.Forms.Cursors.WaitCursor; 52 | this.Name = "ProgressDialog"; 53 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 54 | this.Text = "Working..."; 55 | this.TopMost = true; 56 | this.UseWaitCursor = true; 57 | this.ResumeLayout(false); 58 | 59 | } 60 | 61 | #endregion 62 | 63 | private System.Windows.Forms.ProgressBar progressBar1; 64 | 65 | public int pbMax 66 | { 67 | get { return progressBar1.Maximum; } 68 | set { progressBar1.Maximum = value; Refresh(); } 69 | } 70 | 71 | public int pbVal 72 | { 73 | get { return progressBar1.Value; } 74 | set { progressBar1.Value = value; Refresh(); } 75 | } 76 | } 77 | } -------------------------------------------------------------------------------- /EditTools/ProgressDialog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace EditTools 12 | { 13 | public partial class ProgressDialog : Form 14 | { 15 | public ProgressDialog() 16 | { 17 | InitializeComponent(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /EditTools/ProgressDialog.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | True 122 | 123 | -------------------------------------------------------------------------------- /EditTools/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using System.Security; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("EditTools")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("EditTools")] 14 | [assembly: AssemblyCopyright("Copyright © 2016")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | [assembly: Guid("3b3006fc-4c43-4da5-80bb-ea8bd02a2441")] 25 | 26 | // Version information for an assembly consists of the following four values: 27 | // 28 | // Major Version 29 | // Minor Version 30 | // Build Number 31 | // Revision 32 | // 33 | // You can specify all the values or you can default the Build and Revision Numbers 34 | // by using the '*' as shown below: 35 | // [assembly: AssemblyVersion("1.0.*")] 36 | [assembly: AssemblyVersion("1.0.0.0")] 37 | [assembly: AssemblyFileVersion("1.0.0.0")] 38 | 39 | -------------------------------------------------------------------------------- /EditTools/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace EditTools.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("EditTools.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /EditTools/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | -------------------------------------------------------------------------------- /EditTools/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace EditTools.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | 26 | [global::System.Configuration.UserScopedSettingAttribute()] 27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 28 | [global::System.Configuration.DefaultSettingValueAttribute("2")] 29 | public string mindist { 30 | get { 31 | return ((string)(this["mindist"])); 32 | } 33 | set { 34 | this["mindist"] = value; 35 | } 36 | } 37 | 38 | [global::System.Configuration.UserScopedSettingAttribute()] 39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 40 | [global::System.Configuration.DefaultSettingValueAttribute("\r\n")] 42 | public global::System.Collections.Specialized.StringCollection boilerplate { 43 | get { 44 | return ((global::System.Collections.Specialized.StringCollection)(this["boilerplate"])); 45 | } 46 | set { 47 | this["boilerplate"] = value; 48 | } 49 | } 50 | 51 | [global::System.Configuration.UserScopedSettingAttribute()] 52 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 53 | [global::System.Configuration.DefaultSettingValueAttribute("English (Canada)")] 54 | public string lastlang { 55 | get { 56 | return ((string)(this["lastlang"])); 57 | } 58 | set { 59 | this["lastlang"] = value; 60 | } 61 | } 62 | 63 | [global::System.Configuration.UserScopedSettingAttribute()] 64 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 65 | [global::System.Configuration.DefaultSettingValueAttribute("3")] 66 | public uint minphraselen { 67 | get { 68 | return ((uint)(this["minphraselen"])); 69 | } 70 | set { 71 | this["minphraselen"] = value; 72 | } 73 | } 74 | 75 | [global::System.Configuration.UserScopedSettingAttribute()] 76 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 77 | [global::System.Configuration.DefaultSettingValueAttribute("6")] 78 | public uint maxphraselen { 79 | get { 80 | return ((uint)(this["maxphraselen"])); 81 | } 82 | set { 83 | this["maxphraselen"] = value; 84 | } 85 | } 86 | 87 | [global::System.Configuration.UserScopedSettingAttribute()] 88 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 89 | [global::System.Configuration.DefaultSettingValueAttribute("{\"double spaces\":{\"Find\":\" \",\"Replace\":\" \",\"Wildcards\":false,\"CaseSensitive\":fal" + 90 | "se,\"ReplaceAll\":true}}")] 91 | public global::EditTools.Searches searches { 92 | get { 93 | return ((global::EditTools.Searches)(this["searches"])); 94 | } 95 | set { 96 | this["searches"] = value; 97 | } 98 | } 99 | 100 | [global::System.Configuration.UserScopedSettingAttribute()] 101 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 102 | [global::System.Configuration.DefaultSettingValueAttribute(@"{""(s)"":{""Text"":""Never use \""(s)\"". Both the federal and provincial interpretation acts stipulate that the singular can be read as the plural and vice versa.""},""and/or"":{""Text"":""Never use \""and/or.\"" If clarity is critical, use constructs like \""X or Y or both\"" or \""X or Y but not both.\"" That said, in normal usage, one or the other is sufficient. Saying \""No food or drink allowed\"" does not mean you can have both. Or saying \""Lawyers and law students may not enter\"" does not mean that any one of them may.""}}")] 103 | public global::EditTools.Boilerplate newboiler { 104 | get { 105 | return ((global::EditTools.Boilerplate)(this["newboiler"])); 106 | } 107 | set { 108 | this["newboiler"] = value; 109 | } 110 | } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /EditTools/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 2 7 | 8 | 9 | <?xml version="1.0" encoding="utf-16"?> 10 | <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /> 11 | 12 | 13 | English (Canada) 14 | 15 | 16 | 3 17 | 18 | 19 | 6 20 | 21 | 22 | {"double spaces":{"Find":" ","Replace":" ","Wildcards":false,"CaseSensitive":false,"ReplaceAll":true}} 23 | 24 | 25 | {"(s)":{"Text":"Never use \"(s)\". Both the federal and provincial interpretation acts stipulate that the singular can be read as the plural and vice versa."},"and/or":{"Text":"Never use \"and/or.\" If clarity is critical, use constructs like \"X or Y or both\" or \"X or Y but not both.\" That said, in normal usage, one or the other is sufficient. Saying \"No food or drink allowed\" does not mean you can have both. Or saying \"Lawyers and law students may not enter\" does not mean that any one of them may."}} 26 | 27 | 28 | -------------------------------------------------------------------------------- /EditTools/Ribbon1.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace EditTools 2 | { 3 | partial class Ribbon1 : Microsoft.Office.Tools.Ribbon.RibbonBase 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | public Ribbon1() 11 | : base(Globals.Factory.GetRibbonFactory()) 12 | { 13 | InitializeComponent(); 14 | } 15 | 16 | /// 17 | /// Clean up any resources being used. 18 | /// 19 | /// true if managed resources should be disposed; otherwise, false. 20 | protected override void Dispose(bool disposing) 21 | { 22 | if (disposing && (components != null)) 23 | { 24 | components.Dispose(); 25 | } 26 | base.Dispose(disposing); 27 | } 28 | 29 | #region Component Designer generated code 30 | 31 | /// 32 | /// Required method for Designer support - do not modify 33 | /// the contents of this method with the code editor. 34 | /// 35 | private void InitializeComponent() 36 | { 37 | this.EditingTools = this.Factory.CreateRibbonTab(); 38 | this.group1 = this.Factory.CreateRibbonGroup(); 39 | this.lbl_Version = this.Factory.CreateRibbonLabel(); 40 | this.btn_Help = this.Factory.CreateRibbonButton(); 41 | this.lbl_Spacer1 = this.Factory.CreateRibbonLabel(); 42 | this.btn_Settings = this.Factory.CreateRibbonButton(); 43 | this.group2 = this.Factory.CreateRibbonGroup(); 44 | this.dd_Langs = this.Factory.CreateRibbonDropDown(); 45 | this.btn_FixLang = this.Factory.CreateRibbonButton(); 46 | this.label1 = this.Factory.CreateRibbonLabel(); 47 | this.eb_AuthorName = this.Factory.CreateRibbonEditBox(); 48 | this.eb_AuthorInit = this.Factory.CreateRibbonEditBox(); 49 | this.btn_ChangeOwner = this.Factory.CreateRibbonButton(); 50 | this.btn_SingData = this.Factory.CreateRibbonButton(); 51 | this.group3 = this.Factory.CreateRibbonGroup(); 52 | this.btn_WordList = this.Factory.CreateRibbonButton(); 53 | this.btn_WordFreq = this.Factory.CreateRibbonButton(); 54 | this.btn_ProperNouns = this.Factory.CreateRibbonButton(); 55 | this.edit_MinPhraseLen = this.Factory.CreateRibbonEditBox(); 56 | this.edit_MaxPhraseLen = this.Factory.CreateRibbonEditBox(); 57 | this.btn_PhraseFrequency = this.Factory.CreateRibbonButton(); 58 | this.grp_Finishing = this.Factory.CreateRibbonGroup(); 59 | this.btn_AcceptFormatting = this.Factory.CreateRibbonButton(); 60 | this.btn_LinkText = this.Factory.CreateRibbonButton(); 61 | this.group4 = this.Factory.CreateRibbonGroup(); 62 | this.dd_Boilerplate = this.Factory.CreateRibbonDropDown(); 63 | this.btn_ApplyBoilerplate = this.Factory.CreateRibbonButton(); 64 | this.btn_ManageBoiler = this.Factory.CreateRibbonButton(); 65 | this.group5 = this.Factory.CreateRibbonGroup(); 66 | this.dd_Searches = this.Factory.CreateRibbonDropDown(); 67 | this.btn_ExecuteSearch = this.Factory.CreateRibbonButton(); 68 | this.btn_ManageSearches = this.Factory.CreateRibbonButton(); 69 | this.EditingTools.SuspendLayout(); 70 | this.group1.SuspendLayout(); 71 | this.group2.SuspendLayout(); 72 | this.group3.SuspendLayout(); 73 | this.grp_Finishing.SuspendLayout(); 74 | this.group4.SuspendLayout(); 75 | this.group5.SuspendLayout(); 76 | this.SuspendLayout(); 77 | // 78 | // EditingTools 79 | // 80 | this.EditingTools.Groups.Add(this.group1); 81 | this.EditingTools.Groups.Add(this.group2); 82 | this.EditingTools.Groups.Add(this.group3); 83 | this.EditingTools.Groups.Add(this.grp_Finishing); 84 | this.EditingTools.Groups.Add(this.group4); 85 | this.EditingTools.Groups.Add(this.group5); 86 | this.EditingTools.Label = "Editing Tools"; 87 | this.EditingTools.Name = "EditingTools"; 88 | // 89 | // group1 90 | // 91 | this.group1.Items.Add(this.lbl_Version); 92 | this.group1.Items.Add(this.btn_Help); 93 | this.group1.Items.Add(this.lbl_Spacer1); 94 | this.group1.Items.Add(this.btn_Settings); 95 | this.group1.Label = "Settings"; 96 | this.group1.Name = "group1"; 97 | // 98 | // lbl_Version 99 | // 100 | this.lbl_Version.Label = "Version 2.0.0"; 101 | this.lbl_Version.Name = "lbl_Version"; 102 | // 103 | // btn_Help 104 | // 105 | this.btn_Help.Label = "Help!"; 106 | this.btn_Help.Name = "btn_Help"; 107 | this.btn_Help.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.btn_Help_Click); 108 | // 109 | // lbl_Spacer1 110 | // 111 | this.lbl_Spacer1.Label = " "; 112 | this.lbl_Spacer1.Name = "lbl_Spacer1"; 113 | // 114 | // btn_Settings 115 | // 116 | this.btn_Settings.Label = "Settings"; 117 | this.btn_Settings.Name = "btn_Settings"; 118 | this.btn_Settings.ScreenTip = "Add/remove/edit boilerplate and configure the edit distance for the proper noun c" + 119 | "hecker"; 120 | this.btn_Settings.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.btn_Settings_Click); 121 | // 122 | // group2 123 | // 124 | this.group2.Items.Add(this.dd_Langs); 125 | this.group2.Items.Add(this.btn_FixLang); 126 | this.group2.Items.Add(this.label1); 127 | this.group2.Items.Add(this.eb_AuthorName); 128 | this.group2.Items.Add(this.eb_AuthorInit); 129 | this.group2.Items.Add(this.btn_ChangeOwner); 130 | this.group2.Items.Add(this.btn_SingData); 131 | this.group2.Label = "Editing"; 132 | this.group2.Name = "group2"; 133 | // 134 | // dd_Langs 135 | // 136 | this.dd_Langs.Label = "Languages"; 137 | this.dd_Langs.Name = "dd_Langs"; 138 | this.dd_Langs.ScreenTip = "Apply selected language to the entire document, including notes, headers and foo" + 139 | "ters"; 140 | this.dd_Langs.ShowLabel = false; 141 | this.dd_Langs.SizeString = "WWWWWWWWWWWWWWW"; 142 | // 143 | // btn_FixLang 144 | // 145 | this.btn_FixLang.Label = "Apply Language"; 146 | this.btn_FixLang.Name = "btn_FixLang"; 147 | this.btn_FixLang.ScreenTip = "Apply selected language to the entire document, including notes, headers and foo" + 148 | "ters"; 149 | this.btn_FixLang.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.btn_FixLang_Click); 150 | // 151 | // label1 152 | // 153 | this.label1.Label = " "; 154 | this.label1.Name = "label1"; 155 | // 156 | // eb_AuthorName 157 | // 158 | this.eb_AuthorName.Label = "Author Name"; 159 | this.eb_AuthorName.Name = "eb_AuthorName"; 160 | this.eb_AuthorName.ScreenTip = "Full name of the author to own the comment"; 161 | this.eb_AuthorName.SizeString = "WWWWWWWWWWWW"; 162 | this.eb_AuthorName.Text = null; 163 | // 164 | // eb_AuthorInit 165 | // 166 | this.eb_AuthorInit.Label = "Author Initials"; 167 | this.eb_AuthorInit.Name = "eb_AuthorInit"; 168 | this.eb_AuthorInit.ScreenTip = "The initials of the author to own the comment"; 169 | this.eb_AuthorInit.SizeString = "WWWWW"; 170 | this.eb_AuthorInit.Text = null; 171 | // 172 | // btn_ChangeOwner 173 | // 174 | this.btn_ChangeOwner.Label = "Change Comment Owner"; 175 | this.btn_ChangeOwner.Name = "btn_ChangeOwner"; 176 | this.btn_ChangeOwner.ScreenTip = "Change the author name and initials assigned to the selected comment"; 177 | this.btn_ChangeOwner.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.btn_ChangeOwner_Click); 178 | // 179 | // btn_SingData 180 | // 181 | this.btn_SingData.Label = ""; 182 | this.btn_SingData.Name = "btn_SingData"; 183 | // 184 | // group3 185 | // 186 | this.group3.Items.Add(this.btn_WordList); 187 | this.group3.Items.Add(this.btn_WordFreq); 188 | this.group3.Items.Add(this.btn_ProperNouns); 189 | this.group3.Items.Add(this.edit_MinPhraseLen); 190 | this.group3.Items.Add(this.edit_MaxPhraseLen); 191 | this.group3.Items.Add(this.btn_PhraseFrequency); 192 | this.group3.Label = "Proofing"; 193 | this.group3.Name = "group3"; 194 | // 195 | // btn_WordList 196 | // 197 | this.btn_WordList.Label = "Word List"; 198 | this.btn_WordList.Name = "btn_WordList"; 199 | this.btn_WordList.ScreenTip = "Generate a list of all the unique words in the document"; 200 | this.btn_WordList.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.btn_WordList_Click); 201 | // 202 | // btn_WordFreq 203 | // 204 | this.btn_WordFreq.Label = "Word Frequency List"; 205 | this.btn_WordFreq.Name = "btn_WordFreq"; 206 | this.btn_WordFreq.ScreenTip = "List words in frequency order"; 207 | this.btn_WordFreq.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.btn_WordFreq_Click); 208 | // 209 | // btn_ProperNouns 210 | // 211 | this.btn_ProperNouns.Label = "Check Proper Nouns"; 212 | this.btn_ProperNouns.Name = "btn_ProperNouns"; 213 | this.btn_ProperNouns.ScreenTip = "Find proper nouns that sound alike or that differ by a configurable edit distance" + 214 | ""; 215 | this.btn_ProperNouns.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.btn_ProperNouns_Click); 216 | // 217 | // edit_MinPhraseLen 218 | // 219 | this.edit_MinPhraseLen.Label = "Min. Phrase Length"; 220 | this.edit_MinPhraseLen.Name = "edit_MinPhraseLen"; 221 | this.edit_MinPhraseLen.Text = null; 222 | // 223 | // edit_MaxPhraseLen 224 | // 225 | this.edit_MaxPhraseLen.Label = "Max. Phrase Length"; 226 | this.edit_MaxPhraseLen.Name = "edit_MaxPhraseLen"; 227 | this.edit_MaxPhraseLen.Text = null; 228 | // 229 | // btn_PhraseFrequency 230 | // 231 | this.btn_PhraseFrequency.Label = "Phrase Frequency List"; 232 | this.btn_PhraseFrequency.Name = "btn_PhraseFrequency"; 233 | this.btn_PhraseFrequency.ScreenTip = "List phrases of the given length in frequency order"; 234 | this.btn_PhraseFrequency.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.btn_PhraseFrequency_Click); 235 | // 236 | // grp_Finishing 237 | // 238 | this.grp_Finishing.Items.Add(this.btn_AcceptFormatting); 239 | this.grp_Finishing.Items.Add(this.btn_LinkText); 240 | this.grp_Finishing.Label = "Finishing"; 241 | this.grp_Finishing.Name = "grp_Finishing"; 242 | // 243 | // btn_AcceptFormatting 244 | // 245 | this.btn_AcceptFormatting.Label = "Accept Formatting Changes"; 246 | this.btn_AcceptFormatting.Name = "btn_AcceptFormatting"; 247 | this.btn_AcceptFormatting.ScreenTip = "Accept all formatting changes with one click"; 248 | this.btn_AcceptFormatting.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.btn_AcceptFormatting_Click); 249 | // 250 | // btn_LinkText 251 | // 252 | this.btn_LinkText.Label = "Link Text"; 253 | this.btn_LinkText.Name = "btn_LinkText"; 254 | this.btn_LinkText.ScreenTip = "Add hyperlinks to instances of the same text"; 255 | this.btn_LinkText.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.btn_LinkText_Click); 256 | // 257 | // group4 258 | // 259 | this.group4.Items.Add(this.dd_Boilerplate); 260 | this.group4.Items.Add(this.btn_ApplyBoilerplate); 261 | this.group4.Items.Add(this.btn_ManageBoiler); 262 | this.group4.Label = "Boilerplate"; 263 | this.group4.Name = "group4"; 264 | // 265 | // dd_Boilerplate 266 | // 267 | this.dd_Boilerplate.Label = "Comments"; 268 | this.dd_Boilerplate.Name = "dd_Boilerplate"; 269 | this.dd_Boilerplate.ScreenTip = "Use the \"Settings\" button to add/remove/edit boilerplate"; 270 | this.dd_Boilerplate.ShowLabel = false; 271 | this.dd_Boilerplate.SizeString = "WWWWWWWWWWWWWWW"; 272 | // 273 | // btn_ApplyBoilerplate 274 | // 275 | this.btn_ApplyBoilerplate.Label = "Apply Comment"; 276 | this.btn_ApplyBoilerplate.Name = "btn_ApplyBoilerplate"; 277 | this.btn_ApplyBoilerplate.ScreenTip = "Click to apply selected comment to the selected text; Use the \"Settings\" button t" + 278 | "o add/remove/edit boilerplate"; 279 | this.btn_ApplyBoilerplate.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.btn_ApplyBoilerplate_Click); 280 | // 281 | // btn_ManageBoiler 282 | // 283 | this.btn_ManageBoiler.Label = "Manage Boilerplate"; 284 | this.btn_ManageBoiler.Name = "btn_ManageBoiler"; 285 | this.btn_ManageBoiler.ScreenTip = "Edit your saved comments"; 286 | this.btn_ManageBoiler.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.btn_ManageBoiler_Click); 287 | // 288 | // group5 289 | // 290 | this.group5.Items.Add(this.dd_Searches); 291 | this.group5.Items.Add(this.btn_ExecuteSearch); 292 | this.group5.Items.Add(this.btn_ManageSearches); 293 | this.group5.Label = "Search && Replace"; 294 | this.group5.Name = "group5"; 295 | // 296 | // dd_Searches 297 | // 298 | this.dd_Searches.Label = "Saved Searches"; 299 | this.dd_Searches.Name = "dd_Searches"; 300 | this.dd_Searches.ScreenTip = "Click the \"Manage\" button to change your saved searches"; 301 | this.dd_Searches.ShowLabel = false; 302 | this.dd_Searches.SizeString = "WWWWWWWWWWWWWWW"; 303 | // 304 | // btn_ExecuteSearch 305 | // 306 | this.btn_ExecuteSearch.Label = "Execute Search"; 307 | this.btn_ExecuteSearch.Name = "btn_ExecuteSearch"; 308 | this.btn_ExecuteSearch.ScreenTip = "Click to execute selected saved search"; 309 | this.btn_ExecuteSearch.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.btn_ExecuteSearch_Click); 310 | // 311 | // btn_ManageSearches 312 | // 313 | this.btn_ManageSearches.Label = "Manage Searches"; 314 | this.btn_ManageSearches.Name = "btn_ManageSearches"; 315 | this.btn_ManageSearches.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.btn_ManageSearches_Click); 316 | // 317 | // Ribbon1 318 | // 319 | this.Name = "Ribbon1"; 320 | this.RibbonType = "Microsoft.Word.Document"; 321 | this.Tabs.Add(this.EditingTools); 322 | this.Load += new Microsoft.Office.Tools.Ribbon.RibbonUIEventHandler(this.Ribbon1_Load); 323 | this.EditingTools.ResumeLayout(false); 324 | this.EditingTools.PerformLayout(); 325 | this.group1.ResumeLayout(false); 326 | this.group1.PerformLayout(); 327 | this.group2.ResumeLayout(false); 328 | this.group2.PerformLayout(); 329 | this.group3.ResumeLayout(false); 330 | this.group3.PerformLayout(); 331 | this.grp_Finishing.ResumeLayout(false); 332 | this.grp_Finishing.PerformLayout(); 333 | this.group4.ResumeLayout(false); 334 | this.group4.PerformLayout(); 335 | this.group5.ResumeLayout(false); 336 | this.group5.PerformLayout(); 337 | this.ResumeLayout(false); 338 | 339 | } 340 | 341 | #endregion 342 | 343 | internal Microsoft.Office.Tools.Ribbon.RibbonTab EditingTools; 344 | internal Microsoft.Office.Tools.Ribbon.RibbonGroup group1; 345 | internal Microsoft.Office.Tools.Ribbon.RibbonButton btn_Settings; 346 | internal Microsoft.Office.Tools.Ribbon.RibbonGroup group3; 347 | internal Microsoft.Office.Tools.Ribbon.RibbonGroup group4; 348 | internal Microsoft.Office.Tools.Ribbon.RibbonButton btn_WordList; 349 | internal Microsoft.Office.Tools.Ribbon.RibbonButton btn_ProperNouns; 350 | internal Microsoft.Office.Tools.Ribbon.RibbonDropDown dd_Boilerplate; 351 | internal Microsoft.Office.Tools.Ribbon.RibbonButton btn_ApplyBoilerplate; 352 | internal Microsoft.Office.Tools.Ribbon.RibbonGroup grp_Finishing; 353 | internal Microsoft.Office.Tools.Ribbon.RibbonButton btn_AcceptFormatting; 354 | internal Microsoft.Office.Tools.Ribbon.RibbonButton btn_WordFreq; 355 | internal Microsoft.Office.Tools.Ribbon.RibbonLabel lbl_Version; 356 | internal Microsoft.Office.Tools.Ribbon.RibbonButton btn_Help; 357 | internal Microsoft.Office.Tools.Ribbon.RibbonLabel lbl_Spacer1; 358 | internal Microsoft.Office.Tools.Ribbon.RibbonEditBox edit_MinPhraseLen; 359 | internal Microsoft.Office.Tools.Ribbon.RibbonButton btn_PhraseFrequency; 360 | internal Microsoft.Office.Tools.Ribbon.RibbonEditBox edit_MaxPhraseLen; 361 | internal Microsoft.Office.Tools.Ribbon.RibbonButton btn_LinkText; 362 | internal Microsoft.Office.Tools.Ribbon.RibbonGroup group2; 363 | internal Microsoft.Office.Tools.Ribbon.RibbonDropDown dd_Langs; 364 | internal Microsoft.Office.Tools.Ribbon.RibbonButton btn_FixLang; 365 | internal Microsoft.Office.Tools.Ribbon.RibbonLabel label1; 366 | internal Microsoft.Office.Tools.Ribbon.RibbonEditBox eb_AuthorName; 367 | internal Microsoft.Office.Tools.Ribbon.RibbonEditBox eb_AuthorInit; 368 | internal Microsoft.Office.Tools.Ribbon.RibbonButton btn_ChangeOwner; 369 | internal Microsoft.Office.Tools.Ribbon.RibbonButton btn_SingData; 370 | internal Microsoft.Office.Tools.Ribbon.RibbonGroup group5; 371 | internal Microsoft.Office.Tools.Ribbon.RibbonDropDown dd_Searches; 372 | internal Microsoft.Office.Tools.Ribbon.RibbonButton btn_ExecuteSearch; 373 | internal Microsoft.Office.Tools.Ribbon.RibbonButton btn_ManageSearches; 374 | internal Microsoft.Office.Tools.Ribbon.RibbonButton btn_ManageBoiler; 375 | } 376 | 377 | partial class ThisRibbonCollection 378 | { 379 | internal Ribbon1 Ribbon1 380 | { 381 | get { return this.GetRibbon(); } 382 | } 383 | } 384 | } 385 | -------------------------------------------------------------------------------- /EditTools/Ribbon1.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /EditTools/SettingsClasses.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Configuration; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Diagnostics; 6 | using Newtonsoft.Json; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | 12 | namespace EditTools 13 | { 14 | public class Search 15 | { 16 | public string Find { get; set; } 17 | public string Replace { get; set; } 18 | public bool Wildcards { get; set; } 19 | public bool CaseSensitive { get; set; } 20 | public bool ReplaceAll { get; set; } 21 | } 22 | 23 | [TypeConverter(typeof(SearchesConverter))] 24 | [SettingsSerializeAs(SettingsSerializeAs.String)] 25 | public class Searches 26 | { 27 | public Dictionary Dict {get; set;} 28 | public int Count { get { return this.Dict.Count; } } 29 | 30 | public Searches() 31 | { 32 | Dict = new Dictionary(); 33 | } 34 | } 35 | 36 | public class SearchesConverter : TypeConverter 37 | { 38 | public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) 39 | { 40 | return sourceType == typeof(string); 41 | } 42 | 43 | public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) 44 | { 45 | if (value is string) 46 | { 47 | Dictionary lst = JsonConvert.DeserializeObject>(value.ToString()); 48 | Searches searches = new Searches(); 49 | searches.Dict = lst; 50 | return searches; 51 | } 52 | return base.ConvertFrom(context, culture, value); 53 | } 54 | 55 | public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) 56 | { 57 | if (destinationType == typeof(string)) 58 | { 59 | string val = JsonConvert.SerializeObject(((Searches)value).Dict); 60 | Debug.WriteLine("Serializer says: " + val); 61 | return val; 62 | } 63 | return base.ConvertTo(context, culture, value, destinationType); 64 | } 65 | } 66 | 67 | public class Comment 68 | { 69 | public string Text { get; set; } 70 | } 71 | 72 | [TypeConverter(typeof(BoilerplateConverter))] 73 | [SettingsSerializeAs(SettingsSerializeAs.String)] 74 | public class Boilerplate 75 | { 76 | public Dictionary Dict { get; set; } 77 | public int Count { get { return this.Dict.Count; } } 78 | 79 | public Boilerplate() 80 | { 81 | Dict = new Dictionary(); 82 | } 83 | } 84 | 85 | public class BoilerplateConverter : TypeConverter 86 | { 87 | public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) 88 | { 89 | return sourceType == typeof(string); 90 | } 91 | 92 | public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) 93 | { 94 | if (value is string) 95 | { 96 | Dictionary lst = JsonConvert.DeserializeObject>(value.ToString()); 97 | Boilerplate bp = new Boilerplate(); 98 | bp.Dict = lst; 99 | return bp; 100 | } 101 | return base.ConvertFrom(context, culture, value); 102 | } 103 | 104 | public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) 105 | { 106 | if (destinationType == typeof(string)) 107 | { 108 | string val = JsonConvert.SerializeObject(((Boilerplate)value).Dict); 109 | Debug.WriteLine("Serializer says: " + val); 110 | return val; 111 | } 112 | return base.ConvertTo(context, culture, value, destinationType); 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /EditTools/SettingsDialog.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace EditTools 2 | { 3 | partial class SettingsDialog 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); 32 | this.textBox1 = new System.Windows.Forms.TextBox(); 33 | this.btn_Close = new System.Windows.Forms.Button(); 34 | this.label1 = new System.Windows.Forms.Label(); 35 | this.tableLayoutPanel1.SuspendLayout(); 36 | this.SuspendLayout(); 37 | // 38 | // tableLayoutPanel1 39 | // 40 | this.tableLayoutPanel1.AutoSize = true; 41 | this.tableLayoutPanel1.ColumnCount = 2; 42 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 35F)); 43 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 35F)); 44 | this.tableLayoutPanel1.Controls.Add(this.textBox1, 1, 0); 45 | this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); 46 | this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; 47 | this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); 48 | this.tableLayoutPanel1.Name = "tableLayoutPanel1"; 49 | this.tableLayoutPanel1.RowCount = 1; 50 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 91F)); 51 | this.tableLayoutPanel1.Size = new System.Drawing.Size(267, 53); 52 | this.tableLayoutPanel1.TabIndex = 0; 53 | // 54 | // textBox1 55 | // 56 | this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 57 | | System.Windows.Forms.AnchorStyles.Left) 58 | | System.Windows.Forms.AnchorStyles.Right))); 59 | this.textBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text", global::EditTools.Properties.Settings.Default, "mindist", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); 60 | this.textBox1.Location = new System.Drawing.Point(136, 3); 61 | this.textBox1.Name = "textBox1"; 62 | this.textBox1.Size = new System.Drawing.Size(128, 20); 63 | this.textBox1.TabIndex = 1; 64 | this.textBox1.Text = global::EditTools.Properties.Settings.Default.mindist; 65 | // 66 | // btn_Close 67 | // 68 | this.btn_Close.Dock = System.Windows.Forms.DockStyle.Bottom; 69 | this.btn_Close.Location = new System.Drawing.Point(0, 30); 70 | this.btn_Close.Name = "btn_Close"; 71 | this.btn_Close.Size = new System.Drawing.Size(267, 23); 72 | this.btn_Close.TabIndex = 1; 73 | this.btn_Close.Text = "Close"; 74 | this.btn_Close.UseVisualStyleBackColor = true; 75 | this.btn_Close.Click += new System.EventHandler(this.btn_Close_Click_1); 76 | // 77 | // label1 78 | // 79 | this.label1.AutoSize = true; 80 | this.label1.Dock = System.Windows.Forms.DockStyle.Fill; 81 | this.label1.Location = new System.Drawing.Point(3, 0); 82 | this.label1.Name = "label1"; 83 | this.label1.Padding = new System.Windows.Forms.Padding(0, 5, 0, 0); 84 | this.label1.Size = new System.Drawing.Size(127, 91); 85 | this.label1.TabIndex = 2; 86 | this.label1.Text = "Edit-Distance Sensitivity"; 87 | // 88 | // SettingsDialog 89 | // 90 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 91 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 92 | this.ClientSize = new System.Drawing.Size(267, 53); 93 | this.Controls.Add(this.btn_Close); 94 | this.Controls.Add(this.tableLayoutPanel1); 95 | this.Name = "SettingsDialog"; 96 | this.Text = "General Settings"; 97 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SettingsDialog_Closing); 98 | this.Load += new System.EventHandler(this.SettingsDialog_Load); 99 | this.tableLayoutPanel1.ResumeLayout(false); 100 | this.tableLayoutPanel1.PerformLayout(); 101 | this.ResumeLayout(false); 102 | this.PerformLayout(); 103 | 104 | } 105 | 106 | #endregion 107 | 108 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; 109 | private System.Windows.Forms.TextBox textBox1; 110 | private System.Windows.Forms.Button btn_Close; 111 | private System.Windows.Forms.Label label1; 112 | } 113 | } -------------------------------------------------------------------------------- /EditTools/SettingsDialog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.Specialized; 4 | using System.Windows.Forms; 5 | 6 | namespace EditTools 7 | { 8 | public partial class SettingsDialog : Form 9 | { 10 | BindingSource bs = new BindingSource(); 11 | 12 | public SettingsDialog() 13 | { 14 | InitializeComponent(); 15 | } 16 | 17 | private void SettingsDialog_Load(object sender, EventArgs e) 18 | { 19 | } 20 | 21 | private void SettingsDialog_Closing(object sender, FormClosingEventArgs e) 22 | { 23 | } 24 | 25 | private void btn_Close_Click_1(object sender, EventArgs e) 26 | { 27 | this.Close(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /EditTools/SettingsDialog.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /EditTools/ShortDoubleMetaphone.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * ShortDoubleMetaphone.cs 3 | * 4 | * An implemenatation of Lawrence Phillips' Double Metaphone phonetic matching 5 | * algorithm, published in C/C++ Users Journal, June, 2000. This implementation 6 | * implements Lawrence's proposed optimization, whereby four-character metaphone keys 7 | * are represented as four nibbles in an unsigned short. This dramatically improves 8 | * storage and search efficiency. 9 | * 10 | * This implementation was written by Adam J. Nelson (anelson@nullpointer.net). 11 | * It is based on the general C# implementation, also by Adam Nelson. 12 | * For the latest version of this implementation, implementations 13 | * in other languages, and links to articles I've written on the use of my various 14 | * Double Metaphone implementations, see: 15 | * http;//www.nullpointer.net/anelson/ 16 | * 17 | * Note that since this impl implements IComparable, it can be used to key associative containers, 18 | * thereby easily implementing phonetic matching within a simple container. Examples of this 19 | * should have been included in the archive from which you obtained this file. 20 | * 21 | * Current Version: 1.0.0 22 | * Revision History: 23 | * 1.0.0 - ajn - First release 24 | * 25 | * This implemenatation, and optimizations, Copyright (C) 2003, Adam J. Nelson 26 | * The Double Metaphone algorithm was written by Lawrence Phillips, and is 27 | * Copyright (c) 1998, 1999 by Lawrence Philips. 28 | */ 29 | using System; 30 | using System.Text; 31 | 32 | namespace EditTools 33 | { 34 | /// Subclass of DoubleMetaphone, Adam Nelson's (anelson@nullpointer.net) 35 | /// C# implementation of Lawrence Phillips' Double Metaphone algorithm, 36 | /// published in C/C++ Users Journal, June, 2000. 37 | /// 38 | /// This subclass implements Lawrence's suggested optimization, whereby 39 | /// four-letter metaphone keys are represented as four nibbles in an 40 | /// unsigned short. This greatly improves storage and search efficiency. 41 | public class ShortDoubleMetaphone : DoubleMetaphone 42 | { 43 | //Constants representing the characters in a metaphone key 44 | public const ushort METAPHONE_A = 0x01; 45 | public const ushort METAPHONE_F = 0x02; 46 | public const ushort METAPHONE_FX = ((METAPHONE_F << 4) | METAPHONE_X); 47 | public const ushort METAPHONE_H = 0x03; 48 | public const ushort METAPHONE_J = 0x04; 49 | public const ushort METAPHONE_K = 0x05; 50 | public const ushort METAPHONE_KL = ((METAPHONE_K << 4) | METAPHONE_L); 51 | public const ushort METAPHONE_KN = ((METAPHONE_K << 4) | METAPHONE_N); 52 | public const ushort METAPHONE_KS = ((METAPHONE_K << 4) | METAPHONE_S); 53 | public const ushort METAPHONE_L = 0x06; 54 | public const ushort METAPHONE_M = 0x07; 55 | public const ushort METAPHONE_N = 0x08; 56 | public const ushort METAPHONE_P = 0x09; 57 | public const ushort METAPHONE_S = 0x0A; 58 | public const ushort METAPHONE_SK = ((METAPHONE_S << 4) | METAPHONE_K); 59 | public const ushort METAPHONE_T = 0x0B; 60 | public const ushort METAPHONE_TK = ((METAPHONE_T << 4) | METAPHONE_K); 61 | public const ushort METAPHONE_TS = ((METAPHONE_T << 4) | METAPHONE_S); 62 | public const ushort METAPHONE_R = 0x0C; 63 | public const ushort METAPHONE_X = 0x0D; 64 | public const ushort METAPHONE_0 = 0x0E; 65 | public const ushort METAPHONE_SPACE = 0x0F; 66 | public const ushort METAPHONE_NULL = 0x00; 67 | 68 | /// Sentinel value, used to denote an invalid key 69 | public const ushort METAPHONE_INVALID_KEY = 0xffff; 70 | 71 | /// The ushort versions of the primary and alternate keys 72 | private ushort m_primaryShortKey, m_alternateShortKey; 73 | 74 | /// Default ctor, initializes to an empty string and 0 keys 75 | public ShortDoubleMetaphone() 76 | : base() 77 | { 78 | m_primaryShortKey = m_alternateShortKey = 0; 79 | } 80 | 81 | /// Initializes the base class with the given word, then computes 82 | /// ushort representations of the metaphone keys computed by the 83 | /// base class 84 | /// 85 | /// Word for which to compute metaphone keys 86 | public ShortDoubleMetaphone(String word) 87 | : base(word) 88 | { 89 | m_primaryShortKey = ShortDoubleMetaphone.metaphoneKeyToShort(this.PrimaryKey); 90 | if (this.AlternateKey != null) 91 | { 92 | m_alternateShortKey = ShortDoubleMetaphone.metaphoneKeyToShort(this.AlternateKey); 93 | } 94 | else 95 | { 96 | m_alternateShortKey = METAPHONE_INVALID_KEY; 97 | } 98 | } 99 | 100 | /// Sets a new current word, computing the string and ushort representations 101 | /// of the metaphone keys of the given word. 102 | /// 103 | /// Note that this uses the new modifier, which hides the base class 104 | /// computeKeys. The base class's computeKeys is then explicitly 105 | /// called as part of the function body. It is important to note that 106 | /// this is NOT equivalent to overriding a virtual function, in that 107 | /// polymorphism is not provided. In this case, polymorphism is of no 108 | /// value, while the potential efficiency gained by not using virtual 109 | /// methods is quite valuable. 110 | /// 111 | /// New current word for which to compute metaphone keys 112 | new public void computeKeys(String word) 113 | { 114 | base.computeKeys(word); 115 | 116 | m_primaryShortKey = ShortDoubleMetaphone.metaphoneKeyToShort(this.PrimaryKey); 117 | if (this.AlternateKey != null) 118 | { 119 | m_alternateShortKey = ShortDoubleMetaphone.metaphoneKeyToShort(this.AlternateKey); 120 | } 121 | else 122 | { 123 | m_alternateShortKey = METAPHONE_INVALID_KEY; 124 | } 125 | } 126 | 127 | /// The primary metaphone key, represented as a ushort 128 | public ushort PrimaryShortKey 129 | { 130 | get 131 | { 132 | return m_primaryShortKey; 133 | } 134 | } 135 | 136 | /// The alternative metaphone key, or METAPHONE_INVALID_KEY if the current 137 | /// word has no alternate key by double metaphone 138 | public ushort AlternateShortKey 139 | { 140 | get 141 | { 142 | return m_alternateShortKey; 143 | } 144 | } 145 | 146 | /// Represents a string metaphone key as a ushort 147 | /// 148 | /// String metaphone key. Must be four chars long; if you change 149 | /// METAPHONE_KEY_LENGTH in DoubleMetaphone, this will break. Length 150 | /// tests are not performed, for performance reasons. 151 | /// 152 | /// ushort representation of the given metahphone key 153 | static private ushort metaphoneKeyToShort(String metaphoneKey) 154 | { 155 | ushort result, charResult; 156 | Char currentChar; 157 | 158 | result = 0; 159 | 160 | for (int currentCharIdx = 0; currentCharIdx < metaphoneKey.Length; currentCharIdx++) 161 | { 162 | currentChar = metaphoneKey[currentCharIdx]; 163 | if (currentChar == 'A') 164 | charResult = METAPHONE_A; 165 | else if (currentChar == 'P') 166 | charResult = METAPHONE_P; 167 | else if (currentChar == 'S') 168 | charResult = METAPHONE_S; 169 | else if (currentChar == 'K') 170 | charResult = METAPHONE_K; 171 | else if (currentChar == 'X') 172 | charResult = METAPHONE_X; 173 | else if (currentChar == 'J') 174 | charResult = METAPHONE_J; 175 | else if (currentChar == 'T') 176 | charResult = METAPHONE_T; 177 | else if (currentChar == 'F') 178 | charResult = METAPHONE_F; 179 | else if (currentChar == 'N') 180 | charResult = METAPHONE_N; 181 | else if (currentChar == 'H') 182 | charResult = METAPHONE_H; 183 | else if (currentChar == 'M') 184 | charResult = METAPHONE_M; 185 | else if (currentChar == 'L') 186 | charResult = METAPHONE_L; 187 | else if (currentChar == 'R') 188 | charResult = METAPHONE_R; 189 | else if (currentChar == ' ') 190 | charResult = METAPHONE_SPACE; 191 | else if (currentChar == '\0') 192 | charResult = METAPHONE_0; 193 | else 194 | charResult = 0x00; //This should never happen 195 | 196 | result <<= 4; 197 | result |= charResult; 198 | }; 199 | return result; 200 | } 201 | } 202 | } 203 | -------------------------------------------------------------------------------- /EditTools/TextHelpers.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text.RegularExpressions; 5 | using Word = Microsoft.Office.Interop.Word; 6 | 7 | namespace EditTools 8 | { 9 | public static class TextHelpers 10 | { 11 | public struct compword 12 | { 13 | public string word; 14 | public ushort metaphone1; 15 | public ushort metaphone2; 16 | public int distance; 17 | } 18 | 19 | public static IEnumerable GetText(Word.Document doc) 20 | { 21 | foreach (Word.Paragraph para in doc.Paragraphs) 22 | { 23 | yield return para.Range; 24 | } 25 | 26 | foreach (Word.Footnote fn in doc.Footnotes) 27 | { 28 | yield return fn.Range; 29 | } 30 | 31 | foreach (Word.Endnote fn in doc.Endnotes) 32 | { 33 | yield return fn.Range; 34 | } 35 | 36 | yield break; 37 | } 38 | 39 | public static string StripPunctuation(string txt) 40 | { 41 | Regex re_fixquotes = new Regex(@"[\’\‘]"); 42 | string result = re_fixquotes.Replace(txt, "'"); 43 | 44 | Regex re_punc = new Regex(@"[^A-Za-z0-9\-\'\ ]"); 45 | result = re_punc.Replace(result, " "); 46 | 47 | Regex re_apos2bar = new Regex(@"(?<=[A-Za-z0-9])\'(?=[A-Za-z0-9])"); 48 | result = re_apos2bar.Replace(result, "|"); 49 | Regex re_stripapos = new Regex(@"\'"); 50 | result = re_stripapos.Replace(result, ""); 51 | Regex re_bar2apos = new Regex(@"\|"); 52 | result = re_bar2apos.Replace(result, "'"); 53 | 54 | return result; 55 | } 56 | 57 | public static int SingularData(string txt) 58 | { 59 | Regex re_pre = new Regex(@"(?i)this data"); 60 | Regex re_post = new Regex(@"(?i)data (is|was|has)"); 61 | int count = 0; 62 | count += re_pre.Matches(txt).Count; 63 | count += re_post.Matches(txt).Count; 64 | return count; 65 | } 66 | 67 | public static HashSet ToWords(string txt) 68 | { 69 | HashSet set = new HashSet(); 70 | string[] substrs = Regex.Split(txt, @"\s+"); 71 | foreach (string match in substrs) 72 | { 73 | set.Add(match); 74 | } 75 | return set; 76 | } 77 | 78 | public static HashSet RemoveNumbers(HashSet list) 79 | { 80 | HashSet result = new HashSet(); 81 | Regex re_allnums = new Regex(@"^\d+$"); 82 | foreach (string word in list) 83 | { 84 | Match m = re_allnums.Match(word); 85 | if (!m.Success) 86 | { 87 | result.Add(word); 88 | } 89 | } 90 | return result; 91 | } 92 | 93 | public static HashSet ProperNouns(string str) 94 | { 95 | Regex re_propers = new Regex(@"(? result = new HashSet(); 97 | str = ". " + str; 98 | 99 | foreach (Match m in re_propers.Matches(str)) 100 | { 101 | result.Add(m.ToString()); 102 | } 103 | 104 | return result; 105 | } 106 | 107 | public static HashSet KeepCaps(HashSet list) 108 | { 109 | HashSet capped = new HashSet(); 110 | Regex re_initCap = new Regex(@"^[A-Z]"); 111 | Regex re_allCap = new Regex(@"^[A-Z]+$"); 112 | 113 | foreach (string word in list) 114 | { 115 | Match match1 = re_initCap.Match(word); 116 | if (match1.Success) 117 | { 118 | Match match2 = re_allCap.Match(word); 119 | if (!match2.Success) 120 | { 121 | capped.Add(word); 122 | } 123 | } 124 | } 125 | 126 | return capped; 127 | } 128 | 129 | public static int EditDistance(string original, string modified) 130 | { 131 | if (original == modified) 132 | return 0; 133 | 134 | int len_orig = original.Length; 135 | int len_diff = modified.Length; 136 | 137 | if (len_orig == 0) 138 | return len_diff; 139 | 140 | if (len_diff == 0) 141 | return len_orig; 142 | 143 | var matrix = new int[len_orig + 1, len_diff + 1]; 144 | 145 | for (int i = 1; i <= len_orig; i++) 146 | { 147 | matrix[i, 0] = i; 148 | for (int j = 1; j <= len_diff; j++) 149 | { 150 | int cost = modified[j - 1] == original[i - 1] ? 0 : 1; 151 | if (i == 1) 152 | matrix[0, j] = j; 153 | 154 | var vals = new int[] { 155 | matrix[i - 1, j] + 1, 156 | matrix[i, j - 1] + 1, 157 | matrix[i - 1, j - 1] + cost 158 | }; 159 | matrix[i, j] = vals.Min(); 160 | if (i > 1 && j > 1 && original[i - 1] == modified[j - 2] && original[i - 2] == modified[j - 1]) 161 | matrix[i, j] = Math.Min(matrix[i, j], matrix[i - 2, j - 2] + cost); 162 | } 163 | } 164 | return matrix[len_orig, len_diff]; 165 | } 166 | 167 | public static void highlightText(Word.Range rng, string str, Word.WdColorIndex clr) 168 | { 169 | rng.Find.ClearFormatting(); 170 | rng.Find.Forward = true; 171 | rng.Find.Text = str; 172 | rng.Find.Execute(); 173 | while (rng.Find.Found) 174 | { 175 | rng.HighlightColorIndex = clr; 176 | rng.Find.Execute(); 177 | } 178 | } 179 | 180 | public static bool IsBalanced(string txt) 181 | { 182 | //BRACKETS FIRST 183 | 184 | Dictionary o2c = new Dictionary(); 185 | o2c.Add('(', ')'); 186 | o2c.Add('[', ']'); 187 | o2c.Add('{', '}'); 188 | Dictionary c2o = new Dictionary(); 189 | c2o.Add(')', '('); 190 | c2o.Add(']', '['); 191 | c2o.Add('}', '{'); 192 | 193 | //strip all non-tokens 194 | Regex re_nontoken = new Regex(@"[^\(\)\[\]\{\}]"); 195 | string result = re_nontoken.Replace(txt, ""); 196 | 197 | //process 198 | char[] tokens = result.ToCharArray(); 199 | Stack stack = new Stack(); 200 | foreach (char token in tokens) 201 | { 202 | //Is this an opener? 203 | if (o2c.ContainsKey(token)) 204 | { 205 | stack.Push(token); 206 | } 207 | else 208 | { 209 | //Is the matching token on top? 210 | if (stack.Peek() == c2o[token]) 211 | { 212 | stack.Pop(); 213 | } 214 | else 215 | { 216 | return false; 217 | } 218 | } 219 | } 220 | 221 | if (stack.Count > 0) 222 | { 223 | return false; 224 | } 225 | 226 | //SIMPLE QUOTE CHECK 227 | 228 | //singles 229 | //strip apostrophes 230 | Regex re_apos = new Regex(@"(?<=[A-Za-z0-9])[\'\‘\’](?=[A-Za-z0-9])"); 231 | result = re_apos.Replace(txt, ""); 232 | 233 | //strip nontokens 234 | Regex re_nonsingle = new Regex(@"[^\'\‘\’]"); 235 | result = re_nonsingle.Replace(result, ""); 236 | if (result.Length % 2 != 0) 237 | { 238 | return false; 239 | } 240 | 241 | //doubles 242 | //strip nontokens 243 | Regex re_nondouble = new Regex(@"[^""\“\”]"); 244 | result = re_nondouble.Replace(txt, ""); 245 | if (result.Length % 2 != 0) 246 | { 247 | return false; 248 | } 249 | 250 | return true; 251 | } 252 | } 253 | } 254 | -------------------------------------------------------------------------------- /EditTools/ThisAddIn.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | #pragma warning disable 414 12 | namespace EditTools { 13 | 14 | 15 | /// 16 | [Microsoft.VisualStudio.Tools.Applications.Runtime.StartupObjectAttribute(0)] 17 | [global::System.Security.Permissions.PermissionSetAttribute(global::System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")] 18 | public sealed partial class ThisAddIn : Microsoft.Office.Tools.AddInBase { 19 | 20 | internal Microsoft.Office.Tools.CustomTaskPaneCollection CustomTaskPanes; 21 | 22 | internal Microsoft.Office.Tools.SmartTagCollection VstoSmartTags; 23 | 24 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")] 25 | private global::System.Object missing = global::System.Type.Missing; 26 | 27 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")] 28 | internal Microsoft.Office.Interop.Word.Application Application; 29 | 30 | /// 31 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 32 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] 33 | public ThisAddIn(global::Microsoft.Office.Tools.Word.ApplicationFactory factory, global::System.IServiceProvider serviceProvider) : 34 | base(factory, serviceProvider, "AddIn", "ThisAddIn") { 35 | Globals.Factory = factory; 36 | } 37 | 38 | /// 39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 40 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")] 41 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] 42 | protected override void Initialize() { 43 | base.Initialize(); 44 | this.Application = this.GetHostItem(typeof(Microsoft.Office.Interop.Word.Application), "Application"); 45 | Globals.ThisAddIn = this; 46 | global::System.Windows.Forms.Application.EnableVisualStyles(); 47 | this.InitializeCachedData(); 48 | this.InitializeControls(); 49 | this.InitializeComponents(); 50 | this.InitializeData(); 51 | } 52 | 53 | /// 54 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 55 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")] 56 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] 57 | protected override void FinishInitialization() { 58 | this.InternalStartup(); 59 | this.OnStartup(); 60 | } 61 | 62 | /// 63 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 64 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")] 65 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] 66 | protected override void InitializeDataBindings() { 67 | this.BeginInitialization(); 68 | this.BindToData(); 69 | this.EndInitialization(); 70 | } 71 | 72 | /// 73 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 74 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")] 75 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] 76 | private void InitializeCachedData() { 77 | if ((this.DataHost == null)) { 78 | return; 79 | } 80 | if (this.DataHost.IsCacheInitialized) { 81 | this.DataHost.FillCachedData(this); 82 | } 83 | } 84 | 85 | /// 86 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 87 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")] 88 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] 89 | private void InitializeData() { 90 | } 91 | 92 | /// 93 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 94 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")] 95 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] 96 | private void BindToData() { 97 | } 98 | 99 | /// 100 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 101 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 102 | private void StartCaching(string MemberName) { 103 | this.DataHost.StartCaching(this, MemberName); 104 | } 105 | 106 | /// 107 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 108 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 109 | private void StopCaching(string MemberName) { 110 | this.DataHost.StopCaching(this, MemberName); 111 | } 112 | 113 | /// 114 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 115 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 116 | private bool IsCached(string MemberName) { 117 | return this.DataHost.IsCached(this, MemberName); 118 | } 119 | 120 | /// 121 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 122 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")] 123 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] 124 | private void BeginInitialization() { 125 | this.BeginInit(); 126 | this.CustomTaskPanes.BeginInit(); 127 | this.VstoSmartTags.BeginInit(); 128 | } 129 | 130 | /// 131 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 132 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")] 133 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] 134 | private void EndInitialization() { 135 | this.VstoSmartTags.EndInit(); 136 | this.CustomTaskPanes.EndInit(); 137 | this.EndInit(); 138 | } 139 | 140 | /// 141 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 142 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")] 143 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] 144 | private void InitializeControls() { 145 | this.CustomTaskPanes = Globals.Factory.CreateCustomTaskPaneCollection(null, null, "CustomTaskPanes", "CustomTaskPanes", this); 146 | this.VstoSmartTags = Globals.Factory.CreateSmartTagCollection(null, null, "VstoSmartTags", "VstoSmartTags", this); 147 | } 148 | 149 | /// 150 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 151 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")] 152 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] 153 | private void InitializeComponents() { 154 | } 155 | 156 | /// 157 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 158 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 159 | private bool NeedsFill(string MemberName) { 160 | return this.DataHost.NeedsFill(this, MemberName); 161 | } 162 | 163 | /// 164 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 165 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")] 166 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] 167 | protected override void OnShutdown() { 168 | this.VstoSmartTags.Dispose(); 169 | this.CustomTaskPanes.Dispose(); 170 | base.OnShutdown(); 171 | } 172 | } 173 | 174 | /// 175 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 176 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")] 177 | internal sealed partial class Globals { 178 | 179 | /// 180 | private Globals() { 181 | } 182 | 183 | private static ThisAddIn _ThisAddIn; 184 | 185 | private static global::Microsoft.Office.Tools.Word.ApplicationFactory _factory; 186 | 187 | private static ThisRibbonCollection _ThisRibbonCollection; 188 | 189 | internal static ThisAddIn ThisAddIn { 190 | get { 191 | return _ThisAddIn; 192 | } 193 | set { 194 | if ((_ThisAddIn == null)) { 195 | _ThisAddIn = value; 196 | } 197 | else { 198 | throw new System.NotSupportedException(); 199 | } 200 | } 201 | } 202 | 203 | internal static global::Microsoft.Office.Tools.Word.ApplicationFactory Factory { 204 | get { 205 | return _factory; 206 | } 207 | set { 208 | if ((_factory == null)) { 209 | _factory = value; 210 | } 211 | else { 212 | throw new System.NotSupportedException(); 213 | } 214 | } 215 | } 216 | 217 | internal static ThisRibbonCollection Ribbons { 218 | get { 219 | if ((_ThisRibbonCollection == null)) { 220 | _ThisRibbonCollection = new ThisRibbonCollection(_factory.GetRibbonFactory()); 221 | } 222 | return _ThisRibbonCollection; 223 | } 224 | } 225 | } 226 | 227 | /// 228 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 229 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")] 230 | internal sealed partial class ThisRibbonCollection : Microsoft.Office.Tools.Ribbon.RibbonCollectionBase { 231 | 232 | /// 233 | internal ThisRibbonCollection(global::Microsoft.Office.Tools.Ribbon.RibbonFactory factory) : 234 | base(factory) { 235 | } 236 | } 237 | } 238 | -------------------------------------------------------------------------------- /EditTools/ThisAddIn.Designer.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /EditTools/ThisAddIn.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Xml.Linq; 6 | using Word = Microsoft.Office.Interop.Word; 7 | using Office = Microsoft.Office.Core; 8 | using Microsoft.Office.Tools.Word; 9 | 10 | namespace EditTools 11 | { 12 | public partial class ThisAddIn 13 | { 14 | private void ThisAddIn_Startup(object sender, System.EventArgs e) 15 | { 16 | } 17 | 18 | private void ThisAddIn_Shutdown(object sender, System.EventArgs e) 19 | { 20 | } 21 | 22 | #region VSTO generated code 23 | 24 | /// 25 | /// Required method for Designer support - do not modify 26 | /// the contents of this method with the code editor. 27 | /// 28 | private void InternalStartup() 29 | { 30 | this.Startup += new System.EventHandler(ThisAddIn_Startup); 31 | this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown); 32 | } 33 | 34 | #endregion 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /EditTools/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 2 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | English (Canada) 21 | 22 | 23 | 3 24 | 25 | 26 | 6 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /EditTools/help.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Editing Tools Help 4 | 5 | 6 |

Editing Tools Help

7 |

8 | This is the help file for version 2.0.0 of the editing tools. 9 |

10 |

11 | For general information about this tool, or to download the latest version, visit the project's GitHub page. If you have suggestions for new tools, or if you are having problems using the tool, either file an issue on GitHub or feel free to email me directly. 12 |

13 |

14 | Remember that you can fully customize how the tools appear in your ribbon! Go to File > Options > Customize Ribbon. You can move sections around, hide tools you don't use, or even add elements to your quick bar. 15 |

16 |

17 | The various tools are grouped into six categories: 18 |

26 |

27 | 28 | 29 |

Settings

30 |

This is where you configure the the tool generally. There are three features:

31 |
    32 |
  • Version: This tells you what version of the tool you are running. Visit the "Releases" section of the GitHub page to download the latest version (or older versions, if you prefer).
  • 33 |
  • Help!: This opens the help file you're reading now.
  • 34 |
  • 35 | Settings: There's currently only one setting you can change: 36 |
      37 |
    • Edit-distance sensitivity: This is used by the "Check Proper Nouns" feature (see the "Proofing" section). The number represents the number of changes you have to make to one word to make it another word. The higher the number, the more false positives you'll get. Too low and you'll miss valid misspellings. A setting of "2" seems to me to be a good balance, but play around with it if you wish.
    • 38 |
    39 |
  • 40 |
41 | 42 | 43 |

Editing

44 |
    45 |
  • Apply Language: Applies the selected language to all the text in the body, headers, footers, and notes. It does not find text in text boxes. I don't know if finds text in frames.
  • 46 |
  • Change Comment Owner: This lets you change the name and initials of a comment owner. Only comments can be reassigned this way. Ownership of other revisions can only be done by altering the underlying XML files (very dangerous business). Either put your cursor in the comment you want to change or select the text containing the comments you wish to reasign. Then click the button. This can be undone (it takes two undos per comment changed).
  • 47 |
48 | 49 | 50 |

Proofing

51 |
    52 |
  • Word List: Creates a separate document containing all the unique words in the document. It retains capitalization. This is a great proofreading tool because it removes the meaning of the text and just gives you the individual words.
  • 53 |
  • Word Frequency List: Does the same as above but also counts the occurences of each word. It puts the list in a table, which for some reason is slow, so please be patient.
  • 54 |
  • Check Proper Nouns: This feature gets a lot of use in my day job. This tool generates a list of proper nouns (words that start with a capital letter and are not all-cap acronyms) and then does two comparisons: (1) a "sounds like" check and (2) an edit distance check (see the "Settings" section). If it finds groups of proper nouns that are spelled differently but either sound alike or are close in spelling, it will list them in a new document. This is an excellent way to find common typos in proper names that can easily be missed in a long document.
  • 55 |
  • Phrase Frequency List: Looks for phrases of the given lengths and produces a table listing each in frequency order. Good for finding overused phrases.
  • 56 |
57 | 58 | 59 |

Finishing

60 |

This is for tools you run at the end of an editing pass.

61 |
    62 |
  • Accept Formatting Changes: This lets you accept all tracked formatting changes with one click.
  • 63 |
  • Link Text: I work sometimes on large documents where multiple instances of a document name is to be hyperlinked to the same destination. This tool lets you add, remove, or change a hyperlink on a specific string of characters, regardless of formatting.
  • 64 |
65 | 66 | 67 |

Boilerplate

68 |

For me this is the second-most-used feature, next only to "Check Proper Nouns." If you find yourself typing similar comments over and over again, then this can save you tons of time.

69 |
    70 |
  • Apply Comment: First select the text you want to comment on. Then select the short name of the comment you wish to insert. Then click the "Apply Comment" button. A new comment will be inserted containing the boilerplate. Edit as you will.
  • 71 |
  • 72 | Manage Boilerplate: This opens a new screen where you can manage your saved comments. 73 |
      74 |
    • To add a new comment, just start typing in the blank row at the bottom of the list.
    • 75 |
    • To edit an existing comment, just click inside it and start editing.
    • 76 |
    • To delete a comment, click in the small cell on the far left of the row so that the entire row is highlighted. Hit your Delete key.
    • 77 |
    78 |
  • 79 |
  • Import/Export: Use these buttons to back up or share your boilerplate.
  • 80 |
81 | 82 | 83 |

Saved Searches

84 |

If you find yourself doing the same search over and over again, or just don't want to keep looking up that weird wildcard search everytime you need it, this feature could help.

85 |
    86 |
  • Execute Search: Simply select the saved search from the drop-down menu then click this button to execute it. It's not as full featured as the built-in Advanced Find dialog, but it's sufficient for most searches. If it doesn't work for a particular use case, let me know and I'll see what I can do.
  • 87 |
  • 88 | Manage Searches: This opens a new screen where you can manage your saved searcjes. 89 |
      90 |
    • To add a new search, just start typing in the blank row at the bottom of the list.
    • 91 |
    • To edit an existing search, just click inside it and start editing.
    • 92 |
    • To delete a search, click in the small cell on the far left of the row so that the entire row is highlighted. Hit your Delete key.
    • 93 |
    94 |
  • 95 |
  • Import/Export: Use these buttons to back up or share your saved searches.
  • 96 |
97 | 98 | 99 | -------------------------------------------------------------------------------- /EditTools/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /EditingTools.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26430.15 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EditingTools", "EditTools\EditingTools.csproj", "{FFD516B4-0FAA-4609-A454-755FA36DFAB4}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {FFD516B4-0FAA-4609-A454-755FA36DFAB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {FFD516B4-0FAA-4609-A454-755FA36DFAB4}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {FFD516B4-0FAA-4609-A454-755FA36DFAB4}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {FFD516B4-0FAA-4609-A454-755FA36DFAB4}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # editing-tools 2 | 3 | ![Screen Capture](screen-capture.png) 4 | 5 | These are just a couple tools I coded for use where I work. Details can be found in [it's help file](https://htmlpreview.github.io/?https://github.com/Perlkonig/editing-tools/blob/master/EditTools/help.html). To install, go to [the Releases page](https://github.com/Perlkonig/editing-tools/releases) and download and run the EXE file from the latest release. To update to a new version, uninstall the existing version first (all your settings will be saved). 6 | 7 | If you have suggestions for new tools, or if you have any questions, let me know. 8 | 9 | ## "Real" Editing Tools 10 | 11 | Do *not* confuse this with the most excellent ["Edit Tools" by wordsnSync](http://www.wordsnsync.com/). Also check out [PerfectIt](http://www.intelligentediting.com/) and [the Editorium](http://www.editorium.com/). If you're looking for macros instead of plugins, check out [Paul Beverly's excellent book of macros](http://www.archivepub.co.uk/book.html). 12 | 13 | ## Disclaimers 14 | 15 | I can't guarantee that this code will work in your version of Visual Studio or Word. Microsoft does not make that sort of maintainability easy! 16 | 17 | I'm just sharing this because a couple people asked for the code. If you find it useful, great! 18 | 19 | If you just want to see the algorithms, then you'll be most interested in the files `Ribbon1.cs` (which contains the code that runs when you click a ribbon button and describes the overall algorithms) and `TextHelpers.cs` (which contains all the little helper functions that make writing the algorithms easier). 20 | 21 | Good luck! 22 | 23 | ## Licence 24 | 25 | Released under the MIT license except where noted (the metaphone code). 26 | 27 | Copyright (c) 2016 Aaron Dalton 28 | 29 | Permission is hereby granted, free of charge, to any person obtaining a copy 30 | of this software and associated documentation files (the "Software"), to deal 31 | in the Software without restriction, including without limitation the rights 32 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 33 | copies of the Software, and to permit persons to whom the Software is 34 | furnished to do so, subject to the following conditions: 35 | 36 | The above copyright notice and this permission notice shall be included in all 37 | copies or substantial portions of the Software. 38 | 39 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 40 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 41 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 42 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 43 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 44 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 45 | SOFTWARE. 46 | -------------------------------------------------------------------------------- /deploy/helpfile/help.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Editing Tools Help 4 | 5 | 6 |

Editing Tools Help

7 |

8 | This is the help file for version 2.0.0 of the editing tools. 9 |

10 |

11 | For general information about this tool, or to download the latest version, visit the project's GitHub page. If you have suggestions for new tools, or if you are having problems using the tool, either file an issue on GitHub or feel free to email me directly. 12 |

13 |

14 | Remember that you can fully customize how the tools appear in your ribbon! Go to File > Options > Customize Ribbon. You can move sections around, hide tools you don't use, or even add elements to your quick bar. 15 |

16 |

17 | The various tools are grouped into six categories: 18 |

26 |

27 | 28 | 29 |

Settings

30 |

This is where you configure the the tool generally. There are three features:

31 |
    32 |
  • Version: This tells you what version of the tool you are running. Visit the "Releases" section of the GitHub page to download the latest version (or older versions, if you prefer).
  • 33 |
  • Help!: This opens the help file you're reading now.
  • 34 |
  • 35 | Settings: There's currently only one setting you can change: 36 |
      37 |
    • Edit-distance sensitivity: This is used by the "Check Proper Nouns" feature (see the "Proofing" section). The number represents the number of changes you have to make to one word to make it another word. The higher the number, the more false positives you'll get. Too low and you'll miss valid misspellings. A setting of "2" seems to me to be a good balance, but play around with it if you wish.
    • 38 |
    39 |
  • 40 |
41 | 42 | 43 |

Editing

44 |
    45 |
  • Apply Language: Applies the selected language to all the text in the body, headers, footers, and notes. It does not find text in text boxes. I don't know if finds text in frames.
  • 46 |
  • Change Comment Owner: This lets you change the name and initials of a comment owner. Only comments can be reassigned this way. Ownership of other revisions can only be done by altering the underlying XML files (very dangerous business). Either put your cursor in the comment you want to change or select the text containing the comments you wish to reasign. Then click the button. This can be undone (it takes two undos per comment changed).
  • 47 |
48 | 49 | 50 |

Proofing

51 |
    52 |
  • Word List: Creates a separate document containing all the unique words in the document. It retains capitalization. This is a great proofreading tool because it removes the meaning of the text and just gives you the individual words.
  • 53 |
  • Word Frequency List: Does the same as above but also counts the occurences of each word. It puts the list in a table, which for some reason is slow, so please be patient.
  • 54 |
  • Check Proper Nouns: This feature gets a lot of use in my day job. This tool generates a list of proper nouns (words that start with a capital letter and are not all-cap acronyms) and then does two comparisons: (1) a "sounds like" check and (2) an edit distance check (see the "Settings" section). If it finds groups of proper nouns that are spelled differently but either sound alike or are close in spelling, it will list them in a new document. This is an excellent way to find common typos in proper names that can easily be missed in a long document.
  • 55 |
  • Phrase Frequency List: Looks for phrases of the given lengths and produces a table listing each in frequency order. Good for finding overused phrases.
  • 56 |
57 | 58 | 59 |

Finishing

60 |

This is for tools you run at the end of an editing pass.

61 |
    62 |
  • Accept Formatting Changes: This lets you accept all tracked formatting changes with one click.
  • 63 |
  • Link Text: I work sometimes on large documents where multiple instances of a document name is to be hyperlinked to the same destination. This tool lets you add, remove, or change a hyperlink on a specific string of characters, regardless of formatting.
  • 64 |
65 | 66 | 67 |

Boilerplate

68 |

For me this is the second-most-used feature, next only to "Check Proper Nouns." If you find yourself typing similar comments over and over again, then this can save you tons of time.

69 |
    70 |
  • Apply Comment: First select the text you want to comment on. Then select the short name of the comment you wish to insert. Then click the "Apply Comment" button. A new comment will be inserted containing the boilerplate. Edit as you will.
  • 71 |
  • 72 | Manage Boilerplate: This opens a new screen where you can manage your saved comments. 73 |
      74 |
    • To add a new comment, just start typing in the blank row at the bottom of the list.
    • 75 |
    • To edit an existing comment, just click inside it and start editing.
    • 76 |
    • To delete a comment, click in the small cell on the far left of the row so that the entire row is highlighted. Hit your Delete key.
    • 77 |
    78 |
  • 79 |
  • Import/Export: Use these buttons to back up or share your boilerplate.
  • 80 |
81 | 82 | 83 |

Saved Searches

84 |

If you find yourself doing the same search over and over again, or just don't want to keep looking up that weird wildcard search everytime you need it, this feature could help.

85 |
    86 |
  • Execute Search: Simply select the saved search from the drop-down menu then click this button to execute it. It's not as full featured as the built-in Advanced Find dialog, but it's sufficient for most searches. If it doesn't work for a particular use case, let me know and I'll see what I can do.
  • 87 |
  • 88 | Manage Searches: This opens a new screen where you can manage your saved searcjes. 89 |
      90 |
    • To add a new search, just start typing in the blank row at the bottom of the list.
    • 91 |
    • To edit an existing search, just click inside it and start editing.
    • 92 |
    • To delete a search, click in the small cell on the far left of the row so that the entire row is highlighted. Hit your Delete key.
    • 93 |
    94 |
  • 95 |
  • Import/Export: Use these buttons to back up or share your saved searches.
  • 96 |
97 | 98 | 99 | -------------------------------------------------------------------------------- /deploy/make-installer.iss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Perlkonig/editing-tools/8d2c9ad1c5f9f3c277bb708228ab3bd71f0ac7e4/deploy/make-installer.iss -------------------------------------------------------------------------------- /screen-capture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Perlkonig/editing-tools/8d2c9ad1c5f9f3c277bb708228ab3bd71f0ac7e4/screen-capture.png --------------------------------------------------------------------------------