diff --git a/EcomAnalysis/EcomAnalysis.csproj b/EcomAnalysis/EcomAnalysis.csproj
index 8506baa..31aeaf2 100644
--- a/EcomAnalysis/EcomAnalysis.csproj
+++ b/EcomAnalysis/EcomAnalysis.csproj
@@ -40,6 +40,7 @@
+
@@ -51,12 +52,19 @@
+
Form
Form1.cs
+
+ Form
+
+
+ FormCompareLogs.cs
+
@@ -64,6 +72,9 @@
Form1.cs
+
+ FormCompareLogs.cs
+
ResXFileCodeGenerator
Resources.Designer.cs
diff --git a/EcomAnalysis/Feedback.cs b/EcomAnalysis/Feedback.cs
new file mode 100644
index 0000000..bcf9ff9
--- /dev/null
+++ b/EcomAnalysis/Feedback.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EcomAnalysis {
+ class Feedback {
+ public enum FBITEM { OK, GOOD, NICE, GREAT, EXCELLENT, TOTAL }
+ private const int NUM_ITEMS = 5;
+ private int[] _Counts = new int[NUM_ITEMS];
+ private int[] _Points = new int[NUM_ITEMS];
+
+ ///
+ /// ログからFB回数とポイントを計算
+ ///
+ ///
+ public void Calc(List data) {
+ for (int i = 0; i < NUM_ITEMS; i++) {
+ _Counts[i] = data.Where(s => s.Feedback == i + 1).Count();
+ _Points[i] = _Counts[i] * (i + 1);
+ }
+
+ }
+
+ ///
+ /// FB回数を返す
+ ///
+ ///
+ ///
+ public int Count(FBITEM item) {
+ if (item == FBITEM.TOTAL) {
+ return _Counts.Sum();
+ }
+ return _Counts[(int)item];
+ }
+
+ ///
+ /// ポイントを返す
+ ///
+ ///
+ ///
+ public int Point(FBITEM item) {
+ if (item == FBITEM.TOTAL) {
+ return _Points.Sum();
+ }
+ return _Points[(int)item];
+ }
+ }
+}
diff --git a/EcomAnalysis/Form1.cs b/EcomAnalysis/Form1.cs
index 55edb7a..302a38a 100644
--- a/EcomAnalysis/Form1.cs
+++ b/EcomAnalysis/Form1.cs
@@ -27,6 +27,7 @@
private double[] LF = new double[BLOCKS];
private double[] HF = new double[BLOCKS];
private LogFileInfo _LogFileInfo = new LogFileInfo();
+ private Feedback _Feedback = new Feedback();
///
/// コンストラクタ
@@ -54,7 +55,6 @@
///
///
private void Form1_Load(object sender, EventArgs e) {
- ClearData();
var args = Environment.GetCommandLineArgs();
if (args.Length > 1) OpenLog(args[1]);
}
@@ -65,48 +65,50 @@
///
///
private bool OpenLog(string filename) {
- if (!_LogFileInfo.Set(filename)) {
- MessageBox.Show("Logファイル名が正しくありません", "Error",
- MessageBoxButtons.OK, MessageBoxIcon.Error);
- return false;
- }
- if (!File.Exists(_LogFileInfo.Filepath)) {
+ // ファイルの存在確認
+ if (!File.Exists(filename)) {
MessageBox.Show("ファイルがありません", "Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
- ClearData();
- ReadCSV();
- Analyze();
+ // ログファイル情報の処理
+ if (!_LogFileInfo.Set(filename)) {
+ MessageBox.Show("Logファイル名が正しくありません", "Error",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return false;
+ }
- // 表示
+ // CSV読込
+ ReadCSV();
TxtLogFilename.Text = _LogFileInfo.Filepath;
TxtDateTime.Text = _LogFileInfo.ExecDate.ToString("yyyy年MM月dd日 HH時mm分");
TxtSubject.Text = _LogFileInfo.Subject;
TxtVisit.Text = _LogFileInfo.Visit.ToString();
+ // フィードバック処理
+ _Feedback.Calc(_Data);
+ // 表示
+ TxtFB1.Text = $"{_Feedback.Count(Feedback.FBITEM.OK),2}回 " +
+ $"{_Feedback.Point(Feedback.FBITEM.OK),4}ポイント";
+ TxtFB2.Text = $"{_Feedback.Count(Feedback.FBITEM.GOOD),2}回 " +
+ $"{_Feedback.Point(Feedback.FBITEM.GOOD),4}ポイント";
+ TxtFB3.Text = $"{_Feedback.Count(Feedback.FBITEM.NICE),2}回 " +
+ $"{_Feedback.Point(Feedback.FBITEM.NICE),4}ポイント";
+ TxtFB4.Text = $"{_Feedback.Count(Feedback.FBITEM.GREAT),2}回 " +
+ $"{_Feedback.Point(Feedback.FBITEM.GREAT),4}ポイント";
+ TxtFB5.Text = $"{_Feedback.Count(Feedback.FBITEM.EXCELLENT),2}回 " +
+ $"{_Feedback.Point(Feedback.FBITEM.EXCELLENT),4}ポイント";
+ TxtFBTotal.Text = $"{_Feedback.Count(Feedback.FBITEM.TOTAL),2}回 " +
+ $"{_Feedback.Point(Feedback.FBITEM.TOTAL),4}ポイント";
+
+ Analyze();
+
+
return true;
}
///
- /// データ初期化
- ///
- private void ClearData() {
- _Data.Clear();
- _SceneTable.Clear();
-
- listView1.Items.Clear();
- listView2.Items.Clear();
- foreach (var ctl in this.Controls) {
- if (((Control)ctl).GetType().Equals(typeof(TextBox))){
- ((Control)ctl).Text = "";
- }
- }
- TxtLogFilename.Text = "not opened";
- }
-
- ///
/// 解析
///
private void Analyze() {
@@ -126,6 +128,7 @@
}
// シーン別解析
+ _SceneTable.Clear();
listView1.Items.Clear();
if (_Data.Where(s => s.SceneNo > 0).Count() > 0) {
var sceneBegin = _Data.Where(s => s.SceneNo > 0).Min(s => s.SceneNo);
@@ -302,14 +305,6 @@
listView2.Items.Add(new ListViewItem(new string[] {
$"{block*10+1}-{block*10+10}", $"{LF[block]:0.0}", $"{HF[block]:0.0}", $"{LF[block]/HF[block]:0.00}" }));
}
-
- // 表示
- TxtFB1.Text = $"{fbCounts[0],2}回 {fbPts[0],4}ポイント";
- TxtFB2.Text = $"{fbCounts[1],2}回 {fbPts[1],4}ポイント";
- TxtFB3.Text = $"{fbCounts[2],2}回 {fbPts[2],4}ポイント";
- TxtFB4.Text = $"{fbCounts[3],2}回 {fbPts[3],4}ポイント";
- TxtFB5.Text = $"{fbCounts[4],2}回 {fbPts[4],4}ポイント";
- TxtFBTotal.Text = $"{fbCounts.Sum(),2}回 {fbPts.Sum(),4}ポイント";
}
///
@@ -376,7 +371,6 @@
_Data.Add(ld);
}
//Debug.WriteLine(_Data.Count);
-
}
}
@@ -448,7 +442,18 @@
///
///
private void BtnCompareLogs_Click(object sender, EventArgs e) {
-// var dir = Path.GetDirectoryName();
+ var dir = Path.GetDirectoryName(_LogFileInfo.Filepath);
+ var files = Directory.GetFiles(dir, "*.csv");
+ var LogFiles = new List();
+ foreach (var f in files) {
+ var lfi = new LogFileInfo();
+ if (!lfi.Set(f)) continue;
+ if (!lfi.Subject.Equals(_LogFileInfo.Subject)) continue;
+ if (!File.Exists(f)) continue;
+ LogFiles.Add(lfi);
+ }
+ var form = new FormCompareLogs();
+ form.ShowDialog();
}
}
}
diff --git a/EcomAnalysis/FormCompareLogs.Designer.cs b/EcomAnalysis/FormCompareLogs.Designer.cs
new file mode 100644
index 0000000..a24c25b
--- /dev/null
+++ b/EcomAnalysis/FormCompareLogs.Designer.cs
@@ -0,0 +1,89 @@
+
+namespace EcomAnalysis {
+ partial class FormCompareLogs {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
+ System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
+ System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
+ this.listView1 = new System.Windows.Forms.ListView();
+ this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
+ ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit();
+ this.SuspendLayout();
+ //
+ // listView1
+ //
+ this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.listView1.GridLines = true;
+ this.listView1.HideSelection = false;
+ this.listView1.Location = new System.Drawing.Point(12, 12);
+ this.listView1.Name = "listView1";
+ this.listView1.Size = new System.Drawing.Size(561, 212);
+ this.listView1.TabIndex = 0;
+ this.listView1.UseCompatibleStateImageBehavior = false;
+ this.listView1.View = System.Windows.Forms.View.Details;
+ //
+ // chart1
+ //
+ this.chart1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ chartArea1.Name = "ChartArea1";
+ this.chart1.ChartAreas.Add(chartArea1);
+ legend1.Name = "Legend1";
+ this.chart1.Legends.Add(legend1);
+ this.chart1.Location = new System.Drawing.Point(12, 230);
+ this.chart1.Name = "chart1";
+ series1.ChartArea = "ChartArea1";
+ series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
+ series1.Legend = "Legend1";
+ series1.MarkerColor = System.Drawing.Color.Blue;
+ series1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Square;
+ series1.Name = "Series1";
+ this.chart1.Series.Add(series1);
+ this.chart1.Size = new System.Drawing.Size(561, 406);
+ this.chart1.TabIndex = 1;
+ this.chart1.Text = "chart1";
+ //
+ // FormCompareLogs
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(585, 648);
+ this.Controls.Add(this.chart1);
+ this.Controls.Add(this.listView1);
+ this.Name = "FormCompareLogs";
+ this.Text = "他の実施結果の比較";
+ ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.ListView listView1;
+ private System.Windows.Forms.DataVisualization.Charting.Chart chart1;
+ }
+}
\ No newline at end of file
diff --git a/EcomAnalysis/FormCompareLogs.cs b/EcomAnalysis/FormCompareLogs.cs
new file mode 100644
index 0000000..c15a3af
--- /dev/null
+++ b/EcomAnalysis/FormCompareLogs.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace EcomAnalysis {
+ public partial class FormCompareLogs : Form {
+ public FormCompareLogs() {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/EcomAnalysis/FormCompareLogs.resx b/EcomAnalysis/FormCompareLogs.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/EcomAnalysis/FormCompareLogs.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file