/// <summary> /// Decompile a custom table. /// </summary> /// <param name="table">The table to decompile.</param> private void DecompileCustomTable(Table table) { if (0 < table.Rows.Count || this.suppressDroppingEmptyTables) { Wix.CustomTable customTable = new Wix.CustomTable(); this.core.OnMessage(WixWarnings.DecompilingAsCustomTable(table.Rows[0].SourceLineNumbers, table.Name)); customTable.Id = table.Name; foreach (ColumnDefinition columnDefinition in table.Definition.Columns) { Wix.Column column = new Wix.Column(); column.Id = columnDefinition.Name; if (ColumnCategory.Unknown != columnDefinition.Category) { switch (columnDefinition.Category) { case ColumnCategory.Text: column.Category = Wix.Column.CategoryType.Text; break; case ColumnCategory.UpperCase: column.Category = Wix.Column.CategoryType.UpperCase; break; case ColumnCategory.LowerCase: column.Category = Wix.Column.CategoryType.LowerCase; break; case ColumnCategory.Integer: column.Category = Wix.Column.CategoryType.Integer; break; case ColumnCategory.DoubleInteger: column.Category = Wix.Column.CategoryType.DoubleInteger; break; case ColumnCategory.TimeDate: column.Category = Wix.Column.CategoryType.TimeDate; break; case ColumnCategory.Identifier: column.Category = Wix.Column.CategoryType.Identifier; break; case ColumnCategory.Property: column.Category = Wix.Column.CategoryType.Property; break; case ColumnCategory.Filename: column.Category = Wix.Column.CategoryType.Filename; break; case ColumnCategory.WildCardFilename: column.Category = Wix.Column.CategoryType.WildCardFilename; break; case ColumnCategory.Path: column.Category = Wix.Column.CategoryType.Path; break; case ColumnCategory.Paths: column.Category = Wix.Column.CategoryType.Paths; break; case ColumnCategory.AnyPath: column.Category = Wix.Column.CategoryType.AnyPath; break; case ColumnCategory.DefaultDir: column.Category = Wix.Column.CategoryType.DefaultDir; break; case ColumnCategory.RegPath: column.Category = Wix.Column.CategoryType.RegPath; break; case ColumnCategory.Formatted: column.Category = Wix.Column.CategoryType.Formatted; break; case ColumnCategory.FormattedSDDLText: column.Category = Wix.Column.CategoryType.FormattedSddl; break; case ColumnCategory.Template: column.Category = Wix.Column.CategoryType.Template; break; case ColumnCategory.Condition: column.Category = Wix.Column.CategoryType.Condition; break; case ColumnCategory.Guid: column.Category = Wix.Column.CategoryType.Guid; break; case ColumnCategory.Version: column.Category = Wix.Column.CategoryType.Version; break; case ColumnCategory.Language: column.Category = Wix.Column.CategoryType.Language; break; case ColumnCategory.Binary: column.Category = Wix.Column.CategoryType.Binary; break; case ColumnCategory.CustomSource: column.Category = Wix.Column.CategoryType.CustomSource; break; case ColumnCategory.Cabinet: column.Category = Wix.Column.CategoryType.Cabinet; break; case ColumnCategory.Shortcut: column.Category = Wix.Column.CategoryType.Shortcut; break; default: throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnknownCustomColumnCategory, columnDefinition.Category.ToString())); } } if (null != columnDefinition.Description) { column.Description = columnDefinition.Description; } if (columnDefinition.IsKeyColumnSet) { column.KeyColumn = columnDefinition.KeyColumn; } if (null != columnDefinition.KeyTable) { column.KeyTable = columnDefinition.KeyTable; } if (columnDefinition.IsLocalizable) { column.Localizable = Wix.YesNoType.yes; } if (columnDefinition.IsMaxValueSet) { column.MaxValue = columnDefinition.MaxValue; } if (columnDefinition.IsMinValueSet) { column.MinValue = columnDefinition.MinValue; } if (ColumnModularizeType.None != columnDefinition.ModularizeType) { switch (columnDefinition.ModularizeType) { case ColumnModularizeType.Column: column.Modularize = Wix.Column.ModularizeType.Column; break; case ColumnModularizeType.Condition: column.Modularize = Wix.Column.ModularizeType.Condition; break; case ColumnModularizeType.Icon: column.Modularize = Wix.Column.ModularizeType.Icon; break; case ColumnModularizeType.Property: column.Modularize = Wix.Column.ModularizeType.Property; break; case ColumnModularizeType.SemicolonDelimited: column.Modularize = Wix.Column.ModularizeType.SemicolonDelimited; break; default: throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnknownCustomColumnModularizationType, columnDefinition.ModularizeType.ToString())); } } if (columnDefinition.IsNullable) { column.Nullable = Wix.YesNoType.yes; } if (columnDefinition.IsPrimaryKey) { column.PrimaryKey = Wix.YesNoType.yes; } if (null != columnDefinition.Possibilities) { column.Set = columnDefinition.Possibilities; } if (ColumnType.Unknown != columnDefinition.Type) { switch (columnDefinition.Type) { case ColumnType.Localized: column.Localizable = Wix.YesNoType.yes; column.Type = Wix.Column.TypeType.@string; break; case ColumnType.Number: column.Type = Wix.Column.TypeType.@int; break; case ColumnType.Object: column.Type = Wix.Column.TypeType.binary; break; case ColumnType.Preserved: case ColumnType.String: column.Type = Wix.Column.TypeType.@string; break; default: throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnknownCustomColumnType, columnDefinition.Type.ToString())); } } column.Width = columnDefinition.Length; customTable.AddChild(column); } foreach (Row row in table.Rows) { Wix.Row wixRow = new Wix.Row(); foreach (Field field in row.Fields) { Wix.Data data = new Wix.Data(); data.Column = field.Column.Name; data.Content = Convert.ToString(field.Data, CultureInfo.InvariantCulture); wixRow.AddChild(data); } customTable.AddChild(wixRow); } this.core.RootElement.AddChild(customTable); } }
/// <summary> /// Decompile row attributes for the MessageQueueUserPermission and MessageQueueGroupPermission tables. /// </summary> /// <param name="row">The row to decompile.</param> /// <param name="table">Target element.</param> private void DecompileMessageQueuePermissionAttributes(Row row, Msmq.MessageQueuePermission queuePermission) { int attributes = (int)row[4]; if (0 != (attributes & (int)MsmqCompiler.MqiMessageQueuePermission.DeleteMessage)) { queuePermission.DeleteMessage = Msmq.YesNoType.yes; } if (0 != (attributes & (int)MsmqCompiler.MqiMessageQueuePermission.PeekMessage)) { queuePermission.PeekMessage = Msmq.YesNoType.yes; } if (0 != (attributes & (int)MsmqCompiler.MqiMessageQueuePermission.WriteMessage)) { queuePermission.WriteMessage = Msmq.YesNoType.yes; } if (0 != (attributes & (int)MsmqCompiler.MqiMessageQueuePermission.DeleteJournalMessage)) { queuePermission.DeleteJournalMessage = Msmq.YesNoType.yes; } if (0 != (attributes & (int)MsmqCompiler.MqiMessageQueuePermission.SetQueueProperties)) { queuePermission.SetQueueProperties = Msmq.YesNoType.yes; } if (0 != (attributes & (int)MsmqCompiler.MqiMessageQueuePermission.GetQueueProperties)) { queuePermission.GetQueueProperties = Msmq.YesNoType.yes; } if (0 != (attributes & (int)MsmqCompiler.MqiMessageQueuePermission.DeleteQueue)) { queuePermission.DeleteQueue = Msmq.YesNoType.yes; } if (0 != (attributes & (int)MsmqCompiler.MqiMessageQueuePermission.GetQueuePermissions)) { queuePermission.GetQueuePermissions = Msmq.YesNoType.yes; } if (0 != (attributes & (int)MsmqCompiler.MqiMessageQueuePermission.ChangeQueuePermissions)) { queuePermission.ChangeQueuePermissions = Msmq.YesNoType.yes; } if (0 != (attributes & (int)MsmqCompiler.MqiMessageQueuePermission.TakeQueueOwnership)) { queuePermission.TakeQueueOwnership = Msmq.YesNoType.yes; } if (0 != (attributes & (int)MsmqCompiler.MqiMessageQueuePermission.ReceiveMessage)) { queuePermission.ReceiveMessage = Msmq.YesNoType.yes; } if (0 != (attributes & (int)MsmqCompiler.MqiMessageQueuePermission.ReceiveJournalMessage)) { queuePermission.ReceiveJournalMessage = Msmq.YesNoType.yes; } if (0 != (attributes & (int)MsmqCompiler.MqiMessageQueuePermission.QueueGenericRead)) { queuePermission.QueueGenericRead = Msmq.YesNoType.yes; } if (0 != (attributes & (int)MsmqCompiler.MqiMessageQueuePermission.QueueGenericWrite)) { queuePermission.QueueGenericWrite = Msmq.YesNoType.yes; } if (0 != (attributes & (int)MsmqCompiler.MqiMessageQueuePermission.QueueGenericExecute)) { queuePermission.QueueGenericExecute = Msmq.YesNoType.yes; } if (0 != (attributes & (int)MsmqCompiler.MqiMessageQueuePermission.QueueGenericAll)) { queuePermission.QueueGenericAll = Msmq.YesNoType.yes; } }