示例#1
0
        private static StegModel unstegImageByImageType(string path)
        {
            var sm       = new StegModel();
            var trimPath = path.ToLower().Trim();

            // Check image type
            if (trimPath.EndsWith(".jpg") || trimPath.EndsWith(".jpeg")) // JPEG
            {
                var stegStruct = JpegHelper.UnstegBinary(path);
                sm.SecurityLevel = stegStruct.SecurityLevel;
                sm.TotalSize     = stegStruct.TotalSize;
                sm.ContentFull   = stegStruct.ContentFull;
                sm.IsFile        = stegStruct.IsFile;
                sm.ContentSize   = stegStruct.ContentSize;
                sm.Content       = stegStruct.Content;
            }
            else if (trimPath.EndsWith(".bmp")) // BITMAP
            {
                var stegStruct = BmpHelper.UnstegBinary(path);
                sm.SecurityLevel = stegStruct.SecurityLevel;
                sm.TotalSize     = stegStruct.TotalSize;
                sm.ContentFull   = stegStruct.ContentFull;
                sm.IsFile        = stegStruct.IsFile;
                sm.ContentSize   = stegStruct.ContentSize;
                sm.Content       = stegStruct.Content;
            }
            else if (trimPath.EndsWith(".png")) // PNG
            {
                var stegStruct = PngHelper.UnstegBinary(path);
                sm.SecurityLevel = stegStruct.SecurityLevel;
                sm.TotalSize     = stegStruct.TotalSize;
                sm.ContentFull   = stegStruct.ContentFull;
                sm.IsFile        = stegStruct.IsFile;
                sm.ContentSize   = stegStruct.ContentSize;
                sm.Content       = stegStruct.Content;
            }
            else if (trimPath.EndsWith(".gif")) // GIF
            {
                var stegStruct = GifHelper.UnstegBinary(path);
                sm.SecurityLevel = stegStruct.SecurityLevel;
                sm.TotalSize     = stegStruct.TotalSize;
                sm.ContentFull   = stegStruct.ContentFull;
                sm.IsFile        = stegStruct.IsFile;
                sm.ContentSize   = stegStruct.ContentSize;
                sm.Content       = stegStruct.Content;
            }
            else if (trimPath.EndsWith(".tif") || trimPath.EndsWith(".tiff")) // TIFF
            {
                var stegStruct = TifHelper.UnstegBinary(path);
                sm.SecurityLevel = stegStruct.SecurityLevel;
                sm.TotalSize     = stegStruct.TotalSize;
                sm.ContentFull   = stegStruct.ContentFull;
                sm.IsFile        = stegStruct.IsFile;
                sm.ContentSize   = stegStruct.ContentSize;
                sm.Content       = stegStruct.Content;
            }

            else if (!string.IsNullOrEmpty(trimPath))
            {
                MessageBox.Show("Wrong extension.", "StegImageUI", MessageBoxButton.OK, MessageBoxImage.Information);
            }

            return(sm);
        }