void IThumbnailManager.SetThumbnail(string name, BitmapImage thumbnail) { using (var zipArchive = new ZipArchive("AssetThumbnails.zip")) { zipArchive.Save(name, thumbnail.StreamSource); } }
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)); } }
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; } }
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); } }