Esempio n. 1
0
        public static AampFile LoadFile(Stream Stream)
        {
            AampFile file    = null;
            uint     version = CheckVersion(Stream);

            if (version == 2)
            {
                file = new AampFileV2(Stream);
            }
            else
            {
                file = new AampFileV1(Stream);
            }
            return(file);
        }
Esempio n. 2
0
        public static AampFile FromYaml(string text)
        {
            AampFile file = new AampFile();
            var      yaml = new YamlStream();

            yaml.Load(new StringReader(text));
            var mapping = (YamlMappingNode)yaml.Documents[0].RootNode;

            foreach (var entry in mapping.Children)
            {
                var key   = ((YamlScalarNode)entry.Key).Value;
                var value = entry.Value.ToString();
                if (key == "aamp_version")
                {
                    file.Version = (uint)ParseValueInt(value);
                    if (file.Version == 2)
                    {
                        file = new AampFileV2();
                    }
                    else
                    {
                        file = new AampFileV1();
                    }
                }
                if (key == "type")
                {
                    file.ParameterIOType = value;
                }

                if (entry.Value.Tag == "!list")
                {
                    file.RootNode = ParseParamList(key, (YamlMappingNode)entry.Value);
                }
            }

            return(file);
        }