예제 #1
0
        object IExtractIcon.ExtractIcon(ExtractIconType type, Size desiredSize)
        {
            if (type == ExtractIconType.Thumbnail)
            {
                //// Have we already extracted the image?
                //if (cachedImage != null)
                //    return cachedImage;

                // Do we support this extension?
                string ext = base.File.Extension.ToLowerInvariant();
                if (ext == ".mif")
                {
            #if false
                    using (Stream stream = base.File.OpenRead())
                    using (QQGame.MifImageDecoder mif = new QQGame.MifImageDecoder(stream))
                    {
                        // TODO: should we dispose the original image???
                        Image img = mif.DecodeFrame().Image;
                        return (Image)img.Clone();
                    }
            #else
                    Stream stream = base.File.OpenRead();
                    QQGame.MifImage mif = new QQGame.MifImage(stream);
                    mif.Name = base.File.Name;
                    return mif;
            #endif
                }
                else if (ext == ".bmp" || ext == ".png")
                {
                    using (Stream stream = base.File.OpenRead())
                    using (Bitmap bmp = new Bitmap(stream))
                    {
                        // Make a copy of the bitmap, because MSDN says "You must
                        // keep the stream open for the lifetime of the Bitmap."
                        return bmp.Clone();
                    }
                }
            }
            return null;
        }
예제 #2
0
 string IExtractIcon.GetIconKey(ExtractIconType type, Size desiredSize)
 {
     if (type == ExtractIconType.Thumbnail)
     {
         return base.File.FullName;
     }
     else
     {
         return null;
     }
 }
예제 #3
0
 string IExtractIcon.GetIconKey(ExtractIconType type, Size desiredSize)
 {
     return "Folder_Icon_16";
 }
예제 #4
0
 object IExtractIcon.ExtractIcon(ExtractIconType type, Size desiredSize)
 {
     return smallIcon.Clone();
 }
예제 #5
0
 // NOTE: The following implementation duplicates with ImageFile.
 // We need to consolidate and remove one of them.
 object IExtractIcon.ExtractIcon(ExtractIconType type, Size desiredSize)
 {
     if (type == ExtractIconType.Thumbnail)
     {
         // Do we support this extension?
         string ext = Path.GetExtension( entry.FullName).ToLowerInvariant();
         if (ext == ".mif")
         {
             using (Stream stream = entry.Open())
             {
                 QQGame.MifImage mif = new QQGame.MifImage(stream);
                 mif.Name = entry.FullName;
                 return mif;
             }
         }
         else if (ext == ".bmp" || ext == ".png")
         {
             using (Stream stream = entry.Open())
             using (Bitmap bmp = new Bitmap(stream))
             {
                 // Make a copy of the bitmap, because MSDN says "You must
                 // keep the stream open for the lifetime of the Bitmap."
                 return bmp.Clone();
             }
         }
         else if (ext == ".tga")
         {
             using (Stream stream = entry.Open())
             using (TgaImage tga = new TgaImage(stream))
             {
                 // Make a copy of the bitmap so that we can dispose
                 // the TgaImage object.
                 return tga.Image.Clone();
             }
         }
     }
     return null;
 }
예제 #6
0
 string IExtractIcon.GetIconKey(ExtractIconType type, Size desiredSize)
 {
     return "Package_Icon_16";
 }