/// <summary>
        /// UIをもとに設定を適用します。
        /// </summary>
        public void ToConfiguration(Configuration.ConfigurationData config)
        {
            //[通信]
            {
                bool changed = false;

                changed |= config.Connection.Port != (ushort)Connection_Port.Value;
                config.Connection.Port = (ushort)Connection_Port.Value;

                config.Connection.SaveReceivedData = Connection_SaveReceivedData.Checked;
                config.Connection.SaveDataPath     = Connection_SaveDataPath.Text.Trim(@"\ """.ToCharArray());
                config.Connection.SaveRequest      = Connection_SaveRequest.Checked;
                config.Connection.SaveResponse     = Connection_SaveResponse.Checked;
                config.Connection.SaveSWF          = Connection_SaveSWF.Checked;
                config.Connection.SaveOtherFile    = Connection_SaveOtherFile.Checked;
                config.Connection.ApplyVersion     = Connection_ApplyVersion.Checked;

                changed |= config.Connection.RegisterAsSystemProxy != Connection_RegisterAsSystemProxy.Checked;
                config.Connection.RegisterAsSystemProxy = Connection_RegisterAsSystemProxy.Checked;

                changed |= config.Connection.UseUpstreamProxy != Connection_UseUpstreamProxy.Checked;
                config.Connection.UseUpstreamProxy = Connection_UseUpstreamProxy.Checked;
                changed |= config.Connection.UpstreamProxyPort != (ushort)Connection_UpstreamProxyPort.Value;
                config.Connection.UpstreamProxyPort = (ushort)Connection_UpstreamProxyPort.Value;
                changed |= config.Connection.UpstreamProxyAddress != Connection_UpstreamProxyAddress.Text;
                config.Connection.UpstreamProxyAddress = Connection_UpstreamProxyAddress.Text;

                changed |= config.Connection.UseSystemProxy != Connection_UseSystemProxy.Checked;
                config.Connection.UseSystemProxy = Connection_UseSystemProxy.Checked;

                changed |= config.Connection.DownstreamProxy != Connection_DownstreamProxy.Text;
                config.Connection.DownstreamProxy = Connection_DownstreamProxy.Text;

                if (changed)
                {
                    APIObserver.Instance.Start(config.Connection.Port, _UIControl);
                }
            }

            //[UI]
            config.UI.MainFont         = UI_MainFont.Font;
            config.UI.SubFont          = UI_SubFont.Font;
            config.UI.BarColorMorphing = UI_BarColorMorphing.Checked;

            //[ログ]
            config.Log.LogLevel        = (int)Log_LogLevel.Value;
            config.Log.SaveLogFlag     = Log_SaveLogFlag.Checked;
            config.Log.SaveErrorReport = Log_SaveErrorReport.Checked;
            config.Log.FileEncodingID  = Log_FileEncodingID.SelectedIndex;
            config.Log.ShowSpoiler     = Log_ShowSpoiler.Checked;

            //[動作]
            config.Control.ConditionBorder     = (int)Control_ConditionBorder.Value;
            config.Control.RecordAutoSaving    = Control_RecordAutoSaving.SelectedIndex;
            config.Control.UseSystemVolume     = Control_UseSystemVolume.Checked;
            config.Control.PowerEngagementForm = Control_PowerEngagementForm.SelectedIndex + 1;

            //[デバッグ]
            config.Debug.EnableDebugMenu   = Debug_EnableDebugMenu.Checked;
            config.Debug.LoadAPIListOnLoad = Debug_LoadAPIListOnLoad.Checked;
            config.Debug.APIListPath       = Debug_APIListPath.Text;
            config.Debug.AlertOnError      = Debug_AlertOnError.Checked;

            //[起動と終了]
            config.Life.ConfirmOnClosing          = Life_ConfirmOnClosing.Checked;
            config.Life.TopMost                   = Life_TopMost.Checked;
            config.Life.LayoutFilePath            = Life_LayoutFilePath.Text;
            config.Life.CheckUpdateInformation    = Life_CheckUpdateInformation.Checked;
            config.Life.ShowStatusBar             = Life_ShowStatusBar.Checked;
            config.Life.ClockFormat               = Life_ClockFormat.SelectedIndex;
            config.Life.LockLayout                = Life_LockLayout.Checked;
            config.Life.CanCloseFloatWindowInLock = Life_CanCloseFloatWindowInLock.Checked;

            //[サブウィンドウ]
            config.FormArsenal.ShowShipName      = FormArsenal_ShowShipName.Checked;
            config.FormArsenal.BlinkAtCompletion = FormArsenal_BlinkAtCompletion.Checked;

            config.FormDock.BlinkAtCompletion = FormDock_BlinkAtCompletion.Checked;

            config.FormFleet.ShowAircraft                = FormFleet_ShowAircraft.Checked;
            config.FormFleet.SearchingAbilityMethod      = FormFleet_SearchingAbilityMethod.SelectedIndex;
            config.FormFleet.IsScrollable                = FormFleet_IsScrollable.Checked;
            config.FormFleet.FixShipNameWidth            = FormFleet_FixShipNameWidth.Checked;
            config.FormFleet.ShortenHPBar                = FormFleet_ShortenHPBar.Checked;
            config.FormFleet.ShowNextExp                 = FormFleet_ShowNextExp.Checked;
            config.FormFleet.EquipmentLevelVisibility    = (Window.Control.ShipStatusEquipment.LevelVisibilityFlag)FormFleet_EquipmentLevelVisibility.SelectedIndex;
            config.FormFleet.AirSuperiorityMethod        = FormFleet_AirSuperiorityMethod.SelectedIndex;
            config.FormFleet.ShowAnchorageRepairingTimer = FormFleet_ShowAnchorageRepairingTimer.Checked;
            config.FormFleet.BlinkAtCompletion           = FormFleet_BlinkAtCompletion.Checked;
            config.FormFleet.ShowConditionIcon           = FormFleet_ShowConditionIcon.Checked;

            config.FormHeadquarters.BlinkAtMaximum = FormHeadquarters_BlinkAtMaximum.Checked;
            {
                var list = new List <bool>();
                for (int i = 0; i < FormHeadquarters_Visibility.Items.Count; i++)
                {
                    list.Add(FormHeadquarters_Visibility.GetItemChecked(i));
                }
                config.FormHeadquarters.Visibility.List = list;
            }
            {
                string name = FormHeadquarters_DisplayUseItemID.Text;
                if (string.IsNullOrEmpty(name))
                {
                    config.FormHeadquarters.DisplayUseItemID = -1;
                }
                else
                {
                    var item = ElectronicObserver.Data.KCDatabase.Instance.MasterUseItems.Values.FirstOrDefault(p => p.Name == name);

                    if (item != null)
                    {
                        config.FormHeadquarters.DisplayUseItemID = item.ItemID;
                    }
                    else
                    {
                        int val;
                        if (int.TryParse(name, out val))
                        {
                            config.FormHeadquarters.DisplayUseItemID = val;
                        }
                        else
                        {
                            config.FormHeadquarters.DisplayUseItemID = -1;
                        }
                    }
                }
            }

            config.FormQuest.ShowRunningOnly     = FormQuest_ShowRunningOnly.Checked;
            config.FormQuest.ShowOnce            = FormQuest_ShowOnce.Checked;
            config.FormQuest.ShowDaily           = FormQuest_ShowDaily.Checked;
            config.FormQuest.ShowWeekly          = FormQuest_ShowWeekly.Checked;
            config.FormQuest.ShowMonthly         = FormQuest_ShowMonthly.Checked;
            config.FormQuest.ShowOther           = FormQuest_ShowOther.Checked;
            config.FormQuest.ProgressAutoSaving  = FormQuest_ProgressAutoSaving.SelectedIndex;
            config.FormQuest.AllowUserToSortRows = FormQuest_AllowUserToSortRows.Checked;

            config.FormShipGroup.AutoUpdate         = FormShipGroup_AutoUpdate.Checked;
            config.FormShipGroup.ShowStatusBar      = FormShipGroup_ShowStatusBar.Checked;
            config.FormShipGroup.ShipNameSortMethod = FormShipGroup_ShipNameSortMethod.SelectedIndex;

            config.FormBattle.IsScrollable = FormBattle_IsScrollable.Checked;

            config.FormBrowser.IsEnabled    = FormBrowser_IsEnabled.Checked;
            config.FormBrowser.ZoomRate     = (int)FormBrowser_ZoomRate.Value;
            config.FormBrowser.ZoomFit      = FormBrowser_ZoomFit.Checked;
            config.FormBrowser.LogInPageURL = FormBrowser_LogInPageURL.Text;
            if (FormBrowser_ScreenShotFormat_JPEG.Checked)
            {
                config.FormBrowser.ScreenShotFormat = 1;
            }
            else
            {
                config.FormBrowser.ScreenShotFormat = 2;
            }
            config.FormBrowser.ScreenShotPath    = FormBrowser_ScreenShotPath.Text;
            config.FormBrowser.ConfirmAtRefresh  = FormBrowser_ConfirmAtRefresh.Checked;
            config.FormBrowser.AppliesStyleSheet = FormBrowser_AppliesStyleSheet.Checked;
            config.FormBrowser.FlashQuality      = FormBrowser_FlashQuality.Text;
            config.FormBrowser.FlashWMode        = FormBrowser_FlashWMode.Text;
            if (FormBrowser_ToolMenuDockStyle.SelectedIndex == 4)
            {
                config.FormBrowser.IsToolMenuVisible = false;
            }
            else
            {
                config.FormBrowser.IsToolMenuVisible = true;
                config.FormBrowser.ToolMenuDockStyle = (DockStyle)(FormBrowser_ToolMenuDockStyle.SelectedIndex + 1);
            }

            config.FormCompass.CandidateDisplayCount = (int)FormCompass_CandidateDisplayCount.Value;

            config.FormJson.AutoUpdate       = FormJson_AutoUpdate.Checked;
            config.FormJson.UpdatesTree      = FormJson_UpdatesTree.Checked;
            config.FormJson.AutoUpdateFilter = FormJson_AutoUpdateFilter.Text;

            //[通知]
            setSilencioConfig(Notification_Silencio.Checked);

            //[データベース]
            config.Connection.SendDataToKancolleDB = Database_SendDataToKancolleDB.Checked;
            config.Connection.SendKancolleOAuth    = Database_SendKancolleOAuth.Text;

            //[BGM]
            config.BGMPlayer.Enabled = BGMPlayer_Enabled.Checked;
            for (int i = 0; i < BGMPlayer_ControlGrid.Rows.Count; i++)
            {
                BGMHandles[(SyncBGMPlayer.SoundHandleID)BGMPlayer_ControlGrid[BGMPlayer_ColumnContent.Index, i].Value].Enabled = (bool)BGMPlayer_ControlGrid[BGMPlayer_ColumnEnabled.Index, i].Value;
            }
            config.BGMPlayer.Handles         = new List <SyncBGMPlayer.SoundHandle>(BGMHandles.Values.ToList());
            config.BGMPlayer.SyncBrowserMute = BGMPlayer_SyncBrowserMute.Checked;
        }
        /// <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();
        }
 public DialogConfiguration(Configuration.ConfigurationData config)
     : this()
 {
     FromConfiguration(config);
 }
        /// <summary>
        /// UIをもとに設定を適用します。
        /// </summary>
        public void ToConfiguration(Configuration.ConfigurationData config)
        {
            //[通信]
            {
                bool changed = false;

                changed |= config.Connection.Port != (ushort)Connection_Port.Value;
                config.Connection.Port = (ushort)Connection_Port.Value;

                config.Connection.SaveReceivedData = Connection_SaveReceivedData.Checked;
                config.Connection.SaveDataFilter   = Connection_SaveDataFilter.Text;
                config.Connection.SaveDataPath     = Connection_SaveDataPath.Text.Trim(@"\ """.ToCharArray());
                config.Connection.SaveRequest      = Connection_SaveRequest.Checked;
                config.Connection.SaveResponse     = Connection_SaveResponse.Checked;
                config.Connection.SaveSWF          = Connection_SaveSWF.Checked;
                config.Connection.SaveOtherFile    = Connection_SaveOtherFile.Checked;
                config.Connection.ApplyVersion     = Connection_ApplyVersion.Checked;

                changed |= config.Connection.RegisterAsSystemProxy != Connection_RegisterAsSystemProxy.Checked;
                config.Connection.RegisterAsSystemProxy = Connection_RegisterAsSystemProxy.Checked;

                config.Connection.UseUpstreamProxy  = Connection_UseUpstreamProxy.Checked;
                config.Connection.UpstreamProxyPort = (ushort)Connection_UpstreamProxyPort.Value;

                if (changed)
                {
                    APIObserver.Instance.Stop();
                    APIObserver.Instance.Start(config.Connection.Port, this);
                }
            }

            //[UI]
            config.UI.MainFont = UI_MainFont.Font;
            config.UI.SubFont  = UI_SubFont.Font;

            //[ログ]
            config.Log.LogLevel        = (int)Log_LogLevel.Value;
            config.Log.SaveLogFlag     = Log_SaveLogFlag.Checked;
            config.Log.SaveErrorReport = Log_SaveErrorReport.Checked;
            config.Log.FileEncodingID  = Log_FileEncodingID.SelectedIndex;

            //[動作]
            config.Control.ConditionBorder = (int)Control_ConditionBorder.Value;

            //[デバッグ]
            config.Debug.EnableDebugMenu   = Debug_EnableDebugMenu.Checked;
            config.Debug.LoadAPIListOnLoad = Debug_LoadAPIListOnLoad.Checked;
            config.Debug.APIListPath       = Debug_APIListPath.Text;

            //[起動と終了]
            config.Life.ConfirmOnClosing       = Life_ConfirmOnClosing.Checked;
            config.Life.TopMost                = Life_TopMost.Checked;
            config.Life.LayoutFilePath         = Life_LayoutFilePath.Text;
            config.Life.CheckUpdateInformation = Life_CheckUpdateInformation.Checked;

            //[サブウィンドウ]
            config.FormArsenal.ShowShipName = FormArsenal_ShowShipName.Checked;

            config.FormFleet.ShowAircraft           = FormFleet_ShowAircraft.Checked;
            config.FormFleet.SearchingAbilityMethod = FormFleet_SearchingAbilityMethod.SelectedIndex;
            config.FormFleet.IsScrollable           = FormFleet_IsScrollable.Checked;
            config.FormFleet.FixShipNameWidth       = FormFleet_FixShipNameWidth.Checked;
            config.FormFleet.ShortenHPBar           = FormFleet_ShortenHPBar.Checked;
            config.FormFleet.ShowNextExp            = FormFleet_ShowNextExp.Checked;

            config.FormQuest.ShowRunningOnly = FormQuest_ShowRunningOnly.Checked;
            config.FormQuest.ShowOnce        = FormQuest_ShowOnce.Checked;
            config.FormQuest.ShowDaily       = FormQuest_ShowDaily.Checked;
            config.FormQuest.ShowWeekly      = FormQuest_ShowWeekly.Checked;
            config.FormQuest.ShowMonthly     = FormQuest_ShowMonthly.Checked;

            config.FormShipGroup.AutoUpdate    = FormShipGroup_AutoUpdate.Checked;
            config.FormShipGroup.ShowStatusBar = FormShipGroup_ShowStatusBar.Checked;

            config.FormBrowser.IsEnabled    = FormBrowser_IsEnabled.Checked;
            config.FormBrowser.ZoomRate     = (int)FormBrowser_ZoomRate.Value;
            config.FormBrowser.LogInPageURL = FormBrowser_LogInPageURL.Text;
            if (FormBrowser_ScreenShotFormat_JPEG.Checked)
            {
                config.FormBrowser.ScreenShotFormat = 1;
            }
            else
            {
                config.FormBrowser.ScreenShotFormat = 2;
            }
            config.FormBrowser.ScreenShotPath    = FormBrowser_ScreenShotPath.Text;
            config.FormBrowser.ConfirmAtRefresh  = FormBrowser_ConfirmAtRefresh.Checked;
            config.FormBrowser.AppliesStyleSheet = FormBrowser_AppliesStyleSheet.Checked;
        }
        /// <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();
        }
        /// <summary>
        /// 設定からUIを初期化します。
        /// </summary>
        public void FromConfiguration(Configuration.ConfigurationData config)
        {
            //[通信]
            Connection_Port.Value = config.Connection.Port;
            Connection_SaveReceivedData.Checked      = config.Connection.SaveReceivedData;
            Connection_SaveDataFilter.Text           = config.Connection.SaveDataFilter;
            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;

            //[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;

            //[ログ]
            Log_LogLevel.Value               = config.Log.LogLevel;
            Log_SaveLogFlag.Checked          = config.Log.SaveLogFlag;
            Log_SaveErrorReport.Checked      = config.Log.SaveErrorReport;
            Log_FileEncodingID.SelectedIndex = config.Log.FileEncodingID;

            //[動作]
            Control_ConditionBorder.Value = config.Control.ConditionBorder;

            //[デバッグ]
            Debug_EnableDebugMenu.Checked   = config.Debug.EnableDebugMenu;
            Debug_LoadAPIListOnLoad.Checked = config.Debug.LoadAPIListOnLoad;
            Debug_APIListPath.Text          = config.Debug.APIListPath;

            //[起動と終了]
            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;

            //[サブウィンドウ]
            FormArsenal_ShowShipName.Checked = config.FormArsenal.ShowShipName;

            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;

            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;

            FormShipGroup_AutoUpdate.Checked    = config.FormShipGroup.AutoUpdate;
            FormShipGroup_ShowStatusBar.Checked = config.FormShipGroup.ShowStatusBar;

            FormBrowser_IsEnabled.Checked             = config.FormBrowser.IsEnabled;
            FormBrowser_ZoomRate.Value                = config.FormBrowser.ZoomRate;
            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;

            //finalize
            UpdateParameter();
        }
Example #7
0
        /// <summary>
        /// UIをもとに設定を適用します。
        /// </summary>
        public void ToConfiguration(Configuration.ConfigurationData config)
        {
            //[通信]
            {
                bool changed = false;

                changed |= config.Connection.Port != (ushort)Connection_Port.Value;
                config.Connection.Port = (ushort)Connection_Port.Value;

                config.Connection.SaveReceivedData = Connection_SaveReceivedData.Checked;
                config.Connection.SaveDataPath     = Connection_SaveDataPath.Text.Trim(@"\ """.ToCharArray());
                config.Connection.SaveRequest      = Connection_SaveRequest.Checked;
                config.Connection.SaveResponse     = Connection_SaveResponse.Checked;
                config.Connection.SaveOtherFile    = Connection_SaveOtherFile.Checked;
                config.Connection.ApplyVersion     = Connection_ApplyVersion.Checked;

                changed |= config.Connection.RegisterAsSystemProxy != Connection_RegisterAsSystemProxy.Checked;
                config.Connection.RegisterAsSystemProxy = Connection_RegisterAsSystemProxy.Checked;

                changed |= config.Connection.UseUpstreamProxy != Connection_UseUpstreamProxy.Checked;
                config.Connection.UseUpstreamProxy = Connection_UseUpstreamProxy.Checked;
                changed |= config.Connection.UpstreamProxyPort != (ushort)Connection_UpstreamProxyPort.Value;
                config.Connection.UpstreamProxyPort = (ushort)Connection_UpstreamProxyPort.Value;
                changed |= config.Connection.UpstreamProxyAddress != Connection_UpstreamProxyAddress.Text;
                config.Connection.UpstreamProxyAddress = Connection_UpstreamProxyAddress.Text;

                changed |= config.Connection.UseSystemProxy != Connection_UseSystemProxy.Checked;
                config.Connection.UseSystemProxy = Connection_UseSystemProxy.Checked;

                changed |= config.Connection.DownstreamProxy != Connection_DownstreamProxy.Text;
                config.Connection.DownstreamProxy = Connection_DownstreamProxy.Text;

                if (changed)
                {
                    APIObserver.Instance.Start(config.Connection.Port, _UIControl);
                }
            }

            //[UI]
            {
                var newfont = SerializableFont.StringToFont(UI_MainFont.Text, true);
                if (newfont != null)
                {
                    config.UI.MainFont = newfont;
                }
            }
            {
                var newfont = SerializableFont.StringToFont(UI_SubFont.Text, true);
                if (newfont != null)
                {
                    config.UI.SubFont = newfont;
                }
            }
            config.UI.BarColorMorphing      = UI_BarColorMorphing.Checked;
            config.UI.JapaneseShipName      = UI_JapaneseShipNames.Checked;
            config.UI.JapaneseShipType      = UI_JapaneseShipTypes.Checked;
            config.UI.JapaneseEquipmentName = UI_JapaneseEquipmentNames.Checked;
            config.UI.JapaneseEquipmentType = UI_JapaneseEquipmentTypes.Checked;
            config.UI.UseOriginalNodeId     = !UI_NodeNumbering.Checked;
            config.UI.ThemeMode             = comboBox1.SelectedIndex;

            config.UI.IsLayoutFixed = UI_IsLayoutFixed.Checked;

            //[ログ]
            config.Log.LogLevel           = (int)Log_LogLevel.Value;
            config.Log.SaveLogFlag        = Log_SaveLogFlag.Checked;
            config.Log.SaveErrorReport    = Log_SaveErrorReport.Checked;
            config.Log.FileEncodingID     = Log_FileEncodingID.SelectedIndex;
            config.Log.ShowSpoiler        = Log_ShowSpoiler.Checked;
            config.Log.SaveBattleLog      = Log_SaveBattleLog.Checked;
            config.Log.SaveLogImmediately = Log_SaveLogImmediately.Checked;

            //[動作]
            config.Control.ConditionBorder           = (int)Control_ConditionBorder.Value;
            config.Control.RecordAutoSaving          = Control_RecordAutoSaving.SelectedIndex;
            config.Control.UseSystemVolume           = Control_UseSystemVolume.Checked;
            config.Control.PowerEngagementForm       = Control_PowerEngagementForm.SelectedIndex + 1;
            config.Control.ShowSallyAreaAlertDialog  = Control_ShowSallyAreaAlertDialog.Checked;
            config.Control.ShowExpeditionAlertDialog = Control_ShowExpeditionAlertDialog.Checked;
            config.Control.EnableDiscordRPC          = Control_EnableDiscordRPC.Checked;
            config.Control.DiscordRPCMessage         = Control_DiscordRPCMessage.Text;
            config.Control.DiscordRPCShowFCM         = Control_DiscordRPCShowFCM.Checked;


            //[デバッグ]
            config.Debug.EnableDebugMenu   = Debug_EnableDebugMenu.Checked;
            config.Debug.LoadAPIListOnLoad = Debug_LoadAPIListOnLoad.Checked;
            config.Debug.APIListPath       = Debug_APIListPath.Text;
            config.Debug.AlertOnError      = Debug_AlertOnError.Checked;

            //[起動と終了]
            config.Life.ConfirmOnClosing          = Life_ConfirmOnClosing.Checked;
            config.Life.TopMost                   = Life_TopMost.Checked;
            config.Life.LayoutFilePath            = Life_LayoutFilePath.Text;
            config.Life.CheckUpdateInformation    = Life_CheckUpdateInformation.Checked;
            config.Life.ShowStatusBar             = Life_ShowStatusBar.Checked;
            config.Life.ClockFormat               = Life_ClockFormat.SelectedIndex;
            config.Life.LockLayout                = Life_LockLayout.Checked;
            config.Life.CanCloseFloatWindowInLock = Life_CanCloseFloatWindowInLock.Checked;

            //[サブウィンドウ]
            config.FormArsenal.ShowShipName      = FormArsenal_ShowShipName.Checked;
            config.FormArsenal.BlinkAtCompletion = FormArsenal_BlinkAtCompletion.Checked;
            config.FormArsenal.MaxShipNameWidth  = (int)FormArsenal_MaxShipNameWidth.Value;

            config.FormDock.BlinkAtCompletion = FormDock_BlinkAtCompletion.Checked;
            config.FormDock.MaxShipNameWidth  = (int)FormDock_MaxShipNameWidth.Value;

            config.FormFleet.ShowAircraft                  = FormFleet_ShowAircraft.Checked;
            config.FormFleet.SearchingAbilityMethod        = FormFleet_SearchingAbilityMethod.SelectedIndex;
            config.FormFleet.IsScrollable                  = FormFleet_IsScrollable.Checked;
            config.FormFleet.FixShipNameWidth              = FormFleet_FixShipNameWidth.Checked;
            config.FormFleet.ShortenHPBar                  = FormFleet_ShortenHPBar.Checked;
            config.FormFleet.ShowNextExp                   = FormFleet_ShowNextExp.Checked;
            config.FormFleet.EquipmentLevelVisibility      = (Window.Control.ShipStatusEquipment.LevelVisibilityFlag)FormFleet_EquipmentLevelVisibility.SelectedIndex;
            config.FormFleet.ShowAircraftLevelByNumber     = FormFleet_ShowAircraftLevelByNumber.Checked;
            config.FormFleet.AirSuperiorityMethod          = FormFleet_AirSuperiorityMethod.SelectedIndex;
            config.FormFleet.ShowAnchorageRepairingTimer   = FormFleet_ShowAnchorageRepairingTimer.Checked;
            config.FormFleet.BlinkAtCompletion             = FormFleet_BlinkAtCompletion.Checked;
            config.FormFleet.ShowConditionIcon             = FormFleet_ShowConditionIcon.Checked;
            config.FormFleet.FixedShipNameWidth            = (int)FormFleet_FixedShipNameWidth.Value;
            config.FormFleet.ShowAirSuperiorityRange       = FormFleet_ShowAirSuperiorityRange.Checked;
            config.FormFleet.ReflectAnchorageRepairHealing = FormFleet_ReflectAnchorageRepairHealing.Checked;
            config.FormFleet.BlinkAtDamaged                = FormFleet_BlinkAtDamaged.Checked;
            config.FormFleet.EmphasizesSubFleetInPort      = FormFleet_EmphasizesSubFleetInPort.Checked;
            config.FormFleet.FleetStateDisplayMode         = FormFleet_FleetStateDisplayMode.SelectedIndex;
            config.FormFleet.AppliesSallyAreaColor         = FormFleet_AppliesSallyAreaColor.Checked;

            config.FormHeadquarters.BlinkAtMaximum = FormHeadquarters_BlinkAtMaximum.Checked;
            {
                var list = new List <bool>();
                for (int i = 0; i < FormHeadquarters_Visibility.Items.Count; i++)
                {
                    list.Add(FormHeadquarters_Visibility.GetItemChecked(i));
                }
                config.FormHeadquarters.Visibility.List = list;
            }
            {
                string name = FormHeadquarters_DisplayUseItemID.Text;
                if (string.IsNullOrEmpty(name))
                {
                    config.FormHeadquarters.DisplayUseItemID = -1;
                }
                else
                {
                    var item = ElectronicObserver.Data.KCDatabase.Instance.MasterUseItems.Values.FirstOrDefault(p => p.Name == name);

                    if (item != null)
                    {
                        config.FormHeadquarters.DisplayUseItemID = item.ItemID;
                    }
                    else
                    {
                        if (int.TryParse(name, out int val))
                        {
                            config.FormHeadquarters.DisplayUseItemID = val;
                        }
                        else
                        {
                            config.FormHeadquarters.DisplayUseItemID = -1;
                        }
                    }
                }
            }

            config.FormQuest.ShowRunningOnly     = FormQuest_ShowRunningOnly.Checked;
            config.FormQuest.ShowOnce            = FormQuest_ShowOnce.Checked;
            config.FormQuest.ShowDaily           = FormQuest_ShowDaily.Checked;
            config.FormQuest.ShowWeekly          = FormQuest_ShowWeekly.Checked;
            config.FormQuest.ShowMonthly         = FormQuest_ShowMonthly.Checked;
            config.FormQuest.ShowOther           = FormQuest_ShowOther.Checked;
            config.FormQuest.ProgressAutoSaving  = FormQuest_ProgressAutoSaving.SelectedIndex;
            config.FormQuest.AllowUserToSortRows = FormQuest_AllowUserToSortRows.Checked;

            config.FormShipGroup.AutoUpdate         = FormShipGroup_AutoUpdate.Checked;
            config.FormShipGroup.ShowStatusBar      = FormShipGroup_ShowStatusBar.Checked;
            config.FormShipGroup.ShipNameSortMethod = FormShipGroup_ShipNameSortMethod.SelectedIndex;

            config.FormBattle.IsScrollable           = FormBattle_IsScrollable.Checked;
            config.FormBattle.HideDuringBattle       = FormBattle_HideDuringBattle.Checked;
            config.FormBattle.ShowHPBar              = FormBattle_ShowHPBar.Checked;
            config.FormBattle.ShowShipTypeInHPBar    = FormBattle_ShowShipTypeInHPBar.Checked;
            config.FormBattle.Display7thAsSingleLine = FormBattle_Display7thAsSingleLine.Checked;

            config.FormBrowser.IsEnabled    = FormBrowser_IsEnabled.Checked;
            config.FormBrowser.ZoomRate     = (double)FormBrowser_ZoomRate.Value / 100;
            config.FormBrowser.ZoomFit      = FormBrowser_ZoomFit.Checked;
            config.FormBrowser.LogInPageURL = FormBrowser_LogInPageURL.Text;
            if (FormBrowser_ScreenShotFormat_JPEG.Checked)
            {
                config.FormBrowser.ScreenShotFormat = 1;
            }
            else
            {
                config.FormBrowser.ScreenShotFormat = 2;
            }
            config.FormBrowser.ScreenShotPath               = FormBrowser_ScreenShotPath.Text;
            config.FormBrowser.ConfirmAtRefresh             = FormBrowser_ConfirmAtRefresh.Checked;
            config.FormBrowser.AppliesStyleSheet            = FormBrowser_AppliesStyleSheet.Checked;
            config.FormBrowser.IsDMMreloadDialogDestroyable = FormBrowser_IsDMMreloadDialogDestroyable.Checked;
            config.FormBrowser.AvoidTwitterDeterioration    = FormBrowser_ScreenShotFormat_AvoidTwitterDeterioration.Checked;
            config.FormBrowser.HardwareAccelerationEnabled  = FormBrowser_HardwareAccelerationEnabled.Checked;
            config.FormBrowser.PreserveDrawingBuffer        = FormBrowser_PreserveDrawingBuffer.Checked;
            config.FormBrowser.ForceColorProfile            = FormBrowser_ForceColorProfile.Checked;
            config.FormBrowser.SavesBrowserLog              = FormBrowser_SavesBrowserLog.Checked;
            if (FormBrowser_ToolMenuDockStyle.SelectedIndex == 4)
            {
                config.FormBrowser.IsToolMenuVisible = false;
            }
            else
            {
                config.FormBrowser.IsToolMenuVisible = true;
                config.FormBrowser.ToolMenuDockStyle = (DockStyle)(FormBrowser_ToolMenuDockStyle.SelectedIndex + 1);
            }
            config.FormBrowser.ScreenShotSaveMode = FormBrowser_ScreenShotSaveMode.SelectedIndex + 1;

            config.FormCompass.CandidateDisplayCount = (int)FormCompass_CandidateDisplayCount.Value;
            config.FormCompass.IsScrollable          = FormCompass_IsScrollable.Checked;
            config.FormCompass.MaxShipNameWidth      = (int)FormCompass_MaxShipNameWidth.Value;

            config.FormJson.AutoUpdate       = FormJson_AutoUpdate.Checked;
            config.FormJson.UpdatesTree      = FormJson_UpdatesTree.Checked;
            config.FormJson.AutoUpdateFilter = FormJson_AutoUpdateFilter.Text;

            config.FormBaseAirCorps.ShowEventMapOnly = FormBaseAirCorps_ShowEventMapOnly.Checked;


            //[通知]
            setSilencioConfig(Notification_Silencio.Checked);

            //[BGM]
            config.BGMPlayer.Enabled = BGMPlayer_Enabled.Checked;
            for (int i = 0; i < BGMPlayer_ControlGrid.Rows.Count; i++)
            {
                BGMHandles[(SyncBGMPlayer.SoundHandleID)BGMPlayer_ControlGrid[BGMPlayer_ColumnContent.Index, i].Value].Enabled = (bool)BGMPlayer_ControlGrid[BGMPlayer_ColumnEnabled.Index, i].Value;
            }
            config.BGMPlayer.Handles         = new List <SyncBGMPlayer.SoundHandle>(BGMHandles.Values.ToList());
            config.BGMPlayer.SyncBrowserMute = BGMPlayer_SyncBrowserMute.Checked;
        }
        /// <summary>
        /// 設定からUIを初期化します。
        /// </summary>
        public void FromConfiguration(Configuration.ConfigurationData config)
        {
            //[通信]
            Connection_Port.Value = config.Connection.Port;
            Connection_SaveReceivedData.Checked      = config.Connection.SaveReceivedData;
            Connection_SaveDataFilter.Text           = config.Connection.SaveDataFilter;
            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;

            //[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;

            //[ログ]
            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;

            //[動作]
            Control_ConditionBorder.Value = config.Control.ConditionBorder;

            //[デバッグ]
            Debug_EnableDebugMenu.Checked   = config.Debug.EnableDebugMenu;
            Debug_LoadAPIListOnLoad.Checked = config.Debug.LoadAPIListOnLoad;
            Debug_APIListPath.Text          = config.Debug.APIListPath;

            //[起動と終了]
            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;

            //[サブウィンドウ]
            FormArsenal_ShowShipName.Checked = config.FormArsenal.ShowShipName;

            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_ShowEquipmentLevel.Checked         = config.FormFleet.ShowEquipmentLevel;
            FormFleet_AirSuperiorityMethod.SelectedIndex = config.FormFleet.AirSuperiorityMethod;

            FormHeadquarters_BlinkAtMaximum.Checked = config.FormHeadquarters.BlinkAtMaximum;

            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;

            FormShipGroup_AutoUpdate.Checked    = config.FormShipGroup.AutoUpdate;
            FormShipGroup_ShowStatusBar.Checked = config.FormShipGroup.ShowStatusBar;

            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();
                    }
                    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;

            //[データベース]
            Database_SendDataToKancolleDB.Checked = config.Connection.SendDataToKancolleDB;
            Database_SendKancolleOAuth.Text       = config.Connection.SendKancolleOAuth;


            //finalize
            UpdateParameter();
        }
Example #9
0
        /// <summary>
        /// UIをもとに設定を適用します。
        /// </summary>
        public void ToConfiguration(Configuration.ConfigurationData config)
        {
            //[通信]
            {
                bool changed = false;

                changed |= config.Connection.Port != (ushort)Connection_Port.Value;
                config.Connection.Port = (ushort)Connection_Port.Value;

                config.Connection.SaveReceivedData = Connection_SaveReceivedData.Checked;
                config.Connection.SaveDataPath     = Connection_SaveDataPath.Text.Trim(@"\ """.ToCharArray());
                config.Connection.SaveRequest      = Connection_SaveRequest.Checked;
                config.Connection.SaveResponse     = Connection_SaveResponse.Checked;
                config.Connection.SaveSWF          = Connection_SaveSWF.Checked;
                config.Connection.SaveOtherFile    = Connection_SaveOtherFile.Checked;
                config.Connection.ApplyVersion     = Connection_ApplyVersion.Checked;

                changed |= config.Connection.RegisterAsSystemProxy != Connection_RegisterAsSystemProxy.Checked;
                config.Connection.RegisterAsSystemProxy = Connection_RegisterAsSystemProxy.Checked;

                changed |= config.Connection.UseUpstreamProxy != Connection_UseUpstreamProxy.Checked;
                config.Connection.UseUpstreamProxy = Connection_UseUpstreamProxy.Checked;
                changed |= config.Connection.UpstreamProxyPort != (ushort)Connection_UpstreamProxyPort.Value;
                config.Connection.UpstreamProxyPort = (ushort)Connection_UpstreamProxyPort.Value;
                changed |= config.Connection.UpstreamProxyAddress != Connection_UpstreamProxyAddress.Text;
                config.Connection.UpstreamProxyAddress = Connection_UpstreamProxyAddress.Text;

                changed |= config.Connection.UseSystemProxy != Connection_UseSystemProxy.Checked;
                config.Connection.UseSystemProxy = Connection_UseSystemProxy.Checked;

                changed |= config.Connection.DownstreamProxy != Connection_DownstreamProxy.Text;
                config.Connection.DownstreamProxy = Connection_DownstreamProxy.Text;

                if (changed)
                {
                    APIObserver.Instance.Start(config.Connection.Port, _UIControl);
                }
            }

            //[UI]
            config.UI.MainFont         = UI_MainFont.Font;
            config.UI.SubFont          = UI_SubFont.Font;
            config.UI.BarColorMorphing = UI_BarColorMorphing.Checked;

            //[ログ]
            config.Log.LogLevel        = (int)Log_LogLevel.Value;
            config.Log.SaveLogFlag     = Log_SaveLogFlag.Checked;
            config.Log.SaveErrorReport = Log_SaveErrorReport.Checked;
            config.Log.FileEncodingID  = Log_FileEncodingID.SelectedIndex;
            config.Log.ShowSpoiler     = Log_ShowSpoiler.Checked;

            //[動作]
            config.Control.ConditionBorder  = (int)Control_ConditionBorder.Value;
            config.Control.RecordAutoSaving = Control_RecordAutoSaving.SelectedIndex;
            config.Control.UseSystemVolume  = Control_UseSystemVolume.Checked;

            //[デバッグ]
            config.Debug.EnableDebugMenu   = Debug_EnableDebugMenu.Checked;
            config.Debug.LoadAPIListOnLoad = Debug_LoadAPIListOnLoad.Checked;
            config.Debug.APIListPath       = Debug_APIListPath.Text;
            config.Debug.AlertOnError      = Debug_AlertOnError.Checked;

            //[起動と終了]
            config.Life.ConfirmOnClosing          = Life_ConfirmOnClosing.Checked;
            config.Life.TopMost                   = Life_TopMost.Checked;
            config.Life.LayoutFilePath            = Life_LayoutFilePath.Text;
            config.Life.CheckUpdateInformation    = Life_CheckUpdateInformation.Checked;
            config.Life.ShowStatusBar             = Life_ShowStatusBar.Checked;
            config.Life.ClockFormat               = Life_ClockFormat.SelectedIndex;
            config.Life.LockLayout                = Life_LockLayout.Checked;
            config.Life.CanCloseFloatWindowInLock = Life_CanCloseFloatWindowInLock.Checked;

            //[サブウィンドウ]
            config.FormArsenal.ShowShipName = FormArsenal_ShowShipName.Checked;

            config.FormFleet.ShowAircraft                = FormFleet_ShowAircraft.Checked;
            config.FormFleet.SearchingAbilityMethod      = FormFleet_SearchingAbilityMethod.SelectedIndex;
            config.FormFleet.IsScrollable                = FormFleet_IsScrollable.Checked;
            config.FormFleet.FixShipNameWidth            = FormFleet_FixShipNameWidth.Checked;
            config.FormFleet.ShortenHPBar                = FormFleet_ShortenHPBar.Checked;
            config.FormFleet.ShowNextExp                 = FormFleet_ShowNextExp.Checked;
            config.FormFleet.ShowEquipmentLevel          = FormFleet_ShowEquipmentLevel.Checked;
            config.FormFleet.AirSuperiorityMethod        = FormFleet_AirSuperiorityMethod.SelectedIndex;
            config.FormFleet.ShowAnchorageRepairingTimer = FormFleet_ShowAnchorageRepairingTimer.Checked;

            config.FormHeadquarters.BlinkAtMaximum = FormHeadquarters_BlinkAtMaximum.Checked;

            config.FormQuest.ShowRunningOnly = FormQuest_ShowRunningOnly.Checked;
            config.FormQuest.ShowOnce        = FormQuest_ShowOnce.Checked;
            config.FormQuest.ShowDaily       = FormQuest_ShowDaily.Checked;
            config.FormQuest.ShowWeekly      = FormQuest_ShowWeekly.Checked;
            config.FormQuest.ShowMonthly     = FormQuest_ShowMonthly.Checked;

            config.FormShipGroup.AutoUpdate    = FormShipGroup_AutoUpdate.Checked;
            config.FormShipGroup.ShowStatusBar = FormShipGroup_ShowStatusBar.Checked;

            config.FormBrowser.IsEnabled    = FormBrowser_IsEnabled.Checked;
            config.FormBrowser.ZoomRate     = (int)FormBrowser_ZoomRate.Value;
            config.FormBrowser.ZoomFit      = FormBrowser_ZoomFit.Checked;
            config.FormBrowser.LogInPageURL = FormBrowser_LogInPageURL.Text;
            if (FormBrowser_ScreenShotFormat_JPEG.Checked)
            {
                config.FormBrowser.ScreenShotFormat = 1;
            }
            else
            {
                config.FormBrowser.ScreenShotFormat = 2;
            }
            config.FormBrowser.ScreenShotPath    = FormBrowser_ScreenShotPath.Text;
            config.FormBrowser.ConfirmAtRefresh  = FormBrowser_ConfirmAtRefresh.Checked;
            config.FormBrowser.AppliesStyleSheet = FormBrowser_AppliesStyleSheet.Checked;
            config.FormBrowser.FlashQuality      = FormBrowser_FlashQuality.Text;
            config.FormBrowser.FlashWMode        = FormBrowser_FlashWMode.Text;

            config.FormCompass.CandidateDisplayCount = (int)FormCompass_CandidateDisplayCount.Value;

            //[データベース]
            config.Connection.SendDataToKancolleDB = Database_SendDataToKancolleDB.Checked;
            config.Connection.SendKancolleOAuth    = Database_SendKancolleOAuth.Text;

            //[BGM]
            config.BGMPlayer.Enabled = BGMPlayer_Enabled.Checked;
            for (int i = 0; i < BGMPlayer_ControlGrid.Rows.Count; i++)
            {
                BGMHandles[(SyncBGMPlayer.SoundHandleID)BGMPlayer_ControlGrid[BGMPlayer_ColumnContent.Index, i].Value].Enabled = (bool)BGMPlayer_ControlGrid[BGMPlayer_ColumnEnabled.Index, i].Value;
            }
            config.BGMPlayer.Handles         = new List <SyncBGMPlayer.SoundHandle>(BGMHandles.Values.ToList());
            config.BGMPlayer.SyncBrowserMute = BGMPlayer_SyncBrowserMute.Checked;
        }
Example #10
0
        /// <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;
            selectTheme.DataSource      = Enum.GetValues(typeof(Theme));
            selectTheme.SelectedItem    = config.UI.Theme;
            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;

            //[動作]
            Control_ConditionBorder.Value          = config.Control.ConditionBorder;
            Control_RecordAutoSaving.SelectedIndex = config.Control.RecordAutoSaving;
            Control_UseSystemVolume.Checked        = config.Control.UseSystemVolume;

            //[デバッグ]
            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_ShowEquipmentLevel.Checked          = config.FormFleet.ShowEquipmentLevel;
            FormFleet_AirSuperiorityMethod.SelectedIndex  = config.FormFleet.AirSuperiorityMethod;
            FormFleet_ShowAnchorageRepairingTimer.Checked = config.FormFleet.ShowAnchorageRepairingTimer;
            FormFleet_BlinkAtCompletion.Checked           = config.FormFleet.BlinkAtCompletion;

            FormHeadquarters_BlinkAtMaximum.Checked = config.FormHeadquarters.BlinkAtMaximum;

            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;

            FormShipGroup_AutoUpdate.Checked    = config.FormShipGroup.AutoUpdate;
            FormShipGroup_ShowStatusBar.Checked = config.FormShipGroup.ShowStatusBar;

            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, ConfigRes.FailedLoadRegistry + ex.Message);
                } finally {
                    if (reg != null)
                    {
                        reg.Close();
                    }
                }
            }
            FormBrowser_FlashQuality.Text = config.FormBrowser.FlashQuality;
            FormBrowser_FlashWMode.Text   = config.FormBrowser.FlashWMode;

            FormCompass_CandidateDisplayCount.Value = config.FormCompass.CandidateDisplayCount;

            //[データベース]
            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();
        }