forked from mazarskov/ScreenTime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBarGenerator.cs
More file actions
61 lines (53 loc) · 1.65 KB
/
Copy pathBarGenerator.cs
File metadata and controls
61 lines (53 loc) · 1.65 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ScreenTime
{
public class BarGenerator
{
public string Generate(int minutes)
{
//TODO: fix this garbage hard-coding fix
if (minutes > 60)
{
minutes = 60;
}
int remainder = (minutes % 10);
int ten_intervals = (minutes - remainder) / 10;
string finmin = "";
string complete = "";
for (int i = 0; i < ten_intervals; ten_intervals--)
{
//complete += "||||||||||||||||||||||||||||||\n";
complete += "||||||||||||||||||||\n";
}
if (remainder > 0)
{
while(remainder > 0)
{
//finmin += "||";
finmin += "||";
remainder--;
}
complete = string.Join("\n", finmin, complete);
complete = complete.Substring(0, complete.Length - 1);
}
else
{
complete = complete.Substring(0, complete.Length - 1);
}
if (!((60 - minutes) <= 9))
{
int leftos = 60 - minutes;
int tenIntervalsOfLeftos = (leftos - (leftos % 10)) / 10;
for(int j = 0; j < tenIntervalsOfLeftos; tenIntervalsOfLeftos--)
{
complete = string.Join("\n", "", complete);
}
}
return complete;
}
}
}