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); }
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)); }
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)); }
public static Config CreateFromFile() { return(YamlHelper.DeserializeFromFile <Config>(nameof(Config) + ".yaml")); }