Exemple #1
0
 private void eraseWordOk()
 {
     if (cbWord != "")
     {
         _fileR = new StreamReader(_fileName);
         _fileW = new StreamWriter(_tempName, false);
         while (!_fileR.EndOfStream)
         {
             string temp = _fileR.ReadLine();
             if (temp == "/")
             {
                 temp = _fileR.ReadLine();
                 if (temp == cbWord)
                 {
                     while (!_fileR.EndOfStream)
                     {
                         temp = _fileR.ReadLine();
                         if (temp == "/")
                         {
                             while (!_fileR.EndOfStream)
                             {
                                 _fileW.WriteLine(_fileR.ReadLine());
                             }
                         }
                     }
                     _fileR.Close();
                     _fileW.Close();
                     _fileR = new StreamReader(_tempName);
                     _fileW = new StreamWriter(_fileName, false);
                     while (!_fileR.EndOfStream)
                     {
                         _fileW.WriteLine(_fileR.ReadLine());
                     }
                 }
                 else
                 {
                     _fileW.WriteLine("/");
                     _fileW.WriteLine(temp);
                 }
             }
             else
             {
                 _fileW.WriteLine(temp);
             }
         }
         WordCB.Text = "";
         DefTB.Text  = "";
         cbSyn       = "";
         cbWord      = "";
         tbDef       = "";
         WordCB.Focus();
         _fileR.Close();
         _fileW.Close();
     }
 }
Exemple #2
0
 private void changeWordOk()
 {
     if (WordCB.Text != "")
     {
         if (DefTB.Text == "")
         {
             MessageBox.Show("You must enter a definition!", "No Definition", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             _fileR = new StreamReader(_fileName);
             _fileW = new StreamWriter(_tempName, false);
             while (!_fileR.EndOfStream)
             {
                 string temp = _fileR.ReadLine();
                 if (temp == cbWord)
                 {
                     _fileR.ReadLine();
                     _fileW.WriteLine(WordCB.Text);
                     _fileW.WriteLine(DefTB.Text);
                     while (!_fileR.EndOfStream)
                     {
                         _fileW.WriteLine(_fileR.ReadLine());
                     }
                     _fileR.Close();
                     _fileW.Close();
                     _fileR = new StreamReader(_tempName);
                     _fileW = new StreamWriter(_fileName, false);
                     while (!_fileR.EndOfStream)
                     {
                         _fileW.WriteLine(_fileR.ReadLine());
                     }
                     _fileR.Close();
                     _fileW.Close();
                 }
                 else
                 {
                     _fileW.WriteLine(temp);
                 }
             }
             WordCB.Text = "";
             DefTB.Text  = "";
             cbSyn       = "";
             cbWord      = "";
             tbDef       = "";
             WordCB.Focus();
             _fileR.Close();
             _fileW.Close();
         }
     }
 }