/// <summary>
    /// Converts the .gf pixel data to raw bitmap data, including for the mipmaps
    /// </summary>
    /// <param name="gf">The GF file data</param>
    /// <returns>The raw bitmap data for every image, including the mipmaps</returns>
    public static IEnumerable <RawBitmapData> GetRawBitmapDatas(this GF gf)
    {
        int offset = 0;

        // Return the main image
        yield return(gf.GetRawBitmapData(offset));

        // Return mipmaps
        foreach ((int Width, int Height)mipmap in gf.GetExclusiveMipmapSizes())
        {
            // Calculate the size
            int size = mipmap.Width * mipmap.Height * gf.Channels;

            // Make sure the size is valid
            if (size <= 0)
            {
                continue;
            }

            // Return the bitmap
            yield return(gf.GetRawBitmapData(mipmap.Width, mipmap.Height, offset));

            // Get the offset
            offset += size;
        }
    }
    /// <summary>
    /// Loads the thumbnail and display info for the file
    /// </summary>
    /// <param name="inputStream">The file data stream</param>
    /// <param name="fileExtension">The file extension</param>
    /// <param name="width">The thumbnail width</param>
    /// <param name="manager">The manager</param>
    /// <returns>The thumbnail data</returns>
    public ArchiveFileThumbnailData LoadThumbnail(ArchiveFileStream inputStream, FileExtension fileExtension, int width, IArchiveDataManager manager)
    {
        // Load the file
        GF file = GetFileContent(inputStream, manager);

        // Load the raw bitmap data
        RawBitmapData rawBmp = file.GetRawBitmapData(width, (int)(file.Height / ((double)file.Width / width)));

        var format = rawBmp.PixelFormat == PixelFormat.Format32bppArgb ? PixelFormats.Bgra32 : PixelFormats.Bgr24;

        // Get a thumbnail source
        BitmapSource thumbnailSource = BitmapSource.Create(rawBmp.Width, rawBmp.Height, 96, 96, format, null, rawBmp.PixelData, (rawBmp.Width * format.BitsPerPixel + 7) / 8);

        // Get the thumbnail with the specified size
        return(new ArchiveFileThumbnailData(thumbnailSource, new DuoGridItemViewModel[]
        {
            new DuoGridItemViewModel(
                header: new ResourceLocString(nameof(Resources.Archive_FileInfo_Img_Size)),
                text: $"{file.Width}x{file.Height}"),
            new DuoGridItemViewModel(
                header: new ResourceLocString(nameof(Resources.Archive_FileInfo_Img_HasAlpha)),
                text: new GeneratedLocString(() => $"{file.PixelFormat.SupportsTransparency()}")),
            new DuoGridItemViewModel(
                header: new ResourceLocString(nameof(Resources.Archive_FileInfo_Img_Mipmaps)),
                text: $"{file.ExclusiveMipmapCount}"),
            new DuoGridItemViewModel(
                header: new ResourceLocString(nameof(Resources.Archive_FileInfo_Format)),
                text: $"{file.PixelFormat.ToString().Replace("Format_", "")}",
                minUserLevel: UserLevel.Technical),
        }));
    }
 /// <summary>
 /// Converts the .gf pixel data to raw bitmap data
 /// </summary>
 /// <param name="gf">The GF file data</param>
 /// <param name="offset">The offset in the pixel array</param>
 /// <returns>The raw image data</returns>
 public static RawBitmapData GetRawBitmapData(this GF gf, int offset = 0) => gf.GetRawBitmapData(gf.Width, gf.Height, offset);