DomRegion GetTextEditorRegionForDialogElement(string dialogId) { IDocument document = view.DesignerCodeFileDocument; WixDocumentReader wixReader = new WixDocumentReader(document.Text); return(wixReader.GetElementRegion("Dialog", dialogId)); }
/// <summary> /// Tries to replace the element defined by element name and its Id attribute in the /// text editor with the specified xml. /// </summary> /// <param name="id">The Id attribute of the element.</param> /// <param name="elementName">The name of the element.</param> /// <param name="xml">The replacement xml.</param> public DomRegion ReplaceElement(string elementAttributeId, string elementName, string replacementXml) { WixDocumentReader wixReader = new WixDocumentReader(document.Text); DomRegion region = wixReader.GetElementRegion(elementName, elementAttributeId); if (!region.IsEmpty) { Replace(region, replacementXml); } return region; }
/// <summary> /// Tries to replace the element defined by element name and its Id attribute in the /// text editor with the specified xml. /// </summary> /// <param name="id">The Id attribute of the element.</param> /// <param name="elementName">The name of the element.</param> /// <param name="xml">The replacement xml.</param> public DomRegion ReplaceElement(string elementAttributeId, string elementName, string replacementXml) { WixDocumentReader wixReader = new WixDocumentReader(document.Text); DomRegion region = wixReader.GetElementRegion(elementName, elementAttributeId); if (!region.IsEmpty) { Replace(region, replacementXml); } return(region); }
public void SingleDirectoryElement() { string xml = "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>\r\n" + "\t<Fragment>\r\n" + "\t\t<Directory Id='TARGETDIR' Name='SourceDir'>\r\n" + "\t\t</Directory>\r\n" + "\t</Fragment>\r\n" + "</Wix>"; WixDocumentReader wixReader = new WixDocumentReader(xml); DomRegion region = wixReader.GetElementRegion("Directory", "TARGETDIR"); DomRegion expectedRegion = new DomRegion(3, 3, 4, 14); Assert.AreEqual(expectedRegion, region); }
public void ElementStartsImmediatelyAfterDialogEndElement() { string xml = "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>\r\n" + "\t<Fragment>\r\n" + "\t\t<UI>\r\n" + "<Dialog Id='WelcomeDialog'></Dialog><Property/>\r\n" + "\t\t</UI>\r\n" + "\t</Fragment>\r\n" + "</Wix>"; WixDocumentReader wixReader = new WixDocumentReader(xml); DomRegion region = wixReader.GetElementRegion("Dialog", "WelcomeDialog"); DomRegion expectedRegion = new DomRegion(4, 1, 4, 36); Assert.AreEqual(expectedRegion, region); }
public void EmptyDialogElement() { string xml = "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>\r\n" + "\t<Fragment>\r\n" + "\t\t<UI>\r\n" + "<Dialog Id='WelcomeDialog'/>\r\n" + "\t\t</UI>\r\n" + "\t</Fragment>\r\n" + "</Wix>"; WixDocumentReader wixReader = new WixDocumentReader(xml); DomRegion region = wixReader.GetElementRegion("Dialog", "WelcomeDialog"); DomRegion expectedRegion = new DomRegion(4, 1, 4, 28); Assert.AreEqual(expectedRegion, region); }
public void DialogSpansTwoLines() { string xml = "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>\r\n" + "\t<Fragment>\r\n" + "\t\t<UI>\r\n" + "\t\t\t<Dialog Id='WelcomeDialog' Height='100' Width='200'>\r\n" + "\t\t\t</Dialog>\r\n" + "\t\t</UI>\r\n" + "\t</Fragment>\r\n" + "</Wix>"; WixDocumentReader wixReader = new WixDocumentReader(xml); DomRegion region = wixReader.GetElementRegion("Dialog", "WelcomeDialog"); DomRegion expectedRegion = new DomRegion(4, 4, 5, 12); Assert.AreEqual(expectedRegion, region); }
DomRegion GetTextEditorRegionForDialogElement(string dialogId) { WixDocumentReader wixReader = new WixDocumentReader(view.GetDocumentXml()); return(wixReader.GetElementRegion("Dialog", dialogId)); }
DomRegion GetTextEditorRegionForDialogElement(string dialogId) { WixDocumentReader wixReader = new WixDocumentReader(view.GetDocumentXml()); return wixReader.GetElementRegion("Dialog", dialogId); }
DomRegion GetTextEditorRegionForDialogElement(string dialogId) { IDocument document = view.DesignerCodeFileDocument; WixDocumentReader wixReader = new WixDocumentReader(document.Text); return wixReader.GetElementRegion("Dialog", dialogId); }