//public DateTime[] GetTimeFromRawData(ObservableCollection<string> fileList) //{ // DateTime[] output = new DateTime[2]; // List<DateTime> StartTimes = new List<DateTime>(); // List<DateTime> EndTimes = new List<DateTime>(); // foreach (var fn in fileList) // { // DateTime[] timepair = GetTimesFromFile(fn); // StartTimes.Add(timepair[0]); // EndTimes.Add(timepair[1]); // } // output[0] = GetEarliest(StartTimes); // output[1] = GetLatest(EndTimes); // return output; //} //private DateTime[] GetTimesFromFile(string fn) //{ // DateTime[] output = new DateTime[2]; // FileStream fs = new FileStream(fn, FileMode.Open); // StreamReader sw = new StreamReader(fs); // sw.ReadLine(); // sw.ReadLine(); // string startTimeLine = sw.ReadLine(); // string startTimeStr = startTimeLine.Substring(17, 19); // output[0] = DateTime.Parse(startTimeStr); // string endTimeLine = sw.ReadLine(); // string endTimeStr = endTimeLine.Substring(15, 19); // output[1] = DateTime.Parse(endTimeStr); // sw.Close(); // fs.Close(); // return output; //} //private DateTime GetEarliest(List<DateTime> startTimes) //{ // return startTimes.Min(); //} //private DateTime GetLatest(List<DateTime> endTimes) //{ // return endTimes.Max(); //} internal void BuildProcesser() //根据 Manufacturer 和 Name,来创建TestProcesser { switch (Manufacturer + Name) { case "Chroma17200": ITesterProcesser = new Chroma17200Processer(); break; case "ZKEEBC-X": ITesterProcesser = new ZKEEBC_X_Processer(); break; } }
internal string DataPreProcess(TestRecord record, List <string> rawDataList, bool isRename, string newName, int startIndex, DateTime st, DateTime et, string batteryType, string projectName, Program program, Recipe recipe, ITesterProcesser processer, bool isSkipDP) { string root = $@"{GlobalSettings.RootPath}{batteryType}\{projectName}"; string temproot = $@"{GlobalSettings.LocalFolder}{batteryType}\{projectName}"; string temptestfilepath = string.Empty; if (rawDataList.Count > 1) { temptestfilepath = CreateTestFile(rawDataList, temproot, newName); } else { if (isRename) { temptestfilepath = RenameRawDataAndCopyToFolder(rawDataList[0], $@"{temproot}\{GlobalSettings.TestDataFolderName}", newName); } else { temptestfilepath = CopyToFolder(rawDataList[0], temproot); } } TesterServiceClass ts = new TesterServiceClass(); //#if !Test if (!isSkipDP) { if (!ts.DataPreprocessing(processer, temptestfilepath, program, recipe, record, startIndex)) { File.Delete(temptestfilepath); return(string.Empty); } } //#endif var TestFilePath = $@"{root}\{GlobalSettings.TestDataFolderName}\{Path.GetFileName(temptestfilepath)}"; CopyToServerWithRetry(temptestfilepath, TestFilePath); if (TestFilePath == "") { MessageBox.Show("Test File Path Empty!"); return(string.Empty); } return(TestFilePath); }
internal bool DataPreprocessing(ITesterProcesser tester, string filepath, Program program, Recipe recipe, TestRecord record, int startIndex) { return(tester.DataPreprocessing(filepath, program, recipe, record, startIndex)); }
internal bool CheckFileFormat(ITesterProcesser tester, string filepath) { return(tester.CheckFileFormat(filepath)); }
internal bool CheckChannelNumber(ITesterProcesser tester, string filepath, string channelnumber) { return(tester.CheckChannelNumber(filepath, channelnumber)); }
internal DateTime[] GetTimeFromRawData(ITesterProcesser tester, ObservableCollection <string> fileList) { return(tester.GetTimeFromRawData(fileList)); }