using System; using System.Collections.Generic; using System.Collections; using System.Globalization; using System.IO; using System.Net.Http; using System.Text; using System.Threading.Tasks; using System.Web; using Newtonsoft.Json; using CsvHelper; using System.Data.Common; namespace SqlSugar { internal class QuestDbRestAPHelper { /// /// 绑定RestAPI需要的信息 /// /// /// /// /// public static void SetRestApiInfo(DbConnectionStringBuilder builder, ref string host, ref string username, ref string password) { if (builder.TryGetValue("Host", out object hostValue)) { host = Convert.ToString(hostValue); } if (builder.TryGetValue("Username", out object usernameValue)) { username = Convert.ToString(usernameValue); } if (builder.TryGetValue("Password", out object passwordValue)) { password = Convert.ToString(passwordValue); } } /// /// 逐行读取,包含空行 /// /// /// public static List SplitByLine(string text) { List lines = new List(); byte[] array = Encoding.UTF8.GetBytes(text); using (MemoryStream stream = new MemoryStream(array)) { using (var sr = new StreamReader(stream)) { string line = sr.ReadLine(); while (line != null) { lines.Add(line); line = sr.ReadLine(); } } } return lines; } } }