Esempio n. 1
0
        /// <summary>
        /// Decompile the Control table.
        /// </summary>
        /// <param name="table">The table to decompile.</param>
        private void DecompileControlTable(Table table)
        {
            foreach (ControlRow controlRow in table.Rows)
            {
                Wix.Control control = new Wix.Control();

                control.Id = controlRow.Control;

                control.Type = controlRow.Type;

                control.X = controlRow.X;

                control.Y = controlRow.Y;

                control.Width = controlRow.Width;

                control.Height = controlRow.Height;

                if (null != controlRow[7])
                {
                    string[] specialAttributes;

                    // sets various common attributes like Disabled, Indirect, Integer, ...
                    SetControlAttributes(controlRow.Attributes, control);

                    switch (control.Type)
                    {
                        case "Bitmap":
                            specialAttributes = MsiInterop.BitmapControlAttributes;
                            break;
                        case "CheckBox":
                            specialAttributes = MsiInterop.CheckboxControlAttributes;
                            break;
                        case "ComboBox":
                            specialAttributes = MsiInterop.ComboboxControlAttributes;
                            break;
                        case "DirectoryCombo":
                            specialAttributes = MsiInterop.VolumeControlAttributes;
                            break;
                        case "Edit":
                            specialAttributes = MsiInterop.EditControlAttributes;
                            break;
                        case "Icon":
                            specialAttributes = MsiInterop.IconControlAttributes;
                            break;
                        case "ListBox":
                            specialAttributes = MsiInterop.ListboxControlAttributes;
                            break;
                        case "ListView":
                            specialAttributes = MsiInterop.ListviewControlAttributes;
                            break;
                        case "MaskedEdit":
                            specialAttributes = MsiInterop.EditControlAttributes;
                            break;
                        case "PathEdit":
                            specialAttributes = MsiInterop.EditControlAttributes;
                            break;
                        case "ProgressBar":
                            specialAttributes = MsiInterop.ProgressControlAttributes;
                            break;
                        case "PushButton":
                            specialAttributes = MsiInterop.ButtonControlAttributes;
                            break;
                        case "RadioButtonGroup":
                            specialAttributes = MsiInterop.RadioControlAttributes;
                            break;
                        case "Text":
                            specialAttributes = MsiInterop.TextControlAttributes;
                            break;
                        case "VolumeCostList":
                            specialAttributes = MsiInterop.VolumeControlAttributes;
                            break;
                        case "VolumeSelectCombo":
                            specialAttributes = MsiInterop.VolumeControlAttributes;
                            break;
                        default:
                            specialAttributes = null;
                            break;
                    }

                    if (null != specialAttributes)
                    {
                        bool iconSizeSet = false;

                        for (int i = 16; 32 > i; i++)
                        {
                            if (1 == ((controlRow.Attributes >> i) & 1))
                            {
                                string attribute = null;

                                if (specialAttributes.Length > (i - 16))
                                {
                                    attribute = specialAttributes[i - 16];
                                }

                                // unknown attribute
                                if (null == attribute)
                                {
                                    this.core.OnMessage(WixWarnings.IllegalColumnValue(controlRow.SourceLineNumbers, table.Name, controlRow.Fields[7].Column.Name, controlRow.Attributes));
                                    continue;
                                }

                                switch (attribute)
                                {
                                    case "Bitmap":
                                        control.Bitmap = Wix.YesNoType.yes;
                                        break;
                                    case "CDROM":
                                        control.CDROM = Wix.YesNoType.yes;
                                        break;
                                    case "ComboList":
                                        control.ComboList = Wix.YesNoType.yes;
                                        break;
                                    case "ElevationShield":
                                        control.ElevationShield = Wix.YesNoType.yes;
                                        break;
                                    case "Fixed":
                                        control.Fixed = Wix.YesNoType.yes;
                                        break;
                                    case "FixedSize":
                                        control.FixedSize = Wix.YesNoType.yes;
                                        break;
                                    case "Floppy":
                                        control.Floppy = Wix.YesNoType.yes;
                                        break;
                                    case "FormatSize":
                                        control.FormatSize = Wix.YesNoType.yes;
                                        break;
                                    case "HasBorder":
                                        control.HasBorder = Wix.YesNoType.yes;
                                        break;
                                    case "Icon":
                                        control.Icon = Wix.YesNoType.yes;
                                        break;
                                    case "Icon16":
                                        if (iconSizeSet)
                                        {
                                            control.IconSize = Wix.Control.IconSizeType.Item48;
                                        }
                                        else
                                        {
                                            iconSizeSet = true;
                                            control.IconSize = Wix.Control.IconSizeType.Item16;
                                        }
                                        break;
                                    case "Icon32":
                                        if (iconSizeSet)
                                        {
                                            control.IconSize = Wix.Control.IconSizeType.Item48;
                                        }
                                        else
                                        {
                                            iconSizeSet = true;
                                            control.IconSize = Wix.Control.IconSizeType.Item32;
                                        }
                                        break;
                                    case "Image":
                                        control.Image = Wix.YesNoType.yes;
                                        break;
                                    case "Multiline":
                                        control.Multiline = Wix.YesNoType.yes;
                                        break;
                                    case "NoPrefix":
                                        control.NoPrefix = Wix.YesNoType.yes;
                                        break;
                                    case "NoWrap":
                                        control.NoWrap = Wix.YesNoType.yes;
                                        break;
                                    case "Password":
                                        control.Password = Wix.YesNoType.yes;
                                        break;
                                    case "ProgressBlocks":
                                        control.ProgressBlocks = Wix.YesNoType.yes;
                                        break;
                                    case "PushLike":
                                        control.PushLike = Wix.YesNoType.yes;
                                        break;
                                    case "RAMDisk":
                                        control.RAMDisk = Wix.YesNoType.yes;
                                        break;
                                    case "Remote":
                                        control.Remote = Wix.YesNoType.yes;
                                        break;
                                    case "Removable":
                                        control.Removable = Wix.YesNoType.yes;
                                        break;
                                    case "ShowRollbackCost":
                                        control.ShowRollbackCost = Wix.YesNoType.yes;
                                        break;
                                    case "Sorted":
                                        control.Sorted = Wix.YesNoType.yes;
                                        break;
                                    case "Transparent":
                                        control.Transparent = Wix.YesNoType.yes;
                                        break;
                                    case "UserLanguage":
                                        control.UserLanguage = Wix.YesNoType.yes;
                                        break;
                                    default:
                                        throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnknowControlAttribute, attribute));
                                }
                            }
                        }
                    }
                    else if (0 < (controlRow.Attributes & 0xFFFF0000))
                    {
                        this.core.OnMessage(WixWarnings.IllegalColumnValue(controlRow.SourceLineNumbers, table.Name, controlRow.Fields[7].Column.Name, controlRow.Attributes));
                    }
                }

                // FinalizeCheckBoxTable adds Control/@Property|@CheckBoxPropertyRef
                if (null != controlRow.Property && 0 != String.CompareOrdinal("CheckBox", control.Type))
                {
                    control.Property = controlRow.Property;
                }

                if (null != controlRow.Text)
                {
                    control.Text = controlRow.Text;
                }

                if (null != controlRow.Help)
                {
                    string[] help = controlRow.Help.Split('|');

                    if (2 == help.Length)
                    {
                        if (0 < help[0].Length)
                        {
                            control.ToolTip = help[0];
                        }

                        if (0 < help[1].Length)
                        {
                            control.Help = help[1];
                        }
                    }
                }

                this.core.IndexElement(controlRow, control);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Decompile the BBControl table.
        /// </summary>
        /// <param name="table">The table to decompile.</param>
        private void DecompileBBControlTable(Table table)
        {
            foreach (BBControlRow bbControlRow in table.Rows)
            {
                Wix.Control control = new Wix.Control();

                control.Id = bbControlRow.BBControl;

                control.Type = bbControlRow.Type;

                control.X = bbControlRow.X;

                control.Y = bbControlRow.Y;

                control.Width = bbControlRow.Width;

                control.Height = bbControlRow.Height;

                if (null != bbControlRow[7])
                {
                    SetControlAttributes(bbControlRow.Attributes, control);
                }

                if (null != bbControlRow.Text)
                {
                    control.Text = bbControlRow.Text;
                }

                Wix.Billboard billboard = (Wix.Billboard)this.core.GetIndexedElement("Billboard", bbControlRow.Billboard);
                if (null != billboard)
                {
                    billboard.AddChild(control);
                }
                else
                {
                    this.core.OnMessage(WixWarnings.ExpectedForeignRow(bbControlRow.SourceLineNumbers, table.Name, bbControlRow.GetPrimaryKey(DecompilerCore.PrimaryKeyDelimiter), "Billboard_", bbControlRow.Billboard, "Billboard"));
                }
            }
        }