예제 #1
0
        /// <summary>
        /// Sends required config files through the JamlParser
        /// </summary>
        /// <param name="configNames">Required filenames</param>
        /// <returns>Dictionary with Format name mapped to RecordFormat</returns>
        public Dictionary <string, RecordFormat> parse(string[] configNames)
        {
            Dictionary <string, RecordFormat> formats = new Dictionary <string, RecordFormat>();

            foreach (string config in configNames)
            {
                //checks if the configs specified by the user exist
                string file = @".\config\" + config + ".yml";
                if (!files.Contains(file))
                {
                    Logger.logErr("\"" + config + "\" was not found.");
                    continue;
                }
                try
                {
                    if (!formats.ContainsKey(config))
                    {
                        //index needs to be reset after every config, because it's static
                        ColumnInfo.resetIndex();
                        RecordFormat rf = new JamlParser <RecordFormat>().parse(file);
                        rf.name = config;
                        formats.Add(config, rf);
                        Logger.logMsg("Parsed " + config);
                    }
                }
                catch (Exception e)
                {
                    Logger.logErr("Could not parse " + config + ". Skipping.. (See log for further info)", e);
                }
            }

            return(formats);
        }
예제 #2
0
 public Unittest()
 {
     Logger.logMsg("Starting unittest.");
     JamlParser<FakeClass> parser = new JamlParser<FakeClass>();
     FakeClass fake = parser.parse("config\\example.yml");
     Logger.logMsg("Unittest finished. Everything seems to be working.");
 }