コード例 #1
0
        public static YamlDataFile OpenYaml(string fileName)
        {
            ShortLog.DebugFormat("Loading Yaml File: {0}", fileName);
            using (var input = File.OpenText(fileName))
            {
                var yaml = new YamlStream();
                yaml.Load(input);

                // Examine the stream
                return(new YamlDataFile(yaml.Documents[0].RootNode));
            }
        }
コード例 #2
0
        /// <summary>
        /// Loads a Yaml document and returns the YamlDotNet parser
        ///
        /// This is based on the data file path configured
        /// </summary>
        /// <returns>The YamlDotNet parser</returns>
        /// <param name="fileName">File name to open</param>
        public static YamlObjectStore OpenYamlDataFile(string fileName)
        {
            var path = Path.Combine(Configuration.DataPath, fileName);

            ShortLog.DebugFormat("Loading Yaml File: {0}", path);
            using (var input = File.OpenText(path))
            {
                var yaml = new YamlStream();
                yaml.Load(input);

                // Examine the stream
                return(new YamlObjectStore(yaml.Documents[0].RootNode));
            }
        }