This repository has been archived by the owner on Oct 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
/
SettingsParser.cs
117 lines (103 loc) · 3.79 KB
/
SettingsParser.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
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
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ValorantStreamOverlay
{
class SettingsParser
{
public async Task<string> ReadRegion(int regionName)
{
string region = "na";
switch (regionName)
{
case 0:
region = "na";
break;
case 1:
region = "eu";
break;
case 2:
region = "kr";
break;
case 3:
region = "ap";
break;
}
return region;
}
public async Task ReadSkin(int skinNumber)
{
//Depending on the skin number it will set the background image.
//Implement var that accesses the resources to remove switch statement.
switch (skinNumber)
{
case 0:
LogicHandler.ValorantOver.backgroundPic.Image = Properties.Resources.backgroundv2;
break;
case 1:
LogicHandler.ValorantOver.backgroundPic.Image = Properties.Resources.bluebackground;
break;
case 2:
LogicHandler.ValorantOver.backgroundPic.Image = Properties.Resources.lightbluebackground;
break;
case 3:
LogicHandler.ValorantOver.backgroundPic.Image = Properties.Resources.greenbackground;
break;
case 4:
LogicHandler.ValorantOver.backgroundPic.Image = Properties.Resources.purplebackground;
break;
case 5:
LogicHandler.ValorantOver.backgroundPic.Image = Properties.Resources.graybackground;
break;
case 6:
if (File.Exists(Path.Combine(Directory.GetCurrentDirectory(), "references", "custom.png")))
{
LogicHandler.ValorantOver.backgroundPic.Image = Image.FromFile(Path.Combine(Directory.GetCurrentDirectory(), "references", "custom.png"));
}
else
{
LogicHandler.ValorantOver.backgroundPic.Image = Properties.Resources.custom;
}
break;
}
}
public async Task<int> ReadDelay(int delayNumber)
{
if (delayNumber != null)
{
switch (delayNumber)
{
case 0:
return 30;
case 1:
return 60;
}
}
return 30;
}
public async Task<bool> ReadTwitchBot()
{
//When Called start checking if settings are filling in.
if (Properties.Settings.Default.twitchbotEnabled)
{
if (string.IsNullOrEmpty(Properties.Settings.Default.twitchBotUsername) ||
string.IsNullOrEmpty(Properties.Settings.Default.twitchChannel) ||
string.IsNullOrEmpty(Properties.Settings.Default.twitchBotToken))
{
Properties.Settings.Default.twitchbotEnabled = false;
Properties.Settings.Default.Save();
MessageBox.Show("Twitch Bot Settings are missing, please fill in all fields to use");
Environment.Exit(1);
}
return true;
}
else
return false;
}
}
}