| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Text;
- namespace Ips.Library.Entity
- {
- public class RefResult
- {
- public RefResult() { }
- public RefResult(DateTime outtime, double dto, double dfo)
- {
- OutTime = outtime;
- Dto = dto;
- Dfo = dfo;
- }
- public DateTime OutTime { get; set; }
- public double Dto { get; set; }
- public double Dfo { get; set; }
- public static RefResult FromString(string line)
- {
- var arr = line.Split(',');
- if (arr.Length != 3) return null;
- var time = DateTime.Parse(arr[0]);
- var dt = double.Parse(arr[1]);
- var df = double.Parse(arr[2]);
- return new RefResult(time, dt, df);
- }
- public static List<RefResult> FromStrings(string lines)
- {
- List<RefResult> results = new List<RefResult>();
- using (var sr = new StringReader(lines))
- {
- string line;
- while (true)
- {
- line = sr.ReadLine();
- if (!string.IsNullOrWhiteSpace(line)) break;
- var result = FromString(line);
- if (result != null)
- results.Add(result);
- }
- }
- return results;
- }
- }
- }
|