コード例 #1
0
        public static void Load()
        {
            if (!File.Exists(filePath))
            {
                return;
            }

            try
            {
                Current = filePath.ReadXml <_Settings>();
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);

                return;
            }

            // 設定のマイグレーション

            GeneralSettings.Culture.Value           = Current.Culture;
            GeneralSettings.BrowserZoomFactor.Value = Current.BrowserZoomFactorPercentage / 100.0;

            ScreenshotSettings.Destination.Value = Current.ScreenshotFolder;
            ScreenshotSettings.Filename.Value    = Current.ScreenshotFilename;
            ScreenshotSettings.Format.Value      = Current.ScreenshotImageFormat;

            KanColleSettings.CanDisplayBuildingShipName.Value = Current.CanDisplayBuildingShipName;
            KanColleSettings.NotifyMuteOnMute.Value           = Current.NotifyMuteOnMute;
            KanColleSettings.NotifyBuildingCompleted.Value    = Current.NotifyBuildingCompleted;
            KanColleSettings.NotifyExpeditionReturned.Value   = Current.NotifyExpeditionReturned;
            KanColleSettings.NotifyRepairingCompleted.Value   = Current.NotifyRepairingCompleted;
            KanColleSettings.NotifyFleetRejuvenated.Value     = Current.NotifyFleetRejuvenated;

            if (Current.KanColleClientSettings != null)
            {
                KanColleSettings.ViewRangeCalcType.Value          = Current.KanColleClientSettings.ViewRangeCalcType ?? KanColleSettings.ViewRangeCalcType.Default;
                KanColleSettings.NotificationShorteningTime.Value = Current.KanColleClientSettings.NotificationShorteningTime;
                KanColleSettings.ReSortieCondition.Value          = Current.KanColleClientSettings.ReSortieCondition;
                KanColleSettings.AutoTranslateEnable.Value        = Current.KanColleClientSettings.AutoTranslateEnable;
                KanColleSettings.QuestOnAnyTabs.Value             = Current.KanColleClientSettings.QuestOnAnyTabs;
                KanColleSettings.QuestNoTakeOnTab.Value           = Current.KanColleClientSettings.QuestNoTakeOnTab;
            }

            if (Current.ProxySettings != null)
            {
                NetworkSettings.Proxy.Type.Value = Current.ProxySettings.Type;
                NetworkSettings.Proxy.Host.Value = Current.ProxySettings.Host;
                NetworkSettings.Proxy.Port.Value = Current.ProxySettings.Port;
            }

            try
            {
                File.Delete(filePath);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }
        }
コード例 #2
0
ファイル: _Settings.cs プロジェクト: NatLee/KanColleViewer
		public static void Load()
		{
			if (!File.Exists(filePath)) return;

			try
			{
				Current = filePath.ReadXml<_Settings>();
			}
			catch (Exception ex)
			{
				System.Diagnostics.Debug.WriteLine(ex);

				return;
			}

			// 設定のマイグレーション

			GeneralSettings.Culture.Value = Current.Culture;
			GeneralSettings.BrowserZoomFactor.Value = Current.BrowserZoomFactorPercentage / 100.0;

			ScreenshotSettings.Destination.Value = Current.ScreenshotFolder;
			ScreenshotSettings.Filename.Value = Current.ScreenshotFilename;
			ScreenshotSettings.Format.Value = Current.ScreenshotImageFormat;

			KanColleSettings.CanDisplayBuildingShipName.Value = Current.CanDisplayBuildingShipName;
			KanColleSettings.NotifyBuildingCompleted.Value = Current.NotifyBuildingCompleted;
			KanColleSettings.NotifyExpeditionReturned.Value = Current.NotifyExpeditionReturned;
			KanColleSettings.NotifyRepairingCompleted.Value = Current.NotifyRepairingCompleted;
			KanColleSettings.NotifyFleetRejuvenated.Value = Current.NotifyFleetRejuvenated;

			if (Current.KanColleClientSettings != null)
			{
				KanColleSettings.ViewRangeCalcType.Value = Current.KanColleClientSettings.ViewRangeCalcType ?? KanColleSettings.ViewRangeCalcType.Default;
				KanColleSettings.NotificationShorteningTime.Value = Current.KanColleClientSettings.NotificationShorteningTime;
				KanColleSettings.ReSortieCondition.Value = Current.KanColleClientSettings.ReSortieCondition;
			}

			if (Current.ProxySettings != null)
			{
				NetworkSettings.Proxy.Type.Value = Current.ProxySettings.Type;
				NetworkSettings.Proxy.Host.Value = Current.ProxySettings.Host;
				NetworkSettings.Proxy.Port.Value = Current.ProxySettings.Port;
			}

			try
			{
				File.Delete(filePath);
			}
			catch (Exception ex)
			{
				System.Diagnostics.Debug.WriteLine(ex);
			}
		}