/// <summary>
        /// Initializes a new instance of the ExternalPackageReference class.
        /// </summary>
        /// <param name="parentBundle">The parent bundle in which this reference was found</param>
        /// <param name="packageFullName">The full name of the package</param>
        /// <param name="relativePath">The relative path of this package as specified in the parent bundle</param>
        /// <param name="isOptional">a flag indicating if this package is optional w.r.t its parent</param>
        public ExternalPackageReference(
            AppxBundleMetadata parentBundle,
            string packageFullName,
            string relativePath,
            bool isOptional)
        {
            this.PackageFullName = packageFullName;
            this.FullPath        = Path.Combine(Path.GetDirectoryName(parentBundle.FilePath), relativePath);
            this.ParentBundle    = parentBundle;
            this.RelativePath    = relativePath;
            this.IsOptional      = isOptional;
            this.IsBundle        = FileExtensionHelper.HasUnencryptedBundleExtension(this.FullPath);

            this.packageInfoFactory = new Lazy <PackageMetadata>(() =>
            {
                if (this.IsBundle)
                {
                    return(new AppxBundleMetadata(this.FullPath));
                }
                else
                {
                    return(new AppxMetadata(this.FullPath));
                }
            });
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the AppxBundleMetadata class.
        /// </summary>
        /// <param name="parentBundleInfo">the parent bundle from which this bundle is referenced</param>
        /// <param name="fileRelativePath">the relative path to the appxbundle file, as referenced
        /// from a parent appxbundle file</param>
        public AppxBundleMetadata(AppxBundleMetadata parentBundleInfo, string fileRelativePath)
        {
            this.RelativePath = fileRelativePath;
            string fullPath = Path.Combine(Path.GetDirectoryName(parentBundleInfo.FilePath), fileRelativePath);

            this.Initialize(fullPath);
        }