public void RemovePackageFile(PackageFile package, bool releaseResources, bool forceRelease) { lock (resourceMutex_) { for (int i = 0; i < packages_.Count; i++) { if (packages_[i] == package) {/* * if(releaseResources) * ReleasePackageResources(packages_[i], forceRelease);*/ Log.Info("Removed resource package " + packages_[i].Name); packages_.RemoveAt(i); return; } } } }
File SearchPackages(string nameIn) { for (int i = 0; i < packages_.Count; ++i) { PackageFile pkg = packages_[i]; PackageEntry?entry = pkg.GetEntry(nameIn); if (entry != null) { File file = new File(System.IO.File.OpenRead(pkg.Name)); // todo offset ? file.Name = nameIn; //entry.Value.offset_; //entry.Value.size_; return(file); } } return(null); }
public void RemovePackageFile(string fileName, bool releaseResources, bool forceRelease) { lock (resourceMutex_) { // Compare the name and extension only, not the path string fileNameNoPath = FileUtil.GetFileNameAndExtension(fileName); for (int i = 0; i < packages_.Count; i++) { PackageFile pkg = packages_[i]; if (0 == string.Compare(FileUtil.GetFileNameAndExtension(pkg.Name), fileNameNoPath, true)) {/* * if(releaseResources) * ReleasePackageResources(pkg, forceRelease);*/ Log.Info("Removed resource package " + pkg.Name); packages_.RemoveAt(i); return; } } } }
public bool AddPackageFile(PackageFile package, int priority = int.MaxValue) { lock (resourceMutex_) { // Do not add packages that failed to load if (!package || package.NumFiles == 0) { Log.Error("Could not add package file {0} due to load failure", package.Name); return(false); } if (priority < packages_.Count) { packages_.Insert(priority, package); } else { packages_.Add(package); } Log.Info("Added resource package " + package.Name); return(true); } }
public bool AddPackageFile(string fileName, int priority) { PackageFile package = new PackageFile(); return(package.Open(fileName) && AddPackageFile(package)); }