forked from nerdunit/androidsideloader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ThemeForm.cs
171 lines (155 loc) · 8.07 KB
/
ThemeForm.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
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
using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using System.Collections.Specialized;
namespace AndroidSideloader
{
public partial class themeForm : Form
{
public themeForm()
{
InitializeComponent();
}
//Code made by @Gotard#9164 from discord (id 352745203322585088)
//Steam profile: https://steamcommunity.com/id/GotardPL/
private void button4_Click(object sender, EventArgs e)
{
if (colorDialog1.ShowDialog() == DialogResult.OK)
Properties.Settings.Default.ButtonColor = colorDialog1.Color;
}
private void button1_Click(object sender, EventArgs e)
{
if (colorDialog1.ShowDialog() == DialogResult.OK)
Properties.Settings.Default.BackColor = colorDialog1.Color;
}
private void button7_Click(object sender, EventArgs e)
{
Properties.Settings.Default.Save();
this.Close();
}
private void button8_Click(object sender, EventArgs e)
{
Properties.Settings.Default.BackColor = Color.FromArgb(45,45,45);
Properties.Settings.Default.ComboBoxColor = Color.FromArgb(45, 45, 45);
Properties.Settings.Default.TextBoxColor = Color.FromArgb(45,45,45);
Properties.Settings.Default.ButtonColor = SystemColors.ActiveCaptionText;
Properties.Settings.Default.SubButtonColor=Color.FromArgb(64, 64, 64);
Properties.Settings.Default.BackPicturePath = "";
Properties.Settings.Default.FontStyle = new Font("Microsoft Sans Serif", 11, FontStyle.Regular);
Properties.Settings.Default.FontColor = Color.White;
Properties.Settings.Default.Save();
}
private void button5_Click(object sender, EventArgs e)
{
if (colorDialog1.ShowDialog() == DialogResult.OK)
Properties.Settings.Default.ComboBoxColor = colorDialog1.Color;
}
private void button9_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
String extension = Path.GetExtension(openFileDialog1.FileName);
if (File.Exists(Environment.CurrentDirectory + "\\pic" + extension))
File.Delete(Environment.CurrentDirectory + "\\pic" + extension);
File.Copy(openFileDialog1.FileName, Environment.CurrentDirectory + "\\pic" + extension);
Properties.Settings.Default.BackPicturePath = Environment.CurrentDirectory + "\\pic" + extension ;
}
}
private void button10_Click(object sender, EventArgs e)
{
if (fontDialog1.ShowDialog() == DialogResult.OK)
{
Properties.Settings.Default.FontStyle = fontDialog1.Font;
}
}
private void button3_Click(object sender, EventArgs e)
{
if (colorDialog1.ShowDialog() == DialogResult.OK)
Properties.Settings.Default.FontColor = colorDialog1.Color;
}
private void button11_Click(object sender, EventArgs e)
{
if (colorDialog1.ShowDialog() == DialogResult.OK)
Properties.Settings.Default.SubButtonColor = colorDialog1.Color;
}
private void button12_Click(object sender, EventArgs e)
{
String BackColor = ColorTranslator.ToHtml(Properties.Settings.Default.BackColor);
String TextBoxColor = ColorTranslator.ToHtml(Properties.Settings.Default.TextBoxColor);
String ComboBoxColor = ColorTranslator.ToHtml(Properties.Settings.Default.ComboBoxColor);
String ButtonColor = ColorTranslator.ToHtml(Properties.Settings.Default.ButtonColor);
String SubButtonColor = ColorTranslator.ToHtml(Properties.Settings.Default.SubButtonColor);
String FontColor = ColorTranslator.ToHtml(Properties.Settings.Default.FontColor);
var cvt = new FontConverter();
string FontStyle = cvt.ConvertToString(Properties.Settings.Default.FontStyle);
int i;
if (File.Exists(Environment.CurrentDirectory + "\\theme.txt"))
{
if (File.Exists(Environment.CurrentDirectory + "\\theme11.txt"))
MessageBox.Show("You can't export more than 12 themes, sorry :(");
else
{
for (i = 1; i <= 10; i++)
{
if (File.Exists(Environment.CurrentDirectory + "\\theme" + i + ".txt"))
continue;
else
{
break;
}
}
File.WriteAllText(Environment.CurrentDirectory + "\\theme" + i + ".txt", "#SideloaderTheme# \n" + BackColor + "\n" + ButtonColor + "\n" + SubButtonColor + "\n"
+ TextBoxColor + "\n" + ComboBoxColor + "\n" + FontColor + "\n" + FontStyle);
MessageBox.Show("Theme exported as theme" + i + ".txt");
}
}
else
{
File.WriteAllText(Environment.CurrentDirectory + "\\theme.txt", "#SideloaderTheme# \n" + BackColor + "\n" + ButtonColor + "\n" + SubButtonColor + "\n"
+ TextBoxColor + "\n" + ComboBoxColor + "\n" + FontColor + "\n" + FontStyle);
MessageBox.Show("Theme exported as theme.txt");
}
}
private void button13_Click(object sender, EventArgs e)
{
openThemeDialog.InitialDirectory = Environment.CurrentDirectory;
if (openThemeDialog.ShowDialog() == DialogResult.OK) {
using (StreamReader sr = new StreamReader(openThemeDialog.FileName))
{
StringCollection myCol = new StringCollection();
myCol.AddRange(File.ReadAllLines(openThemeDialog.FileName));
if (myCol.Contains("#SideloaderTheme# "))
{
String[] settings = new String[myCol.Count];
myCol.CopyTo(settings, 0);
Color BackColor = ColorTranslator.FromHtml(settings[1]);
Color ButtonColor = ColorTranslator.FromHtml(settings[2]);
Color SubButtonColor = ColorTranslator.FromHtml(settings[3]);
Color TextBoxColor = ColorTranslator.FromHtml(settings[4]);
Color ComboBoxColor = ColorTranslator.FromHtml(settings[5]);
Color FontColor = ColorTranslator.FromHtml(settings[6]);
Properties.Settings.Default.BackColor = BackColor;
Properties.Settings.Default.ButtonColor = ButtonColor;
Properties.Settings.Default.SubButtonColor = SubButtonColor;
Properties.Settings.Default.TextBoxColor = TextBoxColor;
Properties.Settings.Default.ComboBoxColor = ComboBoxColor;
Properties.Settings.Default.FontColor = FontColor;
System.ComponentModel.TypeConverter converter =
System.ComponentModel.TypeDescriptor.GetConverter(typeof(Font));
var cvt = new FontConverter();
Font f = cvt.ConvertFromString(settings[7]) as Font;
Properties.Settings.Default.FontStyle = f;
}
else
MessageBox.Show("The file you've selected is not a Rookie's Sideloader theme file!");
}
}
}
private void button2_Click(object sender, EventArgs e)
{
if (colorDialog1.ShowDialog() == DialogResult.OK)
Properties.Settings.Default.TextBoxColor = colorDialog1.Color;
}
}
}