예제 #1
0
 public TextFile(string fileName)
 {
     _FileName = fileName;
     _Temp     = new TextLines();
     _Perm     = new TextLines();
     _Orig     = new TextLines();
 }
예제 #2
0
        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);
        }
예제 #3
0
        public TextLines Clone()
        {
            TextLines newTextLines = new TextLines();

            foreach (TextLine item in this)
            {
                newTextLines.Add(new TextLine(item.Value));
            }

            return(newTextLines);
        }
예제 #4
0
        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();
        }
예제 #5
0
 public void Flip()
 {
     _Perm = _Temp.Clone();
 }
예제 #6
0
 public void Cancel()
 {
     _Temp = _Perm.Clone();
 }