public TextFile(string fileName) { _FileName = fileName; _Temp = new TextLines(); _Perm = new TextLines(); _Orig = new TextLines(); }
public override bool Equals(object obj) { if (!(obj is TextLines)) { throw new ArgumentException(STR_EqualsError); } TextLines other = obj as TextLines; if (this.Count != other.Count) { return(false); } int lines = this.Count; bool equals = true; for (int i = 0; i < lines; i++) { equals = this[i].Equals(other[i]); if (!equals) { break; } } return(equals); }
public TextLines Clone() { TextLines newTextLines = new TextLines(); foreach (TextLine item in this) { newTextLines.Add(new TextLine(item.Value)); } return(newTextLines); }
public void ReadFromFile(string fileName) { _FileName = fileName; using (StreamReader reader = new StreamReader(fileName)) { _Temp = new TextLines(); while (!reader.EndOfStream) { string line = reader.ReadLine(); AddTextLine(line); } } _Perm = _Temp.Clone(); _Orig = _Temp.Clone(); }
public void Flip() { _Perm = _Temp.Clone(); }
public void Cancel() { _Temp = _Perm.Clone(); }