Example #1
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);
        }
Example #2
0
        private void getUIElements(YAMLDocument document)
        {
            foreach (YAMLElement yamlElement in document.GetElements())
            {
                ConsoleUIElementParam param = new ConsoleUIElementParam();
                param.Name             = yamlElement.GetPropertyValue(ConsoleUIElement.NAME);
                param.Type             = yamlElement.Name;
                param.Column           = yamlElement.GetPropertyValue(ConsoleUIElement.COLUMN);
                param.Row              = yamlElement.GetPropertyValue(ConsoleUIElement.ROW);
                param.Height           = yamlElement.GetPropertyValue(ConsoleUIElement.HEIGHT);
                param.Width            = yamlElement.GetPropertyValue(ConsoleUIElement.WIDTH);
                param.Text             = yamlElement.GetPropertyValue(ConsoleUIElement.TEXT);
                param.Value            = yamlElement.GetPropertyValue(ConsoleUIElement.VALUE);
                param.FontColor        = yamlElement.GetPropertyValue(ConsoleUIElement.FONT_COLOR);
                param.BackgrounColor   = yamlElement.GetPropertyValue(ConsoleUIElement.BACKGROUND_COLOR);
                param.Options          = yamlElement.GetPropertyValue(ConsoleUIElement.BACKGROUND_COLOR);
                param.SelectedColor    = yamlElement.GetPropertyValue(ConsoleUIElement.SELECTED_COLOR);
                param.NonSelectedColor = yamlElement.GetPropertyValue(ConsoleUIElement.NON_SELECTED_COLOR);
                param.Options          = yamlElement.GetPropertyValue(ConsoleUIElement.OPTIONS);

                ConsoleUIElement element = new ConsoleUIElement(param);
                _elements.Add(element);
            }
        }