public void DecodeMessageSeq(DecodeRequest request) { decodeValidator.Validate(request); Bitmap encodedMessage = new Bitmap(request.EncodedMessagePath); Rectangle rect = new Rectangle(0, 0, encodedMessage.Width, encodedMessage.Height); BitmapData encodedData = encodedMessage.LockBits(rect, ImageLockMode.ReadWrite, encodedMessage.PixelFormat); IntPtr ptr = encodedData.Scan0; int bytes = Math.Abs(encodedData.Stride) * encodedMessage.Height; bool[] lsbitArray = ReadAllLSBitsSeq(bytes, ptr); encodedMessage.UnlockBits(encodedData); BitArray header = GetHeader(lsbitArray, bytes); List <byte> decodedBytes = DecodeBytes(lsbitArray, header); File.WriteAllBytes(request.ResultPath, decodedBytes.ToArray()); }
public void Validate(DecodeRequest request) { ValidateNotNull(request, "Decode request must not be null"); ValidateFileExists(request.EncodedMessagePath, "Given stego-image does not exist"); ValidateExtension(request.EncodedMessagePath, "bmp", "Stego-image must have bmp extension"); }