private void Exec_Click(object sender, RoutedEventArgs e) { FileWork.BinFileReader binFileReader = new FileWork.BinFileReader(); List <bool> bits = binFileReader.ReadFile(InputFile.Text); Int32 row = getRow(); Int32 column = getColumn(); bits = BinWork.Shufle.ShufleBits(bits, row, column); FileWork.BinFileCreator binFileCreator = new FileWork.BinFileCreator(); binFileCreator.WriteInFile(bits, OutPutFile.Text); MessageBox.Show("Готово"); }
private void Create_Click(object sender, RoutedEventArgs e) { bool bit = true; string fileName = "new_file.bin"; Int32 numBits = 100; FileWork.FileSaver fileSaver = new FileWork.FileSaver(); string filePath = fileSaver.SaveFile(fileName); if (!String.IsNullOrEmpty(filePath)) { fileName = filePath; } else { MessageBox.Show("Не вірний шлях до файлу"); return; } if ((bool)BitsTypeZero.IsChecked) { bit = false; } if (!String.IsNullOrEmpty(FileSizeBox.Text)) { numBits = Convert.ToInt32(FileSizeBox.Text); } FileWork.BinFileCreator fileCreator = new FileWork.BinFileCreator(); if (fileCreator.CreateFile(fileName, numBits, bit)) { MessageBox.Show("Готово"); } else { MessageBox.Show("Не вдалося створити файл"); } }
private void Execute_Click(object sender, RoutedEventArgs e) { FileWork.BinFileReader binFileReader = new FileWork.BinFileReader(); List <bool> bits = binFileReader.ReadFile(InputFile.Text); Dictionary <string, double> param = parameters.GetParams(); int typeSim = GetSimetryType(); CodecsWork.ChanelModel chanelModel = new CodecsWork.ChanelModel(typeSim); if (ErrSingleRadio.IsChecked == true) { if (!param.ContainsKey("typeSingle")) { ErrorTypeSingle errWin = new ErrorTypeSingle(parameters); errWin.Close(); param = parameters.GetParams(); chanelModel = new CodecsWork.ChanelModel(typeSim); } bits = chanelModel.SingleError(bits, param["typeSingle"] == 1 ? param["SingleError"] : param["Noise"], param["typeSingle"] == 1 ? true : false); } if (ErrPacketRadio.IsChecked == true) { if (!param.ContainsKey("PacketError")) { ErrorTypePacket errWin = new ErrorTypePacket(parameters); errWin.Close(); param = parameters.GetParams(); chanelModel = new CodecsWork.ChanelModel(typeSim); } bits = chanelModel.PacketError(bits, param); } FileWork.BinFileCreator binFileCreator = new FileWork.BinFileCreator(); binFileCreator.WriteInFile(bits, OutPutFile.Text); MessageBox.Show("Готово"); }