예제 #1
0
        public void Load(bool isWin64, Catalogue catalogue)
        {
            // Get the root folder path.

            string rootFolderPath;

            if (string.IsNullOrEmpty(catalogue.RootFolder))
            {
                rootFolderPath = Path.GetDirectoryName(catalogue.FullPath);
            }
            else
            {
                rootFolderPath = FilePath.GetAbsolutePath(catalogue.RootFolder, Path.GetDirectoryName(catalogue.FullPath));
            }

            // Create the module element.

            Module module = CreateModule();

            Wix.AddChild(module);

            // Create the package element.

            Microsoft.Tools.WindowsInstallerXml.Serialize.Package package = CreatePackage(isWin64);
            module.AddChild(package);

            // Create a target directory element.

            Directory directory = CreateDirectory(Constants.Wix.Xml.Directory.Target.Id, Constants.Wix.Xml.Directory.Target.Name);

            module.AddChild(directory);

            // Load the artifacts in the catalogue.

            foreach (Artifact artifact in catalogue.Artifacts)
            {
                Load(isWin64, artifact, rootFolderPath, directory);
            }

            // Add the catalogue file itself.

            Artifact catalogueArtifact = new Artifact(FilePath.GetRelativePath(catalogue.FullPath, rootFolderPath));

            catalogueArtifact.SetMetadata(Constants.Catalogue.Artifact.Guid, catalogue.Guid);
            Load(isWin64, catalogueArtifact, rootFolderPath, directory);

            // Resolve all elements.

            Resolve(directory);
        }