private void btRepair_Click(object sender, EventArgs e) { foreach (var line in RawFiles) { int samplesPerMin; Int32.TryParse(SamplesPerMinuteInput.Text, out samplesPerMin); var lr = new LocoReader(line.Value, BinMinutes, SamplesPerMinute); lr.GenerateFixedFile(FileProcessor.SelectedIndex, samplesPerMin); } AddText("All files have been repaired."); }
private void GenerateMetrics() { foreach (var rawFile in RawFiles) { var drugName = GetParentFolder(rawFile.Value); var ratId = GetRatId(rawFile.Key); var sessionNumber = GetSessionNumber(rawFile.Key); if (String.IsNullOrEmpty(ratId) || String.IsNullOrEmpty(sessionNumber)) { AddText("Could not generate metrics for: " + rawFile.Key + ": Filename does not meet criteria: [RatID]-[SessionNumber].txt"); AddText("File location: " + rawFile.Value); AddText(""); } var lr = new LocoReader(rawFile.Value, BinMinutes, SamplesPerMinute); AddText(String.Format("File: {0} Drug: {1} Rat: {2} Session: {3}" , rawFile.Key, drugName, ratId, sessionNumber)); lr.GenerateMetrics(); lr.GenRData(ratId, sessionNumber, drugName); } }