private Size GetImageSize(IPackageStreamSource source, string file) { var len = 0; try { using (var str = source.OpenFile(file)) { len = (int)str.Length; if (file.EndsWith(".tga")) { return(TgaFile.GetTgaFileSize(str)); } else { using (var bmp = Image.FromStream(str)) { return(new Size(bmp.Width, bmp.Height)); } } } } catch (Exception ex) { int i = 1; throw; } }
internal static Bitmap OpenImage(IPackageStreamSource source, string file) { var open = source.OpenFile(file.ToLowerInvariant()); if (open == null) { return(null); } if (file.EndsWith(".tga")) { return(TgaFile.LoadTgaFile(open)); } else { return(new Bitmap(open)); } }
public WadStream(WadPackage package) { Package = package; StreamSource = package.GetStreamSource(); }
public Pk3Stream(ZipPackage package) { Package = package; StreamSource = package.GetStreamSource(); }
private static bool PackageHasTexture(IPackageStreamSource package, string name) { return(package.HasFile((name ?? "").ToLowerInvariant())); }