private void eraseSynOk(object sender, EventArgs e) { if (cbWord != "" && cbSyn != "") { _fileR = new StreamReader(_fileName); _fileW = new StreamWriter(_tempName, false); while (!_fileR.EndOfStream) { string temp = _fileR.ReadLine(); if (temp == cbWord) { _fileW.WriteLine(temp); while (!_fileR.EndOfStream) { temp = _fileR.ReadLine(); if (temp == cbSyn) { _fileR.ReadLine(); while (!_fileR.EndOfStream) { _fileW.WriteLine(_fileR.ReadLine()); } } else { _fileW.WriteLine(temp); } } _fileR.Close(); _fileW.Close(); _fileR = new StreamReader(_tempName); _fileW = new StreamWriter(_fileName, false); while (!_fileR.EndOfStream) { _fileW.WriteLine(_fileR.ReadLine()); } } else { _fileW.WriteLine(temp); } } _fileR.Close(); _fileW.Close(); WordCB.Text = cbWord; WordCB_SelectedIndexChanged(sender, e); SynCB.Text = ""; DefTB.Text = ""; SynCB.Focus(); cbSyn = ""; tbDef = ""; } }
private void SynCB_SelectedIndexChanged(object sender, EventArgs e) { cbSyn = SynCB.Text; _fileR = new StreamReader(_fileName); while (!_fileR.EndOfStream) { string temp = _fileR.ReadLine(); if (temp == SynCB.Text) { DefTB.Text = _fileR.ReadLine(); break; } } _fileR.Close(); SynCB.Update(); tbDef = DefTB.Text; }
private void WordCB_SelectedIndexChanged(object sender, EventArgs e) { SynCB.Items.Clear(); cbWord = WordCB.Text; _fileR = new StreamReader(_fileName); if (SynCB.Visible == true) { while (!_fileR.EndOfStream) { string temp = _fileR.ReadLine(); if (temp == WordCB.Text) { _fileR.ReadLine(); temp = _fileR.ReadLine(); while (temp != "/") { SynCB.Items.Add(temp); _fileR.ReadLine(); temp = _fileR.ReadLine(); } } } } else if (SynTB.Visible == false) { while (!_fileR.EndOfStream) { string temp = _fileR.ReadLine(); if (temp == WordCB.Text) { DefTB.Text = _fileR.ReadLine(); break; } } } _fileR.Close(); SynCB.Sorted = true; SynCB.Update(); }