TempLog.cs
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TSA_V.Common
{
public class TempLog
{
/// <summary>
/// 日志记录时间
/// </summary>
public DateTime LogTime { get; set; }
/// <summary>
/// 温度
/// </summary>
public string Temp { get; set; }
public double TempValue { get; set; }
public static TempLog GetLog(string s)
{
string[] fields = s.Split(',');
if (fields.Length == 2)
{
try
{
TempLog log = new TempLog();
log.LogTime = Convert.ToDateTime(fields[0]);
log.Temp = fields[1];
log.TempValue = Convert.ToDouble(log.Temp);
return log;
}
catch (Exception ex)
{
LogUtil.error("解析日志文件出错:【" + s + "】" + ex.ToString());
}
}
return null;
}
}
}