From 1491846b4736bc2e79604086acfd8544aa3ba384 Mon Sep 17 00:00:00 2001 From: wells.liu <wells.liu@broconcentric.com> Date: 星期一, 07 九月 2020 12:09:46 +0800 Subject: [PATCH] Merge branch 'master' of http://gitblit.broconcentric.com:8088/r/M071 --- src/Bro.Process/ProcessControl.cs | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Bro.Process/ProcessControl.cs b/src/Bro.Process/ProcessControl.cs index ca587d2..8a4c27f 100644 --- a/src/Bro.Process/ProcessControl.cs +++ b/src/Bro.Process/ProcessControl.cs @@ -348,10 +348,16 @@ { if (config == null) throw new ProcessException("淇濆瓨鐨勯厤缃俊鎭笉鑳戒负绌�"); - ProductionCode = newProductionCode; + + string newConfigPath = Path.Combine(Path.GetDirectoryName(_configPath), $"Config_{newProductionCode}.json"); + if (File.Exists(newConfigPath)) + { + throw new ProcessException($"{newProductionCode}閰嶇疆鏂囦欢宸茬粡瀛樺湪"); + } + //鐢熸垚config.json string newConfig = JsonConvert.SerializeObject(config, new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.All }); - using (StreamWriter writer = new StreamWriter(_configPath, false, System.Text.Encoding.UTF8)) + using (StreamWriter writer = new StreamWriter(newConfigPath, false, System.Text.Encoding.UTF8)) { writer.Write(newConfig); writer.Flush(); @@ -359,7 +365,7 @@ } //娣诲姞鍒癝etting.json - SettingHelper.AddNewProductionCode(ProductionCode); + SettingHelper.AddNewProductionCode(newProductionCode); } catch (Exception ex) { -- Gitblit v1.8.0