private void AdatRejtes(string fileNev, string szoveg) { BitmapImage bmp = new BitmapImage(); bmp.BeginInit(); bmp.CacheOption = BitmapCacheOption.OnLoad; bmp.CreateOptions = BitmapCreateOptions.IgnoreImageCache; bmp.UriSource = new Uri(fileNev); bmp.EndInit(); WriteableBitmap wbmp = new WriteableBitmap(bmp); int arraySize = wbmp.BackBufferStride * wbmp.PixelHeight; byte[] originalPixels = new byte[arraySize]; wbmp.CopyPixels(originalPixels, wbmp.BackBufferStride, 0); SztegoLSB lsb = new SztegoLSB((TitkositoAlgoritmus)ComboBoxTitkositoTipus.SelectedIndex); lsb.Elrejtes(szoveg, originalPixels); wbmp.WritePixels(new Int32Rect(0, 0, wbmp.PixelWidth, wbmp.PixelHeight), originalPixels, wbmp.BackBufferStride, 0); ImageStego.Source = wbmp; string stegoFileNev = Konyvtarak.AdatKonyvtar + "\\stego.bmp"; BitmapMentese(wbmp, stegoFileNev); KepBetoltese(stegoFileNev); TextBlockFilenev.Text = stegoFileNev; }
private void Visszafejtes(string fileNev) { BitmapImage bmp = new BitmapImage(); bmp.BeginInit(); bmp.CacheOption = BitmapCacheOption.OnLoad; bmp.CreateOptions = BitmapCreateOptions.IgnoreImageCache; bmp.UriSource = new Uri(fileNev); bmp.EndInit(); WriteableBitmap wbmp = new WriteableBitmap(bmp); int arraySize = wbmp.BackBufferStride * bmp.PixelHeight; byte[] originalPixels = new byte[arraySize]; bmp.CopyPixels(originalPixels, wbmp.BackBufferStride, 0); SztegoLSB lsb = new SztegoLSB(); TextBoxVisszafejtett.Text = lsb.Visszafejtes(originalPixels); }