Ejemplo n.º 1
0
        /// <summary>
        /// Reads the manifest and populates the ExternalAppxPackagesRelativePaths and InternalAppxPackagesRelativePaths lists.
        /// </summary>
        private void PopulateChildAppxPackages()
        {
            IAppxBundleManifestPackageInfoEnumerator subPackagesEnumerator = this.manifestReader.GetPackageInfoItems();

            while (subPackagesEnumerator.GetHasCurrent())
            {
                IAppxBundleManifestPackageInfo subPackageInfo = subPackagesEnumerator.GetCurrent();

                // If the package is not contained within the bundle, the corresponding package element in the bundle manifest
                // would not have an offset field. In such a case and only in that case, the AppxPackaging APIs would return 0
                // when retrieving the offset.
                if (subPackageInfo.GetOffset() == 0)
                {
                    this.ExternalAppxPackages.Add(new ExternalPackageReference(
                                                      this,
                                                      subPackageInfo.GetPackageId().GetPackageFullName(),
                                                      subPackageInfo.GetFileName(),
                                                      isOptional: false));
                }
                else
                {
                    this.InternalAppxPackagesRelativePaths.Add(subPackageInfo.GetFileName());
                }

                subPackagesEnumerator.MoveNext();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Reads the manifest and populates the ExternalAppxPackagesRelativePaths and InternalAppxPackagesRelativePaths lists.
        /// </summary>
        private void PopulateChildAppxPackages()
        {
            IAppxBundleManifestPackageInfoEnumerator subPackagesEnumerator = this.manifestReader.GetPackageInfoItems();

            while (subPackagesEnumerator.GetHasCurrent())
            {
                IAppxBundleManifestPackageInfo subPackageInfo = subPackagesEnumerator.GetCurrent();
                IAppxManifestPackageId         subPackageId   = subPackageInfo.GetPackageId();
                string filePath = subPackageInfo.GetFileName();

                // If the package is not contained within the bundle, the corresponding package element in the bundle manifest
                // would not have an offset field. In such a case and only in that case, the AppxPackaging APIs would return 0
                // when retrieving the offset.
                if (subPackageInfo.GetOffset() == 0)
                {
                    this.ExternalAppxPackages.Add(new ExternalPackageReference(
                                                      this,
                                                      subPackageId.GetPackageFullName(),
                                                      filePath,
                                                      isOptional: false));
                }
                else
                {
                    var childPackageMetadata = new ChildPackageMetadata(
                        this,
                        subPackageId.GetPackageFullName(),
                        filePath,
                        subPackageInfo.GetPackageType(),
                        subPackageInfo.GetSize(),
                        subPackageId.GetVersion(),
                        subPackageId.GetResourceId());

                    this.ChildAppxPackages.Add(childPackageMetadata);

#pragma warning disable CS0612 // Type or member is obsolete
                    this.InternalAppxPackagesRelativePaths.Add(filePath);
#pragma warning restore CS0612 // Type or member is obsolete
                }

                subPackagesEnumerator.MoveNext();
            }
        }