示例#1
0
        public Vertica.Integration.Infrastructure.Configuration.Configuration Save(Vertica.Integration.Infrastructure.Configuration.Configuration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }
            FileInfo fileInfo = this.ConfigurationFilePath(configuration.Id);

            File.WriteAllText(fileInfo.FullName, configuration.JsonData);
            File.WriteAllText(FileBasedConfigurationRepository.MetaFilePath(fileInfo).FullName, (new FileBasedConfigurationRepository.MetaFile(configuration)).ToString());
            return(this.Get(configuration.Id));
        }
示例#2
0
        private FileBasedConfigurationRepository.MetaFile ReadMetaFile(FileInfo archiveFile)
        {
            FileInfo fileInfo = FileBasedConfigurationRepository.MetaFilePath(archiveFile);

            if (!fileInfo.Exists)
            {
                return(null);
            }
            string str = File.ReadAllText(fileInfo.FullName);

            if (string.IsNullOrWhiteSpace(str))
            {
                return(null);
            }
            return(FileBasedConfigurationRepository.MetaFile.FromJson(str, this._logger));
        }
示例#3
0
        public void Delete(string id)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                throw new ArgumentException("Value cannot be null or empty.", "id");
            }
            FileInfo fileInfo = this.ConfigurationFilePath(id);

            if (fileInfo.Exists)
            {
                FileInfo fileInfo1 = FileBasedConfigurationRepository.MetaFilePath(fileInfo);
                fileInfo.Delete();
                if (fileInfo1.Exists)
                {
                    fileInfo1.Delete();
                }
            }
        }