private void MakeRegexes()
{
try
{
Typos.Clear();
TyposCount = 0;
TypoGroup bounded = new TypoGroup(20, @"^\\b(.*)\\b$", @"[^\\]\\\d", @"\b", @"\b");
TypoGroup other = new TypoGroup(5, null, @"[^\\]\\\d", "", "");
TypoGroup withBackreferences = new TypoGroup(1, null, null, "", "");
Typos.Add(bounded);
Typos.Add(other);
Typos.Add(withBackreferences);
Dictionary <string, string> typoStrings = LoadTypos();
if (TyposLoaded)
{
foreach (KeyValuePair <string, string> k in typoStrings)
{
if (bounded.SuitableTypo(k.Key))
{
bounded.Add(k.Key, k.Value);
}
else
if (other.SuitableTypo(k.Key))
{
other.Add(k.Key, k.Value);
}
else
{
withBackreferences.Add(k.Key, k.Value);
}
TyposCount++;
}
foreach (TypoGroup grp in Typos)
{
grp.MakeGroups();
}
}
}
catch (TypoException)
{
Typos.Clear();
TyposCount = 0;
TyposLoaded = false;
}
catch (Exception ex)
{
TyposLoaded = false;
ErrorHandler.Handle(ex);
}
}