private void SaveBoxDbConfig(DbConfigEntity dbconfig, string conbox) { //string boxConn = $"Data Source={ip};port=10080;User ID=test;Password=123456;Initial Catalog=smartbox;"; string[] strsplit = conbox.Split(new char[2] { '=', ';' }); //以‘=’开始‘;’结束截取组装数组 if (dbconfig.BoxDbConnStrs == null) { dbconfig.BoxDbConnStrs = new List <DbConnEntity>(); } DbConnEntity boxcon = new DbConnEntity(); boxcon.Ip = strsplit[1]; boxcon.Port = Convert.ToInt32(strsplit[3]); boxcon.UserName = strsplit[5]; boxcon.Password = strsplit[7]; boxcon.DbName = strsplit[9]; dbconfig.BoxDbConnStrs.Add(boxcon); }
private void SaveBoxDbConfigFile(DbConfigEntity dbconfig) { System.IO.File.WriteAllText("DbBoxConfig.ini", Newtonsoft.Json.JsonConvert.SerializeObject(dbconfig.BoxDbConnStrs), Encoding.UTF8); }