public virtual void ReadFile() { ToBegin(); BitArray nameLength = ReadBytesInContainer(4); BitArray fileName = ReadBytesInContainer(BitByte.IntFromBits(nameLength)); BitArray dataLength = ReadBytesInContainer(4); BitArray data = ReadBytesInContainer(BitByte.IntFromBits(dataLength)); HideFile.WriteBitArray(data, BitByte.BytesToString(BitByte.BitsToBytes(fileName))); }
private void Write() { try { resultText.Text = "Writing is started"; FileInfo info = new FileInfo(chosenFileName.Text); writerReader.WriteFile(info.Name, HideFile.ReadBitArray(info.FullName)); container.Image = new Bitmap(writerReader.GetContainer().GetPicture()); resultText.Text = "Writing is over"; } catch (Exception e) { Console.WriteLine(e.ToString()); resultText.Text = "Error during writing"; writerReader.GetBlock().SetContainer(new PixelPicture(new Bitmap(container.Image))); } }
private void Preanalysis() { try { analisysText.Text = "Preanalysis is started"; FileInfo info = new FileInfo(chosenFileName.Text); preanalysis.SetWriterReader(writerReader); preanalysis.WritePicture(info.Name, HideFile.ReadBitArray(info.FullName)); preanalysisPicture.Image = new Bitmap(preanalysis.GetPicture().GetPicture()); analisysText.Text = "Preanalysis is over"; } catch (Exception e) { Console.WriteLine(e.ToString()); analisysText.Text = "Error during preanalysis"; writerReader.GetBlock().SetContainer(new PixelPicture(new Bitmap(container.Image))); } }