public static List <DecryptedFile> Decrypt(Bitmap img) { Color[,] pixels = GetImagePixels(img); if (IsEncryptedImage(img, ref pixels)) { List <DecryptedFile> files = new List <DecryptedFile>(); int fileLength = BitConverter.ToInt32(ReadBytes(img.Size, ref pixels, 128, 32), 0); int position = 160; for (int i = 0; i < fileLength; i++) { string extention = Encoding.ASCII.GetString(ReadBytes(img.Size, ref pixels, position, 24)); int fileSize = BitConverter.ToInt32(ReadBytes(img.Size, ref pixels, position + 24, 32), 0); byte[] data = ReadBytes(img.Size, ref pixels, position + 56, fileSize); DecryptedFile file = new DecryptedFile() { Data = data, Extention = extention }; files.Add(file); position += 56 + fileSize; } return(files); } return(null); }
public List <DecryptedFile> Decrypt() { try { currentLock.LockBits(); if (IsEncryptedImage) { List <DecryptedFile> files = new List <DecryptedFile>(); int fileLength = BitConverter.ToInt32(ReadBytes(128, 32), 0); int position = 160; for (int i = 0; i < fileLength; i++) { string extention = Encoding.ASCII.GetString(ReadBytes(position, 24)); int fileSize = BitConverter.ToInt32(ReadBytes(position + 24, 32), 0); byte[] data = ReadBytes(position + 56, fileSize); DecryptedFile file = new DecryptedFile() { Data = data, Extention = extention }; files.Add(file); position += 56 + fileSize; } return(files); } return(null); } catch (Exception ex) { } finally { currentLock.UnlockBits(); } return(null); }