private static AttributeItem ParseAttributeFromString(string attributeString) { var delimiter = attributeString.IndexOfAny(new [] { '=' }); var key = attributeString.Substring(0, delimiter); var value = attributeString.Substring(delimiter + 2, attributeString.Length - delimiter - 3); var attribute = new AttributeItem(key, value); return(attribute); }
private void OnSaveAttributes(TreeNode selectedNode) { string endPart; if (selectedNode.Text.EndsWith("/>")) { endPart = " />"; } else { endPart = ">"; } var parts = selectedNode.Text.Split(' '); var attributes = new List <AttributeItem>(); foreach (var visualAttributeItem in _visualAttributeItems) { var attribute = new AttributeItem(visualAttributeItem.KeyLabel.Text, visualAttributeItem.ValueTextBox.Text); attributes.Add(attribute); } selectedNode.Text = parts[0] + @" " + AttributeHandler.TransformAttributesListToString(attributes) + endPart; }