/// <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) { } }
/// <summary> /// インストール先パスを取得 /// </summary> /// <param name="void"></param> /// <returns>インストール先パス</returns> private static string getInstallPath() { string rKeyName; // 操作するレジストリ・キーの名前 if (ConfigExtra.isx64()) { rKeyName = @"SOFTWARE\WOW6432Node\NTreev\Trickster_GCrest"; } else { rKeyName = @"SOFTWARE\NTreev\Trickster_GCrest"; } // 取得処理を行う対象となるレジストリの値の名前 string rGetValueName = "FullPath"; SimpleLogger.WriteLine("get client installed path..."); // レジストリの取得 try { // レジストリ・キーのパスを指定してレジストリを開く RegistryKey rKey = Registry.LocalMachine.OpenSubKey(rKeyName); // レジストリの値を取得 string location = rKey.GetValue(rGetValueName).ToString(); // 開いたレジストリ・キーを閉じる rKey.Close(); // 取得したレジストリの値return return(location.Replace("\\Splash.exe", "")); } catch (NullReferenceException) { SimpleLogger.WriteLine("failed to get client installed path."); // レジストリ・キーまたは値が存在しない MessageBox.Show("インストールパスの取得に失敗しました", "ランチャー起動中", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(@"C:\Games\Trickster"); } }