From a332decd68d6d8bb5678d8ec95e6c65e0ccf9f33 Mon Sep 17 00:00:00 2001 From: xcd <834800634@qq.com> Date: 星期四, 02 七月 2020 17:14:45 +0800 Subject: [PATCH] Merge branch 'master' of http://gitblit.broconcentric.com:8088/r/M071 --- src/Bro.Process/ProcessControl.cs | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/src/Bro.Process/ProcessControl.cs b/src/Bro.Process/ProcessControl.cs index 35c3af7..ece460d 100644 --- a/src/Bro.Process/ProcessControl.cs +++ b/src/Bro.Process/ProcessControl.cs @@ -342,6 +342,31 @@ } } + public void CreateNewConfig(IProcessConfig config, string newProductionCode) + { + try + { + if (config == null) + throw new ProcessException("淇濆瓨鐨勯厤缃俊鎭笉鑳戒负绌�"); + ProductionCode = newProductionCode; + //鐢熸垚config.json + string newConfig = JsonConvert.SerializeObject(config, new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.All }); + using (StreamWriter writer = new StreamWriter(_configPath, false, System.Text.Encoding.UTF8)) + { + writer.Write(newConfig); + writer.Flush(); + writer.Close(); + } + + //娣诲姞鍒癝etting.json + SettingHelper.AddNewProductionCode(ProductionCode); + } + catch (Exception ex) + { + throw new ProcessException(ex.Message, null); + } + } + private void SaveBackupConfig() { string backPath = Path.GetDirectoryName(_configPath); -- Gitblit v1.8.0