/// <summary> /// Loads the listfile for the specifed package and adds it to the local list of packages. /// </summary> /// <returns> /// Returns <value>false</value> if the package didn't have a listfile or if the listfile couldn't be loaded, /// <value>true</value> otherwise. /// </returns> public bool LoadListfileByPackage(PackageInteractionHandler inPackageHandler) { if (!HasBundledListfiles()) { // We don't have any listfiles, so there's no use return(false); } if (this.OptimizedLists.ContainsKey(inPackageHandler.PackageName)) { // The package listfile container has already been loaded. // Thus, check if the container has a listfile for this package return(HasListfileForPackage(inPackageHandler)); } foreach (string bundledListfilePath in GetAvailableBundledListfilePaths()) { if (Path.GetFileNameWithoutExtension(bundledListfilePath) == inPackageHandler.PackageName) { OptimizedListContainer bundledListfile = new OptimizedListContainer(File.ReadAllBytes(bundledListfilePath)); // Keep the listfile container around, in case we need it. this.OptimizedLists.Add(bundledListfile.PackageName, bundledListfile); if (bundledListfile.ContainsPackageListfile(inPackageHandler.GetHashTableHash())) { return(true); } } } return(false); }
/// <summary> /// Determines whether the provided package handler has a bundled listfile. /// </summary> /// <returns><c>true</c> if this instance has listfile for package the specified PackageHandler; otherwise, <c>false</c>.</returns> /// <param name="inPackageHandler">Package handler.</param> public bool HasListfileForPackage(PackageInteractionHandler inPackageHandler) { return(HasListfileForPackage(inPackageHandler.PackageName, inPackageHandler.GetHashTableHash())); }
/// <summary> /// Gets the bundled listfile for the provided package handler. /// </summary> /// <returns>The bundled listfile.</returns> /// <param name="inPackageHandler">Package handler.</param> public List <string> GetBundledListfile(PackageInteractionHandler inPackageHandler) { return(GetBundledListfile(inPackageHandler.PackageName, inPackageHandler.GetHashTableHash())); }