private void saveToolStripMenuItem_Click(object sender, EventArgs e) { if (saveFileDialog.ShowDialog() == DialogResult.OK) { try { FileTls fileTls = new FileTls(saveFileDialog.FileName); fileTls.WriteString(Output.Text); } catch (Exception eror) { MessageBox.Show(eror.Message, "ошибка"); } } }
private void save_Click(object sender, EventArgs e) { if (saveFileDialog.ShowDialog() == DialogResult.OK) { try { FileTls fileTls = new FileTls(saveFileDialog.FileName); fileTls.WriteArr(DataGridViewUtils.GridToArray <int>(OutputGrid)); } catch (Exception eror) { MessageBox.Show(eror.Message, "ошибка"); } } }
private void open_Click(object sender, EventArgs e) { if (openFileDialog.ShowDialog() == DialogResult.OK) { try { FileTls fileTls = new FileTls(openFileDialog.FileName); bool[,] Matrix = fileTls.ReadBoolMatrix(); DataGridViewUtils.Array2ToGrid(Grid, Matrix); } catch (Exception eror) { MessageBox.Show(eror.Message, "ошибка"); } } }
private static void ArrFile(int[] Arr) { while (true) { try { Console.Write("введите имя файла: "); FileTls fileTls = new FileTls(Console.ReadLine()); fileTls.WriteArr(Arr); return; } catch (Exception eror) { Console.WriteLine(eror.Message); } } }
private static bool[,] BoolMatrixFile() { while (true) { try { Console.Write("введите имя файла: "); FileTls fileTls = new FileTls(Console.ReadLine()); bool[,] Matrix = fileTls.ReadBoolMatrix(); return(Matrix); } catch (Exception eror) { Console.WriteLine(eror.Message); } } }
private static int[,] IntMatrixFile() { while (true) { try { Console.Write("введите имя файла: "); FileTls fileTls = new FileTls(Console.ReadLine()); int[,] Matrix = fileTls.ReadIntMatrix(); if (Matrix.GetLength(0) != Matrix.GetLength(1)) { throw new Exception("матрица не квадратная"); } return(Matrix); } catch (Exception eror) { Console.WriteLine(eror.Message); } } }
private void open_Click(object sender, EventArgs e) { if (openFileDialog.ShowDialog() == DialogResult.OK) { try { FileTls fileTls = new FileTls(openFileDialog.FileName); int[,] Matrix = fileTls.ReadIntMatrix(); if (Matrix.GetLength(0) == Matrix.GetLength(0)) { DataGridViewUtils.Array2ToGrid(InputGrid, Matrix); } else { throw new Exception("матрица должна быть квадратной"); } } catch (Exception eror) { MessageBox.Show(eror.Message, "ошибка"); } } }