-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSession.cs
75 lines (64 loc) · 1.88 KB
/
Session.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.IO;
namespace TheraWii
{
public class Session
{
public string dataFile, profile, therapy;
public DateTime createDate;
public List<TaskData> TaskDatas;
private DScsv csvOut;
public Session()
{
TaskDatas = new List<TaskData>();
}
public void Initialize(Profile p, Therapy t)
{
therapy = t.ToString();
profile = p.Name;
createDate = System.DateTime.Now;
string date = createDate.Year + "-"
+ createDate.Month + "-"
+ createDate.Day + " "
+ createDate.Hour + "-"
+ createDate.Minute +
+ createDate.Second;
dataFile = profile + "_" + therapy + "_" + date + ".csv";
csvOut = new DScsv();
createFile();
}
public void Finish()
{
// finish writing
csvOut.closeFile();
}
public DScsv GetCSV()
{
return csvOut;
}
public void createFile()
{
csvOut.Initialize((Session)this);
//csvOut.closeFile();
}
public String[] getSubItems()
{
String[] subItems = new String[] {createDate.ToString(), therapy.ToString()};
return subItems;
}
public void delete()
{
string fullPath = GetDataFilePath();
if (System.IO.File.Exists(fullPath))
System.IO.File.Delete(fullPath);
}
public string GetDataFilePath()
{
return Path.Combine(
Path.Combine(DataStorage.DATA_STORE_FOLDER, profile),
dataFile);
}
}
}