- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
RegistryKey readKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Webzen\\Mu\\Config\\");
Microsoft.Win32.RegistryKey regKey = Microsoft.Win32.Registry.CurrentUser;
RegistryKey saveKey = Registry.CurrentUser.CreateSubKey("SOFTWARE\\Webzen\\Mu\\Config\\");
private void b_exit_Click(object sender, EventArgs e)
{
if (checkBox1.Checked == true)
saveKey.SetValue("WindowMode", (int)0x00000001, Microsoft.Win32.RegistryValueKind.DWord);
else
saveKey.SetValue("WindowMode", (int)0x00000000, Microsoft.Win32.RegistryValueKind.DWord);
if (checkBox2.Checked == true)
saveKey.SetValue("MusicOnOff", (int)0x00000001, Microsoft.Win32.RegistryValueKind.DWord);
else
saveKey.SetValue("MusicOnOff", (int)0x00000000, Microsoft.Win32.RegistryValueKind.DWord);
if (checkBox3.Checked == true)
saveKey.SetValue("SoundOnOff", (int)0x00000001, Microsoft.Win32.RegistryValueKind.DWord);
else
saveKey.SetValue("SoundOnOff", (int)0x00000000, Microsoft.Win32.RegistryValueKind.DWord);
if (comboBox1.SelectedItem == "800x600")
saveKey.SetValue("Resolution", (int)0x00000001, Microsoft.Win32.RegistryValueKind.DWord);
else if (comboBox1.SelectedItem == "1024x768")
saveKey.SetValue("Resolution", (int)0x00000002, Microsoft.Win32.RegistryValueKind.DWord);
else if (comboBox1.SelectedItem == "1280x1024")
saveKey.SetValue("Resolution", (int)0x00000003, Microsoft.Win32.RegistryValueKind.DWord);
saveKey.Close();
this.Close();
}
private void Options_Load(object sender, EventArgs e)
{
XmlDocument cfg = new XmlDocument();
cfg.Load("cfg.xml");
String lang = cfg.GetElementsByTagName("language")[0].InnerText;
if (lang == "en")
{
checkBox1.Text = "In window";
checkBox3.Text = "Music";
checkBox2.Text = "Sounds";
label1.Text = "Resolution game";
b_exit.Text = "Save";
b_cancel.Text = "Cancel";
}
int loadString = (int)readKey.GetValue("WindowMode");
if (loadString == 1)
checkBox1.Checked = true;
int loadString2 = (int)readKey.GetValue("MusicOnOff");
if (loadString2 == 1)
checkBox2.Checked = true;
int loadString3 = (int)readKey.GetValue("SoundOnOff");
if (loadString3 == 1)
checkBox3.Checked = true;
if (readKey.GetValue("Resolution") == null)
{
regKey.CreateSubKey("SOFTWARE\\Webzen\\Mu\\Config");
regKey.SetValue("Resolution", (int)0x00000001, Microsoft.Win32.RegistryValueKind.DWord);
}
else
{
int loadString4 = (int)readKey.GetValue("Resolution");
if (loadString4 == (int)0x00000001)
comboBox1.Text = "800x600";
else if (loadString4 == (int)0x00000002)
comboBox1.Text = "1024x768";
else if (loadString4 == (int)0x00000003)
comboBox1.Text = "1280x1024";
else
comboBox1.Text = "Выберите разрешение";
}
readKey.Close();
}
Код годичной давности, по сравнению с моими классами сейчас, это небо и земля.
eth0 06.04.2011 17:41 # +1
daffsik 06.04.2011 17:47 # −2
bugmenot 06.04.2011 17:57 # 0
1 год - слишком мало для улучшения, даже если осваиваешь VB со смешными скобочками
daffsik 06.04.2011 20:08 # 0
Lure Of Chaos 06.04.2011 22:10 # 0
abatishchev 07.04.2011 09:00 # 0