From 22477f0eca904ec628ab59cd749f959af35c1439 Mon Sep 17 00:00:00 2001
From: Moli <linmolilin@gmail.com>
Date: 星期五, 15 四月 2022 10:15:52 +0800
Subject: [PATCH] 加入按配置使用的功能
---
Helpers/Tool.cs | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/Helpers/Tool.cs b/Helpers/Tool.cs
index 717af96..c42ffcc 100644
--- a/Helpers/Tool.cs
+++ b/Helpers/Tool.cs
@@ -677,11 +677,18 @@
/// <param name="ConfigFileName"></param>
/// <returns></returns>
public static SysConfig GetSystemConfig(string ConfigFileName= "appsettings.json") {
- string value = string.Empty;
- string Root = AppContext.BaseDirectory;
- string json = GetTxt(Root + "\\" + ConfigFileName);
- SysConfig config = json.ToModel<SysConfig>();
- return config;
+ try
+ {
+ string value = string.Empty;
+ string Root = AppContext.BaseDirectory;
+ string json = GetTxt(Root + "\\" + ConfigFileName);
+ SysConfig config = json.ToModel<SysConfig>();
+ return config;
+ }
+ catch
+ {
+ throw new Exception("閰嶇疆璇诲彇閿欒锛岃妫�娴嬮」鐩洰褰曚笅鐨刟ppsettings.json鏂囦欢");
+ }
}
/// <summary>
--
Gitblit v1.9.1