private void SaveLog(string path, string filename)
{
try
{
string line = "";
if (!System.IO.Directory.Exists(path))
{
System.IO.Directory.CreateDirectory(path);
}
if (!System.IO.File.Exists(path + filename))
{
for (int i = 0; i < m_tables.Count; i++)
{
List<string> headerList = GetColumnValues<string>(m_tables[i], "参数名称");
line = line + string.Join(",", headerList) + ",";
}
using (System.IO.StreamWriter file = new System.IO.StreamWriter(path + filename, true))
{
if (line.Length > 0)
{
file.WriteLine(line);// 直接追加文件末尾,换行
}
}
}
line = "";
for (int i = 0; i < m_tables.Count; i++)
{
List<string> headerList = GetColumnValues<string>(m_tables[i], "值");
line = line + string.Join(",", headerList) + ",";
}
using (System.IO.StreamWriter file = new System.IO.StreamWriter(path + filename, true))
{
if (line.Length > 0)
{
file.WriteLine(line);// 直接追加文件末尾,换行
}
}
}
catch (Exception)
{
throw;
}
}