/// <summary> /// 設定からUIを初期化します。 /// </summary> public void FromConfiguration(Configuration.ConfigurationData config) { //[通信] Connection_Port.Value = config.Connection.Port; Connection_SaveReceivedData.Checked = config.Connection.SaveReceivedData; Connection_SaveDataPath.Text = config.Connection.SaveDataPath; Connection_SaveRequest.Checked = config.Connection.SaveRequest; Connection_SaveResponse.Checked = config.Connection.SaveResponse; Connection_SaveSWF.Checked = config.Connection.SaveSWF; Connection_SaveOtherFile.Checked = config.Connection.SaveOtherFile; Connection_ApplyVersion.Checked = config.Connection.ApplyVersion; Connection_RegisterAsSystemProxy.Checked = config.Connection.RegisterAsSystemProxy; Connection_UseUpstreamProxy.Checked = config.Connection.UseUpstreamProxy; Connection_UpstreamProxyPort.Value = config.Connection.UpstreamProxyPort; Connection_UpstreamProxyAddress.Text = config.Connection.UpstreamProxyAddress; Connection_UseSystemProxy.Checked = config.Connection.UseSystemProxy; Connection_DownstreamProxy.Text = config.Connection.DownstreamProxy; //[UI] UI_MainFont.Font = config.UI.MainFont.FontData; UI_MainFont.Text = config.UI.MainFont.SerializeFontAttribute; UI_SubFont.Font = config.UI.SubFont.FontData; UI_SubFont.Text = config.UI.SubFont.SerializeFontAttribute; UI_BarColorMorphing.Checked = config.UI.BarColorMorphing; //[ログ] Log_LogLevel.Value = config.Log.LogLevel; Log_SaveLogFlag.Checked = config.Log.SaveLogFlag; Log_SaveErrorReport.Checked = config.Log.SaveErrorReport; Log_FileEncodingID.SelectedIndex = config.Log.FileEncodingID; Log_ShowSpoiler.Checked = config.Log.ShowSpoiler; _playTimeCache = config.Log.PlayTime; UpdatePlayTime(); //[動作] Control_ConditionBorder.Value = config.Control.ConditionBorder; Control_RecordAutoSaving.SelectedIndex = config.Control.RecordAutoSaving; Control_UseSystemVolume.Checked = config.Control.UseSystemVolume; Control_PowerEngagementForm.SelectedIndex = config.Control.PowerEngagementForm - 1; //[デバッグ] Debug_EnableDebugMenu.Checked = config.Debug.EnableDebugMenu; Debug_LoadAPIListOnLoad.Checked = config.Debug.LoadAPIListOnLoad; Debug_APIListPath.Text = config.Debug.APIListPath; Debug_AlertOnError.Checked = config.Debug.AlertOnError; //[起動と終了] Life_ConfirmOnClosing.Checked = config.Life.ConfirmOnClosing; Life_TopMost.Checked = this.TopMost = config.Life.TopMost; //メインウィンドウに隠れないように Life_LayoutFilePath.Text = config.Life.LayoutFilePath; Life_CheckUpdateInformation.Checked = config.Life.CheckUpdateInformation; Life_ShowStatusBar.Checked = config.Life.ShowStatusBar; Life_ClockFormat.SelectedIndex = config.Life.ClockFormat; Life_LockLayout.Checked = config.Life.LockLayout; Life_CanCloseFloatWindowInLock.Checked = config.Life.CanCloseFloatWindowInLock; //[サブウィンドウ] FormArsenal_ShowShipName.Checked = config.FormArsenal.ShowShipName; FormArsenal_BlinkAtCompletion.Checked = config.FormArsenal.BlinkAtCompletion; FormDock_BlinkAtCompletion.Checked = config.FormDock.BlinkAtCompletion; FormFleet_ShowAircraft.Checked = config.FormFleet.ShowAircraft; FormFleet_SearchingAbilityMethod.SelectedIndex = config.FormFleet.SearchingAbilityMethod; FormFleet_IsScrollable.Checked = config.FormFleet.IsScrollable; FormFleet_FixShipNameWidth.Checked = config.FormFleet.FixShipNameWidth; FormFleet_ShortenHPBar.Checked = config.FormFleet.ShortenHPBar; FormFleet_ShowNextExp.Checked = config.FormFleet.ShowNextExp; FormFleet_EquipmentLevelVisibility.SelectedIndex = (int)config.FormFleet.EquipmentLevelVisibility; FormFleet_AirSuperiorityMethod.SelectedIndex = config.FormFleet.AirSuperiorityMethod; FormFleet_ShowAnchorageRepairingTimer.Checked = config.FormFleet.ShowAnchorageRepairingTimer; FormFleet_BlinkAtCompletion.Checked = config.FormFleet.BlinkAtCompletion; FormFleet_ShowConditionIcon.Checked = config.FormFleet.ShowConditionIcon; FormHeadquarters_BlinkAtMaximum.Checked = config.FormHeadquarters.BlinkAtMaximum; FormHeadquarters_Visibility.Items.Clear(); FormHeadquarters_Visibility.Items.AddRange(FormHeadquarters.GetItemNames().ToArray()); FormHeadquarters.CheckVisibilityConfiguration(); for (int i = 0; i < FormHeadquarters_Visibility.Items.Count; i++) { FormHeadquarters_Visibility.SetItemChecked(i, config.FormHeadquarters.Visibility.List[i]); } { FormHeadquarters_DisplayUseItemID.Items.AddRange( ElectronicObserver.Data.KCDatabase.Instance.MasterUseItems.Values .Where(i => i.Name.Length > 0 && i.Description.Length > 0) .Select(i => i.Name).ToArray()); var item = ElectronicObserver.Data.KCDatabase.Instance.MasterUseItems[config.FormHeadquarters.DisplayUseItemID]; if (item != null) { FormHeadquarters_DisplayUseItemID.Text = item.Name; } else { FormHeadquarters_DisplayUseItemID.Text = config.FormHeadquarters.DisplayUseItemID.ToString(); } } FormQuest_ShowRunningOnly.Checked = config.FormQuest.ShowRunningOnly; FormQuest_ShowOnce.Checked = config.FormQuest.ShowOnce; FormQuest_ShowDaily.Checked = config.FormQuest.ShowDaily; FormQuest_ShowWeekly.Checked = config.FormQuest.ShowWeekly; FormQuest_ShowMonthly.Checked = config.FormQuest.ShowMonthly; FormQuest_ShowOther.Checked = config.FormQuest.ShowOther; FormQuest_ProgressAutoSaving.SelectedIndex = config.FormQuest.ProgressAutoSaving; FormQuest_AllowUserToSortRows.Checked = config.FormQuest.AllowUserToSortRows; FormShipGroup_AutoUpdate.Checked = config.FormShipGroup.AutoUpdate; FormShipGroup_ShowStatusBar.Checked = config.FormShipGroup.ShowStatusBar; FormShipGroup_ShipNameSortMethod.SelectedIndex = config.FormShipGroup.ShipNameSortMethod; FormBattle_IsScrollable.Checked = config.FormBattle.IsScrollable; FormBrowser_IsEnabled.Checked = config.FormBrowser.IsEnabled; FormBrowser_ZoomRate.Value = config.FormBrowser.ZoomRate; FormBrowser_ZoomFit.Checked = config.FormBrowser.ZoomFit; FormBrowser_LogInPageURL.Text = config.FormBrowser.LogInPageURL; FormBrowser_ScreenShotFormat_JPEG.Checked = config.FormBrowser.ScreenShotFormat == 1; FormBrowser_ScreenShotFormat_PNG.Checked = config.FormBrowser.ScreenShotFormat == 2; FormBrowser_ScreenShotPath.Text = config.FormBrowser.ScreenShotPath; FormBrowser_ConfirmAtRefresh.Checked = config.FormBrowser.ConfirmAtRefresh; FormBrowser_AppliesStyleSheet.Checked = config.FormBrowser.AppliesStyleSheet; { Microsoft.Win32.RegistryKey reg = null; try { reg = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(RegistryPathMaster + RegistryPathBrowserVersion); if (reg == null) { FormBrowser_BrowserVersion.Text = DefaultBrowserVersion.ToString(); } else { FormBrowser_BrowserVersion.Text = (reg.GetValue(FormBrowserHost.BrowserExeName) ?? DefaultBrowserVersion).ToString(); } if (reg != null) { reg.Close(); } reg = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(RegistryPathMaster + RegistryPathGPURendering); if (reg == null) { FormBrowser_GPURendering.Checked = DefaultGPURendering; } else { int?gpu = reg.GetValue(FormBrowserHost.BrowserExeName) as int?; FormBrowser_GPURendering.Checked = gpu != null ? gpu != 0 : DefaultGPURendering; } } catch (Exception ex) { FormBrowser_BrowserVersion.Text = DefaultBrowserVersion.ToString(); FormBrowser_GPURendering.Checked = DefaultGPURendering; Utility.Logger.Add(3, "レジストリからの読み込みに失敗しました。" + ex.Message); } finally { if (reg != null) { reg.Close(); } } } FormBrowser_FlashQuality.Text = config.FormBrowser.FlashQuality; FormBrowser_FlashWMode.Text = config.FormBrowser.FlashWMode; if (!config.FormBrowser.IsToolMenuVisible) { FormBrowser_ToolMenuDockStyle.SelectedIndex = 4; } else { FormBrowser_ToolMenuDockStyle.SelectedIndex = (int)config.FormBrowser.ToolMenuDockStyle - 1; } FormCompass_CandidateDisplayCount.Value = config.FormCompass.CandidateDisplayCount; FormJson_AutoUpdate.Checked = config.FormJson.AutoUpdate; FormJson_UpdatesTree.Checked = config.FormJson.UpdatesTree; FormJson_AutoUpdateFilter.Text = config.FormJson.AutoUpdateFilter; //[通知] { bool issilenced = NotifierManager.Instance.GetNotifiers().All(no => no.IsSilenced); Notification_Silencio.Checked = issilenced; setSilencioConfig(issilenced); } //[データベース] Database_SendDataToKancolleDB.Checked = config.Connection.SendDataToKancolleDB; Database_SendKancolleOAuth.Text = config.Connection.SendKancolleOAuth; //[BGM] BGMPlayer_Enabled.Checked = config.BGMPlayer.Enabled; BGMHandles = config.BGMPlayer.Handles.ToDictionary(h => h.HandleID); BGMPlayer_SyncBrowserMute.Checked = config.BGMPlayer.SyncBrowserMute; UpdateBGMPlayerUI(); //finalize UpdateParameter(); }
/// <summary> /// 設定からUIを初期化します。 /// </summary> public void FromConfiguration(Configuration.ConfigurationData config) { //[通信] Connection_Port.Value = config.Connection.Port; Connection_SaveReceivedData.Checked = config.Connection.SaveReceivedData; Connection_SaveDataPath.Text = config.Connection.SaveDataPath; Connection_SaveRequest.Checked = config.Connection.SaveRequest; Connection_SaveResponse.Checked = config.Connection.SaveResponse; Connection_SaveOtherFile.Checked = config.Connection.SaveOtherFile; Connection_ApplyVersion.Checked = config.Connection.ApplyVersion; Connection_RegisterAsSystemProxy.Checked = config.Connection.RegisterAsSystemProxy; Connection_UseUpstreamProxy.Checked = config.Connection.UseUpstreamProxy; Connection_UpstreamProxyPort.Value = config.Connection.UpstreamProxyPort; Connection_UpstreamProxyAddress.Text = config.Connection.UpstreamProxyAddress; Connection_UseSystemProxy.Checked = config.Connection.UseSystemProxy; Connection_DownstreamProxy.Text = config.Connection.DownstreamProxy; //[UI] UI_MainFont.Text = config.UI.MainFont.SerializeFontAttribute; UI_SubFont.Text = config.UI.SubFont.SerializeFontAttribute; UI_BarColorMorphing.Checked = config.UI.BarColorMorphing; UI_IsLayoutFixed.Checked = config.UI.IsLayoutFixed; { UI_RenderingTest.MainFont = config.UI.MainFont.FontData; UI_RenderingTest.SubFont = config.UI.SubFont.FontData; UI_RenderingTest.HPBar.ColorMorphing = config.UI.BarColorMorphing; UI_RenderingTest.HPBar.SetBarColorScheme(config.UI.BarColorScheme.Select(c => c.ColorData).ToArray()); UI_RenderingTestChanger.Maximum = UI_RenderingTest.MaximumValue; UI_RenderingTestChanger.Value = UI_RenderingTest.Value; } //[ログ] Log_LogLevel.Value = config.Log.LogLevel; Log_SaveLogFlag.Checked = config.Log.SaveLogFlag; Log_SaveErrorReport.Checked = config.Log.SaveErrorReport; Log_FileEncodingID.SelectedIndex = config.Log.FileEncodingID; Log_ShowSpoiler.Checked = config.Log.ShowSpoiler; _playTimeCache = config.Log.PlayTime; UpdatePlayTime(); Log_SaveBattleLog.Checked = config.Log.SaveBattleLog; Log_SaveLogImmediately.Checked = config.Log.SaveLogImmediately; //[動作] Control_ConditionBorder.Value = config.Control.ConditionBorder; Control_RecordAutoSaving.SelectedIndex = config.Control.RecordAutoSaving; Control_UseSystemVolume.Checked = config.Control.UseSystemVolume; Control_PowerEngagementForm.SelectedIndex = config.Control.PowerEngagementForm - 1; Control_ShowSallyAreaAlertDialog.Checked = config.Control.ShowSallyAreaAlertDialog; Control_ShowExpeditionAlertDialog.Checked = config.Control.ShowExpeditionAlertDialog; //[デバッグ] Debug_EnableDebugMenu.Checked = config.Debug.EnableDebugMenu; Debug_LoadAPIListOnLoad.Checked = config.Debug.LoadAPIListOnLoad; Debug_APIListPath.Text = config.Debug.APIListPath; Debug_AlertOnError.Checked = config.Debug.AlertOnError; //[起動と終了] Life_ConfirmOnClosing.Checked = config.Life.ConfirmOnClosing; Life_TopMost.Checked = this.TopMost = config.Life.TopMost; //メインウィンドウに隠れないように Life_LayoutFilePath.Text = config.Life.LayoutFilePath; Life_CheckUpdateInformation.Checked = config.Life.CheckUpdateInformation; Life_ShowStatusBar.Checked = config.Life.ShowStatusBar; Life_ClockFormat.SelectedIndex = config.Life.ClockFormat; Life_LockLayout.Checked = config.Life.LockLayout; Life_CanCloseFloatWindowInLock.Checked = config.Life.CanCloseFloatWindowInLock; //[サブウィンドウ] FormArsenal_ShowShipName.Checked = config.FormArsenal.ShowShipName; FormArsenal_BlinkAtCompletion.Checked = config.FormArsenal.BlinkAtCompletion; FormArsenal_MaxShipNameWidth.Value = config.FormArsenal.MaxShipNameWidth; FormDock_BlinkAtCompletion.Checked = config.FormDock.BlinkAtCompletion; FormDock_MaxShipNameWidth.Value = config.FormDock.MaxShipNameWidth; FormFleet_ShowAircraft.Checked = config.FormFleet.ShowAircraft; FormFleet_SearchingAbilityMethod.SelectedIndex = config.FormFleet.SearchingAbilityMethod; FormFleet_IsScrollable.Checked = config.FormFleet.IsScrollable; FormFleet_FixShipNameWidth.Checked = config.FormFleet.FixShipNameWidth; FormFleet_ShortenHPBar.Checked = config.FormFleet.ShortenHPBar; FormFleet_ShowNextExp.Checked = config.FormFleet.ShowNextExp; FormFleet_EquipmentLevelVisibility.SelectedIndex = (int)config.FormFleet.EquipmentLevelVisibility; FormFleet_ShowAircraftLevelByNumber.Checked = config.FormFleet.ShowAircraftLevelByNumber; FormFleet_AirSuperiorityMethod.SelectedIndex = config.FormFleet.AirSuperiorityMethod; FormFleet_ShowAnchorageRepairingTimer.Checked = config.FormFleet.ShowAnchorageRepairingTimer; FormFleet_BlinkAtCompletion.Checked = config.FormFleet.BlinkAtCompletion; FormFleet_ShowConditionIcon.Checked = config.FormFleet.ShowConditionIcon; FormFleet_FixedShipNameWidth.Value = config.FormFleet.FixedShipNameWidth; FormFleet_ShowAirSuperiorityRange.Checked = config.FormFleet.ShowAirSuperiorityRange; FormFleet_ReflectAnchorageRepairHealing.Checked = config.FormFleet.ReflectAnchorageRepairHealing; FormFleet_BlinkAtDamaged.Checked = config.FormFleet.BlinkAtDamaged; FormFleet_EmphasizesSubFleetInPort.Checked = config.FormFleet.EmphasizesSubFleetInPort; FormFleet_FleetStateDisplayMode.SelectedIndex = config.FormFleet.FleetStateDisplayMode; FormFleet_AppliesSallyAreaColor.Checked = config.FormFleet.AppliesSallyAreaColor; FormHeadquarters_BlinkAtMaximum.Checked = config.FormHeadquarters.BlinkAtMaximum; FormHeadquarters_Visibility.Items.Clear(); FormHeadquarters_Visibility.Items.AddRange(FormHeadquarters.GetItemNames().ToArray()); FormHeadquarters.CheckVisibilityConfiguration(); for (int i = 0; i < FormHeadquarters_Visibility.Items.Count; i++) { FormHeadquarters_Visibility.SetItemChecked(i, config.FormHeadquarters.Visibility.List[i]); } { FormHeadquarters_DisplayUseItemID.Items.AddRange( ElectronicObserver.Data.KCDatabase.Instance.MasterUseItems.Values .Where(i => i.Name.Length > 0 && i.Description.Length > 0 && !IgnoredItems.Contains(i.ItemID)) .Select(i => i.Name).ToArray()); var item = ElectronicObserver.Data.KCDatabase.Instance.MasterUseItems[config.FormHeadquarters.DisplayUseItemID]; if (item != null) { FormHeadquarters_DisplayUseItemID.Text = item.Name; } else { FormHeadquarters_DisplayUseItemID.Text = config.FormHeadquarters.DisplayUseItemID.ToString(); } } FormQuest_ShowRunningOnly.Checked = config.FormQuest.ShowRunningOnly; FormQuest_ShowOnce.Checked = config.FormQuest.ShowOnce; FormQuest_ShowDaily.Checked = config.FormQuest.ShowDaily; FormQuest_ShowWeekly.Checked = config.FormQuest.ShowWeekly; FormQuest_ShowMonthly.Checked = config.FormQuest.ShowMonthly; FormQuest_ShowOther.Checked = config.FormQuest.ShowOther; FormQuest_ProgressAutoSaving.SelectedIndex = config.FormQuest.ProgressAutoSaving; FormQuest_AllowUserToSortRows.Checked = config.FormQuest.AllowUserToSortRows; FormShipGroup_AutoUpdate.Checked = config.FormShipGroup.AutoUpdate; FormShipGroup_ShowStatusBar.Checked = config.FormShipGroup.ShowStatusBar; FormShipGroup_ShipNameSortMethod.SelectedIndex = config.FormShipGroup.ShipNameSortMethod; FormBattle_IsScrollable.Checked = config.FormBattle.IsScrollable; FormBattle_HideDuringBattle.Checked = config.FormBattle.HideDuringBattle; FormBattle_ShowHPBar.Checked = config.FormBattle.ShowHPBar; FormBattle_ShowShipTypeInHPBar.Checked = config.FormBattle.ShowShipTypeInHPBar; FormBattle_Display7thAsSingleLine.Checked = config.FormBattle.Display7thAsSingleLine; FormBrowser_IsEnabled.Checked = config.FormBrowser.IsEnabled; FormBrowser_ZoomRate.Value = (decimal)Math.Min(Math.Max(config.FormBrowser.ZoomRate * 100, 10), 1000); FormBrowser_ZoomFit.Checked = config.FormBrowser.ZoomFit; FormBrowser_LogInPageURL.Text = config.FormBrowser.LogInPageURL; FormBrowser_ScreenShotFormat_JPEG.Checked = config.FormBrowser.ScreenShotFormat == 1; FormBrowser_ScreenShotFormat_PNG.Checked = config.FormBrowser.ScreenShotFormat == 2; FormBrowser_ScreenShotPath.Text = config.FormBrowser.ScreenShotPath; FormBrowser_ConfirmAtRefresh.Checked = config.FormBrowser.ConfirmAtRefresh; FormBrowser_AppliesStyleSheet.Checked = config.FormBrowser.AppliesStyleSheet; FormBrowser_IsDMMreloadDialogDestroyable.Checked = config.FormBrowser.IsDMMreloadDialogDestroyable; FormBrowser_ScreenShotFormat_AvoidTwitterDeterioration.Checked = config.FormBrowser.AvoidTwitterDeterioration; FormBrowser_ScreenShotSaveMode.SelectedIndex = config.FormBrowser.ScreenShotSaveMode - 1; FormBrowser_HardwareAccelerationEnabled.Checked = config.FormBrowser.HardwareAccelerationEnabled; FormBrowser_PreserveDrawingBuffer.Checked = config.FormBrowser.PreserveDrawingBuffer; FormBrowser_ForceColorProfile.Checked = config.FormBrowser.ForceColorProfile; if (!config.FormBrowser.IsToolMenuVisible) { FormBrowser_ToolMenuDockStyle.SelectedIndex = 4; } else { FormBrowser_ToolMenuDockStyle.SelectedIndex = (int)config.FormBrowser.ToolMenuDockStyle - 1; } FormCompass_CandidateDisplayCount.Value = config.FormCompass.CandidateDisplayCount; FormCompass_IsScrollable.Checked = config.FormCompass.IsScrollable; FormCompass_MaxShipNameWidth.Value = config.FormCompass.MaxShipNameWidth; FormJson_AutoUpdate.Checked = config.FormJson.AutoUpdate; FormJson_UpdatesTree.Checked = config.FormJson.UpdatesTree; FormJson_AutoUpdateFilter.Text = config.FormJson.AutoUpdateFilter; FormBaseAirCorps_ShowEventMapOnly.Checked = config.FormBaseAirCorps.ShowEventMapOnly; //[通知] { bool issilenced = NotifierManager.Instance.GetNotifiers().All(no => no.IsSilenced); Notification_Silencio.Checked = issilenced; setSilencioConfig(issilenced); } //[BGM] BGMPlayer_Enabled.Checked = config.BGMPlayer.Enabled; BGMHandles = config.BGMPlayer.Handles.ToDictionary(h => h.HandleID); BGMPlayer_SyncBrowserMute.Checked = config.BGMPlayer.SyncBrowserMute; UpdateBGMPlayerUI(); //finalize UpdateParameter(); }