|
@@ -7,7 +7,10 @@
|
|
|
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
+using System.Configuration;
|
|
|
+using System.IO;
|
|
|
using System.Linq;
|
|
|
+using System.Reflection;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
@@ -21,10 +24,30 @@ namespace MBIRevitBase.Config
|
|
|
{
|
|
|
if (string.IsNullOrWhiteSpace(m_AlgorithmUrl))
|
|
|
{
|
|
|
- m_AlgorithmUrl = "http://192.168.20.225:8082";
|
|
|
+ string ip=GetAppSettingsConfig("IP");
|
|
|
+ string port= GetAppSettingsConfig("Port");
|
|
|
+ //string ip = "http://192.168.20.225";
|
|
|
+ //string port = "8082";
|
|
|
+ m_AlgorithmUrl = $"{ip}:{port}";
|
|
|
+ File.AppendAllText("D:\\log.txt",m_AlgorithmUrl);
|
|
|
}
|
|
|
|
|
|
return m_AlgorithmUrl;
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取配置文件
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="key"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public static string GetAppSettingsConfig(string key)
|
|
|
+ {
|
|
|
+ string codeBase = Assembly.GetExecutingAssembly().CodeBase;
|
|
|
+ UriBuilder uri = new UriBuilder(codeBase);
|
|
|
+ string path = Uri.UnescapeDataString(uri.Path);
|
|
|
+ string addString = ConfigurationManager.OpenExeConfiguration(path).AppSettings.Settings[key].Value.ToString();
|
|
|
+
|
|
|
+ return addString;
|
|
|
+ }
|
|
|
}
|
|
|
}
|