private static string GetRemoteConfigFile() { //TODO: we MUST create default configuration here in case that "RemoteConfigurationManagerConfiguration.config" does not exist string remoteFile = System.Configuration.ConfigurationManager.AppSettings[RemoteConfigFileAppSettingKey]; if (remoteFile == null) { remoteFile = LocalConfigurationManager.MapConfigPath(RemoteConfigurationManagerConfigFileName); } else { remoteFile = LocalConfigurationManager.MapConfigPath(remoteFile); } if (!File.Exists(remoteFile)) { Log("Config file '" + remoteFile + "' doesn't exists, use/create new configuration files in '" + ConfigUtility.DefaultApplicationConfigFolder + "'"); remoteFile = ConfigUtility.Combine(ConfigUtility.DefaultApplicationConfigFolder, RemoteConfigurationManagerConfigFileName); if (!File.Exists(remoteFile)) { Directory.CreateDirectory(ConfigUtility.DefaultApplicationConfigFolder); using (XmlTextWriter writer = new XmlTextWriter(remoteFile, Encoding.UTF8)) { writer.WriteStartElement(RemoteConfigurationManagerConfiguration.TagName); RemoteConfigurationManagerConfiguration.DefaultConfig.WriteXml(writer); writer.WriteEndElement(); writer.Close(); } } } return(remoteFile); }
private static string GetConfigFilePath(System.Configuration.Configuration confFile, ConfigurationSection section) { string configSource = section.SectionInformation.ConfigSource; if (configSource == String.Empty) { return(Path.GetFullPath(confFile.FilePath)); } else { return(ConfigUtility.Combine(Path.GetDirectoryName(confFile.FilePath), configSource)); } }
public void ReadXml(System.Xml.XmlReader reader) { applicationName = ConfigUtility.GetStringValue(reader, "applicationName", DefaultConfig.ApplicationName); timeout = ConfigUtility.GetIntValue(reader, "timeout", DefaultConfig.Timeout); readwriteTimeout = ConfigUtility.GetIntValue(reader, "readwriteTimeout", DefaultConfig.ReadWriteTimeout); timeInterval = ConfigUtility.GetIntValue(reader, "timeInterval", DefaultConfig.TimerInterval); remoteConfigurationUrl = ConfigUtility.GetStringValue(reader, "remoteConfigurationUrl", DefaultConfig.RemoteConfigurationUrl); localConfigurationFolder = ConfigUtility.GetStringValue(reader, "localConfigurationFolder", DefaultConfig.LocalConfigurationFolder); backupConfig = ConfigUtility.GetBoolValue(reader, "backupConfig", DefaultConfig.BackupConfig); maxBackupFiles = ConfigUtility.GetIntValue(reader, "maxBackupFiles", DefaultConfig.MaxBackupFiles); checkRemoteConfig = ConfigUtility.GetBoolValue(reader, "checkRemoteConfig", DefaultConfig.CheckRemoteConfig); EnsureLocalApplicationFolder(); }
string GetPath(string sectionName) { return(ConfigUtility.Combine(config.LocalApplicationFolder, GetFileName(sectionName))); }
public static string Combine(string folder, string file) { return(ConfigUtility.Combine(folder, file)); }