コード例 #1
0
        public YAMLElement Clone()
        {
            YAMLElement yamlElement = new YAMLElement();

            foreach (YAMLProperty property in this._properties)
            {
                yamlElement.AddProperty(property.Clone());
            }

            yamlElement.Name = _name;

            return(yamlElement);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public void AddElement(YAMLElement yamlElement)
 {
     _elements.Add(yamlElement);
 }