Пример #1
0
        public Intermediate Unbind(IUnbindContext context)
        {
            string uxExtractPath = Path.Combine(context.ExportBasePath, "UX");
            string acExtractPath = Path.Combine(context.ExportBasePath, "AttachedContainer");

            using (BurnReader reader = BurnReader.Open(context.InputFilePath))
            {
                reader.ExtractUXContainer(uxExtractPath, context.IntermediateFolder);
                reader.ExtractAttachedContainer(acExtractPath, context.IntermediateFolder);
            }

            return(null);
        }
Пример #2
0
        public Intermediate Unbind(IUnbindContext context)
        {
            var uxExtractPath = Path.Combine(context.ExportBasePath, "UX");
            var acExtractPath = Path.Combine(context.ExportBasePath, "AttachedContainer");
            var messaging     = context.ServiceProvider.GetService <IMessaging>();

            using (var reader = BurnReader.Open(messaging, context.InputFilePath))
            {
                reader.ExtractUXContainer(uxExtractPath, context.IntermediateFolder);
                reader.ExtractAttachedContainer(acExtractPath, context.IntermediateFolder);
            }

            return(null);
        }
Пример #3
0
        public Intermediate Unbind(IUnbindContext context)
        {
#if REVISIT_FOR_PATCHING
            Output patch;

            // patch files are essentially database files (use a special flag to let the API know its a patch file)
            try
            {
                using (Database database = new Database(context.InputFilePath, OpenDatabase.ReadOnly | OpenDatabase.OpenPatchFile))
                {
                    var unbindCommand = new UnbindDatabaseCommand(context.Messaging, database, context.InputFilePath, OutputType.Patch, context.ExportBasePath, context.IntermediateFolder, context.IsAdminImage, context.SuppressDemodularization, skipSummaryInfo: false);
                    patch = unbindCommand.Execute();
                }
            }
            catch (Win32Exception e)
            {
                if (0x6E == e.NativeErrorCode) // ERROR_OPEN_FAILED
                {
                    throw new WixException(WixErrors.OpenDatabaseFailed(context.InputFilePath));
                }

                throw;
            }

            // retrieve the transforms (they are in substorages)
            using (Storage storage = Storage.Open(context.InputFilePath, StorageMode.Read | StorageMode.ShareDenyWrite))
            {
                Table summaryInformationTable = patch.Tables["_SummaryInformation"];
                foreach (Row row in summaryInformationTable.Rows)
                {
                    if (8 == (int)row[0]) // PID_LASTAUTHOR
                    {
                        string value = (string)row[1];

                        foreach (string decoratedSubStorageName in value.Split(';'))
                        {
                            string subStorageName = decoratedSubStorageName.Substring(1);
                            string transformFile  = Path.Combine(context.IntermediateFolder, String.Concat("Transform", Path.DirectorySeparatorChar, subStorageName, ".mst"));

                            // ensure the parent directory exists
                            Directory.CreateDirectory(Path.GetDirectoryName(transformFile));

                            // copy the substorage to a new storage for the transform file
                            using (Storage subStorage = storage.OpenStorage(subStorageName))
                            {
                                using (Storage transformStorage = Storage.CreateDocFile(transformFile, StorageMode.ReadWrite | StorageMode.ShareExclusive | StorageMode.Create))
                                {
                                    subStorage.CopyTo(transformStorage);
                                }
                            }

                            // unbind the transform
                            var unbindCommand = new UnbindTransformCommand(context.Messaging, transformFile, (null == context.ExportBasePath ? null : Path.Combine(context.ExportBasePath, subStorageName)), context.IntermediateFolder);
                            var transform     = unbindCommand.Execute();

                            patch.SubStorages.Add(new SubStorage(subStorageName, transform));
                        }

                        break;
                    }
                }
            }

            // extract the files from the cabinets
            // TODO: use per-transform export paths for support of multi-product patches
            if (null != context.ExportBasePath && !context.SuppressExtractCabinets)
            {
                using (Database database = new Database(context.InputFilePath, OpenDatabase.ReadOnly | OpenDatabase.OpenPatchFile))
                {
                    foreach (SubStorage subStorage in patch.SubStorages)
                    {
                        // only patch transforms should carry files
                        if (subStorage.Name.StartsWith("#", StringComparison.Ordinal))
                        {
                            var extractCommand = new ExtractCabinetsCommand(subStorage.Data, database, context.InputFilePath, context.ExportBasePath, context.IntermediateFolder);
                            extractCommand.Execute();
                        }
                    }
                }
            }

            return(patch);
#endif
            throw new NotImplementedException();
        }
Пример #4
0
        public Intermediate Unbind(IUnbindContext context)
        {
            var command = new UnbindMsiOrMsmCommand(context);

            return(command.Execute());
        }
 public UnbindMsiOrMsmCommand(IUnbindContext context)
 {
     this.Context = context;
 }