Пример #1
0
        public override WixSection GenerateSection()
        {
            if (this.System || String.IsNullOrEmpty(this.MsiId))
            {
                return(null);
            }

            Folder  folder        = (Folder)this.Item;
            WixItem parentMsiItem = WixBackendCompilerServices.ResolveParentFolderMsiItem(folder.ParentFolder, this.Backend.WixItems);

            if (parentMsiItem == null)
            {
                return(null);
            }

            WixSection section = new WixSection(this.MsiId, "fragment", this.Item.LineNumber);

            string defaultDir = String.IsNullOrEmpty(folder.Name) ? "." : WixBackendCompilerServices.GenerateMsiFileName(false, folder.Name.TrimEnd(new char[] { '\\' }), "Directory", parentMsiItem.MsiId);

            WixBackendCompilerServices.GenerateRow(section, "Directory", this.Item.LineNumber,
                                                   this.MsiId,          // Id
                                                   parentMsiItem.MsiId, // Directory_Parent
                                                   defaultDir);         // DefaultDir

            WixBackendCompilerServices.GenerateSimpleReference(section, "Directory", this.Item.LineNumber, parentMsiItem.MsiId);

            return(section);
        }
Пример #2
0
        public override void GenerateSectionRowsForComponent(WixSection section, string componentId)
        {
            File    file          = (File)this.Item;
            WixItem folderMsiItem = WixBackendCompilerServices.ResolveParentFolderMsiItem(file.ParentFolder, this.Backend.WixItems);

            string fileId   = this.MsiId;
            string fileName = WixBackendCompilerServices.GenerateMsiFileName(true, file.Name, "File", fileId);
            bool   gac      = (folderMsiItem is WixFolderReference && folderMsiItem.System && folderMsiItem.Item.Id.Equals("GacFolder"));

            WixBackendCompilerServices.GenerateRow(section, "File", this.Item.LineNumber,
                                                   fileId,                                              // Id
                                                   componentId,                                         // Component
                                                   fileName,                                            // FileName
                                                   0,                                                   // Size
                                                   null,                                                // Version
                                                   null,                                                // Language
                                                   WixBackendCompilerServices.MsidbFileAttributesVital, // Attributes
                                                   null);                                               // Sequence

            WixBackendCompilerServices.GenerateRow(section, "WixFile", this.Item.LineNumber,
                                                   fileId,                                                                         // Id
                                                   gac ? "0" : null,                                                               // AssemblyAttributes
                                                   null,                                                                           // AssemblyManifest
                                                   null,                                                                           // AssemblyAssemblyApplication
                                                   folderMsiItem.MsiId,                                                            // Directory
                                                   1,                                                                              // DiskId
                                                   file.Source,                                                                    // Source
                                                   null /*file.Architecture*/,                                                     // TODO: make this right
                                                   -1,
                                                   String.Equals(file.Name, fileName, StringComparison.OrdinalIgnoreCase) ? 0 : 1, // GeneratedShortName
                                                   0,
                                                   null,
                                                   null,
                                                   null,
                                                   null);

            if (gac)
            {
                WixBackendCompilerServices.GenerateRow(section, "MsiAssembly", this.Item.LineNumber,
                                                       componentId,              // ComponentId
                                                       Guid.Empty.ToString("B"), // Feature (complex reference)
                                                       null,                     // AssemblyManifest
                                                       null,                     // AssemblyApplication
                                                       0);                       // AssemblyAttributes
            }
        }