forked from MarkusMaal/BlueScreenSimulatorPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDictEdit.cs
156 lines (145 loc) · 5.01 KB
/
DictEdit.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SimulatorDatabase;
namespace UltimateBlueScreenSimulator
{
public partial class DictEdit : Form
{
internal BlueScreen me;
string key;
public DictEdit()
{
InitializeComponent();
}
private void ComboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
label3.Visible = ((textBox2.Text == "os") && textBox2.Visible && (comboBox1.SelectedItem.ToString() == "strings"));
Reload();
}
void Reload()
{
listView1.Items.Clear();
switch (comboBox1.SelectedItem.ToString())
{
case "ints":
foreach (KeyValuePair<string, int> kvp in me.AllInts())
{
ListViewItem li = new ListViewItem
{
Text = kvp.Key
};
li.SubItems.Add(kvp.Value.ToString());
listView1.Items.Add(li);
}
break;
case "strings":
foreach (KeyValuePair<string, string> kvp in me.AllStrings())
{
ListViewItem li = new ListViewItem
{
Text = kvp.Key
};
li.SubItems.Add(kvp.Value);
listView1.Items.Add(li);
}
break;
case "bools":
foreach (KeyValuePair<string, bool> kvp in me.AllBools())
{
ListViewItem li = new ListViewItem
{
Text = kvp.Key
};
li.SubItems.Add(kvp.Value.ToString());
listView1.Items.Add(li);
}
break;
}
}
private void ListView1_SelectedIndexChanged(object sender, EventArgs e)
{
if (listView1.SelectedIndices.Count > 0)
{
key = listView1.SelectedItems[0].Text;
switch (comboBox1.SelectedItem)
{
case "strings":
textBox1.Text = me.GetString(listView1.SelectedItems[0].Text);
break;
case "ints":
textBox1.Text = me.GetInt(listView1.SelectedItems[0].Text).ToString();
break;
case "bools":
textBox1.Text = me.GetBool(listView1.SelectedItems[0].Text).ToString();
break;
}
}
}
private void TextBox1_TextChanged(object sender, EventArgs e)
{
if (textBox1.Focused)
{
switch (comboBox1.SelectedItem)
{
case "strings":
me.SetString(key, textBox1.Text);
break;
case "ints":
try { me.SetInt(key, Convert.ToInt32(textBox1.Text)); } catch { }
break;
case "bools":
try
{
me.SetBool(key, Convert.ToBoolean(textBox1.Text));
} catch { }
break;
}
if (listView1.Visible)
{
Reload();
}
}
}
private void RadioButton2_CheckedChanged(object sender, EventArgs e)
{
if (radioButton2.Checked)
{
listView1.Visible = false;
textBox1.Text = "";
listView1.Items.Clear();
key = "";
textBox2.Visible = true;
}
}
private void RadioButton1_CheckedChanged(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
textBox2.Visible = false;
textBox1.Text = "";
listView1.Visible = true;
key = "";
Reload();
}
}
private void TextBox2_TextChanged(object sender, EventArgs e)
{
key = textBox2.Text;
label3.Visible = ((textBox2.Text == "os") && textBox2.Visible && (comboBox1.SelectedItem.ToString() == "strings"));
}
private void DictEdit_Load(object sender, EventArgs e)
{
comboBox1.SelectedIndex = 0;
}
private void TextBox2_VisibleChanged(object sender, EventArgs e)
{
label3.Visible = ((textBox2.Text == "os") && textBox2.Visible && (comboBox1.SelectedItem.ToString() == "strings"));
}
}
}