/// <summary> /// Get the temporary directory path to store instance data. Sub-Directory will be appended /// if specified. /// </summary> /// <param name="subdir">Relative Sub-Directory</param> /// <returns>Temporary Folder path</returns> public string GetInstancePath(string subdir) { Postconditions.CheckCondition(Settings); Postconditions.CheckCondition(Header); lock (this) { string dir = String.Format("{0}{1}{2}{1}{3}{1}{4}", Header.ApplicationGroup, Path.PathSeparator, Header.Application, Header.Name, Header.Version.ToString()); if (!String.IsNullOrWhiteSpace(subdir)) { dir = String.Format("{0}{1}{2}", dir, Path.PathSeparator, subdir); } return(Settings.GetTempDirectory(dir)); } }
/// <summary> /// Load a configuration from local file. /// </summary> /// <param name="configName">Configuration name</param> /// <param name="configFile">Configuration File Path</param> /// <param name="version">Configuration Version (expected)</param> /// <param name="settings">Configuration Settings</param> /// <param name="password">Password (if required)</param> /// <returns>Loaded Configruation</returns> public Configuration Load(string configName, string configFile, Version version, ConfigurationSettings settings, string password = null) { Preconditions.CheckArgument(configName); Preconditions.CheckArgument(configFile); Preconditions.CheckArgument(version); LogUtils.Info(String.Format("Loading Configuration. [name={0}][version={1}][file={2}]", configName, version.ToString(), configFile)); using (FileReader reader = new FileReader(configFile)) { AbstractConfigParser parser = ConfigProviderFactory.GetParser(configFile); Postconditions.CheckCondition(parser); parser.Parse(configName, reader, version, settings, password); return(parser.GetConfiguration()); } }