public YAMLElement Clone() { YAMLElement yamlElement = new YAMLElement(); foreach (YAMLProperty property in this._properties) { yamlElement.AddProperty(property.Clone()); } yamlElement.Name = _name; return(yamlElement); }
private YAMLDocument parse() { YAMLDocument yamlDocument = null; YAMLElement yamlElement = null; foreach (string line in _lines) { if (yamlDocument != null) { if (line.IndexOf(YAMLDocument.PROPERTY_SPLITTER) > -1 && yamlElement != null) { YAMLProperty property = new YAMLProperty(line); yamlElement.AddProperty(property); } if (line.StartsWith(YAMLDocument.ELEMENT_MARKER)) { if (yamlElement != null) { yamlDocument.AddElement(yamlElement.Clone()); } yamlElement = new YAMLElement(); yamlElement.Name = yamlElement.GetElementLineValue(line); } } if (line.StartsWith(YAMLDocument.DOCUMENT_MARKER)) { if (YAMLDocument.GetDocumentLineValue(line) == YAMLDocument.SCREEN_KEYWORD) { yamlDocument = new YAMLDocument(); } } } if (yamlElement != null) { yamlDocument.AddElement(yamlElement.Clone()); } return(yamlDocument); }
public void AddElement(YAMLElement yamlElement) { _elements.Add(yamlElement); }