public void SetUpFixture() { WixDocument doc = new WixDocument(); doc.LoadXml(GetWixXml()); controlsAddedCount = 0; CreatedComponents.Clear(); WixDialog wixDialog = doc.CreateWixDialog("WelcomeDialog", new MockTextFileReader()); using (Form dialog = wixDialog.CreateDialog(this)) { foreach (Control control in dialog.Controls) { ++controlsAddedCount; } Button nextButton = (Button)dialog.Controls[0]; nextButtonName = nextButton.Name; nextButtonLocation = nextButton.Location; nextButtonSize = nextButton.Size; nextButtonText = nextButton.Text; dialogAcceptButtonName = ((Button)dialog.AcceptButton).Name; Button cancelButton = (Button)dialog.Controls[1]; cancelButtonName = cancelButton.Name; dialogCancelButtonName = ((Button)dialog.CancelButton).Name; } }
public void SetUpFixture() { WixDocument doc = new WixDocument(); doc.LoadXml(GetWixXml()); CreatedComponents.Clear(); WixDialog wixDialog = doc.CreateWixDialog("WelcomeDialog", new MockTextFileReader()); using (Form dialog = wixDialog.CreateDialog(this)) { ListBox listBox = new ListBox(); listBox.Name = "NewListBox"; listBox.Items.Add("New item1"); listBox.Items.Add("New item2"); dialog.Controls.Add(listBox); XmlElement dialogElement = wixDialog.UpdateDialogElement(dialog); XmlElement controlElement = (XmlElement)dialogElement.ChildNodes[0]; controlName = controlElement.GetAttribute("Id"); controlType = controlElement.GetAttribute("Type"); XmlElement listBoxElement = (XmlElement)controlElement.ChildNodes[0]; listBoxItemCount = listBoxElement.ChildNodes.Count; XmlElement listBoxItem1Element = (XmlElement)listBoxElement.ChildNodes[0]; listBoxItem1Text = listBoxItem1Element.GetAttribute("Text"); XmlElement listBoxItem2Element = (XmlElement)listBoxElement.ChildNodes[1]; listBoxItem2Text = listBoxItem2Element.GetAttribute("Text"); } }
public void SetUpFixture() { WixProject p = WixBindingTestsHelper.CreateEmptyWixProject(); projectDirectory = p.Directory; p.Name = "MySetup"; FileProjectItem item = new FileProjectItem(p, ItemType.Compile); item.Include = "Setup.wxs"; string docFileName = item.FileName; ProjectService.AddProjectItem(p, item); item = new FileProjectItem(p, ItemType.Compile); item.Include = "InvalidXml.wxs"; ProjectService.AddProjectItem(p, item); item = new FileProjectItem(p, ItemType.Compile); item.Include = "MissingFile.wxs"; ProjectService.AddProjectItem(p, item); item = new FileProjectItem(p, ItemType.Compile); item.Include = "Fragment.wxs"; ProjectService.AddProjectItem(p, item); WixDocument doc = new WixDocument(p); doc.FileName = docFileName; doc.LoadXml(GetMainWixXml()); binaries = new WixBinaries(doc, this); }
public void GetBinaryFileNameWhenWixDocNotInProject() { WixDocument doc = new WixDocument(); WixBinaries binaries = new WixBinaries(doc, this); Assert.IsNull(binaries.GetBinaryFileName("UnknownId")); }
/// <summary> /// Displays the setup files for the specified WixProject. /// </summary> public void ShowFiles(WixProject project) { // Look for Wix document containing root directory. document = null; view.ContextMenuEnabled = false; if (project.WixSourceFiles.Count > 0) { bool errors = false; WixDocument currentDocument = null; view.ClearDirectories(); foreach (FileProjectItem item in project.WixSourceFiles) { try { currentDocument = CreateWixDocument(item.FileName); FindRootDirectoryResult result = FindRootDirectory(currentDocument); if (result == FindRootDirectoryResult.RootDirectoryRefFound) { break; } } catch (XmlException) { errors = true; } } if (errors) { view.ShowSourceFilesContainErrorsMessage(); } else if (document == null) { view.ShowNoRootDirectoryFoundMessage(); } else { view.ContextMenuEnabled = true; SelectedElementChanged(); } } else { view.ShowNoSourceFileFoundMessage(project.Name); } }
public void SetUpFixture() { BitmapFileNamesRequested.Clear(); CreatedComponents.Clear(); WixProject p = WixBindingTestsHelper.CreateEmptyWixProject(); projectDirectory = p.Directory; p.Name = "MySetup"; FileProjectItem item = new FileProjectItem(p, ItemType.Compile); item.Include = "Setup.wxs"; string docFileName = item.FileName; ProjectService.AddProjectItem(p, item); item = new FileProjectItem(p, ItemType.Compile); item.Include = "Fragment.wxs"; ProjectService.AddProjectItem(p, item); WixDocument doc = new WixDocument(p, this); doc.FileName = docFileName; doc.LoadXml(GetMainWixXml()); WixDialog wixDialog = doc.GetDialog("WelcomeDialog", this); using (Form dialog = wixDialog.CreateDialog(this)) { PictureBox pictureBox = (PictureBox)dialog.Controls[0]; hasImage = (pictureBox.Image != null); } }
public void SetUpFixture() { WixDocument doc = new WixDocument(); doc.LoadXml(GetWixXml()); CreatedComponents.Clear(); WixDialog wixDialog = doc.CreateWixDialog("AcceptLicenseDialog", new MockTextFileReader()); using (Form dialog = wixDialog.CreateDialog(this)) { Panel radioButtonGroup = (Panel)dialog.Controls[0]; radioButtonGroup.Left = 30; radioButtonGroup.Top = 100; RadioButton acceptRadioButton = (RadioButton)radioButtonGroup.Controls[0]; acceptRadioButton.Left = 0; acceptRadioButton.Top = 5; acceptRadioButton.Width = 100; acceptRadioButton.Height = 50; acceptRadioButton.Text = "Accept"; RadioButton declineRadioButton = (RadioButton)radioButtonGroup.Controls[1]; declineRadioButton.Left = 10; declineRadioButton.Top = 20; declineRadioButton.Width = 200; declineRadioButton.Height = 30; declineRadioButton.Text = String.Empty; XmlElement dialogElement = wixDialog.UpdateDialogElement(dialog); radioButtonGroupElement = (XmlElement)dialogElement.SelectSingleNode("w:Control[@Id='Buttons']", new WixNamespaceManager(dialogElement.OwnerDocument.NameTable)); XmlNodeList radioButtonElements = radioButtonGroupElement.SelectNodes("//w:RadioButtonGroup/w:RadioButton", new WixNamespaceManager(dialogElement.OwnerDocument.NameTable)); acceptRadioButtonElement = (XmlElement)radioButtonElements[0]; declineRadioButtonElement = (XmlElement)radioButtonElements[1]; } }
public void SetupFixture() { SD.InitializeForUnitTests(); doc = new WixDocument(); doc.FileName = @"C:\Projects\Setup\Setup.wxs"; doc.LoadXml("<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'/>"); }
/// <summary> /// Creates an id from the filename. /// </summary> /// <remarks> /// Takes the filename, removes all periods, and /// capitalises the first character and first extension character. /// </remarks> /// <param name="document">The Wix document is used to make sure the /// id generated is unique for that document.</param> /// <param name="fileName">The full filename including the directory to /// use when generating the id.</param> public static string GenerateIdFromFileName(WixDocument document, string fileName) { string id = GenerateIdFromFileName(fileName); if (!document.ComponentIdExists(id)) { return id; } // Add the parent folder to the id. string parentDirectory = WixDirectoryElement.GetLastDirectoryName(Path.GetDirectoryName(fileName)); parentDirectory = FirstCharacterToUpperInvariant(parentDirectory); parentDirectory = WixFileElement.GenerateId(parentDirectory).Replace(".", String.Empty); id = String.Concat(parentDirectory, id); if (!document.ComponentIdExists(id)) { return id; } // Add a number to the end until we generate a unique id. int count = 0; string baseId = id; do { ++count; id = String.Concat(baseId, count); } while (document.ComponentIdExists(id)); return id; }
public void SetUpFixture() { WixDocument doc = new WixDocument(); doc.LoadXml(GetWixXml()); controlsAddedCount = 0; CreatedComponents.Clear(); WixDialog wixDialog = doc.CreateWixDialog("AcceptLicenseDialog", new MockTextFileReader()); using (Form dialog = wixDialog.CreateDialog(this)) { foreach (Control control in dialog.Controls) { ++controlsAddedCount; } RadioButtonGroupBox radioButtonGroup = (RadioButtonGroupBox)dialog.Controls[0]; radioButtonGroupName = radioButtonGroup.Name; radioButtonGroupPropertyName = radioButtonGroup.PropertyName; radioButtonGroupLocation = radioButtonGroup.Location; radioButtonGroupSize = radioButtonGroup.Size; RadioButton acceptRadioButton = (RadioButton)radioButtonGroup.Controls[0]; acceptRadioButtonName = acceptRadioButton.Name; acceptRadioButtonLocation = acceptRadioButton.Location; acceptRadioButtonSize = acceptRadioButton.Size; RadioButton declineRadioButton = (RadioButton)radioButtonGroup.Controls[1]; declineRadioButtonName = declineRadioButton.Name; declineRadioButtonLocation = declineRadioButton.Location; declineRadioButtonSize = declineRadioButton.Size; } }
public void Init() { SD.InitializeForUnitTests(); textEditor = new MockTextEditor(); MockTextEditorViewContent viewContent = new MockTextEditorViewContent(); viewContent.TextEditor = textEditor; viewContent.SetFileName(@"d:\projects\test\file.wxs"); workbench = new MockWorkbench(); workbench.ViewContentCollection.Add(viewContent); MockTextEditorOptions textEditorOptions = new MockTextEditorOptions(); MockXmlTextWriter xmlTextWriter = new MockXmlTextWriter(textEditorOptions); WixProject project = WixBindingTestsHelper.CreateEmptyWixProject(); document = new WixDocument(project, new DefaultFileLoader()); document.LoadXml(GetWixXml()); document.FileName = @"d:\projects\test\File.wxs"; textEditor.Document.Text = GetWixXml(); MockWixPackageFilesControl packageFilesControl = new MockWixPackageFilesControl(); packageFilesView = new PackageFilesView(project, workbench, packageFilesControl, xmlTextWriter); packageFilesControl.IsDirty = true; AddNewChildElementsToDirectory(); packageFilesView.Write(document); }
public void AddRootDirectory() { WixDocument doc = new WixDocument(); doc.LoadXml(GetWixXml()); WixDirectoryElement element = doc.AddRootDirectory(); Assert.IsNotNull(element); }
/// <summary> /// Creates a new instance of the Wix Dialog class. /// </summary> /// <param name="dialogElement">The dialog XML element loaded from /// the Wix document</param> public WixDialog(WixDocument document, XmlElement dialogElement, WixBinaries binaries) { this.document = document; this.dialogElement = dialogElement; this.binaries = binaries; namespaceManager = new WixNamespaceManager(dialogElement.OwnerDocument.NameTable); }
/// <summary> /// Creates the directory element and sets its Id and SourceName. /// </summary> public static WixDirectoryElement CreateRootDirectory(WixDocument document) { WixDirectoryElement rootDirectory = new WixDirectoryElement(document); rootDirectory.Id = RootDirectoryId; rootDirectory.SourceName = "SourceDir"; return rootDirectory; }
public void SetUpFixture() { WixDocument doc = new WixDocument(); doc.LoadXml(GetWixXml()); CreatedComponents.Clear(); WixDialog wixDialog = doc.GetDialog("AcceptLicenseDialog"); using (Form dialog = wixDialog.CreateDialog(this)) { RadioButtonGroupBox radioButtonGroup = (RadioButtonGroupBox)dialog.Controls[0]; Label label1 = new Label(); label1.Left = 100; label1.Top = 30; radioButtonGroup.Controls.Add(label1); radioButtonGroup.Controls.SetChildIndex(label1, 0); Label label2 = new Label(); label2.Left = 100; label2.Top = 30; radioButtonGroup.Controls.Add(label2); // Add a panel to the dialog controls. Panel panel = new Panel(); panel.Left = 100; panel.Top = 30; dialog.Controls.Add(panel); XmlElement dialogElement = wixDialog.UpdateDialogElement(dialog); XmlElement radioButtonGroupElement = (XmlElement)dialogElement.SelectSingleNode("w:Control[@Id='Buttons']", new WixNamespaceManager(dialogElement.OwnerDocument.NameTable)); acceptRadioButtonElement = (XmlElement)radioButtonGroupElement.SelectSingleNode("//w:RadioButtonGroup/w:RadioButton", new WixNamespaceManager(dialogElement.OwnerDocument.NameTable)); controlElementCount = dialogElement.SelectNodes("w:Control", new WixNamespaceManager(dialogElement.OwnerDocument.NameTable)).Count; radioButtonElementCount = radioButtonGroupElement.SelectNodes("//w:RadioButtonGroup//w:RadioButton", new WixNamespaceManager(dialogElement.OwnerDocument.NameTable)).Count; } }
public void Init() { doc = new WixDocument(); doc.FileName = @"C:\Projects\Setup\Setup.wxs"; doc.LoadXml(GetWixXml()); component = (WixComponentElement)doc.SelectSingleNode("//w:Component", new WixNamespaceManager(doc.NameTable)); }
/// <summary> /// Creates a new instance of the WixPackageFilesEditor. /// </summary> /// <param name="view">The UI for the package files editor.</param> /// <param name="fileReader">The file reader hides the file system and the /// workbench from the editor so the class can be easily tested.</param> /// <param name="documentWriter">The file writer hides the file system and the /// workbench from the editor.</param> /// <param name="directoryReader">The directory reader hides the file system /// from the editor.</param> public WixPackageFilesEditor(IWixPackageFilesView view, ITextFileReader fileReader, IWixDocumentWriter documentWriter, IDirectoryReader directoryReader) { document = null; this.view = view; this.fileReader = fileReader; this.documentWriter = documentWriter; this.directoryReader = directoryReader; }
public void SetUpFixture() { doc = new WixDocument(); prefixBeforeLoad = doc.WixNamespacePrefix; doc.LoadXml(GetWixXml()); directory = doc.CreateWixElement("Directory"); directory.OwnerDocument.DocumentElement.AppendChild(directory); }
public void CreateDialog() { WixDocument doc = new WixDocument(); doc.LoadXml(GetWixXml()); WixDialog wixDialog = doc.GetDialog("WelcomeDialog"); using (Form dialog = wixDialog.CreateDialog(this)) { } }
public void SetUpFixture() { WixDocument doc = new WixDocument(); WixFileElement fileElement = new WixFileElement(doc); fileElement.FileName = @"MyApp.exe"; fileNameSpecifiedNode = new WixFileTreeNode(fileElement); }
public void Init() { WixProject project = WixBindingTestsHelper.CreateEmptyWixProject(); project.SetProperty("DefineConstants", @"DATADIR=Bitmaps;"); document = new WixDocument(project); document.FileName = @"C:\Projects\Setup\Setup.wxs"; document.LoadXml(GetWixXml()); }
public WixXmlAttribute(string name, string value, WixXmlAttributeType type, string[] values, WixDocument document) { this.name = name; attributeValue = value; this.type = type; this.values = values; this.document = document; }
public void SetUpFixture() { WixDocument doc = new WixDocument(); doc.FileName = @"C:\Projects\Setup\Setup.wxs"; doc.LoadXml(GetWixXml()); WixPackageFilesDiff diff = new WixPackageFilesDiff(this); diffResults = diff.Compare(doc.RootDirectory); }
public void CreateDialog() { WixDocument doc = new WixDocument(); doc.LoadXml(GetWixXml()); WixDialog wixDialog = doc.CreateWixDialog("WelcomeDialog", new MockTextFileReader()); using (Form dialog = wixDialog.CreateDialog(this)) { } }
public void SetUpFixture() { WixDocument doc = new WixDocument(); doc.LoadXml(GetWixXml()); WixComponentElement wixComponent = new WixComponentElement(doc); wixComponent.GenerateUniqueIdFromFileName(@"C:\Projects\My.Project\MyApp.exe"); id = wixComponent.Id; }
public void SetUpFixture() { WixDocument doc = new WixDocument(); doc.LoadXml(GetWixXml()); WixDialog wixDialog = doc.GetDialog("WelcomeDialog"); using (Form simpleDialog = wixDialog.CreateDialog()) { minimizeBox = simpleDialog.MinimizeBox; } }
public void SetUpFixture() { WixDocument doc = new WixDocument(); doc.LoadXml(GetWixXml()); WixDialog wixDialog = doc.CreateWixDialog("WelcomeDialog", new MockTextFileReader()); using (Form dialog = wixDialog.CreateDialog()) { dialogTitle = dialog.Text; } }
public void SetUpFixture() { WixDocument doc = new WixDocument(); doc.LoadXml(GetWixXml()); WixDialog wixDialog = doc.GetDialog("WelcomeDialog"); using (Form dialog = wixDialog.CreateDialog(this)) { Button backButton = (Button)dialog.Controls[0]; disabled = !backButton.Enabled; } }
public void UpdateDialogElement() { WixDocument doc = new WixDocument(); doc.LoadXml(GetWixXml()); CreatedComponents.Clear(); WixDialog wixDialog = doc.GetDialog("WelcomeDialog"); using (Form dialog = wixDialog.CreateDialog(this)) { XmlElement dialogElement = wixDialog.UpdateDialogElement(dialog); } }
public void UpdateDialogElement() { WixDocument doc = new WixDocument(); doc.LoadXml(GetWixXml()); CreatedComponents.Clear(); WixDialog wixDialog = doc.CreateWixDialog("AcceptLicenseDialog", new MockTextFileReader()); using (Form dialog = wixDialog.CreateDialog(this)) { XmlElement dialogElement = wixDialog.UpdateDialogElement(dialog); } }
/// <summary> /// Gets the Wix xml for the specified element. /// </summary> string GetWixXml(XmlElement element) { ITextEditorProperties properties = SharpDevelopTextEditorProperties.Instance; return(WixDocument.GetXml(element, properties.LineTerminator, properties.ConvertTabsToSpaces, properties.IndentationSize)); }
public WixBinaryElement(WixDocument document) : base(BinaryElementName, document) { }
public WixDirectoryElement(WixDocument document) : base(DirectoryElementName, document) { }
public WixBinaryElement(WixDocument document) : base(document.WixNamespacePrefix, BinaryElementName, WixNamespaceManager.Namespace, document) { }
public WixDirectoryElementBase(string localName, WixDocument document) : base(document.WixNamespacePrefix, localName, WixNamespaceManager.Namespace, document) { }
/// <summary> /// Creates a new instance of the WixBinaries class. /// </summary> /// <remarks> /// The active document is checked first for the required binary then the /// document's project is used to locate the binary in other files /// belonging to the project. /// </remarks> /// <param name="document">The active document. This is first checked /// for the specified binary before the rest of the files in the project.</param> /// <param name="reader">The text file reader to use when reading other /// project files.</param> public WixBinaries(WixDocument document, ITextFileReader reader) { activeDocument = document; project = document.Project; textFileReader = reader; }