mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-27 06:22:38 +01:00
Better error handling in spell check user dictionary is corrupt
git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@2195 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
parent
2c785bd401
commit
f4ecf273de
3
src/Forms/GetDictionaries.Designer.cs
generated
3
src/Forms/GetDictionaries.Designer.cs
generated
@ -78,7 +78,6 @@
|
||||
this.labelDescription1.Size = new System.Drawing.Size(316, 13);
|
||||
this.labelDescription1.TabIndex = 8;
|
||||
this.labelDescription1.Text = "Subtitle Edit\'s spell check is based on the NHunspell engine which";
|
||||
this.labelDescription1.Click += new System.EventHandler(this.labelDescription1_Click);
|
||||
//
|
||||
// comboBoxDictionaries
|
||||
//
|
||||
@ -111,7 +110,6 @@
|
||||
this.labelChooseLanguageAndClickDownload.Size = new System.Drawing.Size(201, 13);
|
||||
this.labelChooseLanguageAndClickDownload.TabIndex = 11;
|
||||
this.labelChooseLanguageAndClickDownload.Text = "Choose your languge and click download";
|
||||
this.labelChooseLanguageAndClickDownload.Click += new System.EventHandler(this.labelChooseLanguageAndClickDownload_Click);
|
||||
//
|
||||
// labelPleaseWait
|
||||
//
|
||||
@ -121,7 +119,6 @@
|
||||
this.labelPleaseWait.Size = new System.Drawing.Size(73, 13);
|
||||
this.labelPleaseWait.TabIndex = 12;
|
||||
this.labelPleaseWait.Text = "Please wait...";
|
||||
this.labelPleaseWait.Click += new System.EventHandler(this.labelPleaseWait_Click);
|
||||
//
|
||||
// GetDictionaries
|
||||
//
|
||||
|
@ -221,20 +221,5 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
}
|
||||
|
||||
private void labelPleaseWait_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void labelChooseLanguageAndClickDownload_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void labelDescription1_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -274,16 +274,27 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_userWordList = new List<string>();
|
||||
_userPhraseList = new List<string>();
|
||||
_userWordDictionary = new XmlDocument();
|
||||
if (File.Exists(Utilities.DictionaryFolder + _languageName + "_user.xml"))
|
||||
string fileName = Utilities.DictionaryFolder + _languageName + "_user.xml";
|
||||
if (File.Exists(fileName))
|
||||
{
|
||||
_userWordDictionary.Load(Utilities.DictionaryFolder + _languageName + "_user.xml");
|
||||
foreach (XmlNode node in _userWordDictionary.DocumentElement.SelectNodes("word"))
|
||||
try
|
||||
{
|
||||
string word = node.InnerText.Trim().ToLower();
|
||||
if (word.Contains(" "))
|
||||
_userPhraseList.Add(word);
|
||||
else
|
||||
_userWordList.Add(word);
|
||||
_userWordDictionary.Load(fileName);
|
||||
foreach (XmlNode node in _userWordDictionary.DocumentElement.SelectNodes("word"))
|
||||
{
|
||||
string word = node.InnerText.Trim().ToLower();
|
||||
if (word.Contains(" "))
|
||||
_userPhraseList.Add(word);
|
||||
else
|
||||
_userWordList.Add(word);
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
MessageBox.Show("Unable to load user dictionary for " + _languageName + " from file: " + fileName + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
exception.Source + ": " + exception.Message);
|
||||
_userWordDictionary.LoadXml("<words />");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user