public static void ExtractDefault(Game game) { TexturePack extractor = new TexturePack(); extractor.Extract(game.DefaultTexturePack, game); game.World.TextureUrl = null; }
static void ExtractCachedTexturePack(Game game, string url) { using (Stream data = TextureCache.GetStream(url)) { if (data == null) // e.g. 404 errors { if (game.World.TextureUrl != null) { ExtractDefault(game); } } else if (url != game.World.TextureUrl) { game.World.TextureUrl = url; TexturePack extractor = new TexturePack(); extractor.Extract(data, game); } } }
internal static void ExtractTexturePack(Game game, Request item) { if (item.Data == null) { return; } game.World.TextureUrl = item.Url; byte[] data = (byte[])item.Data; TextureCache.Add(item.Url, data); TextureCache.AddETag(item.Url, item.ETag, game.ETags); TextureCache.AdddLastModified(item.Url, item.LastModified, game.LastModified); TexturePack extractor = new TexturePack(); using (Stream ms = new MemoryStream(data)) { extractor.Extract(ms, game); } }