public void SaveComponentConfig(INeonComponent component, object config) { var attr = component.GetType().GetCustomAttribute <NeonComponentAttribute>(); var fileName = Path.Combine(_neonConfig.ComponentsConfig.ConfigDirectory.DirectoryName, $"{attr.Name}.yaml"); _fileSystemManager.WriteToFile(fileName, config); }
public void SaveVaultConfig(INeonComponent component, object config) { var attr = component.GetType().GetCustomAttribute <NeonComponentAttribute>(); var fileName = $"{attr.Name}_vault.yaml"; _fileSystemManager.WriteToFile(Path.Combine(_config.VaultConfigDirectory.DirectoryName, fileName), config); }
public T LoadVaultConfig <T>(INeonComponent component) where T : new() { var attr = component.GetType().GetCustomAttribute <NeonComponentAttribute>(); var fileName = $"{attr.Name}_vault.yaml"; var fileObject = _fileSystemManager.ReadFromFile <T>(Path.Combine(_config.VaultConfigDirectory.DirectoryName, fileName)); if (fileObject == null) { fileObject = new T(); SaveVaultConfig(component, fileObject); return(LoadVaultConfig <T>(component)); } return(fileObject); }