/// <summary> /// Gets the attributes for the property descriptor based on the /// WixXmlAttribute. /// </summary> /// <remarks>Adds an EditorAttribute for types (e.g. AutogenUuid) /// that have a custom UITypeEditor.</remarks> static Attribute[] GetAttributes(WixXmlAttribute wixXmlAttribute) { List <Attribute> attributes = new List <Attribute>(); switch (wixXmlAttribute.AttributeType) { case WixXmlAttributeType.ComponentGuid: case WixXmlAttributeType.AutogenGuid: case WixXmlAttributeType.Guid: attributes.Add(new EditorAttribute(typeof(GuidEditor), typeof(UITypeEditor))); break; case WixXmlAttributeType.FileName: attributes.Add(new EditorAttribute(typeof(RelativeFileNameEditor), typeof(UITypeEditor))); break; case WixXmlAttributeType.Text: if (wixXmlAttribute.HasValues) { attributes.Add(new EditorAttribute(typeof(WixDropDownEditor), typeof(UITypeEditor))); } break; } return(attributes.ToArray()); }
public void SetUpFixture() { base.InitFixture(); XmlElement rootDirectoryElement = editor.Document.GetRootDirectory(); XmlElement directoryElement = (XmlElement)rootDirectoryElement.ChildNodes[0]; view.SelectedElement = directoryElement; editor.SelectedElementChanged(); idAttribute = base.GetAttribute(view.Attributes, "Id"); }
public void Uuid() { WixXmlAttribute attribute = new WixXmlAttribute("Id", WixXmlAttributeType.Guid); propertyDescriptor = new WixXmlAttributePropertyDescriptor(attribute); EditorAttribute editorAttribute = WixBindingTestsHelper.GetEditorAttribute(propertyDescriptor.Attributes); Assert.IsNotNull(editorAttribute); Assert.AreEqual(typeof(GuidEditor).AssemblyQualifiedName, editorAttribute.EditorTypeName); }
/// <summary> /// Gets the attributes for the specified element. Also adds any standard /// attributes for the element which are not set. /// </summary> public WixXmlAttributeCollection GetAttributes(XmlElement element) { WixXmlAttributeCollection attributes = new WixXmlAttributeCollection(); string elementName = element.Name; foreach (XmlAttribute attribute in element.Attributes) { string attributeName = attribute.Name; WixXmlAttributeType type = GetWixAttributeType(elementName, attributeName); WixDocument document = GetWixDocument(element); string[] attributeValues = GetAttributeValues(elementName, attributeName); WixXmlAttribute wixAttribute = new WixXmlAttribute(attributeName, attribute.Value, type, attributeValues, document); attributes.Add(wixAttribute); } attributes.AddRange(GetMissingAttributes(element, attributes, GetAttributeNames(elementName))); return attributes; }
/// <summary> /// Gets the attributes for the specified element. Also adds any standard /// attributes for the element which are not set. /// </summary> public WixXmlAttributeCollection GetAttributes(XmlElement element) { WixXmlAttributeCollection attributes = new WixXmlAttributeCollection(); string elementName = element.Name; foreach (XmlAttribute attribute in element.Attributes) { string attributeName = attribute.Name; WixXmlAttributeType type = GetWixAttributeType(elementName, attributeName); WixDocument document = GetWixDocument(element); string[] attributeValues = GetAttributeValues(elementName, attributeName); WixXmlAttribute wixAttribute = new WixXmlAttribute(attributeName, attribute.Value, type, attributeValues, document); attributes.Add(wixAttribute); } attributes.AddRange(GetMissingAttributes(element, attributes, GetAttributeNames(elementName))); return(attributes); }
public void Init() { doc = new WixDocument(); doc.FileName = @"C:\Projects\Setup\Files.wxs"; doc.LoadXml(GetWixXml()); XmlElement productElement = doc.GetProduct(); WixXmlAttributeCollection attributes = wixSchema.GetAttributes(productElement); productIdAttribute = attributes["Id"]; productUpgradeCodeAttribute = attributes["UpgradeCode"]; XmlElement componentElement = (XmlElement)doc.SelectSingleNode("//w:Component", new WixNamespaceManager(doc.NameTable)); attributes = wixSchema.GetAttributes(componentElement); componentGuidAttribute = attributes["Guid"]; componentKeyPathAttribute = attributes["KeyPath"]; XmlElement fileElement = (XmlElement)doc.SelectSingleNode("//w:File", new WixNamespaceManager(doc.NameTable)); attributes = wixSchema.GetAttributes(fileElement); fileSourceAttribute = attributes["Source"]; fileSrcAttribute = attributes["src"]; }
/// <summary> /// Creates a new instance of the WixXmlAttributePropertyDescriptor class. /// </summary> public WixXmlAttributePropertyDescriptor(WixXmlAttribute wixXmlAttribute) : base(wixXmlAttribute.Name, GetAttributes(wixXmlAttribute)) { this.wixXmlAttribute = wixXmlAttribute; }
/// <summary> /// Adds the attribute to the collection. /// </summary> public void Add(WixXmlAttribute attribute) { InnerList.Add(attribute); }
public void SetUpFixture() { WixXmlAttribute attribute = new WixXmlAttribute("Id", WixXmlAttributeType.Text, new string[] {"a", "b"}, null); propertyDescriptor = new WixXmlAttributePropertyDescriptor(attribute); editorAttribute = WixBindingTestsHelper.GetEditorAttribute(propertyDescriptor.Attributes); }
public void SetUpFixture() { WixXmlAttribute attribute = new WixXmlAttribute("Id", WixXmlAttributeType.ComponentGuid); propertyDescriptor = new WixXmlAttributePropertyDescriptor(attribute); editorAttribute = WixBindingTestsHelper.GetEditorAttribute(propertyDescriptor.Attributes); }
/// <summary> /// Gets the attributes for the property descriptor based on the /// WixXmlAttribute. /// </summary> /// <remarks>Adds an EditorAttribute for types (e.g. AutogenUuid) /// that have a custom UITypeEditor.</remarks> static Attribute[] GetAttributes(WixXmlAttribute wixXmlAttribute) { List<Attribute> attributes = new List<Attribute>(); switch (wixXmlAttribute.AttributeType) { case WixXmlAttributeType.ComponentGuid: case WixXmlAttributeType.AutogenGuid: case WixXmlAttributeType.Guid: attributes.Add(new EditorAttribute(typeof(GuidEditor), typeof(UITypeEditor))); break; case WixXmlAttributeType.FileName: attributes.Add(new EditorAttribute(typeof(RelativeFileNameEditor), typeof(UITypeEditor))); break; case WixXmlAttributeType.Text: if (wixXmlAttribute.HasValues) { attributes.Add(new EditorAttribute(typeof(WixDropDownEditor), typeof(UITypeEditor))); } break; } return attributes.ToArray(); }
public void Setup() { wixXmlAttribute = new WixXmlAttribute("LongName", "InitialValue", WixXmlAttributeType.Text); pd = new WixXmlAttributePropertyDescriptor(wixXmlAttribute); }