Example #1
0
        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;
            }
        }
Example #2
0
        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));
            }
        }
Example #3
0
 public WadStream(WadPackage package)
 {
     Package      = package;
     StreamSource = package.GetStreamSource();
 }
Example #4
0
 public Pk3Stream(ZipPackage package)
 {
     Package      = package;
     StreamSource = package.GetStreamSource();
 }
Example #5
0
 private static bool PackageHasTexture(IPackageStreamSource package, string name)
 {
     return(package.HasFile((name ?? "").ToLowerInvariant()));
 }