|
@@ -18,10 +18,15 @@ namespace SAGA.DotNetUtils.Extend
|
|
{
|
|
{
|
|
public static class ConfigurationUtil
|
|
public static class ConfigurationUtil
|
|
{
|
|
{
|
|
|
|
+ private static string m_DefaultPath;
|
|
private static string GetDefaultPath()
|
|
private static string GetDefaultPath()
|
|
{
|
|
{
|
|
- string defaultPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "BaseSettings.config");
|
|
|
|
- return defaultPath;
|
|
|
|
|
|
+ var defualtPath = m_DefaultPath;
|
|
|
|
+ if (string.IsNullOrWhiteSpace(defualtPath) || !File.Exists(defualtPath))
|
|
|
|
+ {
|
|
|
|
+ defualtPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "BaseSettings.config");
|
|
|
|
+ }
|
|
|
|
+ return defualtPath;
|
|
}
|
|
}
|
|
private static Configuration m_Default;
|
|
private static Configuration m_Default;
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -71,6 +76,15 @@ namespace SAGA.DotNetUtils.Extend
|
|
File.Copy(path, GetDefaultPath(),true);
|
|
File.Copy(path, GetDefaultPath(),true);
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
+ public static bool SetDefaultPath(string path)
|
|
|
|
+ {
|
|
|
|
+ if (!File.Exists(path))
|
|
|
|
+ {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ m_DefaultPath = path;
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
public static string GetSettingValue(this Configuration config,string appsettingKey)
|
|
public static string GetSettingValue(this Configuration config,string appsettingKey)
|
|
{
|
|
{
|
|
try
|
|
try
|