Ejemplo n.º 1
0
 private void EnsureCachePopulated(string path, bool isDir)
 {
     foreach (string pkgPath in GetAllPossiblePkgPaths(path, isDir))
     {
         if (!packageStatuses.ContainsKey(pkgPath))
         {
             string pkgRealPath = pkgPath.Replace("/", Path.Separator);
             if (File.Exists(pkgRealPath))
             {
                 CryPkgDecoder pkg = new CryPkgDecoder(File.ReadBytes(pkgRealPath));
                 packageStatuses[pkgPath] = pkg;
             }
             else
             {
                 packageStatuses[pkgPath] = null;
             }
         }
     }
 }
Ejemplo n.º 2
0
        private CryPkgPath GetPackagedPath(string fullPath, bool isDir)
        {
            string canonicalPath = fullPath.Replace('\\', '/');

            this.EnsureCachePopulated(canonicalPath, isDir);

            string pkgPath = this.GetPathOfHighestCryPkg(canonicalPath, isDir);

            if (pkgPath == null)
            {
                return(null);
            }
            string        pkgDir      = pkgPath.Substring(0, pkgPath.Length - ".crypkg".Length);
            CryPkgDecoder pkg         = packageStatuses[pkgPath];
            string        relativeDir = (pkgDir == canonicalPath)
                ? "."
                : canonicalPath.Substring(pkgDir.Length + 1);

            return(new CryPkgPath(relativeDir, pkg));
        }
Ejemplo n.º 3
0
 public CryPkgPath(string path, CryPkgDecoder package)
 {
     this.Package = package;
     this.Path    = path;
 }