private void ProcessXAttributes(XAttribute xAttribute, Element parent) { var attribute = new Parts.Attribute(); attribute.Name = xAttribute.Name.LocalName; attribute.Value = xAttribute.Value; attribute.Parent = parent; attribute.RootObject = "Config"; parent.Attributes.Add(attribute); }
private void ProcessXAttributes(XAttribute xAttribute, Element parent) { var attribute = new Parts.Attribute { Name = xAttribute.Name.LocalName, Value = xAttribute.Value, Parent = parent, RootObject = "Config" }; parent.Attributes.Add(attribute); }
public static ComboBox ComboBox(Parts.Attribute attribute, string[] items, ToolTip tooltip = null) { try { if (String.IsNullOrWhiteSpace(attribute.Name) || items.Length == 0) { throw new ArgumentNullException(); } var comboBox = new ComboBox(); comboBox.SuspendLayout(); comboBox.DropDownStyle = ComboBoxStyle.DropDownList; comboBox.ForeColor = System.Drawing.Color.Black; comboBox.FlatStyle = FlatStyle.Flat; comboBox.Font = Methods.BaseFont; comboBox.FormattingEnabled = true; comboBox.Name = "cb" + attribute.Name; comboBox.Size = new System.Drawing.Size(121, 21); comboBox.Items.AddRange(items); comboBox.Tag = attribute; if (String.IsNullOrWhiteSpace(attribute.Value)) { comboBox.SelectedIndex = comboBox.Items.IndexOf(attribute.Default); } else { comboBox.SelectedIndex = comboBox.Items.IndexOf(attribute.Value); } if (tooltip != null) { tooltip.SetToolTip(comboBox, attribute.Documentation); } comboBox.ResumeLayout(); return(comboBox); } catch (Exception ex) { log.Debug(ex); return(null); } }
public static FlowLayoutPanel ComboBoxFlow(Parts.Attribute attribute, string[] items, ToolTip tooltip = null) { try { if (String.IsNullOrWhiteSpace(attribute.Name)) { throw new ArgumentNullException(); } var panel = Container(attribute); panel.SuspendLayout(); panel.Controls.Add(Controls.ComboBox(attribute, items, tooltip)); panel.ResumeLayout(); return(panel); } catch (Exception ex) { log.Debug(ex); return(null); } }
private void ProcessAttributes(XmlSchemaComplexType schemaComplexType, Element element) { var enumerator = schemaComplexType.AttributeUses.GetEnumerator(); while (enumerator.MoveNext()) { var xmlAttribute = (XmlSchemaAttribute)enumerator.Value; var attribute = new Parts.Attribute { Name = xmlAttribute.Name, Type = xmlAttribute.SchemaTypeName.Name, Default = xmlAttribute.DefaultValue ?? "", Use = xmlAttribute.Use.ToString(), Documentation = GetDocumentation(xmlAttribute.Annotation), Parent = element, }; attribute.IsAdvanced = SpecialCaseHandlers.IsAdvanced(attribute, element); attribute.SpecialLength = SpecialCaseHandlers.SpecialLength(attribute, element); attribute.RootObject = "Xsd"; if (xmlAttribute.AttributeSchemaType.Content.GetType().ToString() == "System.Xml.Schema.XmlSchemaSimpleTypeRestriction") { var xmlRestrication = xmlAttribute.AttributeSchemaType.Content as XmlSchemaSimpleTypeRestriction; if (xmlRestrication != null) { var restriction = new Restriction(); foreach (var facet in xmlRestrication.Facets.Cast <XmlSchemaEnumerationFacet>()) { restriction.Enumerations.Add(facet.Value); } attribute.Restriction = restriction; } } element.Attributes.Add(attribute); } }
private static Element FillOutRootElement(Element element) { try { var attribute = new Parts.Attribute { Name = "xmlns", Type = "hidden", Default = "urn:newrelic-config", Parent = element, Value = "urn:newrelic-config", RootObject = "Xsd" }; element.Documentation = "These are the basic settings that govern how the .Net Agent behaves. The key setting is agentEnabled."; element.RootElement = true; element.Attributes.Add(attribute); } catch (Exception ex) { log.Debug(ex); } return(null); }
private static Element FillOutRootElement(Element element) { try { var attribute = new Parts.Attribute { Name = "xmlns", Type = "hidden", Default = "urn:newrelic-config", Parent = element, Value = "urn:newrelic-config", RootObject = "Xsd" }; element.Documentation = "These are the basic settings that govern how the .Net Agent behaves. The key setting is agentEnabled."; element.RootElement = true; element.Attributes.Add(attribute); } catch (Exception ex) { log.Debug(ex); } return null; }
private static void SetupParent(Element parent, Element element) { try { if (parent != null) { element.Parent = parent; element.SpecialLength = SpecialCaseHandlers.SpecialLength(element); element.RootElement = SpecialCaseHandlers.RootElement(element); parent.Elements.Add(element); } else { ConfigurationFile.Xsd = element; //Add the required namespace //xmlns="urn:newrelic-config" var attribute = new Parts.Attribute(); attribute.Name = "xmlns"; attribute.Type = "hidden"; attribute.Default = "urn:newrelic-config"; attribute.Parent = element; attribute.Value = "urn:newrelic-config"; attribute.RootObject = "Xsd"; ConfigurationFile.Xsd.Documentation = "These are the basic settings that govern how the .Net Agent behaves. The key setting is agentEnabled."; ConfigurationFile.Xsd.Attributes.Add(attribute); } } catch(Exception ex) { } }
private void ProcessAttributes(XmlSchemaComplexType schemaComplexType, Element element) { var enumerator = schemaComplexType.AttributeUses.GetEnumerator(); while (enumerator.MoveNext()) { var xmlAttribute = (XmlSchemaAttribute)enumerator.Value; var attribute = new Parts.Attribute(); attribute.Name = xmlAttribute.Name; attribute.Type = xmlAttribute.SchemaTypeName.Name; attribute.Default = xmlAttribute.DefaultValue == null ? "" : xmlAttribute.DefaultValue; attribute.Use = xmlAttribute.Use.ToString(); attribute.Documentation = GetDocumentation(xmlAttribute.Annotation); attribute.Parent = element; attribute.IsAdvanced = SpecialCaseHandlers.IsAdvanced(attribute); attribute.RootObject = "Xsd"; if(xmlAttribute.AttributeSchemaType.Content.GetType().ToString() == "System.Xml.Schema.XmlSchemaSimpleTypeRestriction") { var xmlRestrication = xmlAttribute.AttributeSchemaType.Content as XmlSchemaSimpleTypeRestriction; if (xmlRestrication != null) { var restriction = new Restriction(); foreach (XmlSchemaEnumerationFacet facet in xmlRestrication.Facets) { restriction.Enumerations.Add(facet.Value); } attribute.Restriction = restriction; } } attribute.SpecialLength = SpecialCaseHandlers.SpecialLength(attribute); element.Attributes.Add(attribute); } }