private void LoadISpellDictionaries()
        {
            #region #LoadISpellDictionaries
            checker.Dictionaries.Clear();

            Stream dict_en_US = Assembly.GetExecutingAssembly().
                                GetManifestResourceStream("SpellingDictionaryExample.Dictionaries.ISpell.en_US.american.xlg");
            Stream grammar_en_US = Assembly.GetExecutingAssembly().
                                   GetManifestResourceStream("SpellingDictionaryExample.Dictionaries.ISpell.en_US.english.aff");
            Stream alphabet_en_US = Assembly.GetExecutingAssembly().
                                    GetManifestResourceStream("SpellingDictionaryExample.Dictionaries.EnglishAlphabet.txt");

            SpellCheckerISpellDictionary ispellDictionaryEnglish = new SpellCheckerISpellDictionary();
            ispellDictionaryEnglish.LoadFromStream(dict_en_US, grammar_en_US, alphabet_en_US);
            ispellDictionaryEnglish.Culture = new CultureInfo("en-US");
            checker.Dictionaries.Add(ispellDictionaryEnglish);
            #endregion #LoadISpellDictionaries

            Stream dict_es_ES = Assembly.GetExecutingAssembly().
                                GetManifestResourceStream("SpellingDictionaryExample.Dictionaries.ISpell.es_ES.espanol.dic");
            Stream grammar_es_ES = Assembly.GetExecutingAssembly().
                                   GetManifestResourceStream("SpellingDictionaryExample.Dictionaries.ISpell.es_ES.espanol.aff");
            Stream alphabet_es_ES = Assembly.GetExecutingAssembly().
                                    GetManifestResourceStream("SpellingDictionaryExample.Dictionaries.SpanishAlphabet.txt");

            SpellCheckerISpellDictionary ispellDictionarySpanish = new SpellCheckerISpellDictionary();
            ispellDictionarySpanish.LoadFromStream(dict_es_ES, grammar_es_ES, alphabet_es_ES);
            ispellDictionarySpanish.Culture = new CultureInfo("es-ES");
            checker.Dictionaries.Add(ispellDictionarySpanish);

            LoadCustomDictionary();
        }
Example #2
0
 /// <summary>
 /// Initializes static default and custom dictionaries for the first time they are accessed in the application.
 /// </summary>
 private void EnsureDictionaries()
 {
     if (DefaultDictionary == null)
     {
         lock (lockObject) {
             if (DefaultDictionary == null)
             {
                 SpellCheckerISpellDictionary result = CreateDefaultDictionaryCore();
                 SetupDefaultDictionary(result);
                 DictionaryCreatedEventArgs args = new DictionaryCreatedEventArgs(result, false);
                 OnDictionaryCreated(args);
                 DefaultDictionary = args.Dictionary as SpellCheckerISpellDictionary ?? result;
             }
         }
     }
     if (CustomDictionary == null)
     {
         lock (lockObject) {
             if (CustomDictionary == null)
             {
                 SpellCheckerCustomDictionary result = CreateCustomDictionaryCore();
                 SetupCustomDictionary(result);
                 DictionaryCreatedEventArgs args = new DictionaryCreatedEventArgs(result, true);
                 OnDictionaryCreated(args);
                 CustomDictionary = args.Dictionary as SpellCheckerCustomDictionary ?? result;
             }
         }
     }
 }
Example #3
0
        static ControlService()
        {
            string appdir = ConfigurationManager.AppSettings["ProWriteFontFile"];

            if (appdir.IndexOf(@":") == -1)
            {
                appdir = Application.StartupPath + @"\" + appdir;
            }
            else
            {
                appdir = ConfigurationManager.AppSettings["ProWriteFontFile"];
            }

            FontManager.Initialize(appdir);

            _libraryTree      = new LibraryTree();
            _signCombo        = new SignRepositoryItemLookUpEdit();
            _propertyGrid     = new PropertyGridControl();
            _effectTree       = new EffectTreeControl();
            _toolBox          = new ToolBoxControl();
            _timeSliceControl = new TimeSliceGroupControl();
            _signImage        = new SignImage();
            _signStatus       = new SignStatus();

            _barButtonPosition = new BarButtonItem();
            //_barButtonPosition.CategoryGuid = new System.Guid("77795bb7-9bc5-4dd2-a297-cc758682e23d");
            //_barButtonPosition.Id = 0;
            //_barButtonPosition.Name = "siPosition";

            _statusBar            = new RibbonStatusBar();
            _currentClip          = new CurrentClip();
            _spellChecker         = new DevExpress.XtraSpellChecker.SpellChecker();
            _signStorageIndicator = new SignStorageIndicator();

            _pictureBox = new PictureEdit();
            _pictureBox.Properties.ShowMenu = false;
            _pictureBox.Properties.SizeMode = DevExpress.XtraEditors.Controls.PictureSizeMode.Zoom;

            if (_libraryTree != null)
            {
                _libraryTree.Controller.RemoveLibraryItemEvent += new EventHandler <RemoveLibraryEventArgs>(Controller_RemoveLibraryItemEvent);
            }
            _fonts         = new List <PWFont>();
            _fontsBitMap   = new List <PWFont>();
            _fontsTrueType = new List <PWFont>();

            spellCheckTask = Task.Create((p) =>
            {
                CultureInfo engCulture = new CultureInfo("En-us");
                dictionary             = new SpellCheckerISpellDictionary(DemoUtils.GetRelativePath("american.xlg"), DemoUtils.GetRelativePath("english.aff"), engCulture);

                dictionary.AlphabetPath = DemoUtils.GetRelativePath("EnglishAlphabet.txt");
                customDictorary         = new SpellCheckerCustomDictionary();
                customDictorary.Culture = engCulture;

                SpellCheckerList.Load();
                customDictorary.AddWords(ServiceManager.Get <SpellCheckerList>());
            });
        }
        static SpellCheckerDictionaryBase GetDefaultDictionary()
        {
            SpellCheckerISpellDictionary dic = new SpellCheckerISpellDictionary();

            dic.LoadFromStream(DemoUtils.GetDataStream("american.xlg"),
                               DemoUtils.GetDataStream("english.aff"),
                               DemoUtils.GetDataStream("EnglishAlphabet.txt"));
            return(dic);
        }
Example #5
0
        private void Form1_Load(object sender, EventArgs e)
        {
            SpellCheckerISpellDictionary dictionary = new SpellCheckerISpellDictionary();
            Stream affStream  = Assembly.GetExecutingAssembly().GetManifestResourceStream("WindowsApplication27.Dictionaries.english.aff");
            Stream dicStream  = Assembly.GetExecutingAssembly().GetManifestResourceStream("WindowsApplication27.Dictionaries.american.xlg");
            Stream alphStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("WindowsApplication27.Dictionaries.EnglishAlphabet.txt");

            dictionary.LoadFromStream(dicStream, affStream, alphStream);
            spellChecker1.Dictionaries.Add(dictionary);
        }
Example #6
0
        void Form1_Load(object sender, EventArgs e)
        {
            CultureInfo usCulture = new CultureInfo("en-US");
            SpellCheckerISpellDictionary dictionary1 = new SpellCheckerISpellDictionary(@"..\..\american.xlg", @"..\..\english.aff", usCulture);

            dictionary1.AlphabetPath = @"..\..\EnglishAlphabet.txt";
            dictionary1.Load();
            this.spellChecker1.Dictionaries.Add(dictionary1);

            this.richEditControl1.Text = @"Accordnig to an englnsih unviersitry sutdy the oredr of letetrs in a word dosen't mttaer, the olny thnig thta's imporantt is that the frsit and last ltteer of eevry word is in the crrecot psoition. The rset can be jmbueld and one is stlil able to read the txet withuot dificultfiy.";
            this.labelControl1.Text    = "Right-click a misspelled word for a context menu containing a list of suggested replacements";
        }
        static SpellCheckerDictionaryBase GetDefaultDictionary(string path)
        {
            SpellCheckerISpellDictionary dic = new SpellCheckerISpellDictionary();

            dic.DictionaryLoaded += new EventHandler(dic_DictionaryLoaded);

            dic.DictionaryPath = path + "\\american.xlg";
            dic.GrammarPath    = path + "\\english.aff";
            dic.AlphabetPath   = path + "\\EnglishAlphabet.txt";
            dic.Culture        = new CultureInfo("en-US");
            dic.Load();
            dic.DictionaryLoaded -= dic_DictionaryLoaded;
            return(dic);
        }
Example #8
0
        private void Initialize()
        {
            sharedDictionaryStorage1.Dictionaries.Clear();
            SpellCheckerISpellDictionary dictionary = ControlService.SpellDictionary;

            sharedDictionaryStorage1.Dictionaries.Add(dictionary);

            customDictionary = ControlService.SpellCustomDictionary;
            sharedDictionaryStorage1.Dictionaries.Add(customDictionary);

            spellChecker1.Culture = customDictionary.Culture;

            barManager1.SetPopupContextMenu(this.memoEdit, popupMenu1);
            //DoCheck();
        }
        /// <summary>
        /// create rich editor
        /// </summary>
        /// <param name="fieldInfo"></param>
        /// <returns></returns>
        ///
        protected virtual RichEditControl CreateRichTextEdit(ModuleFieldInfo fieldInfo)
        {
            //var rtControl = new RichEditControl
            //{
            //    Name = string.Format(CONSTANTS.RICHTEXT_NAME_FORMAT, fieldInfo.FieldName),
            //    Tag = fieldInfo
            //};
            rtControl              = new RichEditControl();
            spellChecker1          = new SpellChecker();
            rtControl.SpellChecker = spellChecker1;
            //spellChecker1.SetShowSpellCheckMenu(rtControl, false);
            //spellChecker1.SetSpellCheckerOptions(this.rtControl, optionsSpelling1);
            CultureInfo usCulture = new CultureInfo("en-US");
            SpellCheckerISpellDictionary dictionary1 = new SpellCheckerISpellDictionary(@"..\..\american.xlg", @"..\..\english.aff", usCulture);

            dictionary1.AlphabetPath = @"..\..\EnglishAlphabet.txt";
            dictionary1.Load();
            spellChecker1.Dictionaries.Add(dictionary1);
            rtControl.PopupMenuShowing += new DevExpress.XtraRichEdit.PopupMenuShowingEventHandler(rtControl_PopupMenuShowing);
            return(rtControl);
        }
    String CheckText(String text)
    {
        SpellCheckerBase checker = new SpellCheckerBase();

        checker.NotInDictionaryWordFound += new NotInDictionaryWordFoundEventHandler(checker_NotInDictionaryWordFound);

        SpellCheckerISpellDictionary dict = new SpellCheckerISpellDictionary(Server.MapPath("~/Dictionaries/american.xlg"),
                                                                             Server.MapPath("~/Dictionaries/english.aff"),
                                                                             new CultureInfo("en-us"));

        dict.AlphabetPath = Server.MapPath("~/Dictionaries/EnglishAlphabet.txt");
        dict.CacheKey     = "ispellDic";
        dict.Load();

        checker.Dictionaries.Add(dict);

        checker.LevenshteinDistance = 4;

        String result = checker.Check(text);

        return(result);
    }
        static ISpellCheckerDictionary GetDefaultDictionary()
        {
            SpellCheckerISpellDictionary dic = new SpellCheckerISpellDictionary();
            Stream zipFileStream             = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("DevExpress.MailClient.Win.Dictionaries.default.zip");
            InternalZipFileCollection files  = InternalZipArchive.Open(zipFileStream);
            Stream alphabetStream            = GetFileStream(files, "EnglishAlphabet.txt");
            Stream dictionaryStream          = GetFileStream(files, "american.xlg");
            Stream grammarStream             = GetFileStream(files, "english.aff");

            try {
                dic.LoadFromStream(dictionaryStream, grammarStream, alphabetStream);
            } catch {
            } finally {
                dictionaryStream.Dispose();
                grammarStream.Dispose();
                zipFileStream.Dispose();
                alphabetStream.Dispose();
                DisposeZipFileStreams(files);
            }
            dic.Culture = new CultureInfo("en-US");
            return(dic);
        }
Example #12
0
        static ISpellCheckerDictionary GetDefaultDictionary()
        {
            SpellCheckerISpellDictionary dic = new SpellCheckerISpellDictionary();

            using (Stream stream = DemoUtils.GetDataStream(DemoUtils.PathToDictionaries, "default.zip")) {
                InternalZipFileCollection files = InternalZipArchive.Open(stream);
                Stream dictionaryStream         = GetFileStream(files, "american.xlg");
                Stream grammarStream            = GetFileStream(files, "english.aff");
                Stream alphabetStream           = DemoUtils.GetDataStream(DemoUtils.PathToDictionaries, "EnglishAlphabet.txt");
                try {
                    dic.LoadFromStream(dictionaryStream, grammarStream, alphabetStream);
                }
                catch {
                }
                finally {
                    dictionaryStream.Close();
                    grammarStream.Close();
                    alphabetStream.Close();
                }
            }
            dic.Culture = new CultureInfo("en-US");
            return(dic);
        }
Example #13
0
 /// <summary>
 /// Configures the default dictionary settings.
 /// </summary>
 /// <param name="dictionary"></param>
 protected virtual void SetupDefaultDictionary(SpellCheckerISpellDictionary dictionary)
 {
     dictionary.Culture  = SpellChecker.Culture;
     dictionary.Encoding = System.Text.Encoding.UTF8;
     if (SpellCheckerOptions.PathResolutionMode == FilePathResolutionMode.None)
     {
         SpellCheckerDictionaryStreamInfo streamInfo = GetDictionaryStreamInfo(false);
         try {
             dictionary.LoadFromStream(streamInfo.DictionaryStream, streamInfo.GrammarStream, streamInfo.AlphabetStream);
         }
         finally {
             if (streamInfo.AlphabetStream != null)
             {
                 streamInfo.AlphabetStream.Dispose();
                 streamInfo.AlphabetStream = null;
             }
             if (streamInfo.DictionaryStream != null)
             {
                 streamInfo.DictionaryStream.Dispose();
                 streamInfo.DictionaryStream = null;
             }
             if (streamInfo.GrammarStream != null)
             {
                 streamInfo.GrammarStream.Dispose();
                 streamInfo.GrammarStream = null;
             }
         }
     }
     else
     {
         SpellCheckerDictionaryFileInfo fileInfo = GetDictionaryFileInfo(false);
         dictionary.AlphabetPath   = fileInfo.AlphabetPath;
         dictionary.DictionaryPath = fileInfo.DictionaryPath;
         dictionary.GrammarPath    = fileInfo.GrammarPath;
     }
 }
Example #14
0
        private void LoadISpellDictionaries()
        {
            #region #LoadISpellDictionaries
            spellChecker1.Dictionaries.Clear();

            SpellCheckerISpellDictionary ispellDictionaryEnglish = new SpellCheckerISpellDictionary();
            ispellDictionaryEnglish.DictionaryPath = @"Dictionaries\ISpell\en_US\american.xlg";
            ispellDictionaryEnglish.GrammarPath    = @"Dictionaries\ISpell\en_US\english.aff";
            ispellDictionaryEnglish.AlphabetPath   = @"Dictionaries\EnglishAlphabet.txt";
            ispellDictionaryEnglish.Culture        = new CultureInfo("en-US");
            ispellDictionaryEnglish.Load();
            spellChecker1.Dictionaries.Add(ispellDictionaryEnglish);
            #endregion #LoadISpellDictionaries

            SpellCheckerISpellDictionary ispellDictionarySpanish = new SpellCheckerISpellDictionary();
            ispellDictionarySpanish.DictionaryPath = @"Dictionaries\ISpell\es_ES\espanol.dic";
            ispellDictionarySpanish.GrammarPath    = @"Dictionaries\ISpell\es_ES\espanol.aff";
            ispellDictionarySpanish.AlphabetPath   = @"Dictionaries\SpanishAlphabet.txt";
            ispellDictionarySpanish.Culture        = new CultureInfo("es-ES");
            ispellDictionarySpanish.Load();
            spellChecker1.Dictionaries.Add(ispellDictionarySpanish);

            LoadCustomDictionary();
        }
Example #15
0
 static ISpellCheckerDictionary GetDefaultDictionary()
 {
     SpellCheckerISpellDictionary dic = new SpellCheckerISpellDictionary();
     Stream zipFileStream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("DevExpress.MailClient.Win.Dictionaries.default.zip");
     InternalZipFileCollection files = InternalZipArchive.Open(zipFileStream);
     Stream alphabetStream = GetFileStream(files, "EnglishAlphabet.txt");
     Stream dictionaryStream = GetFileStream(files, "american.xlg");
     Stream grammarStream = GetFileStream(files, "english.aff");
     try {
         dic.LoadFromStream(dictionaryStream, grammarStream, alphabetStream);
     } catch {
     } finally {
         dictionaryStream.Dispose();
         grammarStream.Dispose();
         zipFileStream.Dispose();
         alphabetStream.Dispose();
         DisposeZipFileStreams(files);
     }
     dic.Culture = new CultureInfo("en-US");
     return dic;
 }