/// <summary> /// /// </summary> /// <param name="file"></param> /// <returns></returns> public static DataFileSeriserbase GetFileSeriser(this LogFileInfo file) { var re = DataFileSeriserManager.manager.GetDefaultFileSersie(); re.FileName = file.FileName; re.OpenForReadOnly(file.FileName); return(re); }
/// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <param name="id"></param> /// <param name="mLogTimes"></param> /// <param name="result"></param> private void ReadLogFile <T>(int id, List <DateTime> mLogTimes, QueryValueMatchType type, HisQueryResult <T> result) { if (mLogTimes.Count > 0) { List <DateTime> mtime = new List <DateTime>(); var lfiles = GetFileManager().GetLogDataFiles(mLogTimes); LogFileInfo mPlFile = null; foreach (var vv in lfiles) { if (vv.Value == null) { if (mPlFile != null) { mPlFile.Read <T>(id, mtime, type, result); mPlFile = null; mtime.Clear(); } result.Add(default(T), vv.Key, (byte)QualityConst.Null); } else if (vv.Value != mPlFile) { if (mPlFile != null) { mPlFile.Read <T>(id, mtime, type, result); } mPlFile = vv.Value; mtime.Clear(); mtime.Add(vv.Key); } else { mtime.Add(vv.Key); } } if (mPlFile != null) { mPlFile.Read <T>(id, mtime, type, result); } } }
/// <summary> /// /// </summary> /// <param name="file"></param> /// <param name="tid"></param> /// <param name="times"></param> /// <param name="type"></param> /// <param name="result"></param> public static void Read <T>(this LogFileInfo file, int tid, List <DateTime> times, QueryValueMatchType type, HisQueryResult <T> result) { file.GetFileSeriser().Read(tid, times, type, file.StartTime, result); }
/// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <param name="file"></param> /// <param name="tid"></param> /// <param name="startTime"></param> /// <param name="endTime"></param> /// <param name="result"></param> public static void ReadAllValue <T>(this LogFileInfo file, int tid, DateTime startTime, DateTime endTime, HisQueryResult <T> result) { file.GetFileSeriser().ReadAllValue(tid, startTime, endTime, file.StartTime, result); }