Exemplo n.º 1
0
        public void Execute()
        {
            this.Messaging = this.ServiceProvider.GetService <IMessaging>();

            var extensionManager = this.ServiceProvider.GetService <IExtensionManager>();

            var context = this.ServiceProvider.GetService <ILayoutContext>();

            context.Messaging        = this.Messaging;
            context.Extensions       = extensionManager.Create <ILayoutExtension>();
            context.FileTransfers    = this.FileTransfers;
            context.ContentFilePaths = this.ContentFilePaths;
            context.ContentsFile     = this.ContentsFile;
            context.OutputPdbPath    = this.OutputsFile;
            context.BuiltOutputsFile = this.BuiltOutputsFile;
            context.SuppressAclReset = this.SuppressAclReset;

            // Pre-layout.
            //
            foreach (var extension in context.Extensions)
            {
                extension.PreLayout(context);
            }

            try
            {
                // Final step in binding that transfers (moves/copies) all files generated into the appropriate
                // location in the source image.
                if (context.FileTransfers?.Any() == true)
                {
                    this.Messaging.Write(VerboseMessages.LayingOutMedia());

                    var command = new TransferFilesCommand(context.Messaging, context.Extensions, context.FileTransfers, context.SuppressAclReset);
                    command.Execute();
                }
            }
            finally
            {
                if (!String.IsNullOrEmpty(context.ContentsFile) && context.ContentFilePaths != null)
                {
                    this.CreateContentsFile(context.ContentsFile, context.ContentFilePaths);
                }

                if (!String.IsNullOrEmpty(context.OutputsFile) && context.FileTransfers != null)
                {
                    this.CreateOutputsFile(context.OutputsFile, context.FileTransfers, context.OutputPdbPath);
                }

                if (!String.IsNullOrEmpty(context.BuiltOutputsFile) && context.FileTransfers != null)
                {
                    this.CreateBuiltOutputsFile(context.BuiltOutputsFile, context.FileTransfers, context.OutputPdbPath);
                }
            }

            // Post-layout.
            foreach (var extension in context.Extensions)
            {
                extension.PostLayout();
            }
        }
Exemplo n.º 2
0
        public void Layout(ILayoutContext context)
        {
            // Pre-layout.
            //
            foreach (var extension in context.Extensions)
            {
                extension.PreLayout(context);
            }

            try
            {
                // Final step in binding that transfers (moves/copies) all files generated into the appropriate
                // location in the source image.
                if (context.FileTransfers?.Any() == true)
                {
                    this.Messaging.Write(VerboseMessages.LayingOutMedia());

                    var command = new TransferFilesCommand(this.Messaging, context.Extensions, context.FileTransfers, context.SuppressAclReset);
                    command.Execute();
                }

                if (context.TrackedFiles != null)
                {
                    this.CleanTempFiles(context.IntermediateFolder, context.TrackedFiles);
                }
            }
            finally
            {
                if (context.TrackedFiles != null)
                {
                    if (!String.IsNullOrEmpty(context.ContentsFile))
                    {
                        this.CreateContentsFile(context.ContentsFile, context.TrackedFiles);
                    }

                    if (!String.IsNullOrEmpty(context.OutputsFile))
                    {
                        this.CreateOutputsFile(context.OutputsFile, context.TrackedFiles);
                    }

                    if (!String.IsNullOrEmpty(context.BuiltOutputsFile))
                    {
                        this.CreateBuiltOutputsFile(context.BuiltOutputsFile, context.TrackedFiles);
                    }
                }
            }

            // Post-layout.
            foreach (var extension in context.Extensions)
            {
                extension.PostLayout();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Final step in binding that transfers (moves/copies) all files generated into the appropriate
        /// location in the source image
        /// </summary>
        /// <param name="fileTransfers">List of files to transfer.</param>
        private void LayoutMedia(IEnumerable <FileTransfer> transfers)
        {
            if (null != transfers && transfers.Any())
            {
                this.core.OnMessage(WixVerboses.LayingOutMedia());

                TransferFilesCommand command = new TransferFilesCommand();
                command.FileManagers     = this.fileManagers;
                command.FileTransfers    = transfers;
                command.SuppressAclReset = this.SuppressAclReset;
                command.Execute();
            }
        }