├── demo
├── Demo.TextEditor
│ ├── NOTE03.ICO
│ ├── AssemblyInfo.cs
│ ├── Documents
│ │ ├── demo.txt
│ │ ├── demo.xml
│ │ ├── demo.html
│ │ └── demo.rtf
│ ├── TextEditor.sln
│ ├── app.config
│ └── TextEditor.csproj
├── Demo.WinForm.CSharp
│ ├── App.ico
│ ├── app.config
│ ├── Demo.WinForm.Csharp.sln
│ ├── AssemblyInfo.cs
│ ├── Demo.WinForm.Csharp.csproj
│ └── DemoForm.cs
├── Demo.Web.HtmlEditor
│ ├── images
│ │ ├── bold.gif
│ │ ├── copy.gif
│ │ ├── cut.gif
│ │ ├── redo.gif
│ │ ├── undo.gif
│ │ ├── indent.gif
│ │ ├── italic.gif
│ │ ├── paste.gif
│ │ ├── unlink.gif
│ │ ├── bullets.gif
│ │ ├── outdent.gif
│ │ ├── subscript.gif
│ │ ├── underline.gif
│ │ ├── createlink.gif
│ │ ├── insertimage.gif
│ │ ├── insertrule.gif
│ │ ├── justifyfull.gif
│ │ ├── justifyleft.gif
│ │ ├── spellcheck.gif
│ │ ├── superscript.gif
│ │ ├── justifycenter.gif
│ │ ├── justifyright.gif
│ │ ├── numberedlist.gif
│ │ ├── removeformat.gif
│ │ └── strikethrough.gif
│ ├── spell.css
│ ├── HtmlEditor.css
│ └── spell.js
├── Demo.WinForm.VBnet
│ ├── app.config
│ ├── Demo.WinForm.VBnet.sln
│ ├── AssemblyInfo.vb
│ ├── Demo.WinForm.VBnet.vbproj
│ └── DemoForm.vb
├── Demo.Web.CSharp
│ ├── spell.css
│ ├── default.htm
│ └── spell.js
├── Demo.Web.VBnet
│ ├── spell.css
│ ├── default.htm
│ └── spell.js
└── Demo.Web.FreeTextBox
│ ├── spell.css
│ ├── web.config
│ ├── default.aspx
│ └── spell.js
├── src
├── NetSpell.SpellChecker
│ ├── Spell.snk
│ ├── Spelling.bmp
│ ├── AssemblyInfo.cs
│ ├── Interactive.bmp
│ ├── Dictionary
│ │ ├── Dictionary.bmp
│ │ ├── Affix
│ │ │ ├── AffixRule.cs
│ │ │ ├── AffixEntry.cs
│ │ │ ├── AffixEntryEnumerator.cs
│ │ │ ├── AffixRuleEnumerator.cs
│ │ │ └── AffixEntryCollection.cs
│ │ ├── WordDictionary.resx
│ │ ├── Phonetic
│ │ │ ├── PhoneticRuleEnumerator.cs
│ │ │ ├── PhoneticRule.cs
│ │ │ ├── PhoneticUtility.cs
│ │ │ └── PhoneticRuleCollection.cs
│ │ └── Word.cs
│ ├── Controls
│ │ ├── CheckAsYouTypeState.cs
│ │ ├── NativeMethods.cs
│ │ ├── CheckAsYouType.resx
│ │ ├── SpellTextBox.resx
│ │ ├── SpellRichTextBox.cs
│ │ └── CheckAsYouType.cs
│ ├── ReplaceWordEventArgs.cs
│ ├── SpellingEventArgs.cs
│ ├── Spelling.resx
│ └── TraceWriter.cs
├── NetSpell.WinForm.Test
│ ├── App.ico
│ ├── app.config
│ ├── AssemblyInfo.cs
│ ├── NetSpell.WinForm.Test.csproj
│ └── DemoForm.cs
├── NetSpell.DictionaryBuild
│ ├── BOOK01A.ICO
│ ├── AssemblyInfo.cs
│ ├── app.config
│ └── NetSpell.DictionaryBuild.csproj
├── NetSpell.nunit
├── NetSpell.Tests
│ ├── Data
│ │ └── ValidWords.txt
│ ├── AssemblyInfo.cs
│ ├── PerformanceTimer.cs
│ ├── PerformanceTest.cs
│ ├── DictionaryTest.cs
│ └── NetSpell.Tests.csproj
├── NetSpell.Setup
│ ├── NetSpell.Setup.sln
│ └── InstallerActions
│ │ ├── VirtualDirectoryInstaller.resx
│ │ ├── AssemblyInfo.cs
│ │ └── InstallerActions.csproj
├── NetSpell.sln
└── NetSpell.build
├── LICENSE
├── .gitattributes
├── README.md
└── .gitignore
/demo/Demo.TextEditor/NOTE03.ICO:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.TextEditor/NOTE03.ICO
--------------------------------------------------------------------------------
/demo/Demo.WinForm.CSharp/App.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.WinForm.CSharp/App.ico
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/Spell.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/src/NetSpell.SpellChecker/Spell.snk
--------------------------------------------------------------------------------
/src/NetSpell.WinForm.Test/App.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/src/NetSpell.WinForm.Test/App.ico
--------------------------------------------------------------------------------
/demo/Demo.TextEditor/AssemblyInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.TextEditor/AssemblyInfo.cs
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/bold.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/bold.gif
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/copy.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/copy.gif
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/cut.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/cut.gif
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/redo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/redo.gif
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/undo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/undo.gif
--------------------------------------------------------------------------------
/src/NetSpell.DictionaryBuild/BOOK01A.ICO:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/src/NetSpell.DictionaryBuild/BOOK01A.ICO
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/Spelling.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/src/NetSpell.SpellChecker/Spelling.bmp
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/indent.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/indent.gif
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/italic.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/italic.gif
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/paste.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/paste.gif
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/unlink.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/unlink.gif
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/AssemblyInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/src/NetSpell.SpellChecker/AssemblyInfo.cs
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/Interactive.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/src/NetSpell.SpellChecker/Interactive.bmp
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/bullets.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/bullets.gif
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/outdent.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/outdent.gif
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/subscript.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/subscript.gif
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/underline.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/underline.gif
--------------------------------------------------------------------------------
/src/NetSpell.DictionaryBuild/AssemblyInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/src/NetSpell.DictionaryBuild/AssemblyInfo.cs
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/createlink.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/createlink.gif
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/insertimage.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/insertimage.gif
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/insertrule.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/insertrule.gif
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/justifyfull.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/justifyfull.gif
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/justifyleft.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/justifyleft.gif
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/spellcheck.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/spellcheck.gif
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/superscript.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/superscript.gif
--------------------------------------------------------------------------------
/demo/Demo.TextEditor/Documents/demo.txt:
--------------------------------------------------------------------------------
1 | Becuase people are realy bad spelers, ths produc was desinged to prevent speling erors in a text area like ths.
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/justifycenter.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/justifycenter.gif
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/justifyright.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/justifyright.gif
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/numberedlist.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/numberedlist.gif
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/removeformat.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/removeformat.gif
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/images/strikethrough.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/demo/Demo.Web.HtmlEditor/images/strikethrough.gif
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/Dictionary/Dictionary.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loresoft/NetSpell/HEAD/src/NetSpell.SpellChecker/Dictionary/Dictionary.bmp
--------------------------------------------------------------------------------
/demo/Demo.WinForm.VBnet/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/NetSpell.DictionaryBuild/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/demo/Demo.WinForm.CSharp/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/NetSpell.WinForm.Test/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/demo/Demo.TextEditor/Documents/demo.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | People are realy bad spelers.
4 | ths produc was desinged to prevent speling erors in a text area like ths.
5 |
6 |
--------------------------------------------------------------------------------
/src/NetSpell.nunit:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/demo/Demo.Web.CSharp/spell.css:
--------------------------------------------------------------------------------
1 | body, a, input, option, select, table, tr, td
2 | {
3 | font-family: arial;
4 | font-size: 10pt;
5 | }
6 | body {
7 | background-color: #c3daf9;
8 | }
9 |
10 | input.suggestion, select.suggestion, select.suggestion option
11 | {
12 | width: 230px;
13 | }
14 |
15 | input.button
16 | {
17 | width: 100px;
18 | cursor: hand;
19 | }
20 | td.highlight
21 | {
22 | background-color: #DADADA;
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/demo/Demo.Web.VBnet/spell.css:
--------------------------------------------------------------------------------
1 | body, a, input, option, select, table, tr, td
2 | {
3 | font-family: arial;
4 | font-size: 10pt;
5 | }
6 | body {
7 | background-color: #c3daf9;
8 | }
9 |
10 | input.suggestion, select.suggestion, select.suggestion option
11 | {
12 | width: 230px;
13 | }
14 |
15 | input.button
16 | {
17 | width: 100px;
18 | cursor: hand;
19 | }
20 | td.highlight
21 | {
22 | background-color: #DADADA;
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/demo/Demo.Web.FreeTextBox/spell.css:
--------------------------------------------------------------------------------
1 | body, a, input, option, select, table, tr, td
2 | {
3 | font-family: arial;
4 | font-size: 10pt;
5 | }
6 | body {
7 | background-color: #c3daf9;
8 | }
9 |
10 | input.suggestion, select.suggestion, select.suggestion option
11 | {
12 | width: 230px;
13 | }
14 |
15 | input.button
16 | {
17 | width: 100px;
18 | cursor: hand;
19 | }
20 | td.highlight
21 | {
22 | background-color: #DADADA;
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/spell.css:
--------------------------------------------------------------------------------
1 | body, a, input, option, select, table, tr, td
2 | {
3 | font-family: arial;
4 | font-size: 10pt;
5 | }
6 | body {
7 | background-color: #c3daf9;
8 | }
9 |
10 | input.suggestion, select.suggestion, select.suggestion option
11 | {
12 | width: 230px;
13 | }
14 |
15 | input.button
16 | {
17 | width: 100px;
18 | cursor: hand;
19 | }
20 | td.highlight
21 | {
22 | background-color: #DADADA;
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/demo/Demo.TextEditor/Documents/demo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | NetSpell Html Tst
4 |
5 |
6 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/demo/Demo.Web.FreeTextBox/web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/Controls/CheckAsYouTypeState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace NetSpell.SpellChecker.Controls
5 | {
6 | ///
7 | /// Summary description for CheckAsYouTypeState.
8 | ///
9 | public class CheckAsYouTypeState
10 | {
11 | private TextBoxBase _textBoxBaseInstance;
12 |
13 | public CheckAsYouTypeState(TextBoxBase textBoxBaseInstance)
14 | {
15 | _textBoxBaseInstance = textBoxBaseInstance;
16 | }
17 |
18 | public TextBoxBase TextBoxBaseInstance
19 | {
20 | get { return _textBoxBaseInstance; }
21 | set { _textBoxBaseInstance = value; }
22 | }
23 |
24 |
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/ReplaceWordEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NetSpell.SpellChecker
4 | {
5 | ///
6 | /// Summary description for ReplaceWordEventArgs.
7 | ///
8 | public class ReplaceWordEventArgs : SpellingEventArgs
9 | {
10 | private string _ReplacementWord;
11 |
12 | ///
13 | /// Class sent to the event handler when the ReplacedWord Event is fired
14 | ///
15 | public ReplaceWordEventArgs(string replacementWord, string word, int wordIndex, int textIndex) : base (word, wordIndex, textIndex)
16 | {
17 | _ReplacementWord = replacementWord;
18 | }
19 |
20 | ///
21 | /// The word to use in replacing the misspelled word
22 | ///
23 | public string ReplacementWord
24 | {
25 | get {return _ReplacementWord;}
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/demo/Demo.TextEditor/TextEditor.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 8.00
2 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TextEditor", "TextEditor.csproj", "{6462AA1F-4132-4CB5-941C-C342C79B8433}"
3 | ProjectSection(ProjectDependencies) = postProject
4 | EndProjectSection
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfiguration) = preSolution
8 | Debug = Debug
9 | Release = Release
10 | EndGlobalSection
11 | GlobalSection(ProjectConfiguration) = postSolution
12 | {6462AA1F-4132-4CB5-941C-C342C79B8433}.Debug.ActiveCfg = Debug|.NET
13 | {6462AA1F-4132-4CB5-941C-C342C79B8433}.Debug.Build.0 = Debug|.NET
14 | {6462AA1F-4132-4CB5-941C-C342C79B8433}.Release.ActiveCfg = Release|.NET
15 | {6462AA1F-4132-4CB5-941C-C342C79B8433}.Release.Build.0 = Release|.NET
16 | EndGlobalSection
17 | GlobalSection(ExtensibilityGlobals) = postSolution
18 | EndGlobalSection
19 | GlobalSection(ExtensibilityAddIns) = postSolution
20 | EndGlobalSection
21 | EndGlobal
22 |
--------------------------------------------------------------------------------
/demo/Demo.WinForm.VBnet/Demo.WinForm.VBnet.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 8.00
2 | Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Demo.WinForm.VBnet", "Demo.WinForm.VBnet.vbproj", "{EFB9B355-EC39-47D9-BC48-D613F9D76384}"
3 | ProjectSection(ProjectDependencies) = postProject
4 | EndProjectSection
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfiguration) = preSolution
8 | Debug = Debug
9 | Release = Release
10 | EndGlobalSection
11 | GlobalSection(ProjectConfiguration) = postSolution
12 | {EFB9B355-EC39-47D9-BC48-D613F9D76384}.Debug.ActiveCfg = Debug|.NET
13 | {EFB9B355-EC39-47D9-BC48-D613F9D76384}.Debug.Build.0 = Debug|.NET
14 | {EFB9B355-EC39-47D9-BC48-D613F9D76384}.Release.ActiveCfg = Release|.NET
15 | {EFB9B355-EC39-47D9-BC48-D613F9D76384}.Release.Build.0 = Release|.NET
16 | EndGlobalSection
17 | GlobalSection(ExtensibilityGlobals) = postSolution
18 | EndGlobalSection
19 | GlobalSection(ExtensibilityAddIns) = postSolution
20 | EndGlobalSection
21 | EndGlobal
22 |
--------------------------------------------------------------------------------
/demo/Demo.WinForm.CSharp/Demo.WinForm.Csharp.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 8.00
2 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo.WinForm.Csharp", "Demo.WinForm.Csharp.csproj", "{953B172F-6026-494E-BD97-111374606CFD}"
3 | ProjectSection(ProjectDependencies) = postProject
4 | EndProjectSection
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfiguration) = preSolution
8 | Debug = Debug
9 | Release = Release
10 | EndGlobalSection
11 | GlobalSection(ProjectConfiguration) = postSolution
12 | {953B172F-6026-494E-BD97-111374606CFD}.Debug.ActiveCfg = Debug|.NET
13 | {953B172F-6026-494E-BD97-111374606CFD}.Debug.Build.0 = Debug|.NET
14 | {953B172F-6026-494E-BD97-111374606CFD}.Release.ActiveCfg = Release|.NET
15 | {953B172F-6026-494E-BD97-111374606CFD}.Release.Build.0 = Release|.NET
16 | EndGlobalSection
17 | GlobalSection(ExtensibilityGlobals) = postSolution
18 | EndGlobalSection
19 | GlobalSection(ExtensibilityAddIns) = postSolution
20 | EndGlobalSection
21 | EndGlobal
22 |
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/Controls/NativeMethods.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace NetSpell.SpellChecker.Controls
5 | {
6 | ///
7 | /// Summary description for NativeMethods.
8 | ///
9 | internal sealed class NativeMethods
10 | {
11 |
12 | private NativeMethods()
13 | {
14 | }
15 |
16 | // Windows Messages
17 | internal const int WM_SETREDRAW = 0x000B;
18 |
19 | internal const int WM_PAINT = 0x000F;
20 | internal const int WM_ERASEBKGND = 0x0014;
21 |
22 | internal const int WM_NOTIFY = 0x004E;
23 |
24 | internal const int WM_HSCROLL = 0x0114;
25 | internal const int WM_VSCROLL = 0x0115;
26 |
27 | internal const int WM_CAPTURECHANGED = 0x0215;
28 |
29 | internal const int WM_USER = 0x0400;
30 |
31 | // Win API declaration
32 | [DllImport("user32.dll", EntryPoint="SendMessage", CharSet=CharSet.Auto)]
33 | internal static extern int SendMessage(IntPtr hWnd, int msg, int wParam, int lParam);
34 |
35 |
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/NetSpell.Tests/Data/ValidWords.txt:
--------------------------------------------------------------------------------
1 | abbreviated
2 | reabbreviated
3 | unabbreviated
4 | ability
5 | abilities
6 | ability's
7 | inabilities
8 | disabilities
9 | inability's
10 | disability's
11 | inability
12 | disability
13 | nominate
14 | nomination
15 | nominations
16 | nominating
17 | nominated
18 | nominates
19 | renomination
20 | denomination
21 | renominations
22 | denominations
23 | renominating
24 | denominating
25 | renominated
26 | denominated
27 | renominates
28 | denominates
29 | renominate
30 | denominate
31 | noun
32 | nouns
33 | noun's
34 | pronouns
35 | pronoun's
36 | pronoun
37 | object
38 | objective
39 | objecting
40 | objected
41 | objects
42 | object's
43 | outgrow
44 | outgrowth
45 | outgrowing
46 | outgrows
47 | outlandish
48 | outlandishly
49 | outlandishness
50 | publish
51 | publishing
52 | publishings
53 | published
54 | publisher
55 | publishers
56 | publishes
57 | publishable
58 | sightly
59 | sightliest
60 | sightlier
61 | sightliness
62 | unsightlier
63 | unsightliness
64 | unsightly
65 | supple
66 | supplely
67 | supples
68 | suppleness
69 | supplement
70 | triteness
71 | tritenesses
72 |
73 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 LoreSoft
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/demo/Demo.WinForm.VBnet/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Reflection
3 | Imports System.Runtime.InteropServices
4 |
5 | ' General Information about an assembly is controlled through the following
6 | ' set of attributes. Change these attribute values to modify the information
7 | ' associated with an assembly.
8 |
9 | ' Review the values of the assembly attributes
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | 'The following GUID is for the ID of the typelib if this project is exposed to COM
20 |
21 |
22 | ' Version information for an assembly consists of the following four values:
23 | '
24 | ' Major Version
25 | ' Minor Version
26 | ' Build Number
27 | ' Revision
28 | '
29 | ' You can specify all the values or you can default the Build and Revision Numbers
30 | ' by using the '*' as shown below:
31 |
32 |
33 |
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/SpellingEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NetSpell.SpellChecker
4 | {
5 | ///
6 | /// Class sent to the event handler when the DoubleWord or
7 | /// MisspelledWord event occurs
8 | ///
9 | public class SpellingEventArgs : EventArgs
10 | {
11 | private int _TextIndex;
12 | private string _Word;
13 | private int _WordIndex;
14 |
15 | ///
16 | /// Constructor used to pass in properties
17 | ///
18 | public SpellingEventArgs(string word, int wordIndex, int textIndex)
19 | {
20 | _Word = word;
21 | _WordIndex = wordIndex;
22 | _TextIndex = textIndex;
23 | }
24 |
25 | ///
26 | /// Text index of the WordEvent
27 | ///
28 | public int TextIndex
29 | {
30 | get {return _TextIndex;}
31 | }
32 |
33 | ///
34 | /// Word that caused the WordEvent
35 | ///
36 | public string Word
37 | {
38 | get {return _Word;}
39 | }
40 |
41 | ///
42 | /// Word index of the WordEvent
43 | ///
44 | public int WordIndex
45 | {
46 | get {return _WordIndex;}
47 | }
48 |
49 | } // Class SpellingEventArgs
50 | }
51 |
--------------------------------------------------------------------------------
/demo/Demo.TextEditor/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/Dictionary/Affix/AffixRule.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Text.RegularExpressions;
4 |
5 | namespace NetSpell.SpellChecker.Dictionary.Affix
6 | {
7 | ///
8 | /// Rule for expanding base words
9 | ///
10 | public class AffixRule
11 | {
12 | private bool _AllowCombine = false;
13 | private AffixEntryCollection _AffixEntries = new AffixEntryCollection();
14 | private string _Name = "";
15 |
16 | ///
17 | /// Initializes a new instance of the class
18 | ///
19 | public AffixRule()
20 | {
21 | }
22 |
23 | ///
24 | /// Allow combining prefix and suffix
25 | ///
26 | public bool AllowCombine
27 | {
28 | get {return _AllowCombine;}
29 | set {_AllowCombine = value;}
30 | }
31 |
32 | ///
33 | /// Collection of text entries that make up this rule
34 | ///
35 | public AffixEntryCollection AffixEntries
36 | {
37 | get {return _AffixEntries;}
38 | set {_AffixEntries = value;}
39 | }
40 |
41 | ///
42 | /// Name of the Affix rule
43 | ///
44 | public string Name
45 | {
46 | get {return _Name;}
47 | set {_Name = value;}
48 | }
49 |
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/NetSpell.Setup/NetSpell.Setup.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 8.00
2 | Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "NetSpell.Setup", "NetSpell.Setup.vdproj", "{15A9988D-DC47-4480-97A1-4133DB16527C}"
3 | ProjectSection(ProjectDependencies) = postProject
4 | EndProjectSection
5 | EndProject
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InstallerActions", "InstallerActions\InstallerActions.csproj", "{018BA054-7E49-4AF8-BFD8-43894F69C7A5}"
7 | ProjectSection(ProjectDependencies) = postProject
8 | EndProjectSection
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfiguration) = preSolution
12 | Debug = Debug
13 | Release = Release
14 | EndGlobalSection
15 | GlobalSection(ProjectConfiguration) = postSolution
16 | {15A9988D-DC47-4480-97A1-4133DB16527C}.Debug.ActiveCfg = Debug
17 | {15A9988D-DC47-4480-97A1-4133DB16527C}.Debug.Build.0 = Debug
18 | {15A9988D-DC47-4480-97A1-4133DB16527C}.Release.ActiveCfg = Release
19 | {15A9988D-DC47-4480-97A1-4133DB16527C}.Release.Build.0 = Release
20 | {018BA054-7E49-4AF8-BFD8-43894F69C7A5}.Debug.ActiveCfg = Debug|.NET
21 | {018BA054-7E49-4AF8-BFD8-43894F69C7A5}.Debug.Build.0 = Debug|.NET
22 | {018BA054-7E49-4AF8-BFD8-43894F69C7A5}.Release.ActiveCfg = Release|.NET
23 | {018BA054-7E49-4AF8-BFD8-43894F69C7A5}.Release.Build.0 = Release|.NET
24 | EndGlobalSection
25 | GlobalSection(ExtensibilityGlobals) = postSolution
26 | EndGlobalSection
27 | GlobalSection(ExtensibilityAddIns) = postSolution
28 | EndGlobalSection
29 | EndGlobal
30 |
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/Dictionary/Affix/AffixEntry.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text.RegularExpressions;
3 |
4 | namespace NetSpell.SpellChecker.Dictionary.Affix
5 | {
6 | ///
7 | /// Rule Entry for expanding base words
8 | ///
9 | public class AffixEntry
10 | {
11 | private int _ConditionCount;
12 | private string _AddCharacters = "";
13 | private int[] _Condition = new int[256] ;
14 | private string _StripCharacters = "";
15 |
16 | ///
17 | /// Initializes a new instance of the class
18 | ///
19 | public AffixEntry()
20 | {
21 | }
22 |
23 | ///
24 | /// The characters to add to the string
25 | ///
26 | public string AddCharacters
27 | {
28 | get {return _AddCharacters;}
29 | set {_AddCharacters = value;}
30 | }
31 |
32 | ///
33 | /// The condition to be met in order to add characters
34 | ///
35 | public int[] Condition
36 | {
37 | get {return _Condition;}
38 | set {_Condition = value;}
39 | }
40 |
41 |
42 | ///
43 | /// The characters to remove before adding characters
44 | ///
45 | public string StripCharacters
46 | {
47 | get {return _StripCharacters;}
48 | set {_StripCharacters = value;}
49 | }
50 |
51 |
52 | ///
53 | /// The number of conditions that must be met
54 | ///
55 | public int ConditionCount
56 | {
57 | get {return _ConditionCount;}
58 | set {_ConditionCount = value;}
59 | }
60 |
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/demo/Demo.Web.FreeTextBox/default.aspx:
--------------------------------------------------------------------------------
1 | <%@ Page Language="C#" ValidateRequest=false %>
2 | <%@ Register TagPrefix="FTB" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>
3 |
4 |
19 |
20 |
21 | Example 1
22 |
23 |
24 |
25 |
26 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/Spelling.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | text/microsoft-resx
32 |
33 |
34 | 1.0.0.0
35 |
36 |
37 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
38 |
39 |
40 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
41 |
42 |
43 |
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/Controls/CheckAsYouType.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | text/microsoft-resx
32 |
33 |
34 | 1.0.0.0
35 |
36 |
37 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
38 |
39 |
40 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
41 |
42 |
43 |
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/Controls/SpellTextBox.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | text/microsoft-resx
32 |
33 |
34 | 1.0.0.0
35 |
36 |
37 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
38 |
39 |
40 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
41 |
42 |
43 |
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/Dictionary/WordDictionary.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | text/microsoft-resx
32 |
33 |
34 | 1.0.0.0
35 |
36 |
37 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
38 |
39 |
40 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
41 |
42 |
43 |
--------------------------------------------------------------------------------
/src/NetSpell.Setup/InstallerActions/VirtualDirectoryInstaller.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | text/microsoft-resx
32 |
33 |
34 | 1.0.0.0
35 |
36 |
37 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
38 |
39 |
40 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
41 |
42 |
43 |
--------------------------------------------------------------------------------
/demo/Demo.TextEditor/Documents/demo.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}{\f1\fnil\fcharset0 Microsoft Sans Serif;}{\f2\fnil\fprq1\fcharset0 Courier New;}{\f3\fnil\fcharset2 Symbol;}}
2 | {\colortbl ;\red128\green0\blue128;\red0\green0\blue0;\red0\green0\blue255;\red128\green0\blue0;\red255\green0\blue255;\red255\green0\blue0;}
3 | {\*\generator Msftedit 5.41.15.1503;}\viewkind4\uc1\pard\b\f0\fs32 NetSpell Spel Check Demo\par
4 | \par
5 | \b0\f1\fs17 Becuase people are realy bad spelers, ths produc was desinged to prevent speling erors in a text area like ths.\par
6 | \par
7 | \cf1 Ths test to mke sure fomating is not removved.\par
8 | \par
9 | \pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent0{\pntxtb\'B7}}\fi-720\li720\cf2 What to chck bulets tu\cf0\f0\fs20\par
10 | \cf2\f1\fs17{\pntext\f3\'B7\tab}Dos this work?\cf0\f0\fs20\par
11 | \pard\par
12 | \b NetSpell Handles HTML\par
13 | \cf3\b0\f2 <\cf4 html\cf3 >\par
14 | <\cf4 head\cf3 >\par
15 | \cf0\tab\cf3 <\cf4 title\cf3 >\cf0 NetSpell Html Tst\cf3 \cf4 title\cf3 >\par
16 | \cf4 head\cf3 >\par
17 | <\cf4 body\cf5 \cf6 bgcolor\cf3 ="#FFFFFF">\par
18 | \cf0 \cf3 <\cf4 h2\cf3 >\cf0 NetSpell Dos html tu\cf3 \cf4 h2\cf3 >\par
19 | \cf0 \cf3 <\cf4 br\cf3 >\par
20 | \cf0 \cf3 <\cf4 p\cf3 ><\cf4 font\cf5 \cf6 face\cf3 ="Arial">\cf0 Becuase people are realy bad spelers, ths produc was desinged to prevent speling erors in a text area like ths.\cf3 \cf4 font\cf3 >\cf4 p\cf3 >\par
21 | \cf4 body\cf3 >\par
22 | \cf4 html\cf3 >\cf0\f0\par
23 | \par
24 | \b NetSpell Handles XML\b0\par
25 | \cf3\f2 \cf4 xml\cf5 \cf6 version\cf3 ="1.0"\cf5 \cf6 encoding\cf3 ="utf-8"\cf5 \cf3 ?>\cf0 \par
26 | \cf3 <\cf4 netspell\cf5 \cf6 name\cf3 ="tst">\par
27 | \cf0\tab\cf3 <\cf4 test\cf3 >\cf0 People are realy bad spelers.\cf3 \cf4 test\cf3 >\par
28 | \cf0\tab\cf3 <\cf4 test\cf3 >\cf0 ths produc prevent speling erors.\cf3 \cf4 test\cf3 >\par
29 | \cf4 netspell\cf3 >\cf0\f0\par
30 | }
31 |
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/Dictionary/Affix/AffixEntryEnumerator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NetSpell.SpellChecker.Dictionary.Affix
4 | {
5 | ///
6 | /// A strongly typed enumerator for 'AffixEntryCollection'
7 | ///
8 | public class AffixEntryEnumerator : object, System.Collections.IEnumerator
9 | {
10 |
11 | private System.Collections.IEnumerator Base;
12 |
13 | private System.Collections.IEnumerable Local;
14 |
15 | ///
16 | /// Enumerator constructor
17 | ///
18 | public AffixEntryEnumerator(AffixEntryCollection mappings)
19 | {
20 | this.Local = ((System.Collections.IEnumerable)(mappings));
21 | this.Base = Local.GetEnumerator();
22 | }
23 |
24 | ///
25 | /// Gets the current element from the collection (strongly typed)
26 | ///
27 | public AffixEntry Current
28 | {
29 | get
30 | {
31 | return ((AffixEntry)(Base.Current));
32 | }
33 | }
34 |
35 | ///
36 | /// Gets the current element from the collection
37 | ///
38 | object System.Collections.IEnumerator.Current
39 | {
40 | get
41 | {
42 | return Base.Current;
43 | }
44 | }
45 |
46 | ///
47 | /// Advances the enumerator to the next element of the collection
48 | ///
49 | public bool MoveNext()
50 | {
51 | return Base.MoveNext();
52 | }
53 |
54 | ///
55 | /// Advances the enumerator to the next element of the collection
56 | ///
57 | bool System.Collections.IEnumerator.MoveNext()
58 | {
59 | return Base.MoveNext();
60 | }
61 |
62 | ///
63 | /// Sets the enumerator to the first element in the collection
64 | ///
65 | public void Reset()
66 | {
67 | Base.Reset();
68 | }
69 |
70 | ///
71 | /// Sets the enumerator to the first element in the collection
72 | ///
73 | void System.Collections.IEnumerator.Reset()
74 | {
75 | Base.Reset();
76 | }
77 | }
78 |
79 |
80 | }
81 |
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/Dictionary/Phonetic/PhoneticRuleEnumerator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NetSpell.SpellChecker.Dictionary.Phonetic
4 | {
5 | ///
6 | /// A strongly typed enumerator for 'PhoneticRuleCollection'
7 | ///
8 | public class PhoneticRuleEnumerator : object, System.Collections.IEnumerator
9 | {
10 |
11 | private System.Collections.IEnumerator Base;
12 |
13 | private System.Collections.IEnumerable Local;
14 |
15 | ///
16 | /// Enumerator constructor
17 | ///
18 | public PhoneticRuleEnumerator(PhoneticRuleCollection mappings)
19 | {
20 | this.Local = ((System.Collections.IEnumerable)(mappings));
21 | this.Base = Local.GetEnumerator();
22 | }
23 |
24 | ///
25 | /// Gets the current element from the collection (strongly typed)
26 | ///
27 | public PhoneticRule Current
28 | {
29 | get
30 | {
31 | return ((PhoneticRule)(Base.Current));
32 | }
33 | }
34 |
35 | ///
36 | /// Gets the current element from the collection
37 | ///
38 | object System.Collections.IEnumerator.Current
39 | {
40 | get
41 | {
42 | return Base.Current;
43 | }
44 | }
45 |
46 | ///
47 | /// Advances the enumerator to the next element of the collection
48 | ///
49 | public bool MoveNext()
50 | {
51 | return Base.MoveNext();
52 | }
53 |
54 | ///
55 | /// Advances the enumerator to the next element of the collection
56 | ///
57 | bool System.Collections.IEnumerator.MoveNext()
58 | {
59 | return Base.MoveNext();
60 | }
61 |
62 | ///
63 | /// Sets the enumerator to the first element in the collection
64 | ///
65 | public void Reset()
66 | {
67 | Base.Reset();
68 | }
69 |
70 | ///
71 | /// Sets the enumerator to the first element in the collection
72 | ///
73 | void System.Collections.IEnumerator.Reset()
74 | {
75 | Base.Reset();
76 | }
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/HtmlEditor.css:
--------------------------------------------------------------------------------
1 | .tbButton {
2 | background-color: buttonface;
3 | border-bottom: buttonface solid 1px;
4 | border-left: buttonface solid 1px;
5 | border-right: buttonface solid 1px;
6 | border-top: buttonface solid 1px;
7 | height: 20px;
8 | top: 1px;
9 | width: 21px;
10 | }
11 |
12 | .tbButtonDown {
13 | background-color: #DCDCDC;
14 | border-bottom: buttonhighlight solid 1px;
15 | border-left: buttonshadow solid 1px;
16 | border-right: buttonhighlight solid 1px;
17 | border-top: buttonshadow solid 1px;
18 | height: 20px;
19 | top: 1px;
20 | width: 21px;
21 | }
22 |
23 | .tbButtonMouseOverDown {
24 | background-color: buttonface;
25 | border-bottom: buttonhighlight solid 1px;
26 | border-left: buttonshadow solid 1px;
27 | border-right: buttonhighlight solid 1px;
28 | border-top: buttonshadow solid 1px;
29 | height: 20px;
30 | top: 1px;
31 | width: 21px;
32 | }
33 |
34 | .tbButtonMouseOverUp {
35 | background-color: buttonface;
36 | border-bottom: buttonshadow solid 1px;
37 | border-left: buttonhighlight solid 1px;
38 | border-right: buttonshadow solid 1px;
39 | border-top: buttonhighlight solid 1px;
40 | height: 20px;
41 | top: 1px;
42 | width: 21px;
43 | }
44 |
45 | .tbGeneral {
46 | height: 22px;
47 | top: 2;
48 | }
49 |
50 | .tbHandleDiv {
51 | background-color: buttonface;
52 | border-left: buttonhighlight solid 1px;
53 | border-right: buttonshadow solid 1px;
54 | border-top: buttonhighlight solid 1px;
55 | font-size: 1px;
56 | height: 22px;
57 | top: 1px;
58 | width: 3px;
59 | }
60 |
61 | .tbIcon {
62 | left: -1;
63 | top: -1;
64 | }
65 |
66 | .tbIconDown {
67 | left: 0px;
68 | top: 0px;
69 | }
70 |
71 | .tbIconDownPressed {
72 | left: 1px;
73 | top: 1px;
74 | }
75 |
76 | .tbSeparator {
77 | border-left: buttonshadow solid 1px;
78 | border-right: buttonhighlight solid 1px;
79 | font-size: 0px;
80 | height: 20px;
81 | top: 1px;
82 | width: 1px;
83 | }
84 |
85 | .tbToolbar {
86 | background-color: buttonface;
87 | border-bottom: buttonshadow solid 1px;
88 | border-left: buttonhighlight solid 1px;
89 | border-right: buttonshadow solid 1px;
90 | border-top: buttonhighlight solid 1px;
91 | height: 27px;
92 | left: 0;
93 | top: 0;
94 | width: 100%;
95 | }
96 |
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/TraceWriter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Reflection;
4 |
5 |
6 | ///
7 | /// Summary description for TraceWriter.
8 | ///
9 | internal sealed class TraceWriter
10 | {
11 |
12 | public static TraceSwitch Switch = new TraceSwitch(Assembly.GetAssembly(typeof(TraceWriter)).GetName().Name, "Trace Helper Switch");
13 |
14 | public static void TraceError(string format, params object[] args)
15 | {
16 | if (Switch.TraceError)
17 | Trace.WriteLine(string.Format(format, args), GetCallingMethod(new StackTrace(1)));
18 | }
19 |
20 | public static void TraceError(string value)
21 | {
22 | if (Switch.TraceError)
23 | Trace.WriteLine(value, GetCallingMethod(new StackTrace(1)));
24 | }
25 |
26 | public static void TraceInfo(string format, params object[] args)
27 | {
28 | if (Switch.TraceInfo)
29 | Trace.WriteLine(string.Format(format, args), GetCallingMethod(new StackTrace(1)));
30 | }
31 |
32 | public static void TraceInfo(string value)
33 | {
34 | if (Switch.TraceInfo)
35 | Trace.WriteLine(value, GetCallingMethod(new StackTrace(1)));
36 | }
37 |
38 | public static void TraceWarning(string format, params object[] args)
39 | {
40 | if (Switch.TraceWarning)
41 | Trace.WriteLine(string.Format(format, args), GetCallingMethod(new StackTrace(1)));
42 | }
43 |
44 | public static void TraceWarning(string value)
45 | {
46 | if (Switch.TraceWarning)
47 | Trace.WriteLine(value, GetCallingMethod(new StackTrace(1))); }
48 |
49 | public static void TraceVerbose(string format, params object[] args)
50 | {
51 | if (Switch.TraceVerbose)
52 | Trace.WriteLine(string.Format(format, args), GetCallingMethod(new StackTrace(1)));
53 | }
54 |
55 | public static void TraceVerbose(string value)
56 | {
57 | if (Switch.TraceVerbose)
58 | Trace.WriteLine(value, GetCallingMethod(new StackTrace(1)));
59 | }
60 |
61 | private static string GetCallingMethod(StackTrace stack)
62 | {
63 | StackFrame frame = stack.GetFrame(0);
64 | string className = frame.GetMethod().DeclaringType.ToString();
65 | string functionName = frame.GetMethod().Name;
66 | return string.Format("{0}.{1}", className, functionName);
67 | }
68 |
69 | private TraceWriter()
70 | {
71 | }
72 |
73 | }
74 |
75 |
--------------------------------------------------------------------------------
/demo/Demo.Web.VBnet/default.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NetSpell Web Demo
6 |
7 |
8 |
9 |
10 |
11 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/demo/Demo.Web.CSharp/default.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NetSpell Web Demo
6 |
7 |
8 |
9 |
10 |
11 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/Dictionary/Affix/AffixRuleEnumerator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 |
4 | namespace NetSpell.SpellChecker.Dictionary.Affix
5 | {
6 | ///
7 | /// A strongly typed enumerator for 'AffixRuleCollection'
8 | ///
9 | public class AffixRuleEnumerator : IDictionaryEnumerator
10 | {
11 | private IDictionaryEnumerator innerEnumerator;
12 |
13 | internal AffixRuleEnumerator (AffixRuleCollection enumerable)
14 | {
15 | innerEnumerator = enumerable.InnerHash.GetEnumerator();
16 | }
17 |
18 | #region Implementation of IDictionaryEnumerator
19 |
20 | ///
21 | /// gets the key of the current AffixRuleCollection entry.
22 | ///
23 | public string Key
24 | {
25 | get
26 | {
27 | return (string)innerEnumerator.Key;
28 | }
29 | }
30 | object IDictionaryEnumerator.Key
31 | {
32 | get
33 | {
34 | return Key;
35 | }
36 | }
37 |
38 |
39 | ///
40 | /// gets the value of the current AffixRuleCollection entry.
41 | ///
42 | public AffixRule Value
43 | {
44 | get
45 | {
46 | return (AffixRule)innerEnumerator.Value;
47 | }
48 | }
49 | object IDictionaryEnumerator.Value
50 | {
51 | get
52 | {
53 | return Value;
54 | }
55 | }
56 |
57 | ///
58 | /// gets both the key and the value of the current AffixRuleCollection entry.
59 | ///
60 | public System.Collections.DictionaryEntry Entry
61 | {
62 | get
63 | {
64 | return innerEnumerator.Entry;
65 | }
66 | }
67 |
68 | #endregion
69 |
70 | #region Implementation of IEnumerator
71 |
72 | ///
73 | /// Sets the enumerator to the first element in the collection
74 | ///
75 | public void Reset()
76 | {
77 | innerEnumerator.Reset();
78 | }
79 |
80 | ///
81 | /// Advances the enumerator to the next element of the collection
82 | ///
83 | public bool MoveNext()
84 | {
85 | return innerEnumerator.MoveNext();
86 | }
87 |
88 | ///
89 | /// Gets the current element from the collection
90 | ///
91 | public object Current
92 | {
93 | get
94 | {
95 | return innerEnumerator.Current;
96 | }
97 | }
98 | #endregion
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/Dictionary/Phonetic/PhoneticRule.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NetSpell.SpellChecker.Dictionary.Phonetic
4 | {
5 | ///
6 | /// This class hold the settings for a phonetic rule
7 | ///
8 | public class PhoneticRule
9 | {
10 | private bool _BeginningOnly;
11 | private int[] _Condition = new int[256];
12 | private int _ConditionCount = 0;
13 | private int _ConsumeCount;
14 | private bool _EndOnly;
15 | private int _Priority;
16 | private bool _ReplaceMode = false;
17 | private string _ReplaceString;
18 |
19 | ///
20 | /// Initializes a new instance of the class
21 | ///
22 | public PhoneticRule()
23 | {
24 | }
25 |
26 | ///
27 | /// True if this rule should be applied to the beginning only
28 | ///
29 | public bool BeginningOnly
30 | {
31 | get {return _BeginningOnly;}
32 | set {_BeginningOnly = value;}
33 | }
34 |
35 |
36 | ///
37 | /// The ascii condition array
38 | ///
39 | public int[] Condition
40 | {
41 | get {return _Condition;}
42 | }
43 |
44 | ///
45 | /// The number of conditions
46 | ///
47 | public int ConditionCount
48 | {
49 | get {return _ConditionCount;}
50 | set {_ConditionCount = value;}
51 | }
52 |
53 | ///
54 | /// The number of chars to consume with this rule
55 | ///
56 | public int ConsumeCount
57 | {
58 | get {return _ConsumeCount;}
59 | set {_ConsumeCount = value;}
60 | }
61 |
62 | ///
63 | /// True if this rule should be applied to the end only
64 | ///
65 | public bool EndOnly
66 | {
67 | get {return _EndOnly;}
68 | set {_EndOnly = value;}
69 | }
70 |
71 | ///
72 | /// The priority of this rule
73 | ///
74 | public int Priority
75 | {
76 | get {return _Priority;}
77 | set {_Priority = value;}
78 | }
79 |
80 | ///
81 | /// True if this rule should run in replace mode
82 | ///
83 | public bool ReplaceMode
84 | {
85 | get {return _ReplaceMode;}
86 | set {_ReplaceMode = value;}
87 | }
88 |
89 | ///
90 | /// The string to use when replacing
91 | ///
92 | public string ReplaceString
93 | {
94 | get {return _ReplaceString;}
95 | set {_ReplaceString = value;}
96 | }
97 |
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/src/NetSpell.Tests/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 |
4 | //
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | //
9 | [assembly: AssemblyTitle("")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("")]
14 | [assembly: AssemblyCopyright("")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | //
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Revision and Build Numbers
27 | // by using the '*' as shown below:
28 |
29 | [assembly: AssemblyVersion("1.0.*")]
30 |
31 | //
32 | // In order to sign your assembly you must specify a key to use. Refer to the
33 | // Microsoft .NET Framework documentation for more information on assembly signing.
34 | //
35 | // Use the attributes below to control which key is used for signing.
36 | //
37 | // Notes:
38 | // (*) If no key is specified, the assembly is not signed.
39 | // (*) KeyName refers to a key that has been installed in the Crypto Service
40 | // Provider (CSP) on your machine. KeyFile refers to a file which contains
41 | // a key.
42 | // (*) If the KeyFile and the KeyName values are both specified, the
43 | // following processing occurs:
44 | // (1) If the KeyName can be found in the CSP, that key is used.
45 | // (2) If the KeyName does not exist and the KeyFile does exist, the key
46 | // in the KeyFile is installed into the CSP and used.
47 | // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
48 | // When specifying the KeyFile, the location of the KeyFile should be
49 | // relative to the project output directory which is
50 | // %Project Directory%\obj\. For example, if your KeyFile is
51 | // located in the project directory, you would specify the AssemblyKeyFile
52 | // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
53 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
54 | // documentation for more information on this.
55 | //
56 | [assembly: AssemblyDelaySign(false)]
57 | [assembly: AssemblyKeyFile("")]
58 | [assembly: AssemblyKeyName("")]
59 |
--------------------------------------------------------------------------------
/demo/Demo.WinForm.CSharp/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 |
4 | //
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | //
9 | [assembly: AssemblyTitle("")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("")]
14 | [assembly: AssemblyCopyright("")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | //
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Revision and Build Numbers
27 | // by using the '*' as shown below:
28 |
29 | [assembly: AssemblyVersion("1.0.*")]
30 |
31 | //
32 | // In order to sign your assembly you must specify a key to use. Refer to the
33 | // Microsoft .NET Framework documentation for more information on assembly signing.
34 | //
35 | // Use the attributes below to control which key is used for signing.
36 | //
37 | // Notes:
38 | // (*) If no key is specified, the assembly is not signed.
39 | // (*) KeyName refers to a key that has been installed in the Crypto Service
40 | // Provider (CSP) on your machine. KeyFile refers to a file which contains
41 | // a key.
42 | // (*) If the KeyFile and the KeyName values are both specified, the
43 | // following processing occurs:
44 | // (1) If the KeyName can be found in the CSP, that key is used.
45 | // (2) If the KeyName does not exist and the KeyFile does exist, the key
46 | // in the KeyFile is installed into the CSP and used.
47 | // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
48 | // When specifying the KeyFile, the location of the KeyFile should be
49 | // relative to the project output directory which is
50 | // %Project Directory%\obj\. For example, if your KeyFile is
51 | // located in the project directory, you would specify the AssemblyKeyFile
52 | // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
53 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
54 | // documentation for more information on this.
55 | //
56 | [assembly: AssemblyDelaySign(false)]
57 | [assembly: AssemblyKeyFile("")]
58 | [assembly: AssemblyKeyName("")]
59 |
--------------------------------------------------------------------------------
/src/NetSpell.WinForm.Test/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 |
4 | //
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | //
9 | [assembly: AssemblyTitle("")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("")]
14 | [assembly: AssemblyCopyright("")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | //
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Revision and Build Numbers
27 | // by using the '*' as shown below:
28 |
29 | [assembly: AssemblyVersion("1.0.*")]
30 |
31 | //
32 | // In order to sign your assembly you must specify a key to use. Refer to the
33 | // Microsoft .NET Framework documentation for more information on assembly signing.
34 | //
35 | // Use the attributes below to control which key is used for signing.
36 | //
37 | // Notes:
38 | // (*) If no key is specified, the assembly is not signed.
39 | // (*) KeyName refers to a key that has been installed in the Crypto Service
40 | // Provider (CSP) on your machine. KeyFile refers to a file which contains
41 | // a key.
42 | // (*) If the KeyFile and the KeyName values are both specified, the
43 | // following processing occurs:
44 | // (1) If the KeyName can be found in the CSP, that key is used.
45 | // (2) If the KeyName does not exist and the KeyFile does exist, the key
46 | // in the KeyFile is installed into the CSP and used.
47 | // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
48 | // When specifying the KeyFile, the location of the KeyFile should be
49 | // relative to the project output directory which is
50 | // %Project Directory%\obj\. For example, if your KeyFile is
51 | // located in the project directory, you would specify the AssemblyKeyFile
52 | // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
53 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
54 | // documentation for more information on this.
55 | //
56 | [assembly: AssemblyDelaySign(false)]
57 | [assembly: AssemblyKeyFile("")]
58 | [assembly: AssemblyKeyName("")]
59 |
--------------------------------------------------------------------------------
/src/NetSpell.Setup/InstallerActions/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 |
4 | //
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | //
9 | [assembly: AssemblyTitle("")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("")]
14 | [assembly: AssemblyCopyright("")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | //
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Revision and Build Numbers
27 | // by using the '*' as shown below:
28 |
29 | [assembly: AssemblyVersion("1.0.*")]
30 |
31 | //
32 | // In order to sign your assembly you must specify a key to use. Refer to the
33 | // Microsoft .NET Framework documentation for more information on assembly signing.
34 | //
35 | // Use the attributes below to control which key is used for signing.
36 | //
37 | // Notes:
38 | // (*) If no key is specified, the assembly is not signed.
39 | // (*) KeyName refers to a key that has been installed in the Crypto Service
40 | // Provider (CSP) on your machine. KeyFile refers to a file which contains
41 | // a key.
42 | // (*) If the KeyFile and the KeyName values are both specified, the
43 | // following processing occurs:
44 | // (1) If the KeyName can be found in the CSP, that key is used.
45 | // (2) If the KeyName does not exist and the KeyFile does exist, the key
46 | // in the KeyFile is installed into the CSP and used.
47 | // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
48 | // When specifying the KeyFile, the location of the KeyFile should be
49 | // relative to the project output directory which is
50 | // %Project Directory%\obj\. For example, if your KeyFile is
51 | // located in the project directory, you would specify the AssemblyKeyFile
52 | // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
53 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
54 | // documentation for more information on this.
55 | //
56 | [assembly: AssemblyDelaySign(false)]
57 | [assembly: AssemblyKeyFile("")]
58 | [assembly: AssemblyKeyName("")]
59 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/src/NetSpell.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 8.00
2 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetSpell.SpellChecker", "NetSpell.SpellChecker\NetSpell.SpellChecker.csproj", "{A426EE0B-E52E-4D74-AF24-06797142D7B2}"
3 | ProjectSection(ProjectDependencies) = postProject
4 | EndProjectSection
5 | EndProject
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetSpell.Tests", "NetSpell.Tests\NetSpell.Tests.csproj", "{FA92DDBE-81AD-4F8A-9941-300839C15727}"
7 | ProjectSection(ProjectDependencies) = postProject
8 | EndProjectSection
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetSpell.DictionaryBuild", "NetSpell.DictionaryBuild\NetSpell.DictionaryBuild.csproj", "{1A1420D4-99BA-4755-9D54-F920BA435D64}"
11 | ProjectSection(ProjectDependencies) = postProject
12 | EndProjectSection
13 | EndProject
14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetSpell.WinForm.Test", "NetSpell.WinForm.Test\NetSpell.WinForm.Test.csproj", "{953B172F-6026-494E-BD97-111374606CFD}"
15 | ProjectSection(ProjectDependencies) = postProject
16 | EndProjectSection
17 | EndProject
18 | Global
19 | GlobalSection(SolutionConfiguration) = preSolution
20 | Debug = Debug
21 | Release = Release
22 | EndGlobalSection
23 | GlobalSection(ProjectConfiguration) = postSolution
24 | {A426EE0B-E52E-4D74-AF24-06797142D7B2}.Debug.ActiveCfg = Debug|.NET
25 | {A426EE0B-E52E-4D74-AF24-06797142D7B2}.Debug.Build.0 = Debug|.NET
26 | {A426EE0B-E52E-4D74-AF24-06797142D7B2}.Release.ActiveCfg = Release|.NET
27 | {A426EE0B-E52E-4D74-AF24-06797142D7B2}.Release.Build.0 = Release|.NET
28 | {FA92DDBE-81AD-4F8A-9941-300839C15727}.Debug.ActiveCfg = Debug|.NET
29 | {FA92DDBE-81AD-4F8A-9941-300839C15727}.Debug.Build.0 = Debug|.NET
30 | {FA92DDBE-81AD-4F8A-9941-300839C15727}.Release.ActiveCfg = Release|.NET
31 | {FA92DDBE-81AD-4F8A-9941-300839C15727}.Release.Build.0 = Release|.NET
32 | {1A1420D4-99BA-4755-9D54-F920BA435D64}.Debug.ActiveCfg = Debug|.NET
33 | {1A1420D4-99BA-4755-9D54-F920BA435D64}.Debug.Build.0 = Debug|.NET
34 | {1A1420D4-99BA-4755-9D54-F920BA435D64}.Release.ActiveCfg = Release|.NET
35 | {1A1420D4-99BA-4755-9D54-F920BA435D64}.Release.Build.0 = Release|.NET
36 | {953B172F-6026-494E-BD97-111374606CFD}.Debug.ActiveCfg = Debug|.NET
37 | {953B172F-6026-494E-BD97-111374606CFD}.Debug.Build.0 = Debug|.NET
38 | {953B172F-6026-494E-BD97-111374606CFD}.Release.ActiveCfg = Release|.NET
39 | {953B172F-6026-494E-BD97-111374606CFD}.Release.Build.0 = Release|.NET
40 | EndGlobalSection
41 | GlobalSection(SolutionItems) = postSolution
42 | NetSpell.build = NetSpell.build
43 | EndGlobalSection
44 | GlobalSection(ExtensibilityGlobals) = postSolution
45 | EndGlobalSection
46 | GlobalSection(ExtensibilityAddIns) = postSolution
47 | EndGlobalSection
48 | EndGlobal
49 |
--------------------------------------------------------------------------------
/src/NetSpell.Tests/PerformanceTimer.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2003, Paul Welter
2 | // All rights reserved.
3 |
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | ///
8 | /// Use this class to profile your code and any other operation
9 | /// typically with a precision greater than 1 millionth of a second
10 | ///
11 | public class PerformanceTimer
12 | {
13 | private long _Frequency = 0;
14 | private float _TotalTime = 0;
15 | private long _StartTime = 0;
16 | private long _EndTime = 0;
17 |
18 | [DllImport("KERNEL32")]
19 | private static extern bool QueryPerformanceCounter( ref long lpPerformanceCount);
20 |
21 | [DllImport("KERNEL32")]
22 | private static extern bool QueryPerformanceFrequency( ref long lpFrequency);
23 |
24 | ///
25 | /// The default constructor automaticly starts the timer
26 | ///
27 | public PerformanceTimer()
28 | {
29 | QueryPerformanceFrequency(ref _Frequency);
30 | this.StartTimer();
31 | }
32 |
33 | ///
34 | /// Starts the timer
35 | ///
36 | public void StartTimer()
37 | {
38 | //get the current value of the counter
39 | QueryPerformanceCounter(ref _StartTime);
40 | }
41 |
42 | ///
43 | /// Stops the timer
44 | ///
45 | ///
46 | /// the time elapsed since StartTimer
47 | ///
48 | public float StopTimer()
49 | {
50 | // get the elapsed time
51 | float result = this.ElapsedTime;
52 | // update the total time counter
53 | _TotalTime += (_EndTime - _StartTime);
54 | // reset starting time
55 | _StartTime = 0;
56 |
57 | return result;
58 | }
59 |
60 | ///
61 | /// returns the elapsed time in seconds since StartTimer,
62 | /// without stopping the timer
63 | ///
64 | public float ElapsedTime
65 | {
66 | get
67 | {
68 | if(_StartTime == 0) return 0;
69 |
70 | // get the current value of the counter
71 | QueryPerformanceCounter(ref _EndTime);
72 | // return the elapsed time in seconds
73 | return ((float)_EndTime - (float)_StartTime) / (float)_Frequency;
74 | }
75 | }
76 |
77 | ///
78 | /// returns the total time in seconds that the
79 | /// timer has been running
80 | ///
81 | public float TotalTime
82 | {
83 | get
84 | {
85 | if(_StartTime == 0)
86 | _TotalTime = _TotalTime / (float)_Frequency;
87 | else
88 | _TotalTime = (_TotalTime + ((float)_EndTime - (float)_StartTime)) / (float)_Frequency;
89 |
90 | return _TotalTime;
91 | }
92 | set {_TotalTime = value;}
93 | }
94 |
95 | ///
96 | /// returns the timer precision in seconds
97 | ///
98 | public float Precision
99 | {
100 | get {return 1 / ((float)_Frequency * 10000);}
101 | }
102 |
103 | }
104 |
105 |
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/Controls/SpellRichTextBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 | using System.Drawing;
4 | using System.ComponentModel;
5 |
6 | namespace NetSpell.SpellChecker.Controls
7 | {
8 | ///
9 | /// Summary description for SpellRichTextBox.
10 | ///
11 | public class SpellRichTextBox : RichTextBox
12 | {
13 | private bool _EnableSpellCheck = true;
14 | private Pen _errorPen = new Pen(Color.Red, 1);
15 | private Spelling _spellChecker;
16 |
17 | public SpellRichTextBox()
18 | {
19 | Application.Idle +=new EventHandler(OnIdle);
20 | }
21 |
22 |
23 | protected override void WndProc(ref Message m)
24 | {
25 | base.WndProc (ref m);
26 | }
27 |
28 | protected override void OnTextChanged(EventArgs e)
29 | {
30 | base.OnTextChanged (e);
31 | }
32 |
33 | protected override void OnSelectionChanged(EventArgs e)
34 | {
35 | base.OnSelectionChanged (e);
36 | }
37 |
38 | protected override void OnMouseDown(MouseEventArgs e)
39 | {
40 | base.OnMouseDown (e);
41 | }
42 |
43 | protected override void OnPaint(PaintEventArgs e)
44 | {
45 | base.OnPaint (e);
46 | }
47 |
48 | protected override void Dispose(bool disposing)
49 | {
50 | if( disposing )
51 | {
52 | // free pen resources
53 | if(_errorPen != null)
54 | _errorPen.Dispose();
55 | }
56 | base.Dispose( disposing );
57 | }
58 |
59 | protected void OnScroll(EventArgs e)
60 | {
61 |
62 | }
63 |
64 | protected void OnIdle(object sender, EventArgs e)
65 | {
66 |
67 | }
68 |
69 | ///
70 | /// The WordDictionary object to use when spell checking
71 | ///
72 | [Browsable(true)]
73 | [CategoryAttribute("SpellCheck")]
74 | [Description("The Spelling object to use when spell checking")]
75 | public Spelling SpellChecker
76 | {
77 | get {return _spellChecker;}
78 | set {_spellChecker = value;}
79 | }
80 |
81 |
82 | ///
83 | /// The color of the wavy underline that marks misspelled words
84 | ///
85 | [Browsable(true)]
86 | [CategoryAttribute("SpellCheck")]
87 | [Description("The color of the wavy underline that marks misspelled words")]
88 | public Color ErrorColor
89 | {
90 | get {return _errorPen.Color;}
91 | set {_errorPen.Color = value;}
92 | }
93 |
94 |
95 | ///
96 | /// Enable As You Type spell checking
97 | ///
98 | [Browsable(true)]
99 | [DefaultValue(true)]
100 | [CategoryAttribute("SpellCheck")]
101 | [Description("Enable As You Type spell checking")]
102 | public bool EnableSpellCheck
103 | {
104 | get {return _EnableSpellCheck;}
105 | set {_EnableSpellCheck = value;}
106 | }
107 |
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/Dictionary/Phonetic/PhoneticUtility.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 |
4 | namespace NetSpell.SpellChecker.Dictionary.Phonetic
5 | {
6 | ///
7 | /// This class holds helper methods for phonetic encoding
8 | ///
9 | public sealed class PhoneticUtility
10 | {
11 | ///
12 | /// Initializes a new instance of the class
13 | ///
14 | private PhoneticUtility()
15 | {
16 | }
17 |
18 | ///
19 | /// Converts the rule text in to a PhoneticRule class
20 | ///
21 | ///
22 | ///
23 | /// The text to convert
24 | ///
25 | ///
26 | ///
27 | ///
28 | /// The object that will hold the conversion data
29 | ///
30 | ///
31 | public static void EncodeRule(string ruleText, ref PhoneticRule rule)
32 | {
33 | // clear the conditions array
34 | for (int i=0; i < rule.Condition.Length; i++)
35 | {
36 | rule.Condition[i] = 0;
37 | }
38 |
39 | bool group = false; /* group indicator */
40 | bool end = false; /* end condition indicator */
41 |
42 | char [] memberChars = new char[200];
43 | int numMember = 0; /* number of member in group */
44 |
45 | foreach (char cond in ruleText)
46 | {
47 | switch (cond)
48 | {
49 | case '(' :
50 | group = true;
51 | break;
52 | case ')' :
53 | end = true;
54 | break;
55 | case '^' :
56 | rule.BeginningOnly = true;
57 | break;
58 | case '$' :
59 | rule.EndOnly = true;
60 | break;
61 | case '-' :
62 | rule.ConsumeCount++;
63 | break;
64 | case '<' :
65 | rule.ReplaceMode = true;
66 | break;
67 | case '0' :
68 | case '1' :
69 | case '2' :
70 | case '3' :
71 | case '4' :
72 | case '5' :
73 | case '6' :
74 | case '7' :
75 | case '8' :
76 | case '9' :
77 | rule.Priority = int.Parse(cond.ToString(CultureInfo.CurrentUICulture));
78 | break;
79 | default :
80 | if (group)
81 | {
82 | // add chars to group
83 | memberChars[numMember] = cond;
84 | numMember++;
85 | }
86 | else
87 | {
88 | end = true;
89 | }
90 | break;
91 | } // switch
92 |
93 | if (end)
94 | {
95 | if (group)
96 | {
97 | // turn on chars in member group
98 | for (int j=0; j < numMember; j++)
99 | {
100 | int charCode = (int)memberChars[j];
101 | rule.Condition[charCode] = rule.Condition[charCode] | (1 << rule.ConditionCount);
102 | }
103 |
104 | group = false;
105 | numMember = 0;
106 | }
107 | else
108 | {
109 | // turn on char
110 | int charCode = (int)cond;
111 | rule.Condition[charCode] = rule.Condition[charCode] | (1 << rule.ConditionCount);
112 | }
113 | end = false;
114 | rule.ConditionCount++;
115 | } // if end
116 | } // for each
117 | }
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/src/NetSpell.Tests/PerformanceTest.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2003, Paul Welter
2 | // All rights reserved.
3 |
4 | using System;
5 | using System.Collections;
6 | using System.IO;
7 | using System.Text;
8 | using System.Diagnostics;
9 |
10 | using NUnit.Framework;
11 | using NetSpell.SpellChecker;
12 | using NetSpell.SpellChecker.Dictionary;
13 | using NetSpell.SpellChecker.Dictionary.Phonetic;
14 | using NetSpell.SpellChecker.Dictionary.Affix;
15 |
16 | namespace NetSpell.Tests
17 | {
18 | ///
19 | /// Summary description for PerformanceTest.
20 | ///
21 | [TestFixture]
22 | [Ignore("Too Long")]
23 | public class PerformanceTest
24 | {
25 | Spelling _SpellChecker = new Spelling();
26 | PerformanceTimer _timer = new PerformanceTimer();
27 |
28 | public PerformanceTest()
29 | {
30 | //
31 | // TODO: Add constructor logic here
32 | //
33 | }
34 |
35 | [SetUp]
36 | public void SetUp()
37 | {
38 | _SpellChecker.Dictionary.DictionaryFolder = @"..\..\..\..\dic";
39 | _SpellChecker.Dictionary.Initialize();
40 |
41 | _SpellChecker.ShowDialog = false;
42 | _SpellChecker.MaxSuggestions = 0;
43 | }
44 |
45 | [Test]
46 | public void SuggestionRank()
47 | {
48 | string invalidFile = @"..\src\NetSpell.Tests\Data\SuggestionTest.txt";
49 |
50 | // open file
51 | FileStream fs = new FileStream(invalidFile, FileMode.Open, FileAccess.Read, FileShare.Read);
52 | StreamReader sr = new StreamReader(fs, Encoding.UTF7);
53 |
54 | int totalFound = 0;
55 | int totalChecked = 0;
56 | int totalFirst = 0;
57 | int totalTopFive = 0;
58 | int totalTopTen = 0;
59 | int totalTopTwentyFive = 0;
60 |
61 | Console.WriteLine("Misspelled\tCorrect\tPosition\tCount");
62 |
63 | // read line by line
64 | while (sr.Peek() >= 0)
65 | {
66 | string tempLine = sr.ReadLine().Trim();
67 | if (tempLine.Length > 0)
68 | {
69 | string[] parts = tempLine.Split();
70 | string misSpelled = parts[0];
71 | string correctSpelled = parts[1];
72 | if (parts.Length > 2) correctSpelled += " " + parts[2];
73 |
74 | bool found = false;
75 |
76 | if(_SpellChecker.SpellCheck(misSpelled))
77 | {
78 | totalChecked++;
79 | _SpellChecker.Suggest();
80 | int position = 0;
81 | foreach(string suggestion in _SpellChecker.Suggestions)
82 | {
83 | position++;
84 | if(suggestion.ToLower() == correctSpelled.ToLower())
85 | {
86 | Console.WriteLine("{0}\t{1}\t{2}\t{3}",
87 | misSpelled, correctSpelled, position.ToString(), _SpellChecker.Suggestions.Count.ToString());
88 | found = true;
89 |
90 | totalFound++;
91 |
92 | if (position == 1) totalFirst++;
93 | else if (position <= 5) totalTopFive++;
94 | else if (position <= 10) totalTopTen++;
95 | else if (position <= 25) totalTopTwentyFive++;
96 |
97 | break;
98 | }
99 | }
100 |
101 | if (!found)
102 | {
103 | if (_SpellChecker.Suggestions.Count > 0)
104 | {
105 | Console.WriteLine("{0}\t{1}\t{2}\t{3}",
106 | misSpelled, correctSpelled, "0", _SpellChecker.Suggestions.Count.ToString());
107 | }
108 | else
109 | {
110 | Console.WriteLine("{0}\t{1}\t{2}\t{3}",
111 | misSpelled, correctSpelled, "-1", "-1");
112 | }
113 |
114 | }
115 | }
116 | else
117 | {
118 | Console.WriteLine("{0}\t{1}\t{2}\t{3}",
119 | misSpelled, correctSpelled, "1", "1");
120 | }
121 | }
122 | }
123 |
124 |
125 | totalTopFive += totalFirst;
126 | totalTopTen += totalTopFive;
127 | totalTopTwentyFive += totalTopTen;
128 |
129 | Console.WriteLine("Total Tested\t{0}", totalChecked);
130 | Console.WriteLine("Total Found\t{0}\t{1}%", totalFound, ((float)totalFound / (float)totalChecked * 100f));
131 | Console.WriteLine("First Suggestions\t{0}\t{1}%", totalFirst, ((float)totalFirst / (float)totalChecked * 100f));
132 | Console.WriteLine("Top 5 Suggestions\t{0}\t{1}%", totalTopFive, ((float)totalTopFive / (float)totalChecked * 100f));
133 | Console.WriteLine("Top 10 Suggestions\t{0}\t{1}%", totalTopTen, ((float)totalTopTen / (float)totalChecked * 100f));
134 | Console.WriteLine("Top 25 Suggestions\t{0}\t{1}%", totalTopTwentyFive, ((float)totalTopTwentyFive / (float)totalChecked * 100f));
135 |
136 | sr.Close();
137 | fs.Close();
138 |
139 |
140 | }
141 | }
142 | }
143 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # NetSpell
2 |
3 | Spell Checker for .net
4 |
5 | [](https://www.nuget.org/packages/NetSpell/)
6 |
7 | ## Download
8 |
9 | The NetSpell library is available on nuget.org via package name `NetSpell`.
10 |
11 | To install NetSpell, run the following command in the Package Manager Console
12 |
13 | PM> Install-Package NetSpell
14 |
15 | More information about NuGet package available at
16 |
17 |
18 | ## Development Builds
19 |
20 | Development builds are available on the myget.org feed. A development build is promoted to the main NuGet feed when it's determined to be stable.
21 |
22 | In your Package Manager settings add the following package source for development builds:
23 |
24 |
25 | ## Overview
26 |
27 | The NetSpell project is a spell checking engine written entirely in managed C#
28 | .net code. NetSpell's suggestions for a misspelled word are generated using phonetic
29 | (sounds like) matching and ranked by a typographical score (looks like). NetSpell
30 | supports multiple languages and the dictionaries are based on the OpenOffice Affix
31 | compression format. The library can be used in Windows or Web Form projects. The
32 | download includes an English dictionary with dictionaries for other languages available for download on the project web site. NetSpell also supports user added words and automatic creation of user dictionaries. The package includes a dictionary build tool to build custom dictionaries.
33 |
34 | ## Dictionaries
35 |
36 | NetSpell dictionaries are based on the OpenOffice dictionary format. You can use
37 | the Dictionary build tool to convert OpenOffice dictionaries to the NetSpell format.
38 | OpenOffice dictionaries can be downloaded here:
39 |
40 | ## Features
41 |
42 | - Detect misspelled works
43 | - Generate suggestions for misspelled word
44 | - Rank possible words for misspelled word
45 | - Support multiple dictionaries
46 |
47 | ## Change Log
48 |
49 | ### NetSpell 2.1.7
50 |
51 | - Fixed DeleteWord bug
52 | - Improved white space handling for DeleteWord
53 | - Renamed SpellingForm to SuggestionForm
54 | - Renamed `en-uk.dic` to `en-gb.dic`
55 |
56 | ### NetSpell 2.1.6
57 |
58 | - Fixed EndOfText event bugs
59 | - Fixed ReplaceWord bug
60 | - Added AlertComplete Property to enable or disable Spell Check Complete message box.
61 | - Added FreeTextBox Demo
62 |
63 | ### NetSpell 2.1.5
64 |
65 | - Changed internal form to lazy load for better resource use in an asp.net application
66 | - Made properties less dependant on the order in wish they are set.
67 | - Fixed a dispose bug in internal form
68 | - Bug fixes in Dictionary Build tool
69 |
70 | ### NetSpell 2.1
71 |
72 | - Implemented spell checking for a range of words
73 | - Added events for ReplacedWord, IgnoredWord, and DeletedWord
74 | - IgnoreList and ReplaceList no longer reset when the Text property is set
75 | - Spelling.Dictionary now lazy loads to make sharing the dictionary more efficient
76 | - WordDictionary is now a component to better support design time and dictionary sharing
77 | - Tracing as been added
78 | - Improved HTML, XML and RTF support
79 | - Added several new demos
80 |
81 | ### NetSpell 2.0.3
82 |
83 | - Major bug fix in WordDictionary.Contains method
84 | - update ignore html routine
85 | - replace all bug fix
86 | - minor web demo bug fixes
87 |
88 | ### NetSpell 2.0.2
89 |
90 | - web demo bug fixes
91 | - changes to user dictionary
92 |
93 | ### NetSpell 2.0.1
94 |
95 | - Complete change to the dictionary
96 | - Added international support
97 | - Added Affix compression support
98 | - Dictionary now based on OpenOffice dictionary format
99 | - Improved web demo
100 | - web demo now supports Ignore All, Replace All and Add Word
101 | - Windows demo changed to a MDI text editor
102 |
103 | ### NetSpell 1.1
104 |
105 | - Added Html Ignore support
106 | - Changed license to BSD for more flexibility
107 |
108 | ### NetSpell 1.0
109 |
110 | - More improvements to Visual Studio designer
111 | - Replace word bug fix
112 | - Improved suggestions by using Ispell's near miss strategy
113 | - Misc bug fixes
114 |
115 | ### NetSpell 0.9
116 |
117 | - Added MainDictionary property to spelling object
118 | - Added UserDictionary property to spelling object to make it easier to identify when there was a user dictionary
119 | - Changed constructor `Spelling(string dictionaryFile, string text)` to `Spelling(string mainDictionaryFile, string userDictionaryFile)`
120 | - Added SpellingForm property to expose the internal suggestion form
121 | - Added 'Add' button to internal suggestion form
122 | - Improved Visual Studio designer support
123 | - Added Web Demo project to demonstrate using NetSpell in an Asp.Net project
124 | - Misc bug fixes
125 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 |
24 | # Visual Studio 2015 cache/options directory
25 | .vs/
26 | # Uncomment if you have tasks that create the project's static files in wwwroot
27 | #wwwroot/
28 |
29 | # MSTest test Results
30 | [Tt]est[Rr]esult*/
31 | [Bb]uild[Ll]og.*
32 |
33 | #NUNIT
34 | *.VisualState.xml
35 | TestResult.xml
36 |
37 | # Build Results of an ATL Project
38 | [Dd]ebugPS/
39 | [Rr]eleasePS/
40 | dlldata.c
41 |
42 | # DNX
43 | project.lock.json
44 | artifacts/
45 |
46 | *_i.c
47 | *_p.c
48 | *_i.h
49 | *.ilk
50 | *.meta
51 | *.obj
52 | *.pch
53 | *.pdb
54 | *.pgc
55 | *.pgd
56 | *.rsp
57 | *.sbr
58 | *.tlb
59 | *.tli
60 | *.tlh
61 | *.tmp
62 | *.tmp_proj
63 | *.log
64 | *.vspscc
65 | *.vssscc
66 | .builds
67 | *.pidb
68 | *.svclog
69 | *.scc
70 |
71 | # Chutzpah Test files
72 | _Chutzpah*
73 |
74 | # Visual C++ cache files
75 | ipch/
76 | *.aps
77 | *.ncb
78 | *.opendb
79 | *.opensdf
80 | *.sdf
81 | *.cachefile
82 |
83 | # Visual Studio profiler
84 | *.psess
85 | *.vsp
86 | *.vspx
87 | *.sap
88 |
89 | # TFS 2012 Local Workspace
90 | $tf/
91 |
92 | # Guidance Automation Toolkit
93 | *.gpState
94 |
95 | # ReSharper is a .NET coding add-in
96 | _ReSharper*/
97 | *.[Rr]e[Ss]harper
98 | *.DotSettings.user
99 |
100 | # JustCode is a .NET coding add-in
101 | .JustCode
102 |
103 | # TeamCity is a build add-in
104 | _TeamCity*
105 |
106 | # DotCover is a Code Coverage Tool
107 | *.dotCover
108 |
109 | # NCrunch
110 | _NCrunch_*
111 | .*crunch*.local.xml
112 | nCrunchTemp_*
113 |
114 | # MightyMoose
115 | *.mm.*
116 | AutoTest.Net/
117 |
118 | # Web workbench (sass)
119 | .sass-cache/
120 |
121 | # Installshield output folder
122 | [Ee]xpress/
123 |
124 | # DocProject is a documentation generator add-in
125 | DocProject/buildhelp/
126 | DocProject/Help/*.HxT
127 | DocProject/Help/*.HxC
128 | DocProject/Help/*.hhc
129 | DocProject/Help/*.hhk
130 | DocProject/Help/*.hhp
131 | DocProject/Help/Html2
132 | DocProject/Help/html
133 |
134 | # Click-Once directory
135 | publish/
136 |
137 | # Publish Web Output
138 | *.[Pp]ublish.xml
139 | *.azurePubxml
140 | # TODO: Comment the next line if you want to checkin your web deploy settings
141 | # but database connection strings (with potential passwords) will be unencrypted
142 | *.pubxml
143 | *.publishproj
144 |
145 | # NuGet Packages
146 | *.nupkg
147 | # The packages folder can be ignored because of Package Restore
148 | **/packages/*
149 | # except build/, which is used as an MSBuild target.
150 | !**/packages/build/
151 | # Uncomment if necessary however generally it will be regenerated when needed
152 | #!**/packages/repositories.config
153 | # NuGet v3's project.json files produces more ignoreable files
154 | *.nuget.props
155 | *.nuget.targets
156 |
157 | # Microsoft Azure Build Output
158 | csx/
159 | *.build.csdef
160 |
161 | # Microsoft Azure Emulator
162 | ecf/
163 | rcf/
164 |
165 | # Microsoft Azure ApplicationInsights config file
166 | ApplicationInsights.config
167 |
168 | # Windows Store app package directory
169 | AppPackages/
170 | BundleArtifacts/
171 |
172 | # Visual Studio cache files
173 | # files ending in .cache can be ignored
174 | *.[Cc]ache
175 | # but keep track of directories ending in .cache
176 | !*.[Cc]ache/
177 |
178 | # Others
179 | ClientBin/
180 | ~$*
181 | *~
182 | *.dbmdl
183 | *.dbproj.schemaview
184 | *.pfx
185 | *.publishsettings
186 | node_modules/
187 | orleans.codegen.cs
188 |
189 | # RIA/Silverlight projects
190 | Generated_Code/
191 |
192 | # Backup & report files from converting an old project file
193 | # to a newer Visual Studio version. Backup files are not needed,
194 | # because we have git ;-)
195 | _UpgradeReport_Files/
196 | Backup*/
197 | UpgradeLog*.XML
198 | UpgradeLog*.htm
199 |
200 | # SQL Server files
201 | *.mdf
202 | *.ldf
203 |
204 | # Business Intelligence projects
205 | *.rdl.data
206 | *.bim.layout
207 | *.bim_*.settings
208 |
209 | # Microsoft Fakes
210 | FakesAssemblies/
211 |
212 | # GhostDoc plugin setting file
213 | *.GhostDoc.xml
214 |
215 | # Node.js Tools for Visual Studio
216 | .ntvs_analysis.dat
217 |
218 | # Visual Studio 6 build log
219 | *.plg
220 |
221 | # Visual Studio 6 workspace options file
222 | *.opt
223 |
224 | # Visual Studio LightSwitch build output
225 | **/*.HTMLClient/GeneratedArtifacts
226 | **/*.DesktopClient/GeneratedArtifacts
227 | **/*.DesktopClient/ModelManifest.xml
228 | **/*.Server/GeneratedArtifacts
229 | **/*.Server/ModelManifest.xml
230 | _Pvt_Extensions
231 |
232 | # Paket dependency manager
233 | .paket/paket.exe
234 |
235 | # FAKE - F# Make
236 | .fake/
237 |
238 | # Custom
239 | /Build
240 | /Tools
241 | /*.txt
242 | /xunit.xml
243 | *.GhostDoc.xml
244 | *.csv
--------------------------------------------------------------------------------
/demo/Demo.WinForm.VBnet/Demo.WinForm.VBnet.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
26 |
42 |
58 |
59 |
60 |
64 |
68 |
72 |
76 |
80 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
102 |
107 |
112 |
117 |
118 |
119 |
123 |
124 |
125 |
126 |
--------------------------------------------------------------------------------
/demo/Demo.WinForm.CSharp/Demo.WinForm.Csharp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
25 |
45 |
65 |
66 |
67 |
72 |
77 |
82 |
87 |
92 |
97 |
98 |
99 |
100 |
101 |
105 |
109 |
114 |
119 |
124 |
125 |
126 |
127 |
128 |
129 |
--------------------------------------------------------------------------------
/src/NetSpell.WinForm.Test/NetSpell.WinForm.Test.csproj:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
25 |
45 |
65 |
66 |
67 |
72 |
77 |
82 |
87 |
92 |
97 |
98 |
99 |
100 |
101 |
105 |
109 |
114 |
119 |
124 |
125 |
126 |
127 |
128 |
129 |
--------------------------------------------------------------------------------
/src/NetSpell.Setup/InstallerActions/InstallerActions.csproj:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
25 |
45 |
65 |
66 |
67 |
72 |
77 |
82 |
87 |
92 |
97 |
102 |
103 |
104 |
105 |
106 |
111 |
116 |
121 |
122 |
123 |
124 |
125 |
126 |
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/Dictionary/Word.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NetSpell.SpellChecker.Dictionary
4 | {
5 | ///
6 | /// The Word class represents a base word in the dictionary
7 | ///
8 | public class Word : IComparable
9 | {
10 | private string _AffixKeys = "";
11 | private int _EditDistance = 0;
12 | private int _height = 0;
13 | private int _index = 0;
14 | private string _PhoneticCode = "";
15 | private string _text = "";
16 |
17 | ///
18 | /// Initializes a new instance of the class
19 | ///
20 | public Word()
21 | {
22 | }
23 |
24 | ///
25 | /// Initializes a new instance of the class
26 | ///
27 | ///
28 | ///
29 | /// The string for the base word
30 | ///
31 | ///
32 | ///
33 | ///
34 | /// The affix keys that can be applied to this base word
35 | ///
36 | ///
37 | ///
38 | ///
39 | /// The phonetic code for this word
40 | ///
41 | ///
42 | public Word(string text, string affixKeys, string phoneticCode)
43 | {
44 | _text = text;
45 | _AffixKeys = affixKeys;
46 | _PhoneticCode = phoneticCode;
47 | }
48 |
49 | ///
50 | /// Initializes a new instance of the class
51 | ///
52 | ///
53 | ///
54 | /// The string for the base word
55 | ///
56 | ///
57 | ///
58 | ///
59 | /// The affix keys that can be applied to this base word
60 | ///
61 | ///
62 | public Word(string text, string affixKeys)
63 | {
64 | _text = text;
65 | _AffixKeys = affixKeys;
66 | }
67 |
68 | ///
69 | /// Initializes a new instance of the class
70 | ///
71 | ///
72 | ///
73 | /// The string for the base word
74 | ///
75 | ///
76 | public Word(string text)
77 | {
78 | _text = text;
79 | }
80 |
81 | ///
82 | /// Initializes a new instance of the class
83 | ///
84 | ///
85 | ///
86 | /// The string for the word
87 | ///
88 | ///
89 | ///
90 | ///
91 | /// The position index of this word
92 | ///
93 | ///
94 | ///
95 | ///
96 | /// The line height of this word
97 | ///
98 | ///
99 | ///
100 | /// A void value...
101 | ///
102 | internal Word(string text, int index, int height)
103 | {
104 | _text = text;
105 | _index = index;
106 | _height = height;
107 | }
108 |
109 | ///
110 | /// Initializes a new instance of the class
111 | ///
112 | ///
113 | ///
114 | /// The string for the base word
115 | ///
116 | ///
117 | ///
118 | ///
119 | /// The edit distance from the misspelled word
120 | ///
121 | ///
122 | internal Word(string text, int editDistance)
123 | {
124 | _text = text;
125 | _EditDistance = editDistance;
126 | }
127 |
128 | ///
129 | /// Sorts a collection of words by EditDistance
130 | ///
131 | ///
132 | /// The compare sorts in desc order, largest EditDistance first
133 | ///
134 | public int CompareTo(object obj)
135 | {
136 | int result = this.EditDistance.CompareTo(((Word)obj).EditDistance);
137 | return result; // * -1; // sorts desc order
138 | }
139 |
140 |
141 | ///
142 | /// The affix keys that can be applied to this base word
143 | ///
144 | public string AffixKeys
145 | {
146 | get {return _AffixKeys;}
147 | set {_AffixKeys = value;}
148 | }
149 |
150 |
151 | ///
152 | /// The index position of where this word appears
153 | ///
154 | public int Index
155 | {
156 | get { return _index; }
157 | set { _index = value; }
158 | }
159 |
160 | ///
161 | /// The phonetic code for this word
162 | ///
163 | public string PhoneticCode
164 | {
165 | get {return _PhoneticCode;}
166 | set {_PhoneticCode = value;}
167 | }
168 |
169 | ///
170 | /// The string for the base word
171 | ///
172 | public string Text
173 | {
174 | get { return _text; }
175 | set { _text = value; }
176 | }
177 |
178 |
179 | ///
180 | /// Used for sorting suggestions by its edit distance for
181 | /// the misspelled word
182 | ///
183 | internal int EditDistance
184 | {
185 | get {return _EditDistance;}
186 | set {_EditDistance = value;}
187 | }
188 |
189 | ///
190 | /// The line height of this word
191 | ///
192 | internal int Height
193 | {
194 | get { return _height; }
195 | set { _height = value; }
196 | }
197 |
198 | ///
199 | /// Converts the word object to a string
200 | ///
201 | ///
202 | /// Returns the Text Property contents
203 | ///
204 | public override string ToString()
205 | {
206 | return _text;
207 | }
208 | }
209 | }
210 |
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/Dictionary/Affix/AffixEntryCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NetSpell.SpellChecker.Dictionary.Affix
4 | {
5 |
6 | ///
7 | /// A collection that stores 'AffixEntry' objects.
8 | ///
9 | [Serializable()]
10 | public class AffixEntryCollection : System.Collections.CollectionBase
11 | {
12 |
13 | ///
14 | /// Initializes a new instance of 'AffixEntryCollection'.
15 | ///
16 | public AffixEntryCollection()
17 | {
18 | }
19 |
20 | ///
21 | /// Initializes a new instance of 'AffixEntryCollection' based on an already existing instance.
22 | ///
23 | ///
24 | /// A 'AffixEntryCollection' from which the contents is copied
25 | ///
26 | public AffixEntryCollection(AffixEntryCollection value)
27 | {
28 | this.AddRange(value);
29 | }
30 |
31 | ///
32 | /// Initializes a new instance of 'AffixEntryCollection' with an array of 'AffixEntry' objects.
33 | ///
34 | ///
35 | /// An array of 'AffixEntry' objects with which to initialize the collection
36 | ///
37 | public AffixEntryCollection(AffixEntry[] value)
38 | {
39 | this.AddRange(value);
40 | }
41 |
42 | ///
43 | /// Represents the 'AffixEntry' item at the specified index position.
44 | ///
45 | ///
46 | /// The zero-based index of the entry to locate in the collection.
47 | ///
48 | ///
49 | /// The entry at the specified index of the collection.
50 | ///
51 | public AffixEntry this[int index]
52 | {
53 | get
54 | {
55 | return ((AffixEntry)(List[index]));
56 | }
57 | set
58 | {
59 | List[index] = value;
60 | }
61 | }
62 |
63 | ///
64 | /// Adds a 'AffixEntry' item with the specified value to the 'AffixEntryCollection'
65 | ///
66 | ///
67 | /// The 'AffixEntry' to add.
68 | ///
69 | ///
70 | /// The index at which the new element was inserted.
71 | ///
72 | public int Add(AffixEntry value)
73 | {
74 | return List.Add(value);
75 | }
76 |
77 | ///
78 | /// Copies the elements of an array at the end of this instance of 'AffixEntryCollection'.
79 | ///
80 | ///
81 | /// An array of 'AffixEntry' objects to add to the collection.
82 | ///
83 | public void AddRange(AffixEntry[] value)
84 | {
85 | for (int Counter = 0; (Counter < value.Length); Counter = (Counter + 1))
86 | {
87 | this.Add(value[Counter]);
88 | }
89 | }
90 |
91 | ///
92 | /// Adds the contents of another 'AffixEntryCollection' at the end of this instance.
93 | ///
94 | ///
95 | /// A 'AffixEntryCollection' containing the objects to add to the collection.
96 | ///
97 | public void AddRange(AffixEntryCollection value)
98 | {
99 | for (int Counter = 0; (Counter < value.Count); Counter = (Counter + 1))
100 | {
101 | this.Add(value[Counter]);
102 | }
103 | }
104 |
105 | ///
106 | /// Gets a value indicating whether the 'AffixEntryCollection' contains the specified value.
107 | ///
108 | ///
109 | /// The item to locate.
110 | ///
111 | ///
112 | /// True if the item exists in the collection; false otherwise.
113 | ///
114 | public bool Contains(AffixEntry value)
115 | {
116 | return List.Contains(value);
117 | }
118 |
119 | ///
120 | /// Copies the 'AffixEntryCollection' values to a one-dimensional System.Array
121 | /// instance starting at the specified array index.
122 | ///
123 | ///
124 | /// The one-dimensional System.Array that represents the copy destination.
125 | ///
126 | ///
127 | /// The index in the array where copying begins.
128 | ///
129 | public void CopyTo(AffixEntry[] array, int index)
130 | {
131 | List.CopyTo(array, index);
132 | }
133 |
134 | ///
135 | /// Returns the index of a 'AffixEntry' object in the collection.
136 | ///
137 | ///
138 | /// The 'AffixEntry' object whose index will be retrieved.
139 | ///
140 | ///
141 | /// If found, the index of the value; otherwise, -1.
142 | ///
143 | public int IndexOf(AffixEntry value)
144 | {
145 | return List.IndexOf(value);
146 | }
147 |
148 | ///
149 | /// Inserts an existing 'AffixEntry' into the collection at the specified index.
150 | ///
151 | ///
152 | /// The zero-based index where the new item should be inserted.
153 | ///
154 | ///
155 | /// The item to insert.
156 | ///
157 | public void Insert(int index, AffixEntry value)
158 | {
159 | List.Insert(index, value);
160 | }
161 |
162 | ///
163 | /// Returns an enumerator that can be used to iterate through
164 | /// the 'AffixEntryCollection'.
165 | ///
166 | public new AffixEntryEnumerator GetEnumerator()
167 | {
168 | return new AffixEntryEnumerator(this);
169 | }
170 |
171 | ///
172 | /// Removes a specific item from the 'AffixEntryCollection'.
173 | ///
174 | ///
175 | /// The item to remove from the 'AffixEntryCollection'.
176 | ///
177 | public void Remove(AffixEntry value)
178 | {
179 | List.Remove(value);
180 | }
181 | }
182 |
183 | }
184 |
--------------------------------------------------------------------------------
/demo/Demo.WinForm.VBnet/DemoForm.vb:
--------------------------------------------------------------------------------
1 | Public Class DemoForm
2 | Inherits System.Windows.Forms.Form
3 |
4 | #Region " Windows Form Designer generated code "
5 |
6 | Public Sub New()
7 | MyBase.New()
8 |
9 | 'This call is required by the Windows Form Designer.
10 | InitializeComponent()
11 |
12 | 'Add any initialization after the InitializeComponent() call
13 |
14 | End Sub
15 |
16 | 'Form overrides dispose to clean up the component list.
17 | Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
18 | If disposing Then
19 | If Not (components Is Nothing) Then
20 | components.Dispose()
21 | End If
22 | End If
23 | MyBase.Dispose(disposing)
24 | End Sub
25 |
26 | 'Required by the Windows Form Designer
27 | Private components As System.ComponentModel.IContainer
28 |
29 | 'NOTE: The following procedure is required by the Windows Form Designer
30 | 'It can be modified using the Windows Form Designer.
31 | 'Do not modify it using the code editor.
32 | Friend WithEvents DemoRichText As System.Windows.Forms.RichTextBox
33 | Friend WithEvents SpellButton As System.Windows.Forms.Button
34 | Friend WithEvents WordDictionary As NetSpell.SpellChecker.Dictionary.WordDictionary
35 | Friend WithEvents SpellChecker As NetSpell.SpellChecker.Spelling
36 | Private Sub InitializeComponent()
37 | Me.components = New System.ComponentModel.Container
38 | Dim configurationAppSettings As System.Configuration.AppSettingsReader = New System.Configuration.AppSettingsReader
39 | Me.DemoRichText = New System.Windows.Forms.RichTextBox
40 | Me.SpellButton = New System.Windows.Forms.Button
41 | Me.WordDictionary = New NetSpell.SpellChecker.Dictionary.WordDictionary(Me.components)
42 | Me.SpellChecker = New NetSpell.SpellChecker.Spelling(Me.components)
43 | Me.SuspendLayout()
44 | '
45 | 'DemoRichText
46 | '
47 | Me.DemoRichText.AcceptsTab = True
48 | Me.DemoRichText.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
49 | Or System.Windows.Forms.AnchorStyles.Left) _
50 | Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
51 | Me.DemoRichText.AutoWordSelection = True
52 | Me.DemoRichText.Location = New System.Drawing.Point(16, 8)
53 | Me.DemoRichText.Name = "DemoRichText"
54 | Me.DemoRichText.ShowSelectionMargin = True
55 | Me.DemoRichText.Size = New System.Drawing.Size(440, 328)
56 | Me.DemoRichText.TabIndex = 0
57 | Me.DemoRichText.Text = "Becuase people are realy bad spelers, ths produc was desinged to prevent speling " & _
58 | "erors in a text area like ths."
59 | '
60 | 'SpellButton
61 | '
62 | Me.SpellButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
63 | Me.SpellButton.Location = New System.Drawing.Point(376, 344)
64 | Me.SpellButton.Name = "SpellButton"
65 | Me.SpellButton.Size = New System.Drawing.Size(80, 23)
66 | Me.SpellButton.TabIndex = 1
67 | Me.SpellButton.Text = "Spell Check"
68 | '
69 | 'WordDictionary
70 | '
71 | Me.WordDictionary.DictionaryFolder = CType(configurationAppSettings.GetValue("WordDictionary.DictionaryFolder", GetType(System.String)), String)
72 | '
73 | 'SpellChecker
74 | '
75 | Me.SpellChecker.Dictionary = Me.WordDictionary
76 | '
77 | 'DemoForm
78 | '
79 | Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
80 | Me.ClientSize = New System.Drawing.Size(472, 382)
81 | Me.Controls.Add(Me.SpellButton)
82 | Me.Controls.Add(Me.DemoRichText)
83 | Me.Name = "DemoForm"
84 | Me.Text = "NetSpell Demo"
85 | Me.ResumeLayout(False)
86 |
87 | End Sub
88 |
89 | #End Region
90 |
91 | Private Sub SpellButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SpellButton.Click
92 | Me.SpellChecker.Text = Me.DemoRichText.Text
93 | Me.SpellChecker.SpellCheck()
94 | End Sub
95 |
96 | Private Sub SpellChecker_DeletedWord(ByVal sender As Object, ByVal e As NetSpell.SpellChecker.SpellingEventArgs) Handles SpellChecker.DeletedWord
97 | 'save existing selecting
98 | Dim start As Integer = Me.DemoRichText.SelectionStart
99 | Dim length As Integer = Me.DemoRichText.SelectionLength
100 |
101 | 'select word for this event
102 | Me.DemoRichText.Select(e.TextIndex, e.Word.Length)
103 | 'delete word
104 | Me.DemoRichText.SelectedText = ""
105 |
106 | If ((start + length) > Me.DemoRichText.Text.Length) Then
107 | length = 0
108 | End If
109 | 'restore selection
110 | Me.DemoRichText.Select(start, length)
111 | End Sub
112 |
113 | Private Sub SpellChecker_ReplacedWord(ByVal sender As Object, ByVal e As NetSpell.SpellChecker.ReplaceWordEventArgs) Handles SpellChecker.ReplacedWord
114 | 'save existing selecting
115 | Dim start As Integer = Me.DemoRichText.SelectionStart
116 | Dim length As Integer = Me.DemoRichText.SelectionLength
117 |
118 | 'select word for this event
119 | Me.DemoRichText.Select(e.TextIndex, e.Word.Length)
120 | 'replace word
121 | Me.DemoRichText.SelectedText = e.ReplacementWord
122 |
123 | If ((start + length) > Me.DemoRichText.Text.Length) Then
124 | length = 0
125 | End If
126 | 'restore selection
127 | Me.DemoRichText.Select(start, length)
128 | End Sub
129 | End Class
130 |
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/Controls/CheckAsYouType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Collections;
4 | using System.Diagnostics;
5 | using System.Windows.Forms;
6 |
7 | using NetSpell.SpellChecker;
8 |
9 | namespace NetSpell.SpellChecker.Controls
10 | {
11 | ///
12 | /// Summary description for CheckAsYouType.
13 | ///
14 | [ProvideProperty("EnableCheck", typeof(TextBoxBase))]
15 | [ProvideProperty("SpellChecker", typeof(TextBoxBase))]
16 | public class CheckAsYouType : Component, ISupportInitialize, IExtenderProvider, IMessageFilter
17 | {
18 |
19 | ///
20 | /// Required designer variable.
21 | ///
22 | private System.ComponentModel.Container components = null;
23 |
24 | private Hashtable textBoxes = new Hashtable();
25 | private Spelling _spellChecker;
26 |
27 | public CheckAsYouType(System.ComponentModel.IContainer container)
28 | {
29 | /// Required for Windows.Forms Class Composition Designer support
30 | container.Add(this);
31 | InitializeComponent();
32 | Initialize();
33 | }
34 |
35 | public CheckAsYouType()
36 | {
37 | /// Required for Windows.Forms Class Composition Designer support
38 | InitializeComponent();
39 | Initialize();
40 | }
41 |
42 | private void Initialize()
43 | {
44 | Application.AddMessageFilter(this);
45 | Application.Idle +=new EventHandler(OnIdle);
46 | }
47 |
48 | #region Extended Properties
49 |
50 | [
51 | Category("SpellChecker"),
52 | Description("Spell Check this Control As You Type"),
53 | ]
54 | public bool GetEnableCheck(TextBoxBase extendee)
55 | {
56 | return this.textBoxes.Contains(extendee.Handle);
57 | }
58 |
59 | public void SetEnableCheck(TextBoxBase extendee, bool value)
60 | {
61 | if(value && !this.textBoxes.Contains(extendee.Handle))
62 | {
63 | this.textBoxes.Add(extendee.Handle, new CheckAsYouTypeState(extendee));
64 | extendee.TextChanged += new EventHandler(OnTextChanged);
65 | extendee.MouseDown += new MouseEventHandler(OnMouseDown);
66 | }
67 | else if(!value && this.textBoxes.Contains(extendee.Handle))
68 | {
69 | this.textBoxes.Remove(extendee);
70 | extendee.TextChanged -= new EventHandler(OnTextChanged);
71 | extendee.MouseDown -= new MouseEventHandler(OnMouseDown);
72 | }
73 | }
74 |
75 | [
76 | Category("SpellChecker"),
77 | Description("Spell Check instance to use"),
78 | ]
79 | public Spelling GetSpellChecker(TextBoxBase extendee)
80 | {
81 | return _spellChecker;
82 | }
83 |
84 | public void SetSpellChecker(TextBoxBase extendee, Spelling value)
85 | {
86 | _spellChecker = value;
87 | }
88 |
89 | #endregion //Extended Properties
90 |
91 |
92 |
93 | ///
94 | /// Clean up any resources being used.
95 | ///
96 | protected override void Dispose( bool disposing )
97 | {
98 | if( disposing )
99 | {
100 | if(components != null)
101 | {
102 | components.Dispose();
103 | }
104 | }
105 | base.Dispose( disposing );
106 | }
107 |
108 |
109 | #region Component Designer generated code
110 | ///
111 | /// Required method for Designer support - do not modify
112 | /// the contents of this method with the code editor.
113 | ///
114 | private void InitializeComponent()
115 | {
116 | components = new System.ComponentModel.Container();
117 | }
118 | #endregion
119 |
120 | #region IExtenderProvider Members
121 |
122 | public bool CanExtend(object extendee)
123 | {
124 | if (extendee is TextBoxBase)
125 | return true;
126 |
127 | return false;
128 | }
129 |
130 | #endregion
131 |
132 | #region IMessageFilter Members
133 |
134 |
135 |
136 | public bool PreFilterMessage(ref Message m)
137 | {
138 | // only listen to extended controls
139 | if(this.textBoxes.Contains(m.HWnd))
140 | {
141 | TextBoxBase textBox = ((CheckAsYouTypeState)this.textBoxes[m.HWnd]).TextBoxBaseInstance;
142 |
143 | if(m.Msg == NativeMethods.WM_PAINT)
144 | OnPaint(textBox, null);
145 | else if(m.Msg == NativeMethods.WM_ERASEBKGND)
146 | Console.WriteLine("WM_ERASEBKGND:{0}", textBox.Name);
147 | else if(m.Msg == NativeMethods.WM_HSCROLL)
148 | Console.WriteLine("WM_HSCROLL:{0}", textBox.Name);
149 | else if(m.Msg == NativeMethods.WM_VSCROLL)
150 | Console.WriteLine("WM_VSCROLL:{0}", textBox.Name);
151 | else if(m.Msg == NativeMethods.WM_CAPTURECHANGED)
152 | Console.WriteLine("WM_CAPTURECHANGED:{0}", textBox.Name);
153 | //else
154 | //Console.WriteLine("Msg: 0x{0}", m.Msg.ToString("x4"));
155 |
156 |
157 | }
158 |
159 | // never handle messages
160 | return false;
161 | }
162 |
163 | #endregion
164 |
165 | #region ISupportInitialize Members
166 |
167 | public void BeginInit()
168 | {
169 | // TODO: Add TextBoxExtender.BeginInit implementation
170 | }
171 |
172 | public void EndInit()
173 | {
174 | // TODO: Add TextBoxExtender.EndInit implementation
175 | }
176 |
177 | #endregion
178 |
179 | private void OnTextChanged(object sender, EventArgs e)
180 | {
181 | if(sender is TextBoxBase)
182 | {
183 | TextBoxBase textBox = (TextBoxBase)sender;
184 | Console.WriteLine("OnTextChanged:{0}", textBox.Name);
185 | }
186 | }
187 |
188 | private void OnPaint(object sender, PaintEventArgs e)
189 | {
190 | if(sender is TextBoxBase)
191 | {
192 | TextBoxBase textBox = (TextBoxBase)sender;
193 | Console.WriteLine("OnPaint:{0}", textBox.Name);
194 | }
195 | }
196 |
197 | private void OnMouseDown(object sender, MouseEventArgs e)
198 | {
199 | if(sender is TextBoxBase)
200 | {
201 | TextBoxBase textBox = (TextBoxBase)sender;
202 | Console.WriteLine("OnMouseDown:{0}", textBox.Name);
203 | }
204 | }
205 |
206 | private void OnIdle(object sender, EventArgs e)
207 | {
208 |
209 | }
210 | }
211 | }
212 |
--------------------------------------------------------------------------------
/src/NetSpell.SpellChecker/Dictionary/Phonetic/PhoneticRuleCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NetSpell.SpellChecker.Dictionary.Phonetic
4 | {
5 | ///
6 | /// A collection that stores 'PhoneticRule' objects.
7 | ///
8 | [Serializable()]
9 | public class PhoneticRuleCollection : System.Collections.CollectionBase
10 | {
11 |
12 | ///
13 | /// Initializes a new instance of 'PhoneticRuleCollection'.
14 | ///
15 | public PhoneticRuleCollection()
16 | {
17 | }
18 |
19 | ///
20 | /// Initializes a new instance of 'PhoneticRuleCollection' based on an already existing instance.
21 | ///
22 | ///
23 | /// A 'PhoneticRuleCollection' from which the contents is copied
24 | ///
25 | public PhoneticRuleCollection(PhoneticRuleCollection value)
26 | {
27 | this.AddRange(value);
28 | }
29 |
30 | ///
31 | /// Initializes a new instance of 'PhoneticRuleCollection' with an array of 'PhoneticRule' objects.
32 | ///
33 | ///
34 | /// An array of 'PhoneticRule' objects with which to initialize the collection
35 | ///
36 | public PhoneticRuleCollection(PhoneticRule[] value)
37 | {
38 | this.AddRange(value);
39 | }
40 |
41 | ///
42 | /// Represents the 'PhoneticRule' item at the specified index position.
43 | ///
44 | ///
45 | /// The zero-based index of the entry to locate in the collection.
46 | ///
47 | ///
48 | /// The entry at the specified index of the collection.
49 | ///
50 | public PhoneticRule this[int index]
51 | {
52 | get
53 | {
54 | return ((PhoneticRule)(List[index]));
55 | }
56 | set
57 | {
58 | List[index] = value;
59 | }
60 | }
61 |
62 | ///
63 | /// Adds a 'PhoneticRule' item with the specified value to the 'PhoneticRuleCollection'
64 | ///
65 | ///
66 | /// The 'PhoneticRule' to add.
67 | ///
68 | ///
69 | /// The index at which the new element was inserted.
70 | ///
71 | public int Add(PhoneticRule value)
72 | {
73 | return List.Add(value);
74 | }
75 |
76 | ///
77 | /// Copies the elements of an array at the end of this instance of 'PhoneticRuleCollection'.
78 | ///
79 | ///
80 | /// An array of 'PhoneticRule' objects to add to the collection.
81 | ///
82 | public void AddRange(PhoneticRule[] value)
83 | {
84 | for (int Counter = 0; (Counter < value.Length); Counter = (Counter + 1))
85 | {
86 | this.Add(value[Counter]);
87 | }
88 | }
89 |
90 | ///
91 | /// Adds the contents of another 'PhoneticRuleCollection' at the end of this instance.
92 | ///
93 | ///
94 | /// A 'PhoneticRuleCollection' containing the objects to add to the collection.
95 | ///
96 | public void AddRange(PhoneticRuleCollection value)
97 | {
98 | for (int Counter = 0; (Counter < value.Count); Counter = (Counter + 1))
99 | {
100 | this.Add(value[Counter]);
101 | }
102 | }
103 |
104 | ///
105 | /// Gets a value indicating whether the 'PhoneticRuleCollection' contains the specified value.
106 | ///
107 | ///
108 | /// The item to locate.
109 | ///
110 | ///
111 | /// True if the item exists in the collection; false otherwise.
112 | ///
113 | public bool Contains(PhoneticRule value)
114 | {
115 | return List.Contains(value);
116 | }
117 |
118 | ///
119 | /// Copies the 'PhoneticRuleCollection' values to a one-dimensional System.Array
120 | /// instance starting at the specified array index.
121 | ///
122 | ///
123 | /// The one-dimensional System.Array that represents the copy destination.
124 | ///
125 | ///
126 | /// The index in the array where copying begins.
127 | ///
128 | public void CopyTo(PhoneticRule[] array, int index)
129 | {
130 | List.CopyTo(array, index);
131 | }
132 |
133 | ///
134 | /// Returns the index of a 'PhoneticRule' object in the collection.
135 | ///
136 | ///
137 | /// The 'PhoneticRule' object whose index will be retrieved.
138 | ///
139 | ///
140 | /// If found, the index of the value; otherwise, -1.
141 | ///
142 | public int IndexOf(PhoneticRule value)
143 | {
144 | return List.IndexOf(value);
145 | }
146 |
147 | ///
148 | /// Inserts an existing 'PhoneticRule' into the collection at the specified index.
149 | ///
150 | ///
151 | /// The zero-based index where the new item should be inserted.
152 | ///
153 | ///
154 | /// The item to insert.
155 | ///
156 | public void Insert(int index, PhoneticRule value)
157 | {
158 | List.Insert(index, value);
159 | }
160 |
161 | ///
162 | /// Returns an enumerator that can be used to iterate through
163 | /// the 'PhoneticRuleCollection'.
164 | ///
165 | public new PhoneticRuleEnumerator GetEnumerator()
166 | {
167 | return new PhoneticRuleEnumerator(this);
168 | }
169 |
170 | ///
171 | /// Removes a specific item from the 'PhoneticRuleCollection'.
172 | ///
173 | ///
174 | /// The item to remove from the 'PhoneticRuleCollection'.
175 | ///
176 | public void Remove(PhoneticRule value)
177 | {
178 | List.Remove(value);
179 | }
180 | }
181 |
182 | }
183 |
--------------------------------------------------------------------------------
/src/NetSpell.build:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
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 |
110 |
111 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/src/NetSpell.Tests/DictionaryTest.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2003, Paul Welter
2 | // All rights reserved.
3 |
4 | using System;
5 | using System.Collections;
6 | using System.IO;
7 | using System.Text;
8 | using System.Diagnostics;
9 |
10 | using NUnit.Framework;
11 | using NetSpell.SpellChecker;
12 | using NetSpell.SpellChecker.Dictionary;
13 | using NetSpell.SpellChecker.Dictionary.Phonetic;
14 | using NetSpell.SpellChecker.Dictionary.Affix;
15 |
16 | namespace NetSpell.Tests
17 | {
18 | ///
19 | /// Summary description for DictionaryTest.
20 | ///
21 | [TestFixture]
22 | public class DictionaryTest
23 | {
24 | WordDictionary _WordDictionary = new WordDictionary();
25 | PerformanceTimer _timer = new PerformanceTimer();
26 |
27 |
28 | public DictionaryTest()
29 | {
30 | }
31 |
32 | [SetUp]
33 | public void SetUp()
34 | {
35 | _WordDictionary.DictionaryFolder = @"..\..\..\..\dic";
36 | _WordDictionary.Initialize();
37 | }
38 |
39 | [Test]
40 | public void Contains()
41 | {
42 | string validFile = @"..\..\Data\ValidWords.txt";
43 | string invalidFile = @"..\..\Data\SuggestionTest.txt";
44 |
45 | // open file
46 | FileStream fs = new FileStream(validFile, FileMode.Open, FileAccess.Read, FileShare.Read);
47 | StreamReader sr = new StreamReader(fs, Encoding.UTF7);
48 |
49 | _timer.StartTimer();
50 |
51 | // read line by line
52 | while (sr.Peek() >= 0)
53 | {
54 | string tempLine = sr.ReadLine().Trim();
55 | if (tempLine.Length > 0)
56 | {
57 | if (tempLine.IndexOf(' ') > 0)
58 | {
59 | tempLine = tempLine.Substring(0, tempLine.IndexOf(' '));
60 | }
61 |
62 | if (!_WordDictionary.Contains(tempLine))
63 | {
64 | Assertion.Fail(string.Format("Did not find word: {0}" , tempLine));
65 | }
66 | }
67 | }
68 | float checkTime = _timer.StopTimer();
69 | Console.WriteLine("Valid words check time:" + checkTime.ToString());
70 |
71 | sr.Close();
72 | fs.Close();
73 |
74 |
75 | // open file
76 | fs = new FileStream(invalidFile, FileMode.Open, FileAccess.Read, FileShare.Read);
77 | sr = new StreamReader(fs, Encoding.UTF7);
78 |
79 | _timer.StartTimer();
80 | // read line by line
81 | while (sr.Peek() >= 0)
82 | {
83 | string tempLine = sr.ReadLine().Trim();
84 | if (tempLine.Length > 0)
85 | {
86 | if (tempLine.IndexOf(' ') > 0)
87 | {
88 | tempLine = tempLine.Substring(0, tempLine.IndexOf(' '));
89 | }
90 |
91 | if (_WordDictionary.Contains(tempLine))
92 | {
93 | Assertion.Fail(string.Format("Word found that should not be: {0}" , tempLine));
94 | }
95 | }
96 |
97 | }
98 | float invalidTime = _timer.StopTimer();
99 | Console.WriteLine("Invalid words check time:" + invalidTime.ToString());
100 |
101 | sr.Close();
102 | fs.Close();
103 | }
104 |
105 | [Test]
106 | public void PhoneticCode()
107 | {
108 | string code = _WordDictionary.PhoneticCode("test");
109 |
110 | Assertion.AssertEquals("Incorrect Phonitic Code", "*BRFTT", _WordDictionary.PhoneticCode("abbreviated"));
111 | Assertion.AssertEquals("Incorrect Phonitic Code", "*BLT", _WordDictionary.PhoneticCode("ability"));
112 | Assertion.AssertEquals("Incorrect Phonitic Code", "NMNT", _WordDictionary.PhoneticCode("nominate"));
113 | Assertion.AssertEquals("Incorrect Phonitic Code", "NN", _WordDictionary.PhoneticCode("noun"));
114 | Assertion.AssertEquals("Incorrect Phonitic Code", "*BKKT", _WordDictionary.PhoneticCode("object"));
115 | Assertion.AssertEquals("Incorrect Phonitic Code", "*TKR", _WordDictionary.PhoneticCode("outgrow"));
116 | Assertion.AssertEquals("Incorrect Phonitic Code", "*TLNTX", _WordDictionary.PhoneticCode("outlandish"));
117 | Assertion.AssertEquals("Incorrect Phonitic Code", "PBLX", _WordDictionary.PhoneticCode("publish"));
118 | Assertion.AssertEquals("Incorrect Phonitic Code", "STL", _WordDictionary.PhoneticCode("sightly"));
119 | Assertion.AssertEquals("Incorrect Phonitic Code", "SPL", _WordDictionary.PhoneticCode("supple"));
120 | Assertion.AssertEquals("Incorrect Phonitic Code", "TRTNS", _WordDictionary.PhoneticCode("triteness"));
121 |
122 | }
123 |
124 | [Test]
125 | public void ExpandWord()
126 | {
127 |
128 | ArrayList words = new ArrayList();
129 |
130 | words = _WordDictionary.ExpandWord(new Word("abbreviated", "UA"));
131 | Assertion.AssertEquals("Incorrect Number of expanded words", 3, words.Count);
132 |
133 | words = _WordDictionary.ExpandWord(new Word("ability", "IMES"));
134 | Assertion.AssertEquals("Incorrect Number of expanded words", 9, words.Count);
135 |
136 | words = _WordDictionary.ExpandWord(new Word("nominate", "CDSAXNG"));
137 | Assertion.AssertEquals("Incorrect Number of expanded words", 18, words.Count);
138 |
139 | words = _WordDictionary.ExpandWord(new Word("noun", "SMK"));
140 | Assertion.AssertEquals("Incorrect Number of expanded words", 6, words.Count);
141 |
142 | words = _WordDictionary.ExpandWord(new Word("object", "SGVMD"));
143 | Assertion.AssertEquals("Incorrect Number of expanded words", 6, words.Count);
144 |
145 | words = _WordDictionary.ExpandWord(new Word("outgrow", "GSH"));
146 | Assertion.AssertEquals("Incorrect Number of expanded words", 4, words.Count);
147 |
148 | words = _WordDictionary.ExpandWord(new Word("outlandish", "PY"));
149 | Assertion.AssertEquals("Incorrect Number of expanded words", 3, words.Count);
150 |
151 | words = _WordDictionary.ExpandWord(new Word("publish", "JDRSBZG"));
152 | Assertion.AssertEquals("Incorrect Number of expanded words", 8, words.Count);
153 |
154 | words = _WordDictionary.ExpandWord(new Word("sightly", "TURP"));
155 | Assertion.AssertEquals("Incorrect Number of expanded words", 7, words.Count);
156 |
157 | words = _WordDictionary.ExpandWord(new Word("supple", "SPLY"));
158 | Assertion.AssertEquals("Incorrect Number of expanded words", 5, words.Count);
159 |
160 | words = _WordDictionary.ExpandWord(new Word("triteness", "SF"));
161 | Assertion.AssertEquals("Incorrect Number of expanded words", 4, words.Count);
162 |
163 | }
164 |
165 | }
166 | }
167 |
--------------------------------------------------------------------------------
/demo/Demo.WinForm.CSharp/DemoForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Collections;
4 | using System.ComponentModel;
5 | using System.Windows.Forms;
6 | using System.Data;
7 |
8 | namespace Demo.WinForm.Csharp
9 | {
10 | ///
11 | /// Summary description for Form1.
12 | ///
13 | public class DemoForm : System.Windows.Forms.Form
14 | {
15 | private NetSpell.SpellChecker.Spelling spelling;
16 | private NetSpell.SpellChecker.Dictionary.WordDictionary wordDictionary;
17 | internal System.Windows.Forms.Button spellButton;
18 | internal System.Windows.Forms.RichTextBox demoRichText;
19 | private System.ComponentModel.IContainer components;
20 |
21 | public DemoForm()
22 | {
23 | //
24 | // Required for Windows Form Designer support
25 | //
26 | InitializeComponent();
27 |
28 | //
29 | // TODO: Add any constructor code after InitializeComponent call
30 | //
31 | }
32 |
33 | ///
34 | /// Clean up any resources being used.
35 | ///
36 | protected override void Dispose( bool disposing )
37 | {
38 | if( disposing )
39 | {
40 | if (components != null)
41 | {
42 | components.Dispose();
43 | }
44 | }
45 | base.Dispose( disposing );
46 | }
47 |
48 | #region Windows Form Designer generated code
49 | ///
50 | /// Required method for Designer support - do not modify
51 | /// the contents of this method with the code editor.
52 | ///
53 | private void InitializeComponent()
54 | {
55 | this.components = new System.ComponentModel.Container();
56 | System.Configuration.AppSettingsReader configurationAppSettings = new System.Configuration.AppSettingsReader();
57 | this.spellButton = new System.Windows.Forms.Button();
58 | this.demoRichText = new System.Windows.Forms.RichTextBox();
59 | this.spelling = new NetSpell.SpellChecker.Spelling(this.components);
60 | this.wordDictionary = new NetSpell.SpellChecker.Dictionary.WordDictionary(this.components);
61 | this.SuspendLayout();
62 | //
63 | // spellButton
64 | //
65 | this.spellButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
66 | this.spellButton.Location = new System.Drawing.Point(344, 368);
67 | this.spellButton.Name = "spellButton";
68 | this.spellButton.Size = new System.Drawing.Size(80, 23);
69 | this.spellButton.TabIndex = 3;
70 | this.spellButton.Text = "Spell Check";
71 | this.spellButton.Click += new System.EventHandler(this.spellButton_Click);
72 | //
73 | // demoRichText
74 | //
75 | this.demoRichText.AcceptsTab = true;
76 | this.demoRichText.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
77 | | System.Windows.Forms.AnchorStyles.Left)
78 | | System.Windows.Forms.AnchorStyles.Right)));
79 | this.demoRichText.AutoWordSelection = true;
80 | this.demoRichText.Location = new System.Drawing.Point(16, 16);
81 | this.demoRichText.Name = "demoRichText";
82 | this.demoRichText.ShowSelectionMargin = true;
83 | this.demoRichText.Size = new System.Drawing.Size(408, 344);
84 | this.demoRichText.TabIndex = 2;
85 | this.demoRichText.Text = "Becuase people are realy bad spelers, ths produc was desinged to prevent speling " +
86 | "erors in a text area like ths.";
87 | //
88 | // spelling
89 | //
90 | this.spelling.Dictionary = this.wordDictionary;
91 | this.spelling.ReplacedWord += new NetSpell.SpellChecker.Spelling.ReplacedWordEventHandler(this.spelling_ReplacedWord);
92 | this.spelling.EndOfText += new NetSpell.SpellChecker.Spelling.EndOfTextEventHandler(this.spelling_EndOfText);
93 | this.spelling.DeletedWord += new NetSpell.SpellChecker.Spelling.DeletedWordEventHandler(this.spelling_DeletedWord);
94 | //
95 | // wordDictionary
96 | //
97 | this.wordDictionary.DictionaryFolder = ((string)(configurationAppSettings.GetValue("wordDictionary.DictionaryFolder", typeof(string))));
98 | //
99 | // DemoForm
100 | //
101 | this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
102 | this.ClientSize = new System.Drawing.Size(440, 406);
103 | this.Controls.Add(this.spellButton);
104 | this.Controls.Add(this.demoRichText);
105 | this.Name = "DemoForm";
106 | this.Text = "NetSpell Demo";
107 | this.ResumeLayout(false);
108 |
109 | }
110 | #endregion
111 |
112 | ///
113 | /// The main entry point for the application.
114 | ///
115 | [STAThread]
116 | static void Main()
117 | {
118 | Application.Run(new DemoForm());
119 | }
120 |
121 | private void spellButton_Click(object sender, System.EventArgs e)
122 | {
123 | this.spelling.Text = this.demoRichText.Text;
124 | this.spelling.SpellCheck();
125 |
126 | }
127 |
128 | private void spelling_DeletedWord(object sender, NetSpell.SpellChecker.SpellingEventArgs e)
129 | {
130 | int start = this.demoRichText.SelectionStart;
131 | int length = this.demoRichText.SelectionLength;
132 |
133 | this.demoRichText.Select(e.TextIndex, e.Word.Length);
134 | this.demoRichText.SelectedText = "";
135 |
136 | if(start > this.demoRichText.Text.Length)
137 | start = this.demoRichText.Text.Length;
138 |
139 | if((start + length) > this.demoRichText.Text.Length)
140 | length = 0;
141 |
142 | this.demoRichText.Select(start, length);
143 | }
144 |
145 | private void spelling_ReplacedWord(object sender, NetSpell.SpellChecker.ReplaceWordEventArgs e)
146 | {
147 | int start = this.demoRichText.SelectionStart;
148 | int length = this.demoRichText.SelectionLength;
149 |
150 | this.demoRichText.Select(e.TextIndex, e.Word.Length);
151 | this.demoRichText.SelectedText = e.ReplacementWord;
152 |
153 | if(start > this.demoRichText.Text.Length)
154 | start = this.demoRichText.Text.Length;
155 |
156 | if((start + length) > this.demoRichText.Text.Length)
157 | length = 0;
158 |
159 | this.demoRichText.Select(start, length);
160 | }
161 |
162 | private void spelling_EndOfText(object sender, System.EventArgs e)
163 | {
164 | Console.WriteLine("EndOfText");
165 | }
166 | }
167 | }
168 |
--------------------------------------------------------------------------------
/src/NetSpell.WinForm.Test/DemoForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Collections;
4 | using System.ComponentModel;
5 | using System.Windows.Forms;
6 | using System.Data;
7 |
8 | namespace NetSpell.WinForm.Test
9 | {
10 | ///
11 | /// Summary description for Form1.
12 | ///
13 | public class DemoForm : System.Windows.Forms.Form
14 | {
15 | private NetSpell.SpellChecker.Spelling spelling;
16 | private NetSpell.SpellChecker.Dictionary.WordDictionary wordDictionary;
17 | internal System.Windows.Forms.Button spellButton;
18 | internal System.Windows.Forms.RichTextBox demoRichText;
19 | private System.ComponentModel.IContainer components;
20 |
21 | public DemoForm()
22 | {
23 | //
24 | // Required for Windows Form Designer support
25 | //
26 | InitializeComponent();
27 |
28 | //
29 | // TODO: Add any constructor code after InitializeComponent call
30 | //
31 | }
32 |
33 | ///
34 | /// Clean up any resources being used.
35 | ///
36 | protected override void Dispose( bool disposing )
37 | {
38 | if( disposing )
39 | {
40 | if (components != null)
41 | {
42 | components.Dispose();
43 | }
44 | }
45 | base.Dispose( disposing );
46 | }
47 |
48 | #region Windows Form Designer generated code
49 | ///
50 | /// Required method for Designer support - do not modify
51 | /// the contents of this method with the code editor.
52 | ///
53 | private void InitializeComponent()
54 | {
55 | this.components = new System.ComponentModel.Container();
56 | System.Configuration.AppSettingsReader configurationAppSettings = new System.Configuration.AppSettingsReader();
57 | this.spellButton = new System.Windows.Forms.Button();
58 | this.demoRichText = new System.Windows.Forms.RichTextBox();
59 | this.spelling = new NetSpell.SpellChecker.Spelling(this.components);
60 | this.wordDictionary = new NetSpell.SpellChecker.Dictionary.WordDictionary(this.components);
61 | this.SuspendLayout();
62 | //
63 | // spellButton
64 | //
65 | this.spellButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
66 | this.spellButton.Location = new System.Drawing.Point(344, 368);
67 | this.spellButton.Name = "spellButton";
68 | this.spellButton.Size = new System.Drawing.Size(80, 23);
69 | this.spellButton.TabIndex = 3;
70 | this.spellButton.Text = "Spell Check";
71 | this.spellButton.Click += new System.EventHandler(this.spellButton_Click);
72 | //
73 | // demoRichText
74 | //
75 | this.demoRichText.AcceptsTab = true;
76 | this.demoRichText.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
77 | | System.Windows.Forms.AnchorStyles.Left)
78 | | System.Windows.Forms.AnchorStyles.Right)));
79 | this.demoRichText.AutoWordSelection = true;
80 | this.demoRichText.Location = new System.Drawing.Point(16, 16);
81 | this.demoRichText.Name = "demoRichText";
82 | this.demoRichText.ShowSelectionMargin = true;
83 | this.demoRichText.Size = new System.Drawing.Size(408, 344);
84 | this.demoRichText.TabIndex = 2;
85 | this.demoRichText.Text = "Becuase people are realy bad spelers, \nths produc was desinged to prevent speling " +
86 | "erors in a text area like ths.";
87 | //
88 | // spelling
89 | //
90 | this.spelling.Dictionary = this.wordDictionary;
91 | this.spelling.ReplacedWord += new NetSpell.SpellChecker.Spelling.ReplacedWordEventHandler(this.spelling_ReplacedWord);
92 | this.spelling.EndOfText += new NetSpell.SpellChecker.Spelling.EndOfTextEventHandler(this.spelling_EndOfText);
93 | this.spelling.DeletedWord += new NetSpell.SpellChecker.Spelling.DeletedWordEventHandler(this.spelling_DeletedWord);
94 | //
95 | // wordDictionary
96 | //
97 | this.wordDictionary.DictionaryFolder = ((string)(configurationAppSettings.GetValue("wordDictionary.DictionaryFolder", typeof(string))));
98 | //
99 | // DemoForm
100 | //
101 | this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
102 | this.ClientSize = new System.Drawing.Size(440, 406);
103 | this.Controls.Add(this.spellButton);
104 | this.Controls.Add(this.demoRichText);
105 | this.Name = "DemoForm";
106 | this.Text = "NetSpell Demo";
107 | this.ResumeLayout(false);
108 |
109 | }
110 | #endregion
111 |
112 | ///
113 | /// The main entry point for the application.
114 | ///
115 | [STAThread]
116 | static void Main()
117 | {
118 | Application.Run(new DemoForm());
119 | }
120 |
121 | private void spellButton_Click(object sender, System.EventArgs e)
122 | {
123 | this.spelling.Text = this.demoRichText.Text;
124 | this.spelling.SpellCheck();
125 |
126 | }
127 |
128 | private void spelling_DeletedWord(object sender, NetSpell.SpellChecker.SpellingEventArgs e)
129 | {
130 | int start = this.demoRichText.SelectionStart;
131 | int length = this.demoRichText.SelectionLength;
132 |
133 | this.demoRichText.Select(e.TextIndex, e.Word.Length);
134 | this.demoRichText.SelectedText = "";
135 |
136 | if(start > this.demoRichText.Text.Length)
137 | start = this.demoRichText.Text.Length;
138 |
139 | if((start + length) > this.demoRichText.Text.Length)
140 | length = 0;
141 |
142 | this.demoRichText.Select(start, length);
143 | }
144 |
145 | private void spelling_ReplacedWord(object sender, NetSpell.SpellChecker.ReplaceWordEventArgs e)
146 | {
147 | int start = this.demoRichText.SelectionStart;
148 | int length = this.demoRichText.SelectionLength;
149 |
150 | this.demoRichText.Select(e.TextIndex, e.Word.Length);
151 | this.demoRichText.SelectedText = e.ReplacementWord;
152 |
153 | if(start > this.demoRichText.Text.Length)
154 | start = this.demoRichText.Text.Length;
155 |
156 | if((start + length) > this.demoRichText.Text.Length)
157 | length = 0;
158 |
159 | this.demoRichText.Select(start, length);
160 | }
161 |
162 | private void spelling_EndOfText(object sender, System.EventArgs e)
163 | {
164 | Console.WriteLine("EndOfText");
165 | }
166 | }
167 | }
168 |
--------------------------------------------------------------------------------
/demo/Demo.TextEditor/TextEditor.csproj:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
25 |
45 |
65 |
66 |
67 |
72 |
77 |
82 |
87 |
92 |
97 |
98 |
99 |
100 |
101 |
106 |
111 |
115 |
120 |
125 |
130 |
135 |
140 |
144 |
145 |
146 |
147 |
148 |
149 |
--------------------------------------------------------------------------------
/src/NetSpell.DictionaryBuild/NetSpell.DictionaryBuild.csproj:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
25 |
45 |
65 |
66 |
67 |
72 |
77 |
82 |
87 |
92 |
97 |
98 |
99 |
100 |
101 |
106 |
111 |
115 |
120 |
124 |
129 |
134 |
139 |
144 |
145 |
146 |
147 |
148 |
149 |
--------------------------------------------------------------------------------
/demo/Demo.Web.CSharp/spell.js:
--------------------------------------------------------------------------------
1 | /****************************************************
2 | * Spell Checker Client JavaScript Code
3 | ****************************************************/
4 | // spell checker constants
5 | var spellURL = "SpellCheck.aspx";
6 | var showCompleteAlert = true;
7 |
8 |
9 | var tagGroup = new Array("INPUT", "TEXTAREA", "DIV", "SPAN");
10 | // global elements to check
11 | var checkElements = new Array();
12 |
13 | function getText(index)
14 | {
15 | var oElement = document.getElementById(checkElements[index]);
16 | var sText = "";
17 |
18 | switch (oElement.tagName)
19 | {
20 | case "INPUT" :
21 | case "TEXTAREA" :
22 | sText = oElement.value;
23 | break;
24 | case "DIV" :
25 | case "SPAN" :
26 | case "BODY" :
27 | sText = oElement.innerHTML;
28 | break;
29 | case "IFRAME" :
30 | var oFrame = eval(oElement.id);
31 | if(oFrame.contentDocument)
32 | {
33 | sText = oFrame.contentDocument.body.innerHTML;
34 | }
35 | else
36 | {
37 | sText = oFrame.document.body.innerHTML;
38 | }
39 | }
40 |
41 | return sText;
42 | }
43 |
44 | function setText(index, text)
45 | {
46 | var oElement = document.getElementById(checkElements[index]);
47 |
48 | switch (oElement.tagName)
49 | {
50 | case "INPUT" :
51 | case "TEXTAREA" :
52 | oElement.value = text;
53 | break;
54 | case "DIV" :
55 | case "SPAN" :
56 | oElement.innerHTML = text;
57 | break;
58 | case "IFRAME" :
59 | var oFrame = eval(oElement.id);
60 | if(oFrame.contentDocument)
61 | {
62 | oFrame.contentDocument.body.innerHTML = text;
63 | }
64 | else
65 | {
66 | oFrame.document.body.innerHTML = text;
67 | }
68 | break;
69 | }
70 | }
71 |
72 | function checkSpelling()
73 | {
74 | checkElements = new Array();
75 | //loop through all tag groups
76 | for (var i = 0; i < tagGroup.length; i++)
77 | {
78 | var sTagName = tagGroup[i];
79 | var oElements = document.getElementsByTagName(sTagName);
80 | //loop through all elements
81 | for(var x = 0; x < oElements.length; x++)
82 | {
83 | if ((sTagName == "INPUT" && oElements[x].type == "text") || sTagName == "TEXTAREA")
84 | checkElements[checkElements.length] = oElements[x].id;
85 | else if ((sTagName == "DIV" || sTagName == "SPAN") && oElements[x].isContentEditable)
86 | checkElements[checkElements.length] = oElements[x].id;
87 | }
88 | }
89 | openSpellChecker();
90 | }
91 |
92 | function checkSpellingById(id)
93 | {
94 | checkElements = new Array();
95 | checkElements[checkElements.length] = id;
96 | openSpellChecker();
97 | }
98 |
99 | function checkElementSpelling(oElement)
100 | {
101 | checkElements = new Array();
102 | checkElements[checkElements.length] = oElement.id;
103 | openSpellChecker();
104 | }
105 |
106 | function openSpellChecker()
107 | {
108 | if (window.showModalDialog)
109 | var result = window.showModalDialog(spellURL + "?Modal=true", window, "dialogHeight:320px; dialogWidth:400px; edge:Raised; center:Yes; help:No; resizable:No; status:No; scroll:No");
110 | else
111 | var newWindow = window.open(spellURL, "newWindow", "height=300,width=400,scrollbars=no,resizable=no,toolbars=no,status=no,menubar=no,location=no");
112 | }
113 |
114 |
115 | /****************************************************
116 | * Spell Checker Suggestion Window JavaScript Code
117 | ****************************************************/
118 | var iElementIndex = -1;
119 | var parentWindow;
120 |
121 | function initialize()
122 | {
123 | iElementIndex = parseInt(document.getElementById("ElementIndex").value);
124 |
125 | if (parent.window.dialogArguments)
126 | parentWindow = parent.window.dialogArguments;
127 | else if (top.opener)
128 | parentWindow = top.opener;
129 |
130 | var spellMode = document.getElementById("SpellMode").value;
131 |
132 | switch (spellMode)
133 | {
134 | case "start" :
135 | //do nothing client side
136 | break;
137 | case "suggest" :
138 | //update text from parent document
139 | updateText();
140 | //wait for input
141 | break;
142 | case "end" :
143 | //update text from parent document
144 | updateText();
145 | //fall through to default
146 | default :
147 | //get text block from parent document
148 | if(loadText())
149 | document.SpellingForm.submit();
150 | else
151 | endCheck()
152 |
153 | break;
154 | }
155 | }
156 |
157 | function loadText()
158 | {
159 | if (!parentWindow.document)
160 | return false;
161 |
162 | // check if there is any text to spell check
163 | for (++iElementIndex; iElementIndex < parentWindow.checkElements.length; iElementIndex++)
164 | {
165 | var newText = parentWindow.getText(iElementIndex);
166 | if (newText.length > 0)
167 | {
168 | updateSettings(newText, 0, iElementIndex, "start");
169 | document.getElementById("StatusText").innerText = "Spell Checking Text ...";
170 | return true;
171 | }
172 | }
173 |
174 | return false;
175 | }
176 |
177 | function updateSettings(currentText, wordIndex, elementIndex, mode)
178 | {
179 | document.getElementById("CurrentText").value = currentText;
180 | document.getElementById("WordIndex").value = wordIndex;
181 | document.getElementById("ElementIndex").value = elementIndex;
182 | document.getElementById("SpellMode").value = mode;
183 | }
184 |
185 | function updateText()
186 | {
187 | if (!parentWindow.document)
188 | return false;
189 |
190 | var newText = document.getElementById("CurrentText").value;
191 | parentWindow.setText(iElementIndex, newText);
192 | }
193 |
194 | function endCheck()
195 | {
196 | if (showCompleteAlert)
197 | alert("Spell Check Complete");
198 | closeWindow();
199 | }
200 |
201 | function closeWindow()
202 | {
203 | if (top.opener || parent.window.dialogArguments)
204 | self.close();
205 | }
206 |
207 | function changeWord(oElement)
208 | {
209 | var k = oElement.selectedIndex;
210 | oElement.form.ReplacementWord.value = oElement.options[k].value;
211 | }
212 |
--------------------------------------------------------------------------------
/demo/Demo.Web.VBnet/spell.js:
--------------------------------------------------------------------------------
1 | /****************************************************
2 | * Spell Checker Client JavaScript Code
3 | ****************************************************/
4 | // spell checker constants
5 | var spellURL = "SpellCheck.aspx";
6 | var showCompleteAlert = true;
7 |
8 |
9 | var tagGroup = new Array("INPUT", "TEXTAREA", "DIV", "SPAN");
10 | // global elements to check
11 | var checkElements = new Array();
12 |
13 | function getText(index)
14 | {
15 | var oElement = document.getElementById(checkElements[index]);
16 | var sText = "";
17 |
18 | switch (oElement.tagName)
19 | {
20 | case "INPUT" :
21 | case "TEXTAREA" :
22 | sText = oElement.value;
23 | break;
24 | case "DIV" :
25 | case "SPAN" :
26 | case "BODY" :
27 | sText = oElement.innerHTML;
28 | break;
29 | case "IFRAME" :
30 | var oFrame = eval(oElement.id);
31 | if(oFrame.contentDocument)
32 | {
33 | sText = oFrame.contentDocument.body.innerHTML;
34 | }
35 | else
36 | {
37 | sText = oFrame.document.body.innerHTML;
38 | }
39 | }
40 |
41 | return sText;
42 | }
43 |
44 | function setText(index, text)
45 | {
46 | var oElement = document.getElementById(checkElements[index]);
47 |
48 | switch (oElement.tagName)
49 | {
50 | case "INPUT" :
51 | case "TEXTAREA" :
52 | oElement.value = text;
53 | break;
54 | case "DIV" :
55 | case "SPAN" :
56 | oElement.innerHTML = text;
57 | break;
58 | case "IFRAME" :
59 | var oFrame = eval(oElement.id);
60 | if(oFrame.contentDocument)
61 | {
62 | oFrame.contentDocument.body.innerHTML = text;
63 | }
64 | else
65 | {
66 | oFrame.document.body.innerHTML = text;
67 | }
68 | break;
69 | }
70 | }
71 |
72 | function checkSpelling()
73 | {
74 | checkElements = new Array();
75 | //loop through all tag groups
76 | for (var i = 0; i < tagGroup.length; i++)
77 | {
78 | var sTagName = tagGroup[i];
79 | var oElements = document.getElementsByTagName(sTagName);
80 | //loop through all elements
81 | for(var x = 0; x < oElements.length; x++)
82 | {
83 | if ((sTagName == "INPUT" && oElements[x].type == "text") || sTagName == "TEXTAREA")
84 | checkElements[checkElements.length] = oElements[x].id;
85 | else if ((sTagName == "DIV" || sTagName == "SPAN") && oElements[x].isContentEditable)
86 | checkElements[checkElements.length] = oElements[x].id;
87 | }
88 | }
89 | openSpellChecker();
90 | }
91 |
92 | function checkSpellingById(id)
93 | {
94 | checkElements = new Array();
95 | checkElements[checkElements.length] = id;
96 | openSpellChecker();
97 | }
98 |
99 | function checkElementSpelling(oElement)
100 | {
101 | checkElements = new Array();
102 | checkElements[checkElements.length] = oElement.id;
103 | openSpellChecker();
104 | }
105 |
106 | function openSpellChecker()
107 | {
108 | if (window.showModalDialog)
109 | var result = window.showModalDialog(spellURL + "?Modal=true", window, "dialogHeight:320px; dialogWidth:400px; edge:Raised; center:Yes; help:No; resizable:No; status:No; scroll:No");
110 | else
111 | var newWindow = window.open(spellURL, "newWindow", "height=300,width=400,scrollbars=no,resizable=no,toolbars=no,status=no,menubar=no,location=no");
112 | }
113 |
114 |
115 | /****************************************************
116 | * Spell Checker Suggestion Window JavaScript Code
117 | ****************************************************/
118 | var iElementIndex = -1;
119 | var parentWindow;
120 |
121 | function initialize()
122 | {
123 | iElementIndex = parseInt(document.getElementById("ElementIndex").value);
124 |
125 | if (parent.window.dialogArguments)
126 | parentWindow = parent.window.dialogArguments;
127 | else if (top.opener)
128 | parentWindow = top.opener;
129 |
130 | var spellMode = document.getElementById("SpellMode").value;
131 |
132 | switch (spellMode)
133 | {
134 | case "start" :
135 | //do nothing client side
136 | break;
137 | case "suggest" :
138 | //update text from parent document
139 | updateText();
140 | //wait for input
141 | break;
142 | case "end" :
143 | //update text from parent document
144 | updateText();
145 | //fall through to default
146 | default :
147 | //get text block from parent document
148 | if(loadText())
149 | document.SpellingForm.submit();
150 | else
151 | endCheck()
152 |
153 | break;
154 | }
155 | }
156 |
157 | function loadText()
158 | {
159 | if (!parentWindow.document)
160 | return false;
161 |
162 | // check if there is any text to spell check
163 | for (++iElementIndex; iElementIndex < parentWindow.checkElements.length; iElementIndex++)
164 | {
165 | var newText = parentWindow.getText(iElementIndex);
166 | if (newText.length > 0)
167 | {
168 | updateSettings(newText, 0, iElementIndex, "start");
169 | document.getElementById("StatusText").innerText = "Spell Checking Text ...";
170 | return true;
171 | }
172 | }
173 |
174 | return false;
175 | }
176 |
177 | function updateSettings(currentText, wordIndex, elementIndex, mode)
178 | {
179 | document.getElementById("CurrentText").value = currentText;
180 | document.getElementById("WordIndex").value = wordIndex;
181 | document.getElementById("ElementIndex").value = elementIndex;
182 | document.getElementById("SpellMode").value = mode;
183 | }
184 |
185 | function updateText()
186 | {
187 | if (!parentWindow.document)
188 | return false;
189 |
190 | var newText = document.getElementById("CurrentText").value;
191 | parentWindow.setText(iElementIndex, newText);
192 | }
193 |
194 | function endCheck()
195 | {
196 | if (showCompleteAlert)
197 | alert("Spell Check Complete");
198 | closeWindow();
199 | }
200 |
201 | function closeWindow()
202 | {
203 | if (top.opener || parent.window.dialogArguments)
204 | self.close();
205 | }
206 |
207 | function changeWord(oElement)
208 | {
209 | var k = oElement.selectedIndex;
210 | oElement.form.ReplacementWord.value = oElement.options[k].value;
211 | }
212 |
--------------------------------------------------------------------------------
/src/NetSpell.Tests/NetSpell.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
25 |
45 |
65 |
66 |
67 |
72 |
77 |
82 |
87 |
92 |
98 |
104 |
105 |
106 |
107 |
108 |
113 |
118 |
123 |
128 |
133 |
138 |
142 |
146 |
147 |
148 |
149 |
150 |
151 |
--------------------------------------------------------------------------------
/demo/Demo.Web.FreeTextBox/spell.js:
--------------------------------------------------------------------------------
1 | /****************************************************
2 | * Spell Checker Client JavaScript Code
3 | ****************************************************/
4 | // spell checker constants
5 | var spellURL = "SpellCheck.aspx";
6 | var showCompleteAlert = true;
7 |
8 |
9 | var tagGroup = new Array("INPUT", "TEXTAREA", "DIV", "SPAN");
10 | // global elements to check
11 | var checkElements = new Array();
12 |
13 | function getText(index)
14 | {
15 | var oElement = document.getElementById(checkElements[index]);
16 | var sText = "";
17 |
18 | switch (oElement.tagName)
19 | {
20 | case "INPUT" :
21 | case "TEXTAREA" :
22 | sText = oElement.value;
23 | break;
24 | case "DIV" :
25 | case "SPAN" :
26 | case "BODY" :
27 | sText = oElement.innerHTML;
28 | break;
29 | case "IFRAME" :
30 | var oFrame = eval(oElement.id);
31 | if(oFrame.contentDocument)
32 | {
33 | sText = oFrame.contentDocument.body.innerHTML;
34 | }
35 | else
36 | {
37 | sText = oFrame.document.body.innerHTML;
38 | }
39 | }
40 |
41 | return sText;
42 | }
43 |
44 | function setText(index, text)
45 | {
46 | var oElement = document.getElementById(checkElements[index]);
47 |
48 | switch (oElement.tagName)
49 | {
50 | case "INPUT" :
51 | case "TEXTAREA" :
52 | oElement.value = text;
53 | break;
54 | case "DIV" :
55 | case "SPAN" :
56 | oElement.innerHTML = text;
57 | break;
58 | case "IFRAME" :
59 | var oFrame = eval(oElement.id);
60 | if(oFrame.contentDocument)
61 | {
62 | oFrame.contentDocument.body.innerHTML = text;
63 | }
64 | else
65 | {
66 | oFrame.document.body.innerHTML = text;
67 | }
68 | break;
69 | }
70 | }
71 |
72 | function checkSpelling()
73 | {
74 | checkElements = new Array();
75 | //loop through all tag groups
76 | for (var i = 0; i < tagGroup.length; i++)
77 | {
78 | var sTagName = tagGroup[i];
79 | var oElements = document.getElementsByTagName(sTagName);
80 | //loop through all elements
81 | for(var x = 0; x < oElements.length; x++)
82 | {
83 | if ((sTagName == "INPUT" && oElements[x].type == "text") || sTagName == "TEXTAREA")
84 | checkElements[checkElements.length] = oElements[x].id;
85 | else if ((sTagName == "DIV" || sTagName == "SPAN") && oElements[x].isContentEditable)
86 | checkElements[checkElements.length] = oElements[x].id;
87 | }
88 | }
89 | openSpellChecker();
90 | }
91 |
92 | function checkSpellingById(id)
93 | {
94 | checkElements = new Array();
95 | checkElements[checkElements.length] = id;
96 | openSpellChecker();
97 | }
98 |
99 | function checkElementSpelling(oElement)
100 | {
101 | checkElements = new Array();
102 | checkElements[checkElements.length] = oElement.id;
103 | openSpellChecker();
104 | }
105 |
106 | function openSpellChecker()
107 | {
108 | if (window.showModalDialog)
109 | var result = window.showModalDialog(spellURL + "?Modal=true", window, "dialogHeight:320px; dialogWidth:400px; edge:Raised; center:Yes; help:No; resizable:No; status:No; scroll:No");
110 | else
111 | var newWindow = window.open(spellURL, "newWindow", "height=300,width=400,scrollbars=no,resizable=no,toolbars=no,status=no,menubar=no,location=no");
112 | }
113 |
114 |
115 | /****************************************************
116 | * Spell Checker Suggestion Window JavaScript Code
117 | ****************************************************/
118 | var iElementIndex = -1;
119 | var parentWindow;
120 |
121 | function initialize()
122 | {
123 | iElementIndex = parseInt(document.getElementById("ElementIndex").value);
124 |
125 | if (parent.window.dialogArguments)
126 | parentWindow = parent.window.dialogArguments;
127 | else if (top.opener)
128 | parentWindow = top.opener;
129 |
130 | var spellMode = document.getElementById("SpellMode").value;
131 |
132 | switch (spellMode)
133 | {
134 | case "start" :
135 | //do nothing client side
136 | break;
137 | case "suggest" :
138 | //update text from parent document
139 | updateText();
140 | //wait for input
141 | break;
142 | case "end" :
143 | //update text from parent document
144 | updateText();
145 | //fall through to default
146 | default :
147 | //get text block from parent document
148 | if(loadText())
149 | document.SpellingForm.submit();
150 | else
151 | endCheck()
152 |
153 | break;
154 | }
155 | }
156 |
157 | function loadText()
158 | {
159 | if (!parentWindow.document)
160 | return false;
161 |
162 | // check if there is any text to spell check
163 | for (++iElementIndex; iElementIndex < parentWindow.checkElements.length; iElementIndex++)
164 | {
165 | var newText = parentWindow.getText(iElementIndex);
166 | if (newText.length > 0)
167 | {
168 | updateSettings(newText, 0, iElementIndex, "start");
169 | document.getElementById("StatusText").innerText = "Spell Checking Text ...";
170 | return true;
171 | }
172 | }
173 |
174 | return false;
175 | }
176 |
177 | function updateSettings(currentText, wordIndex, elementIndex, mode)
178 | {
179 | document.getElementById("CurrentText").value = currentText;
180 | document.getElementById("WordIndex").value = wordIndex;
181 | document.getElementById("ElementIndex").value = elementIndex;
182 | document.getElementById("SpellMode").value = mode;
183 | }
184 |
185 | function updateText()
186 | {
187 | if (!parentWindow.document)
188 | return false;
189 |
190 | var newText = document.getElementById("CurrentText").value;
191 | parentWindow.setText(iElementIndex, newText);
192 | }
193 |
194 | function endCheck()
195 | {
196 | if (showCompleteAlert)
197 | alert("Spell Check Complete");
198 | closeWindow();
199 | }
200 |
201 | function closeWindow()
202 | {
203 | if (top.opener || parent.window.dialogArguments)
204 | self.close();
205 | }
206 |
207 | function changeWord(oElement)
208 | {
209 | var k = oElement.selectedIndex;
210 | oElement.form.ReplacementWord.value = oElement.options[k].value;
211 | }
212 |
--------------------------------------------------------------------------------
/demo/Demo.Web.HtmlEditor/spell.js:
--------------------------------------------------------------------------------
1 | /****************************************************
2 | * Spell Checker Client JavaScript Code
3 | ****************************************************/
4 | // spell checker constants
5 | var spellURL = "SpellCheck.aspx";
6 | var showCompleteAlert = true;
7 |
8 |
9 | var tagGroup = new Array("INPUT", "TEXTAREA", "DIV", "SPAN");
10 | // global elements to check
11 | var checkElements = new Array();
12 |
13 | function getText(index)
14 | {
15 | var oElement = document.getElementById(checkElements[index]);
16 | var sText = "";
17 |
18 | switch (oElement.tagName)
19 | {
20 | case "INPUT" :
21 | case "TEXTAREA" :
22 | sText = oElement.value;
23 | break;
24 | case "DIV" :
25 | case "SPAN" :
26 | case "BODY" :
27 | sText = oElement.innerHTML;
28 | break;
29 | case "IFRAME" :
30 | var oFrame = eval(oElement.id);
31 | if(oFrame.contentDocument)
32 | {
33 | sText = oFrame.contentDocument.body.innerHTML;
34 | }
35 | else
36 | {
37 | sText = oFrame.document.body.innerHTML;
38 | }
39 | }
40 |
41 | return sText;
42 | }
43 |
44 | function setText(index, text)
45 | {
46 | var oElement = document.getElementById(checkElements[index]);
47 |
48 | switch (oElement.tagName)
49 | {
50 | case "INPUT" :
51 | case "TEXTAREA" :
52 | oElement.value = text;
53 | break;
54 | case "DIV" :
55 | case "SPAN" :
56 | oElement.innerHTML = text;
57 | break;
58 | case "IFRAME" :
59 | var oFrame = eval(oElement.id);
60 | if(oFrame.contentDocument)
61 | {
62 | oFrame.contentDocument.body.innerHTML = text;
63 | }
64 | else
65 | {
66 | oFrame.document.body.innerHTML = text;
67 | }
68 | break;
69 | }
70 | }
71 |
72 | function checkSpelling()
73 | {
74 | checkElements = new Array();
75 | //loop through all tag groups
76 | for (var i = 0; i < tagGroup.length; i++)
77 | {
78 | var sTagName = tagGroup[i];
79 | var oElements = document.getElementsByTagName(sTagName);
80 | //loop through all elements
81 | for(var x = 0; x < oElements.length; x++)
82 | {
83 | if ((sTagName == "INPUT" && oElements[x].type == "text") || sTagName == "TEXTAREA")
84 | checkElements[checkElements.length] = oElements[x].id;
85 | else if ((sTagName == "DIV" || sTagName == "SPAN") && oElements[x].isContentEditable)
86 | checkElements[checkElements.length] = oElements[x].id;
87 | }
88 | }
89 | openSpellChecker();
90 | }
91 |
92 | function checkSpellingById(id)
93 | {
94 | checkElements = new Array();
95 | checkElements[checkElements.length] = id;
96 | openSpellChecker();
97 | }
98 |
99 | function checkElementSpelling(oElement)
100 | {
101 | checkElements = new Array();
102 | checkElements[checkElements.length] = oElement.id;
103 | openSpellChecker();
104 | }
105 |
106 | function openSpellChecker()
107 | {
108 | if (window.showModalDialog)
109 | var result = window.showModalDialog(spellURL + "?Modal=true", window, "dialogHeight:320px; dialogWidth:400px; edge:Raised; center:Yes; help:No; resizable:No; status:No; scroll:No");
110 | else
111 | var newWindow = window.open(spellURL, "newWindow", "height=300,width=400,scrollbars=no,resizable=no,toolbars=no,status=no,menubar=no,location=no");
112 | }
113 |
114 |
115 | /****************************************************
116 | * Spell Checker Suggestion Window JavaScript Code
117 | ****************************************************/
118 | var iElementIndex = -1;
119 | var parentWindow;
120 |
121 | function initialize()
122 | {
123 | iElementIndex = parseInt(document.getElementById("ElementIndex").value);
124 |
125 | if (parent.window.dialogArguments)
126 | parentWindow = parent.window.dialogArguments;
127 | else if (top.opener)
128 | parentWindow = top.opener;
129 |
130 | var spellMode = document.getElementById("SpellMode").value;
131 |
132 | switch (spellMode)
133 | {
134 | case "start" :
135 | //do nothing client side
136 | break;
137 | case "suggest" :
138 | //update text from parent document
139 | updateText();
140 | //wait for input
141 | break;
142 | case "end" :
143 | //update text from parent document
144 | updateText();
145 | //fall through to default
146 | default :
147 | //get text block from parent document
148 | if(loadText())
149 | document.SpellingForm.submit();
150 | else
151 | endCheck()
152 |
153 | break;
154 | }
155 | }
156 |
157 | function loadText()
158 | {
159 | if (!parentWindow.document)
160 | return false;
161 |
162 | // check if there is any text to spell check
163 | for (++iElementIndex; iElementIndex < parentWindow.checkElements.length; iElementIndex++)
164 | {
165 | var newText = parentWindow.getText(iElementIndex);
166 | if (newText.length > 0)
167 | {
168 | updateSettings(newText, 0, iElementIndex, "start");
169 | document.getElementById("StatusText").innerText = "Spell Checking Text ...";
170 | return true;
171 | }
172 | }
173 |
174 | return false;
175 | }
176 |
177 | function updateSettings(currentText, wordIndex, elementIndex, mode)
178 | {
179 | document.getElementById("CurrentText").value = currentText;
180 | document.getElementById("WordIndex").value = wordIndex;
181 | document.getElementById("ElementIndex").value = elementIndex;
182 | document.getElementById("SpellMode").value = mode;
183 | }
184 |
185 | function updateText()
186 | {
187 | if (!parentWindow.document)
188 | return false;
189 |
190 | var newText = document.getElementById("CurrentText").value;
191 | parentWindow.setText(iElementIndex, newText);
192 | }
193 |
194 | function endCheck()
195 | {
196 | if (showCompleteAlert)
197 | alert("Spell Check Complete");
198 | closeWindow();
199 | }
200 |
201 | function closeWindow()
202 | {
203 | if (top.opener || parent.window.dialogArguments)
204 | self.close();
205 | }
206 |
207 | function changeWord(oElement)
208 | {
209 | var k = oElement.selectedIndex;
210 | oElement.form.ReplacementWord.value = oElement.options[k].value;
211 | }
212 |
--------------------------------------------------------------------------------