public void DeleteCorrectWords() { var _chkSpell = new CheakSpell(); var f = File.ReadAllLines(Environment.CurrentDirectory + @"\..\..\..\File\All_word.txt"); string _correctWord = string.Empty; string _failWord = string.Empty; string _isFalseWord = string.Empty; string _isInSuggestList = string.Empty; string _isDefineYet = string.Empty; string result; foreach (var l in f) { if (l.Length > 2) { var words = l.Split(','); _correctWord = words[0]; _failWord = words[1]; if (_chkSpell.Cheak_Spell(_correctWord) == false) { _isDefineYet = "not_define"; } else { _isDefineYet = "define"; } if (_chkSpell.Cheak_Spell(_failWord) == false) { _isFalseWord = "false_word"; if (_chkSpell.Suggest(_failWord).Contains(_correctWord)) { _isInSuggestList = "Suggested"; } else { _isInSuggestList = "NoSuggest"; } } else { _isFalseWord = "true_word"; } result = _isDefineYet + @"," + _correctWord + @"," + _failWord + @"," + _isFalseWord + @"," + _isInSuggestList; File.AppendAllText(Environment.CurrentDirectory + @"\..\..\..\File\All_data.txt", result + Environment.NewLine); Thread.Sleep(1000); } } }
private void Application_WindowBeforeRightClickEvent(Word.Selection curselection, ref bool cancel) { GlobalClass.myselection = curselection; var wordrange = GlobalClass.myword.Selection.Range; int left, top, width, height; GlobalClass.myword.ActiveWindow.GetPoint(out left, out top, out width, out height, wordrange); var curword = curselection.Range.Words[1].Text; var curwordcount = curselection.Range.Words.Count; PunchPattern punckPattern = null; if (_listpukPattern != null) { punckPattern = _listpukPattern.Find(t => t.IndexStart <= curselection.Range.Start && t.IndexEnd >= curselection.Range.End); } if (punckPattern != null && punckPattern.ErrorCode > 0) { cancel = true; _currentPuncPattern = punckPattern; _cpuncForm = new CPPPunctuation(); _cpuncForm.Deactivate += CpPuncForm_Deactivate; _cpuncForm.ShowBallonScreen(new Point(left, top)); _cpuncForm.ShowFormWithMessage = punckPattern.ErroMessage + Environment.NewLine + punckPattern.ErrorCorrection; } else { // else spell var isSpellisCorrect = _chkSpell.Cheak_Spell(curword.Trim()); if (curword.Trim().Length > 1 && curwordcount == 1 && isSpellisCorrect == false) { cancel = true; _cspellForm = new CPPSPell(); _cspellForm.Deactivate += cpSpellForm_Deactivate; _cspellForm.ShowBallonScreen(new Point(left, top)); var suggestList = _chkSpell.Suggest(curword); _cspellForm.ShowDlg(suggestList); } } }