-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
304 lines (266 loc) · 11.7 KB
/
Program.cs
File metadata and controls
304 lines (266 loc) · 11.7 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
using System;
class Program
{
static async Task Main(string[] args)
{
Console.Clear();
User user = new User();
Console.WriteLine("1. Create user");
Console.WriteLine("2. Login");
Console.Write("\nOption: ");
string userAction = Console.ReadLine();
if (userAction == "1")
{
await user.CreateUser();
}
else if (userAction == "2")
{
await user.Login();
}
else {
return;
}
Folder activeDirectory = await user.GetRoot();
StudySet activeSet = null;
bool isStudyingSet = false;
bool isLearning = true;
do
{
Console.Clear();
// PWD(activeDirectory, activeSet);
activeDirectory.DisplayName();
if (activeSet == null)
{
Console.WriteLine("\nSelect an option:");
Console.WriteLine("1. Create folder");
Console.WriteLine("2. Create study set");
Console.WriteLine("3. Delete folder");
Console.WriteLine("4. Delete study set");
Console.WriteLine("5. Exit");
List<Dictionary<string, string>> children = await user.GetDirectoryContents(activeDirectory.GetFolderId());
DisplayChildren(children, 6);
Console.Write("\nOption: ");
int response = int.Parse(Console.ReadLine()!);
if (response == 1)
{
activeDirectory = await user.CreateFolder(activeDirectory.GetFolderId());
// Console.Write("Folder name: ");
// string folderName = Console.ReadLine()!;
// if (!string.IsNullOrEmpty(folderName))
// {
// Folder newFolder = new Folder(folderName, activeDirectory);
// activeDirectory.AddFolder(newFolder);
// activeDirectory = newFolder;
// }
}
else if (response == 2)
{
// Console.Write("Set name: ");
// string setName = Console.ReadLine()!;
// if (!string.IsNullOrEmpty(setName))
// {
// StudySet newSet = new StudySet(setName, activeDirectory);
// activeDirectory.AddSet(newSet);
// activeSet = newSet;
// }
}
// else if (response == 3)
// {
// activeDirectory.DisplayDirectories();
// Console.Write("\nFolder to delete: ");
// int index = int.Parse(Console.ReadLine()!) - 1;
// activeDirectory.RemoveFolder(index);
// }
// else if (response == 4)
// {
// activeDirectory.DisplayStudySets();
// Console.Write("\nSet to delete: ");
// int index = int.Parse(Console.ReadLine()!) - 1;
// activeDirectory.RemoveSet(index);
// }
else if (response == 5)
{
if (activeDirectory.GetParentId() != null)
{
activeDirectory = await user.MoveDirectory(activeDirectory.GetParentId()!);
}
else
{
isLearning = false;
}
}
// else if (response > 5)
// {
// // Change directories
// int index = response - 5;
// if (index > activeDirectory.GetDirectoryCount())
// {
// // Study Set
// index -= activeDirectory.GetDirectoryCount();
// activeSet = activeDirectory.GetStudySet(index - 1);
// }
// else if (index <= activeDirectory.GetDirectoryCount())
// {
// // Folder
// activeDirectory = activeDirectory.GetDirectory(index - 1);
// }
// }
}
// else
// {
// if (isStudyingSet)
// {
// if (activeSet.GetTermCount() < 1)
// {
// Console.WriteLine("No items to study in this set yet.");
// Console.WriteLine("Add study items to study");
// Console.ReadLine();
// isStudyingSet = false;
// }
// else
// {
// Console.WriteLine("\nSelect a study activity:");
// Console.WriteLine("1. Flashcards");
// Console.WriteLine("2. Write");
// Console.WriteLine("3. Multiple Choice");
// Console.WriteLine("4. Test");
// Console.WriteLine("5. View progress");
// Console.WriteLine("6. Exit");
// // settings
// bool studySetting = activeSet.GetStudySetting();
// string setting = "";
// if (studySetting)
// {
// setting = "TERM";
// }
// else
// {
// setting = "DEFINITION";
// }
// Console.WriteLine("\nSETTINGS:");
// Console.WriteLine($"7. Answer with: {setting}");
// Console.Write("\nSelect an option: ");
// string studyOption = Console.ReadLine()!;
// if (studyOption == "1")
// {
// Flashcard flashcard = new Flashcard(activeSet);
// Dictionary<string, bool> results = flashcard.PlaySession();
// activeSet.UpdateTermClassifactions(results);
// }
// else if (studyOption == "2")
// {
// Write write = new Write(activeSet);
// Dictionary<string, bool> results = write.PlaySession();
// activeSet.UpdateTermClassifactions(results);
// }
// else if (studyOption == "3")
// {
// MultipleChoice multipleChoice = new MultipleChoice(activeSet);
// Dictionary<string, bool> results = multipleChoice.PlaySession();
// activeSet.UpdateTermClassifactions(results);
// }
// else if (studyOption == "4")
// {
// Console.WriteLine("NOTE: the results of this test will not effect mastery of terms.");
// Console.Write("Press 'Enter' to begin...");
// Console.ReadLine();
// Test test = new Test(activeSet);
// test.PlaySession();
// }
// else if (studyOption == "5")
// {
// activeSet.DisplayClassification();
// Console.ReadLine();
// }
// else if (studyOption == "7")
// {
// if (studySetting)
// {
// activeSet.UpdateStudySetting(false);
// }
// else
// {
// activeSet.UpdateStudySetting(true);
// }
// }
// else
// {
// isStudyingSet = false;
// }
// }
// }
// else
// {
// Console.WriteLine("\nSelect an option:");
// Console.WriteLine("1. Study");
// Console.WriteLine("2. Upload from notes");
// Console.WriteLine("3. Add term");
// Console.WriteLine("4. Delete term");
// Console.WriteLine("5. Display terms");
// Console.WriteLine("6. Exit");
// Console.Write("\nOption: ");
// int response = int.Parse(Console.ReadLine()!);
// if (response == 1)
// {
// isStudyingSet = true;
// }
// else if (response == 2)
// {
// activeSet.UploadNotes();
// }
// else if (response == 3)
// {
// Console.Write("\nTerm: ");
// string term = Console.ReadLine()!;
// Console.Write("\nDefinition: ");
// string definition = Console.ReadLine()!;
// activeSet.AddTerm(term, definition);
// }
// else if (response == 4)
// {
// activeSet.DisplayTerms(1);
// Console.Write("Term to delete [e.g. 4]: ");
// int removeIndex = int.Parse(Console.ReadLine()!);
// activeSet.RemoveTerm(removeIndex - 1);
// }
// else if (response == 5)
// {
// activeSet.DisplayTerms(1);
// string wait = Console.ReadLine()!;
// }
// else if (response == 6)
// {
// activeSet = null;
// }
// }
// }
} while (isLearning);
}
static void DisplayChildren(List<Dictionary<string, string>> children, int startingIndex)
{
int index = startingIndex;
foreach (Dictionary<string, string> child in children)
{
Console.WriteLine($"{index}. {child["name"]}");
index++;
}
}
// static void PWD(Folder activeDirectory, StudySet activeSet)
// {
// List<string> path = new List<string>();
// Console.WriteLine("Current Location:");
// // Get the study set name if one is active
// if (activeSet != null)
// {
// path.Add(activeSet.GetName());
// }
// // Gets the Folder location
// do
// {
// path.Add(activeDirectory.GetName());
// activeDirectory = activeDirectory.GetParent();
// } while (activeDirectory != null);
// string fullPath = string.Join("/", path.ToArray().Reverse());
// Console.WriteLine(fullPath);
// }
}