예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }