public static ImageSource Load(string packagePath, string localPath, double dpi = 96)
        {
            return(s_packageImageCache.GetOrCreate(UnifiedPath.Combine(packagePath, localPath),
                                                   () =>
            {
                try
                {
                    using (var stream = new PackageStream(packagePath, localPath))
                    {
                        BitmapSource image = BitmapImageEx.FromStream(stream);

                        if (image.DpiX != dpi || image.DpiY != dpi)
                        {
                            image = image.ChangeDPI(dpi);
                        }

                        image.Freeze();
                        return (ImageSource)image;
                    }
                }
                catch (Exception)
                {
                    return null;
                }
            }));
        }
Esempio n. 2
0
        public PackageFolderVM(ExplorerTreeNodeVM parent, string packageFile, string localPath)
            : base(parent, UnifiedPath.Combine(packageFile, localPath), UnifiedPath.GetFileName(localPath))
        {
            this.LocalPath   = localPath;
            this.PackagePath = packageFile;

            _childEntries = new List <ZipEntry>();
        }
Esempio n. 3
0
 public PackageFileVM(ExplorerTreeNodeVM parent, string packageFile, string localPath, string name)
     : base(parent, UnifiedPath.Combine(packageFile, localPath), name)
 {
     this.LocalPath   = localPath;
     this.PackagePath = packageFile;
 }
 public string GetNationalTechTreeLayoutFile(string nationKey)
 {
     return(UnifiedPath.Combine(this.GuiPackageFile, string.Format(@"{0}\{1}{2}", c_techTreeLayoutRelativePath, nationKey, c_techTreeLayoutFilePostfix)));
 }
Esempio n. 5
0
 public string GetUnifiedPath(string filename)
 {
     return(UnifiedPath.Combine(this.GetPackagePath(filename), filename));
 }