static List <Line> ConsoleInput() { StringBuilder sb = new StringBuilder(); string temp; temp = Console.ReadLine(); while (temp != "") { sb.AppendLine(temp); temp = Console.ReadLine(); } return(LineConvert.StrToLineList(sb.ToString())); }
private void Filt_Click(object sender, EventArgs e) { try { List <Line> lines = LineConvert.MatrixToLineList(Input.GetMatrix()); List <Line> LinesFilt = Line.GetMaxLines(lines); Output.SetMatrix(LineConvert.LineListToMatrix(LinesFilt)); save.Enabled = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "ошибка"); } }
private void Save_Click(object sender, EventArgs e) { if (saveFileDialog.ShowDialog() == DialogResult.OK) { try { LinesFile file = new LinesFile(saveFileDialog.FileName); file.WriteLines(LineConvert.MatrixToLineList(Output.GetMatrix())); } catch (Exception ex) { MessageBox.Show(ex.Message, "ошибка"); } } }
private void Open_Click(object sender, EventArgs e) { if (openFileDialog.ShowDialog() == DialogResult.OK) { try { LinesFile file = new LinesFile(openFileDialog.FileName); List <Line> lines = file.ReadLines(); Input.SetMatrix(LineConvert.LineListToMatrix(lines)); } catch (Exception ex) { MessageBox.Show(ex.Message, "ошибка"); } } }
static void ConsoleOutput(List <Line> Lines) { Console.WriteLine(LineConvert.LineListToStr(Lines)); }