Esempio n. 1
0
        public static string Compose(string input, string searchPath)
        {
            YamlSerializer.SearchPath = searchPath;
            var data   = YamlSerializer.Deserialize(input);
            var output = YamlSerializer.Serialize(data);

            return(output);
        }
Esempio n. 2
0
        public object ReadYaml(IParser parser, Type type)
        {
            parser.Expect <MappingStart>();
            var key = parser.Expect <Scalar>();
            var val = parser.Expect <Scalar>();

            parser.Expect <MappingEnd>();

            if (key.Value != "File")
            {
                throw new YamlException(key.Start, val.End, "Expected a scalar named 'File'");
            }

            //Console.WriteLine($"Reading file {val.Value}");
            var input = File.ReadAllText(Path.Combine(YamlSerializer.SearchPath, val.Value));

            //Console.WriteLine($"Successfully loaded file {val.Value}");

            Console.WriteLine($"Deserializing file {val.Value}");
            var data = YamlSerializer.Deserialize(input);

            //Console.WriteLine($"Successfully Deserialized file {val.Value}");
            return(data);
        }