1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
-
- 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;
- namespace MBIRevitBase.Config
- {
- public class ApiConfig
- {
- public static string m_AlgorithmUrl;
- public static string AlgorithmUrl()
- {
- if (string.IsNullOrWhiteSpace(m_AlgorithmUrl))
- {
- string ip=GetAppSettingsConfig("IP");
- string port= GetAppSettingsConfig("Port");
-
-
- string path = ApiConfig.GetAppSettingsConfig("Path");
- m_AlgorithmUrl = $"{ip}:{port}{path}";
- }
- return m_AlgorithmUrl;
- }
-
-
-
-
-
- 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;
- }
- }
- }
|