/// <summary> /// Return true if a file exists at a specific location within the package. /// </summary> /// <param name="relativePath">The package-relative path to the requested file.</param> /// <returns>True if the package exists.</returns> /// <exception cref="ArgumentException">Returned if the relativePath is null or empty or /// is not a relative path.</exception> public override bool FileExists(string relativePath) { if (m_isDisposed) { throw new ObjectDisposedException(GetType().Name); } // If the package exists, the manifest exists. if (IsManifest(relativePath)) { return(true); } return(m_spPackageReader.FileExists(relativePath)); }
/// <summary> /// Validate the basic structure of a package to ensure it is e-learning content. This method does not /// verify any package details, but rather verifies that the structure of the package indicates it is /// intended to be e-learning content that can be rendered within MLC. /// </summary> /// <param name="packageReader">The package to validate.</param> /// <returns>The results of validation.</returns> public static ValidationResults Validate(PackageReader packageReader) { ValidatorResources.Culture = LocalizationManager.GetCurrentCulture(); Utilities.ValidateParameterNonNull("packageReader", packageReader); ValidationResults results = new ValidationResults(); try { // If the path does not contain imsmanifest.xml return error result if (!packageReader.FileExists("imsmanifest.xml")) { results.AddResult(new ValidationResult(true, ValidatorResources.ManifestMissing)); } } catch (InvalidPackageException e) { results.AddResult(new ValidationResult(true, e.Message)); } return(results); }