/// <summary> /// レジストリから設定を読み込みます。 /// </summary> private void loadConfig() { string rKeyName; // 操作するレジストリ・キーの名前 if (ConfigExtra.isx64() && (ConfigExtra.getWindowsName() == "Windows Vista" || ConfigExtra.getWindowsName() == "Windows XP")) { rKeyName = @"SOFTWARE\WOW6432Node\NTreev\Trickster_GCrest\Setup"; } else { rKeyName = @"SOFTWARE\NTreev\Trickster_GCrest\Setup"; } // レジストリの取得 try { // レジストリ・キーのパスを指定してレジストリを開く RegistryKey rKey = Registry.CurrentUser.OpenSubKey(rKeyName); // レジストリの値を取得 this.useFullScreen = ((int)rKey.GetValue("Full Screen") == 1) ? true : false; this.ScreenHeight = (int)rKey.GetValue("heightPixel"); this.ScreenWidth = (int)rKey.GetValue("widthPixel"); this.useSound = ((int)rKey.GetValue("UseSound") == 1) ? true : false; this.SoundBit = (int)rKey.GetValue("SoundBit"); this.SoundFreq = (int)rKey.GetValue("SoundFrequency"); this.SoundChannel = (int)rKey.GetValue("2DSample"); switch (this.SoundChannel) { case 4: this.SoundChannel = 8; break; case 8: this.SoundChannel = 16; break; case 16: this.SoundChannel = 32; break; case 32: this.SoundChannel = 48; break; } this.use3DEffect = ((int)rKey.GetValue("Use3DEffect") == 1) ? true : false; this.useMapEffect = ((int)rKey.GetValue("UseMapEffect") == 1) ? true : false; this.CaptureScreenFormat = (rKey.GetValue("CaptureScreenFormat").ToString() == "JPG") ? Structures.Images.ImageFormat.JPG : Structures.Images.ImageFormat.BMP; this.CaptureScreenJPGQuality = (int)rKey.GetValue("CaptureScreenJPGQuality"); // 開いたレジストリ・キーを閉じる rKey.Close(); } catch (Exception) { } }
private void button_OK_Click(object sender, EventArgs e) { this.useFullScreen = this.checkBox_FullScreen.Checked; this.useSound = !this.checkBox_FullSoundOFF.Checked; this.useMapEffect = this.checkBox_MapEffect.Checked; this.use3DEffect = this.checkBox_SpecailEffect.Checked; ComboBoxDisplay combDisplay = (ComboBoxDisplay)this.comboBox_Resolution.SelectedItem; Structures.Display.DisplayCollector dispCol = new Structures.Display.DisplayCollector(); //Structures.Display.Display display = dispCol.getDisplay(combDisplay.Gauge); Structures.Display.Display display = new TricksterTools.Plugins.ConfigExtra.Structures.Display.Display(combDisplay.Width, combDisplay.Height); if (display.Width > 0 && display.Height > 0) { this.ScreenWidth = display.Width; this.ScreenHeight = display.Height; } this.SoundBit = Convert.ToInt16(this.comboBox_Bits.SelectedItem.ToString().Replace(" Bit", "")); this.SoundChannel = Convert.ToInt16(this.comboBox_Channel.SelectedItem.ToString().Replace(" Channel", "")); this.SoundFreq = Convert.ToInt32(this.comboBox_SampleRate.SelectedItem.ToString()); this.CaptureScreenFormat = (this.comboBox_FileFormat.SelectedItem.ToString() == "JPG") ? Structures.Images.ImageFormat.JPG : Structures.Images.ImageFormat.BMP; this.CaptureScreenJPGQuality = this.trackBar_JPGOption.Value; string rKeyName; // 操作するレジストリ・キーの名前 rKeyName = @"SOFTWARE\NTreev\Trickster_GCrest\Setup"; // レジストリの取得 try { // レジストリ・キーのパスを指定してレジストリを開く RegistryKey rKey = Registry.CurrentUser.CreateSubKey(rKeyName); // レジストリの値を取得 rKey.SetValue("Full Screen", ((this.useFullScreen) ? 1 : 0), RegistryValueKind.DWord); rKey.SetValue("heightPixel", this.ScreenHeight, RegistryValueKind.DWord); rKey.SetValue("widthPixel", this.ScreenWidth, RegistryValueKind.DWord); rKey.SetValue("UseSound", ((this.useSound) ? 1 : 0), RegistryValueKind.DWord); rKey.SetValue("SoundBit", this.SoundBit, RegistryValueKind.DWord); rKey.SetValue("SoundFrequency", this.SoundFreq, RegistryValueKind.DWord); int ch = 8; switch (this.SoundChannel) { case 8: ch = 4; break; case 16: ch = 8; break; case 32: ch = 16; break; case 48: ch = 32; break; } int ch3d = (ch > 16) ? 16 : ch; rKey.SetValue("2DSample", ch, RegistryValueKind.DWord); rKey.SetValue("3DSample", ch3d, RegistryValueKind.DWord); rKey.SetValue("Use3DEffect", ((this.use3DEffect) ? 1 : 0), RegistryValueKind.DWord); rKey.SetValue("UseMapEffect", ((this.useMapEffect) ? 1 : 0), RegistryValueKind.DWord); rKey.SetValue("CaptureScreenFormat", this.CaptureScreenFormat.ToString(), RegistryValueKind.String); rKey.SetValue("CaptureScreenJPGQuality", this.CaptureScreenJPGQuality, RegistryValueKind.DWord); // 開いたレジストリ・キーを閉じる rKey.Close(); // 画面サイズに依存するファイルを生成 if (!this.createFileOfScreenSize()) { MessageBox.Show("必要なファイルのコピーが行えませんでした。", "Trickster Config", MessageBoxButtons.OK, MessageBoxIcon.Warning); } ConfigExtra.updateUcf(); } catch (Exception ex) { SimpleLogger.WriteLine(ex.Message); MessageBox.Show("設定の変更に失敗しました。", "Trickster Config", MessageBoxButtons.OK, MessageBoxIcon.Error); throw ex; } this.Close(); }
/// <summary> /// ���W�X�g������ݒ��ǂݍ��݂܂��B /// </summary> private void loadConfig() { string rKeyName; // ���삷�郌�W�X�g���E�L�[�̖��O if (ConfigExtra.isx64() && (ConfigExtra.getWindowsName() == "Windows Vista" || ConfigExtra.getWindowsName() == "Windows XP")) { rKeyName = @"SOFTWARE\WOW6432Node\NTreev\Trickster_GCrest\Setup"; } else { rKeyName = @"SOFTWARE\NTreev\Trickster_GCrest\Setup"; } // ���W�X�g���̎擾 try { // ���W�X�g���E�L�[�̃p�X��w�肵�ă��W�X�g����J�� RegistryKey rKey = Registry.CurrentUser.OpenSubKey(rKeyName); // ���W�X�g���̒l��擾 this.useFullScreen = ((int)rKey.GetValue("Full Screen") == 1) ? true : false; this.ScreenHeight = (int)rKey.GetValue("heightPixel"); this.ScreenWidth = (int)rKey.GetValue("widthPixel"); this.useSound = ((int)rKey.GetValue("UseSound") == 1) ? true : false; this.SoundBit = (int)rKey.GetValue("SoundBit"); this.SoundFreq = (int)rKey.GetValue("SoundFrequency"); this.SoundChannel = (int)rKey.GetValue("2DSample"); switch (this.SoundChannel) { case 4: this.SoundChannel = 8; break; case 8: this.SoundChannel = 16; break; case 16: this.SoundChannel = 32; break; case 32: this.SoundChannel = 48; break; } this.use3DEffect = ((int)rKey.GetValue("Use3DEffect") == 1) ? true : false; this.useMapEffect = ((int)rKey.GetValue("UseMapEffect") == 1) ? true : false; this.CaptureScreenFormat = (rKey.GetValue("CaptureScreenFormat").ToString() == "JPG") ? Structures.Images.ImageFormat.JPG : Structures.Images.ImageFormat.BMP; this.CaptureScreenJPGQuality = (int)rKey.GetValue("CaptureScreenJPGQuality"); // �J�������W�X�g���E�L�[����� rKey.Close(); } catch (Exception) { } }
private void button_OK_Click(object sender, EventArgs e) { this.useFullScreen = this.checkBox_FullScreen.Checked; this.useSound = !this.checkBox_FullSoundOFF.Checked; this.useMapEffect = this.checkBox_MapEffect.Checked; this.use3DEffect = this.checkBox_SpecailEffect.Checked; ComboBoxDisplay combDisplay = (ComboBoxDisplay)this.comboBox_Resolution.SelectedItem; Structures.Display.DisplayCollector dispCol= new Structures.Display.DisplayCollector(); //Structures.Display.Display display = dispCol.getDisplay(combDisplay.Gauge); Structures.Display.Display display = new TricksterTools.Plugins.ConfigExtra.Structures.Display.Display(combDisplay.Width, combDisplay.Height); if (display.Width > 0 && display.Height > 0) { this.ScreenWidth = display.Width; this.ScreenHeight = display.Height; } this.SoundBit = Convert.ToInt16(this.comboBox_Bits.SelectedItem.ToString().Replace(" Bit", "")); this.SoundChannel = Convert.ToInt16(this.comboBox_Channel.SelectedItem.ToString().Replace(" Channel", "")); this.SoundFreq = Convert.ToInt32(this.comboBox_SampleRate.SelectedItem.ToString()); this.CaptureScreenFormat = (this.comboBox_FileFormat.SelectedItem.ToString() == "JPG") ? Structures.Images.ImageFormat.JPG : Structures.Images.ImageFormat.BMP; this.CaptureScreenJPGQuality = this.trackBar_JPGOption.Value; string rKeyName; // ���삷�郌�W�X�g���E�L�[�̖��O rKeyName = @"SOFTWARE\NTreev\Trickster_GCrest\Setup"; // ���W�X�g���̎擾 try { // ���W�X�g���E�L�[�̃p�X��w�肵�ă��W�X�g����J�� RegistryKey rKey = Registry.CurrentUser.CreateSubKey(rKeyName); // ���W�X�g���̒l��擾 rKey.SetValue("Full Screen", ((this.useFullScreen) ? 1 : 0), RegistryValueKind.DWord); rKey.SetValue("heightPixel", this.ScreenHeight, RegistryValueKind.DWord); rKey.SetValue("widthPixel", this.ScreenWidth, RegistryValueKind.DWord); rKey.SetValue("UseSound", ((this.useSound) ? 1 : 0), RegistryValueKind.DWord); rKey.SetValue("SoundBit", this.SoundBit, RegistryValueKind.DWord); rKey.SetValue("SoundFrequency", this.SoundFreq, RegistryValueKind.DWord); int ch = 8; switch (this.SoundChannel) { case 8: ch = 4; break; case 16: ch = 8; break; case 32: ch = 16; break; case 48: ch = 32; break; } int ch3d = (ch > 16) ? 16 : ch; rKey.SetValue("2DSample", ch, RegistryValueKind.DWord); rKey.SetValue("3DSample", ch3d, RegistryValueKind.DWord); rKey.SetValue("Use3DEffect", ((this.use3DEffect) ? 1 : 0), RegistryValueKind.DWord); rKey.SetValue("UseMapEffect", ((this.useMapEffect) ? 1 : 0), RegistryValueKind.DWord); rKey.SetValue("CaptureScreenFormat", this.CaptureScreenFormat.ToString(), RegistryValueKind.String); rKey.SetValue("CaptureScreenJPGQuality", this.CaptureScreenJPGQuality, RegistryValueKind.DWord); // �J�������W�X�g���E�L�[����� rKey.Close(); // ��ʃT�C�Y�Ɉˑ�����t�@�C���� if (!this.createFileOfScreenSize()) { MessageBox.Show("�K�v�ȃt�@�C���̃R�s�[���s���܂���ł����B", "Trickster Config", MessageBoxButtons.OK, MessageBoxIcon.Warning); } ConfigExtra.updateUcf(); } catch (Exception ex) { SimpleLogger.WriteLine(ex.Message); MessageBox.Show("�ݒ�̕ύX�Ɏ��s���܂����B", "Trickster Config", MessageBoxButtons.OK, MessageBoxIcon.Error); throw ex; } this.Close(); }