public GameForm(EngineList engineList, VolatileConfig volatileConfig) { InitializeComponent(); engineSelectControl1.Initialize(engineList); engineSelectControl2.Initialize(engineList); this.volatileConfig = volatileConfig; engineSelectControl1.SelectedItem = engineList.Select( volatileConfig.GameEngine1Name, volatileConfig.GameEngine1Path); engineSelectControl2.SelectedItem = engineList.Select( volatileConfig.GameEngine2Name, volatileConfig.GameEngine2Path); engineTimeOptionControl1.TimeControl = volatileConfig.GameEngineTimeControls[0]; engineTimeOptionControl2.TimeControl = volatileConfig.GameEngineTimeControls[1]; engineTimeOptionControl1.Depth = volatileConfig.GameEngineDepths[0]; engineTimeOptionControl2.Depth = volatileConfig.GameEngineDepths[1]; engineTimeOptionControl1.Nodes = volatileConfig.GameEngineNodes[0]; engineTimeOptionControl2.Nodes = volatileConfig.GameEngineNodes[1]; switch (volatileConfig.GameTimeIndex) { case 0: radioButton1.Checked = true; break; case 1: radioButton2.Checked = true; break; case 2: radioButton3.Checked = true; break; default: goto case 0; } gameTimePickerControl1.TimeASeconds = volatileConfig.GameTimes[0].TimeASeconds; gameTimePickerControl2.TimeASeconds = volatileConfig.GameTimes[1].TimeASeconds; gameTimePickerControl3.TimeASeconds = volatileConfig.GameTimes[2].TimeASeconds; gameTimePickerControl1.TimeBSeconds = volatileConfig.GameTimes[0].TimeBSeconds; gameTimePickerControl2.TimeBSeconds = volatileConfig.GameTimes[1].TimeBSeconds; gameTimePickerControl3.TimeBSeconds = volatileConfig.GameTimes[2].TimeBSeconds; gameTimePickerControl1.IncTimeSeconds = volatileConfig.GameTimes[0].IncTimeSeconds; gameTimePickerControl2.IncTimeSeconds = volatileConfig.GameTimes[1].IncTimeSeconds; gameTimePickerControl3.IncTimeSeconds = volatileConfig.GameTimes[2].IncTimeSeconds; comboBox1.SelectedIndex = volatileConfig.GameTimeUpType; numericUpDown1.Value = volatileConfig.GameCount; checkBox2.Checked = volatileConfig.GameEndByMoveCount; numericUpDown3.Value = volatileConfig.GameEndMoveCount; switch (volatileConfig.GameStartPosType) { case 0: radioButton5.Checked = true; break; case 1: radioButton6.Checked = true; break; default: goto case 0; } textBox1.Text = volatileConfig.GameStartPosNotationPath; checkBox1.Checked = volatileConfig.GameStartPosNotationShuffle; numericUpDown2.Value = volatileConfig.GameStartPosNotationStartCount; checkBoxRestart.Checked = volatileConfig.GameEngineRestart; UpdateEnables(); }
public ThinkForm(VolatileConfig volatileConfig, EngineList engineList) { InitializeComponent(); engineSelectControl1.Initialize(engineList); this.volatileConfig = volatileConfig; engineSelectControl1.SelectedItem = engineList.Select( volatileConfig.ThinkEngineName, volatileConfig.ThinkEnginePath); UpdateEnables(); }
EngineList engineList; // 重複チェック用 public EngineForm(Engine engine, EngineList engineList) { InitializeComponent(); this.engine = engine; this.engineList = engineList; // Engineからコントロールへ textBoxName.Text = engine.Name; textBoxAuthor.Text = engine.Author; textBoxPath.Text = engine.Path; checkBoxUSIPonder.Checked = engine.USIPonder; numericUpDownHash.Value = engine.USIHash; checkBox1.Checked = engine.ByoyomiHack; engineOptionsControl1.FromList(engine.Options); // 有効無効を設定 textBoxPath_TextChanged(this, EventArgs.Empty); }
public NetworkGameForm(EngineList engineList, Config config, VolatileConfig volatileConfig) { InitializeComponent(); this.engineList = engineList; this.config = config; this.volatileConfig = volatileConfig; System.Diagnostics.Debug.Assert( config.NetworkGameConnections != null && config.NetworkGameConnections.Length == 6); engineSelectControl1.Initialize(engineList); // コンフィグからフォームへ // エンジン engineSelectControl1.SelectedItem = engineList.Select( volatileConfig.NetworkGameEngineName, volatileConfig.NetworkGameEnginePath); // 接続先 networkGameConnectionControl1.ReadFromConfig(config.NetworkGameConnections[0]); networkGameConnectionControl2.ReadFromConfig(config.NetworkGameConnections[1]); networkGameConnectionControl3.ReadFromConfig(config.NetworkGameConnections[2]); networkGameConnectionControl4.ReadFromConfig(config.NetworkGameConnections[3]); networkGameConnectionControl5.ReadFromConfig(config.NetworkGameConnections[4]); networkGameConnectionControl6.ReadFromConfig(config.NetworkGameConnections[5]); switch (volatileConfig.NetworkGameConnectionIndex) { case 0: radioButton1.Checked = true; break; case 1: radioButton2.Checked = true; break; case 2: radioButton3.Checked = true; break; case 3: radioButton4.Checked = true; break; case 4: radioButton5.Checked = true; break; case 5: radioButton6.Checked = true; break; default: goto case 0; } numericUpDown1.Value = volatileConfig.NetworkGameCount; // 表示を更新 UpdateEnables(); }
/// <summary> /// 読み込み処理 /// </summary> private void OnThread(object arg) { lock (syncObject) { try { // Engine.xmlの読み込み try { engineList = ConfigSerializer.Deserialize <EngineList>(); engineList.Engines.Sort(); } catch (Exception ex) { logger.Warn("Engine.xmlの読み込みに失敗。", ex); ConfigLoadFailed(this, new ConfigLoadFailedEventArgs { ConfigFileName = "Engine.xml", ToBeQuit = true }); return; } // ShogiBoard.xmlの読み込み try { config = ConfigSerializer.Deserialize <Config>(); config.Ready(); } catch (Exception ex) { logger.Warn("ShogiBoard.xmlの読み込みに失敗。", ex); ConfigLoadFailed(this, new ConfigLoadFailedEventArgs { ConfigFileName = "ShogiBoard.xml", ToBeQuit = true }); return; } // ShogiBoard.Volatile.xmlの読み込み try { volatileConfig = ConfigSerializer.Deserialize <VolatileConfig>(); } catch (Exception ex) { logger.Warn("ShogiBoard.Volatile.xmlの読み込みに失敗。", ex); ConfigLoadFailed(this, new ConfigLoadFailedEventArgs { ConfigFileName = "ShogiBoard.Volatile.xml", ToBeQuit = false }); volatileConfig = new VolatileConfig(); // 初期値にしてしまう } volatileConfig.Ready(); } catch (Exception ex) { logger.Warn("ShogiBoard.Volatile.xmlの読み込みに失敗。", ex); } Monitor.PulseAll(syncObject); } }
/// <summary> /// 初期化。必ず呼び出すこと。(なんかイマイチなのだが…) /// </summary> public void Initialize(EngineList engineList) { this.engineList = engineList; comboBoxEngine.Items.AddRange(engineList.Engines.ToArray()); }
/// <summary> /// 詰将棋解答用のエンジンが存在するかチェック /// </summary> public bool IsMateEngineExists() { return(EngineList.EngineExists(VolatileConfig.MateEngineName, VolatileConfig.MateEnginePath)); }
public EngineListForm(EngineList engineList, string addEnginePath = null) { InitializeComponent(); this.engineList = engineList; this.addEnginePath = addEnginePath; }