Esempio n. 1
0
 void IThumbnailManager.SetThumbnail(string name, BitmapImage thumbnail)
 {
     using (var zipArchive = new ZipArchive("AssetThumbnails.zip"))
     {
         zipArchive.Save(name, thumbnail.StreamSource);
     }
 }
Esempio n. 2
0
        public static Font Load(Device device, string fileName, string name, AssetManager assetManager)
        {
            using (var zip = new ZipArchive(fileName))
            {
                string textureFile = Path.ChangeExtension(Path.GetFileName(fileName), ".tga");
                Texture texture = new Texture(device, zip.Load(textureFile), name);

                string widthDataFile = Path.ChangeExtension(Path.GetFileName(fileName), ".dat");
                return new Font(name, texture, zip.Load(widthDataFile));
            }
        }
Esempio n. 3
0
        BitmapImage IThumbnailManager.GetThumbnail(string name)
        {
            try
            {
                using (var zipArchive = new ZipArchive("AssetThumbnails.zip"))
                {
                    var stream = zipArchive.Load(name);

                    BitmapImage bi = new BitmapImage();
                    bi.BeginInit();
                    bi.CacheOption = BitmapCacheOption.OnLoad;
                    bi.StreamSource = stream;
                    bi.EndInit();
                    return bi;
                }
            }
            catch
            {
                return null;
            }
        }
Esempio n. 4
0
 public void Save(string fileName)
 {
     using (var zip = new ZipArchive(fileName))
     {
         zip.Save(Path.ChangeExtension(fileName, ".tga"), Texture.ToStream());
         zip.Save(Path.ChangeExtension(fileName, ".dat"), WidthStream);
     }
 }