Example #1
0
        public static ConfigurationDirectoryInfo CreateFromFile()
        {
            App.Trace($"Begin main config read started. Path: {FilePath}");
            var item = YamlHelper.DeserializeFromFile <ConfigurationDirectoryInfo>(FilePath);

            App.Trace($"End main config read started. Path: {FilePath}");

            return(item);
        }
Example #2
0
        public static T ReadConfig <T>(params string[] folders)
        {
            var items = new List <string>(folders);

            if (ConfigurationDirectoryPath != null)
            {
                items.Insert(0, ConfigurationDirectoryPath);
            }

            items.Add(typeof(T).Name + ".yaml");

            var filePath = string.Join(Path.DirectorySeparatorChar.ToString(), items);

            return(YamlHelper.DeserializeFromFile <T>(filePath));
        }
Example #3
0
        public static T ReadConfig <T>(params string[] folders)
        {
            var items = new List <string>(folders);

            if (ConfigurationDirectoryPath != null)
            {
                items.Insert(0, ConfigurationDirectoryPath);
            }

            items.Add(typeof(T).Name + ".yaml");

            var filePath = string.Join(Path.DirectorySeparatorChar.ToString(), items);

            if (!File.Exists(filePath))
            {
                App.Trace($"File not found. FilePath: {filePath}");
                throw new FileNotFoundException(filePath);
            }
            return(YamlHelper.DeserializeFromFile <T>(filePath));
        }
 /// <summary>
 ///     Creates from file.
 /// </summary>
 public static Config CreateFromFile(string filePath)
 {
     return(YamlHelper.DeserializeFromFile <Config>(filePath));
 }
Example #5
0
 public static Config CreateFromFile()
 {
     return(YamlHelper.DeserializeFromFile <Config>(nameof(Config) + ".yaml"));
 }