20 namespace SpellChecker.Net.Search.Spell
35 virtual public System.Collections.Generic.IEnumerator<
string> GetWordsIterator()
37 return new FileIterator(
this);
40 public System.Collections.Generic.IEnumerator<
string> GetEnumerator()
42 return GetWordsIterator();
45 System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
47 return GetEnumerator();
50 private System.IO.StreamReader in_Renamed;
51 private System.String line;
52 private bool has_next_called;
56 in_Renamed =
new System.IO.StreamReader(
new System.IO.StreamReader(file.FullName, System.Text.Encoding.Default).BaseStream,
new System.IO.StreamReader(file.FullName, System.Text.Encoding.Default).CurrentEncoding);
61 in_Renamed =
new System.IO.StreamReader(
new System.IO.StreamReader(dictFile, System.Text.Encoding.Default).BaseStream,
new System.IO.StreamReader(dictFile, System.Text.Encoding.Default).CurrentEncoding);
65 internal sealed
class FileIterator : System.Collections.Generic.IEnumerator<string>
69 InitBlock(enclosingInstance);
72 private void InitBlock(PlainTextDictionary enclosingInstance)
74 this.enclosingInstance = enclosingInstance;
77 private PlainTextDictionary enclosingInstance;
83 if (!Enclosing_Instance.has_next_called)
87 Enclosing_Instance.has_next_called =
false;
88 return Enclosing_Instance.line;
92 object System.Collections.IEnumerator.Current
96 if (!Enclosing_Instance.has_next_called)
100 Enclosing_Instance.has_next_called =
false;
101 return Enclosing_Instance.line;
106 public PlainTextDictionary Enclosing_Instance
108 get {
return enclosingInstance; }
112 public bool MoveNext()
114 Enclosing_Instance.has_next_called =
true;
117 Enclosing_Instance.line = Enclosing_Instance.in_Renamed.ReadLine();
119 catch (System.IO.IOException ex)
121 System.Console.Error.WriteLine(ex.StackTrace);
122 Enclosing_Instance.line = null;
125 return (Enclosing_Instance.line != null) ?
true :
false;
137 public void Dispose()