diff --git a/EcomAnalysis/Form1.cs b/EcomAnalysis/Form1.cs index 302a38a..192c408 100644 --- a/EcomAnalysis/Form1.cs +++ b/EcomAnalysis/Form1.cs @@ -17,10 +17,10 @@ public partial class Form1 : Form { const int BLOCKS = 4; - private string[] _HeaderItems = { + static private string[] _HeaderItems = { "time", "stimNo", "sceneNo", "stimTime", "target", "contact time", "Feedback", "RR", "gazeVx", "gazeVy", "pupilR", "pupilL" }; - private Dictionary _SceneNoAssign = new Dictionary(); + static private Dictionary _SceneNoAssign = new Dictionary(); private List _Data = new List(); private List _SceneTable = new List(); private SceneMean _ScMean = new SceneMean(); @@ -80,7 +80,7 @@ } // CSV読込 - ReadCSV(); + ReadCSV(_LogFileInfo, _Data); TxtLogFilename.Text = _LogFileInfo.Filepath; TxtDateTime.Text = _LogFileInfo.ExecDate.ToString("yyyy年MM月dd日 HH時mm分"); TxtSubject.Text = _LogFileInfo.Subject; @@ -119,14 +119,6 @@ const int RR_MIN = (int)RR2HB / HB_MAX; // RR間隔の変動範囲の最小値 const int RR_MAX = (int)RR2HB / HB_MIN; // RR間隔の変動範囲の最大値 - // FB回数 - var fbCounts = new int[5]; - var fbPts = new int[5]; - for (int i=0; i s.Feedback == i + 1).Count(); - fbPts[i] = fbCounts[i] * (i + 1); - } - // シーン別解析 _SceneTable.Clear(); listView1.Items.Clear(); @@ -332,9 +324,9 @@ /// /// CSVファイルの読み込み /// - private void ReadCSV() { + static private void ReadCSV(LogFileInfo lfi, List data) { - using (var sr = new StreamReader(_LogFileInfo.Filepath, + using (var sr = new StreamReader(lfi.Filepath, Encoding.GetEncoding("shift_jis"))) { // ヘッダー検証 @@ -350,7 +342,7 @@ } // 読み込み - _Data.Clear(); + data.Clear(); var sceneNoExist = headerCol["sceneNo"] >= 0; while (sr.Peek() > -1) { var line = sr.ReadLine().Split(','); @@ -368,7 +360,7 @@ ld.GazeV.y = float.Parse(line[headerCol["gazeVy"]]); ld.Pupil.R = float.Parse(line[headerCol["pupilR"]]); ld.Pupil.L = float.Parse(line[headerCol["pupilL"]]); - _Data.Add(ld); + data.Add(ld); } //Debug.WriteLine(_Data.Count); } @@ -442,16 +434,30 @@ /// /// private void BtnCompareLogs_Click(object sender, EventArgs e) { + + var preCursor = Cursor.Current; + Cursor.Current = Cursors.WaitCursor; + var dir = Path.GetDirectoryName(_LogFileInfo.Filepath); var files = Directory.GetFiles(dir, "*.csv"); - var LogFiles = new List(); + var LogFiles = new List() { _LogFileInfo}; + var FBs = new List() { _Feedback}; foreach (var f in files) { + if (f.Equals(_LogFileInfo.Filepath)) continue; var lfi = new LogFileInfo(); if (!lfi.Set(f)) continue; if (!lfi.Subject.Equals(_LogFileInfo.Subject)) continue; if (!File.Exists(f)) continue; + + var data = new List(); + ReadCSV(lfi, data); + var fb = new Feedback(); + fb.Calc(data); + LogFiles.Add(lfi); } + Cursor.Current = preCursor; + var form = new FormCompareLogs(); form.ShowDialog(); } diff --git a/EcomAnalysis/FormCompareLogs.cs b/EcomAnalysis/FormCompareLogs.cs index c15a3af..3d5c386 100644 --- a/EcomAnalysis/FormCompareLogs.cs +++ b/EcomAnalysis/FormCompareLogs.cs @@ -10,6 +10,10 @@ namespace EcomAnalysis { public partial class FormCompareLogs : Form { + + private List _LogFiles; + + public FormCompareLogs() { InitializeComponent(); }