Exemplo n.º 1
0
        private void ImportExternalCabinetAsPayloads(Dtf.Database db, WixBundlePayloadRow packagePayload, ISet <string> payloadNames)
        {
            if (db.Tables.Contains("Media"))
            {
                foreach (string cabinet in db.ExecuteStringQuery("SELECT `Cabinet` FROM `Media`"))
                {
                    if (!String.IsNullOrEmpty(cabinet) && !cabinet.StartsWith("#", StringComparison.Ordinal))
                    {
                        // If we didn't find the Payload as an existing child of the package, we need to
                        // add it.  We expect the file to exist on-disk in the same relative location as
                        // the MSI expects to find it...
                        string cabinetName = Path.Combine(Path.GetDirectoryName(packagePayload.Name), cabinet);

                        if (!payloadNames.Contains(cabinetName))
                        {
                            string generatedId       = Common.GenerateIdentifier("cab", packagePayload.Id, cabinet);
                            string payloadSourceFile = FileManager.ResolveRelatedFile(packagePayload.UnresolvedSourceFile, cabinet, "Cabinet", this.Facade.Package.SourceLineNumbers, BindStage.Normal);

                            WixBundlePayloadRow payload = (WixBundlePayloadRow)this.PayloadTable.CreateRow(this.Facade.Package.SourceLineNumbers);
                            payload.Id                        = generatedId;
                            payload.Name                      = cabinetName;
                            payload.SourceFile                = payloadSourceFile;
                            payload.Compressed                = packagePayload.Compressed;
                            payload.UnresolvedSourceFile      = cabinetName;
                            payload.Package                   = packagePayload.Package;
                            payload.Container                 = packagePayload.Container;
                            payload.ContentFile               = true;
                            payload.EnableSignatureValidation = packagePayload.EnableSignatureValidation;
                            payload.Packaging                 = packagePayload.Packaging;
                            payload.ParentPackagePayload      = packagePayload.Id;
                        }
                    }
                }
            }
        }
        private void ImportExternalCabinetAsPayloads(Dtf.Database db, WixBundlePayloadSymbol packagePayload, ISet <string> payloadNames)
        {
            if (db.Tables.Contains("Media"))
            {
                foreach (var cabinet in db.ExecuteStringQuery("SELECT `Cabinet` FROM `Media`"))
                {
                    if (!String.IsNullOrEmpty(cabinet) && !cabinet.StartsWith("#", StringComparison.Ordinal))
                    {
                        // If we didn't find the Payload as an existing child of the package, we need to
                        // add it.  We expect the file to exist on-disk in the same relative location as
                        // the MSI expects to find it...
                        var cabinetName = Path.Combine(Path.GetDirectoryName(packagePayload.Name), cabinet);

                        if (!payloadNames.Contains(cabinetName))
                        {
                            var generatedId       = Common.GenerateIdentifier("cab", packagePayload.Id.Id, cabinet);
                            var payloadSourceFile = this.ResolveRelatedFile(packagePayload.SourceFile.Path, packagePayload.UnresolvedSourceFile, cabinet, "Cabinet", this.Facade.PackageSymbol.SourceLineNumbers, BindStage.Normal);

                            this.Section.AddSymbol(new WixBundlePayloadSymbol(this.Facade.PackageSymbol.SourceLineNumbers, new Identifier(AccessModifier.Private, generatedId))
                            {
                                Name       = cabinetName,
                                SourceFile = new IntermediateFieldPathValue {
                                    Path = payloadSourceFile
                                },
                                Compressed                = packagePayload.Compressed,
                                UnresolvedSourceFile      = cabinetName,
                                PackageRef                = packagePayload.PackageRef,
                                ContainerRef              = packagePayload.ContainerRef,
                                ContentFile               = true,
                                EnableSignatureValidation = packagePayload.EnableSignatureValidation,
                                Packaging = packagePayload.Packaging,
                                ParentPackagePayloadRef = packagePayload.Id.Id,
                            });
                        }
                    }
                }
            }
        }