namespace IStation.Hydraulic
|
{
|
public class DayValueHelper
|
{
|
|
public static List<DayValue> GetDayValues(int station)
|
{
|
string folderPath;
|
if (station==1)
|
{
|
folderPath = $"{AppDomain.CurrentDomain.BaseDirectory}Eapnet验证数据\\陈行一输";
|
}
|
else
|
{
|
folderPath = $"{AppDomain.CurrentDomain.BaseDirectory}Eapnet验证数据\\陈行二输";
|
}
|
|
if (!Directory.Exists(folderPath))
|
return default;
|
var fileList=Directory.GetFiles(folderPath);
|
if (fileList == null || !fileList.Any())
|
return default;
|
|
var list = new List<DayValue>();
|
foreach (var file in fileList)
|
{
|
var fileName = Path.GetFileNameWithoutExtension(file);
|
if (!DateTime.TryParse(fileName, out DateTime day))
|
continue;
|
var json=File.ReadAllText(file);
|
var timeValues = JsonHelper.Json2Object<List<TimeValue>>(json);
|
if (timeValues == null || !timeValues.Any())
|
continue;
|
var dayValue = new DayValue();
|
dayValue.Year = day.Year;
|
dayValue.Month = day.Month;
|
dayValue.Day = day.Day;
|
dayValue.TimeValueList = timeValues;
|
list.Add(dayValue);
|
}
|
|
return list;
|
}
|
}
|
}
|