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); } }
private void LoadYaml() { TextInput input = new TextInput(txtConfig.Text); bool success; YamlParser parser = new YamlParser(); YamlStream yamlStream = parser.ParseYamlStream(input, out success); if (success) { tviYaml.Nodes.Clear(); foreach (YamlDocument doc in yamlStream.Documents) { tviYaml.Nodes.Add(YamlEmittor.CreateNode(doc.Root)); } tviYaml.ExpandAll(); ESClustername = YamlEmittor.ClusterName; } else { MessageBox.Show(parser.GetEorrorMessages()); } }