GetEorrorMessages() public method

public GetEorrorMessages ( ) : string
return string
 public static YamlStream Load(string file)
 {
     string text = File.ReadAllText(file);
     TextInput input = new TextInput(text);
     YamlParser parser = new YamlParser();
     bool success;
     YamlStream stream = parser.ParseYamlStream(input, out success);
     if (success)
     {
         return stream;
     }
     else
     {
         string message = parser.GetEorrorMessages();
         throw new Exception(message);
     }
 }
Ejemplo n.º 2
0
        public static YamlStream Load(string file)
        {
            string     text   = File.ReadAllText(file);
            TextInput  input  = new TextInput(text);
            YamlParser parser = new YamlParser();
            bool       success;
            YamlStream stream = parser.ParseYamlStream(input, out success);

            if (success)
            {
                return(stream);
            }
            else
            {
                string message = parser.GetEorrorMessages();
                throw new Exception(message);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets the sample yaml.
        /// </summary>
        /// <returns></returns>
        public List<MappingEntry> GetSampleYaml()
        {
            YamlParser parser = new YamlParser();
            TextInput input = new TextInput(File.ReadAllText("sample.txt"));
            bool success;
            YamlStream yamlStream = parser.ParseYamlStream(input, out success);
            if (success)
            {

                    Mapping mapping = yamlStream.Documents[0].Root as Mapping;

                    return mapping.Enties;
            }
            else
            {
                Console.WriteLine(parser.GetEorrorMessages());
            }

            return null;
        }
        private void toolStripButtonParse_Click(object sender, EventArgs e)
        {
            TextInput input = new TextInput(richTextBoxSource.Text);

            bool success;
            YamlParser parser = new YamlParser();
            YamlStream yamlStream = parser.ParseYamlStream(input, out success);
            if (success)
            {
                treeViewData.Nodes.Clear();
                foreach (YamlDocument doc in yamlStream.Documents)
                {
                    treeViewData.Nodes.Add(YamlEmittor.CreateNode(doc.Root));
                }
                treeViewData.ExpandAll();
                tabControl1.SelectedTab = tabPageDataTree;
            }
            else
            {
                MessageBox.Show(parser.GetEorrorMessages());
            }
        }