void INvnControl.Build() { //Copy license text File.Copy(LicenseFile.Text, Common.localWixFolder + Path.DirectorySeparatorChar + "License.rtf", true); // Copy images to wix folder ResourceManager res = new ResourceManager(typeof(Resources)); if (Globals.registered) { if (txtBanner.Text != "[Default]") { File.Copy(txtBanner.Text, Globals.localFolder + @"Wix\Bitmaps\bannrbmp.bmp", true); } else { Bitmap bannerImg = (Bitmap)res.GetObject("bannrbmp"); bannerImg.Save(Common.localWixFolder + Path.DirectorySeparatorChar + "Bitmaps" + Path.DirectorySeparatorChar + "bannrbmp.bmp"); } if (txtDialog.Text != "[Default]") { File.Copy(txtDialog.Text, Globals.localFolder + @"Wix\Bitmaps\dlgbmp.bmp", true); } else { Bitmap dlgImg = (Bitmap)res.GetObject("dlgbmp"); dlgImg.Save(Common.localWixFolder + Path.DirectorySeparatorChar + "Bitmaps" + Path.DirectorySeparatorChar + "dlgbmp.bmp"); } } else { Bitmap bannerImg = (Bitmap)res.GetObject("bannrbmp"); bannerImg.Save(Common.localWixFolder + Path.DirectorySeparatorChar + "Bitmaps" + Path.DirectorySeparatorChar + "bannrbmp.bmp"); Bitmap dlgImg = (Bitmap)res.GetObject("dlgbmp"); dlgImg.Save(Common.localWixFolder + Path.DirectorySeparatorChar + "Bitmaps" + Path.DirectorySeparatorChar + "dlgbmp.bmp"); } //<Product> string[] selectedLanguage = ((string)cmbLanguage.SelectedValue).Split("|".ToCharArray()); MsiBuilder.Product = new Wix.Product(); MsiBuilder.Product.Name = ProductName.Text; MsiBuilder.Product.Version = Version.Text; MsiBuilder.Product.Id = ProductCode.Text; MsiBuilder.Product.UpgradeCode = UpgradeCode.Text; MsiBuilder.Product.Language = selectedLanguage[0]; MsiBuilder.Product.Codepage = selectedLanguage[1]; MsiBuilder.UILocalizedFile = selectedLanguage[2]; MsiBuilder.Product.Manufacturer = Manufacturer.Text; //<Product>/<Package> MsiBuilder.Product.Package = new Wix.Package(); MsiBuilder.Product.Package.Id = PackageId.Text; MsiBuilder.Product.Package.Keywords = "Installer"; if (Description.Text != string.Empty) { MsiBuilder.Product.Package.Description = Description.Text; } if (Comments.Text != string.Empty) { MsiBuilder.Product.Package.Comments = Comments.Text; } MsiBuilder.Product.Package.Manufacturer = Manufacturer.Text; int majorInstallerVersion = Int32.Parse(txtMajorVersion.Text); int minorInstallerVersion = String.IsNullOrEmpty(txtMinorVersion.Text) ? 0 : Int32.Parse(txtMinorVersion.Text); MsiBuilder.Product.Package.InstallerVersion = (majorInstallerVersion * 100 + minorInstallerVersion).ToString(); MsiBuilder.Product.Package.Languages = selectedLanguage[0]; MsiBuilder.Product.Package.CompressedSpecified = true; MsiBuilder.Product.Package.Compressed = Wix.YesNoType.yes; MsiBuilder.Product.Package.SummaryCodepage = selectedLanguage[1]; if (chk64Bit.Checked) { MsiBuilder.Product.Package.Platforms = "x64"; } //Build User Interface Wix.UIRef uiRef1 = new Wix.UIRef(); if (rbMondo.Checked) { uiRef1.Id = "WixUI_Mondo"; } else if (rbFeatureTree.Checked) { uiRef1.Id = "WixUI_FeatureTree"; } else if (rbInstall.Checked) { uiRef1.Id = "WixUI_InstallDir"; Wix.Property installDirProperty = new Wix.Property(); installDirProperty.Id = "WIXUI_INSTALLDIR"; installDirProperty.Value = "INSTALLDIR"; MsiBuilder.PropertyElements.Add(installDirProperty.Id, installDirProperty); } else if (rbMinimal.Checked) { uiRef1.Id = "WixUI_Minimal"; } Wix.UIRef uiRef2 = new Wix.UIRef(); uiRef2.Id = "WixUI_ErrorProgressText"; MsiBuilder.UIRef.Add(uiRef1); MsiBuilder.UIRef.Add(uiRef2); // application is installed for all users ... Wix.Property allUsersProp = new Wix.Property(); allUsersProp.Id = "ALLUSERS"; allUsersProp.Value = "1"; MsiBuilder.PropertyElements.Add(allUsersProp.Id, allUsersProp); // Set properties for Icon if (String.IsNullOrEmpty(IconFile.Text) == false) { Wix.Icon icon = new Wix.Icon(); icon.Id = "iconfile.exe"; // STRANGE : The Id for the Icon element must end in '.exe' (i.e. LinkedCells.exe) icon.SourceFile = IconFile.Text; MsiBuilder.ProductMiscElements.Add(icon); Wix.Property productIconProp = new Wix.Property(); productIconProp.Id = "ARPPRODUCTICON"; productIconProp.Value = icon.Id; MsiBuilder.PropertyElements.Add(productIconProp.Id, productIconProp); } #region Features if (tvFeatures.Nodes.Count > 0) { TreeNode rootFeatureNode = tvFeatures.Nodes[0]; FeatureProperty property = (FeatureProperty)rootFeatureNode.Tag; if (property != null) { MsiBuilder.Feature.Id = property.Id; MsiBuilder.Feature.Title = property.Name; MsiBuilder.Feature.Description = property.Description; MsiBuilder.Feature.Display = "expand"; MsiBuilder.Feature.Level = "1"; MsiBuilder.Feature.ConfigurableDirectory = "INSTALLDIR"; MsiBuilder.FeatureTable.Add(MsiBuilder.Feature.Id, MsiBuilder.Feature); foreach (TreeNode featureNode in rootFeatureNode.Nodes) { CreateFeature(featureNode, MsiBuilder.Feature); } } } #endregion // Prerequisites if (cmbPrerequisite.SelectedIndex != 0) /* If selected item is not NONE */ { MsiCompiler.BootstrapperName = (string)cmbPrerequisite.SelectedValue; } }
void INvnControl.Build() { //Build User Interface Wix.UIRef uiRef1 = new Wix.UIRef(); if (rbComplete.Checked) { uiRef1.Id = "WixUI_Mondo"; } else if (rbFeatureTree.Checked) { uiRef1.Id = "WixUI_FeatureTree"; } else if (rbInstall.Checked) { uiRef1.Id = "WixUI_InstallDir"; } else if (rbMinimal.Checked) { uiRef1.Id = "WixUI_Minimal"; } Wix.UIRef uiRef2 = new Wix.UIRef(); uiRef2.Id = "WixUI_ErrorProgressText"; MsiBuilder.UIRef.Add(uiRef1); MsiBuilder.UIRef.Add(uiRef2); // replace UI variables with wix variables foreach (DataTable table in dsText.Tables) { foreach (DataRow row in table.Rows) { UIFontSize fontsize = (UIFontSize)Enum.Parse(typeof(UIFontSize), (string)row["fontsize"]); switch (fontsize) { case UIFontSize.Normal: row["text"] = @"{\WixUI_Font_Normal}" + ((string)row["text"]); //TODO: check whether this is needed or not break; case UIFontSize.Bigger: row["text"] = @"{\WixUI_Font_Bigger}" + ((string)row["text"]); break; case UIFontSize.Title: row["text"] = @"{\WixUI_Font_Title}" + ((string)row["text"]); break; } } } // update wix source files foreach (DataTable table in dsText.Tables) { string src = table.TableName; // update each text controls XmlDocument doc = new XmlDocument(); doc.Load(Common.wixUIFolder + Path.DirectorySeparatorChar + src); XmlNodeList controls = doc.GetElementsByTagName("Control"); foreach (XmlNode control in controls) { if (control.Attributes["Type"].Value == "Text") { string id = control.Attributes["Id"].Value; foreach (DataRow row in table.Rows) { if (((string)row["id"]) == id) { control.Attributes["X"].Value = (string)row["x"]; control.Attributes["X"].Value = (string)row["y"]; control.Attributes["Width"].Value = (string)row["width"]; control.Attributes["Height"].Value = (string)row["height"]; textsDictionary[(string)row["textid"]] = (string)row["text"]; break; } } } } doc.Save(Common.wixUIFolder + Path.DirectorySeparatorChar + src); } // update WixUI-en-us.wxl (which contains text) XmlDocument wixdoc = new XmlDocument(); wixdoc.Load(Common.wixUIFolder + Path.DirectorySeparatorChar + "WixUI_en-us.wxl"); XmlNodeList textList = wixdoc.GetElementsByTagName("String"); foreach (XmlNode text in textList) { text.InnerText = textsDictionary[text.Attributes["Id"].Value];// get value from dictionary } wixdoc.Save(Common.wixUIFolder + Path.DirectorySeparatorChar + "WixUI_en-us.wxl"); }