-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStoredDataHandler.cs
More file actions
28 lines (24 loc) · 959 Bytes
/
StoredDataHandler.cs
File metadata and controls
28 lines (24 loc) · 959 Bytes
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
using System;
using System.Threading.Tasks;
using Windows.Storage;
namespace Rubber_Duck_Debugging
{
public static class StoredDataHandler
{
public static async Task<StoredData> GetData()
{
var folder = Windows.ApplicationModel.Package.Current.InstalledLocation;
var file = await folder.GetFileAsync("stored.dat");
var lines = await FileIO.ReadLinesAsync(file);
var noOfProblems = lines[0].Split(';')[0];
var totalTime = lines[0].Split(';')[1];
return new StoredData { NumberOfProblems = noOfProblems, TotalTimeUsed = totalTime};
}
public static async void WriteData(string number, string time)
{
var folder = Windows.ApplicationModel.Package.Current.InstalledLocation;
var file = await folder.GetFileAsync("stored.dat");
await FileIO.WriteTextAsync(file, number + ";" + time);
}
}
}