コード例 #1
0
        /*
         *  パブリックメソッド
         */
        #region Public Method

        /// <summary>
        /// 設定をXMLに保存する
        /// </summary>
        /// <returns></returns>
        public bool SaveSetting()
        {
            LinearConfig linearConfig = getLinearConfigValue();

            //new XmlSerializer().save(linearConfig, typeof(LinearConfig), Application.StartupPath + LinearConst.SETTING_FILE);

            File.WriteAllText(
                Application.StartupPath + LinearConst.NEW_SETTING_FILE,
                JsonConvert.SerializeObject(linearConfig, Formatting.Indented),
                Encoding.UTF8);

            // 旧コンフィグファイルがあれば削除
            File.Delete(Application.StartupPath + LinearConst.SETTING_FILE);

            // TODO: カラーテスト
            //ColorConfigXml cc = new ColorConfigXml();
            //XmlUtils.save(cc, typeof(ColorConfigXml), Application.StartupPath + "\\color/test.xml");

            return(true);
        }
コード例 #2
0
        /// <summary>
        /// 設定を取得する。(保存用)
        /// </summary>
        /// <returns></returns>
        private LinearConfig getLinearConfigValue()
        {
            LinearConfig setting = new LinearConfig();

            setting.Version = LinearGlobal.ApplicationVersion;

            // 表示設定
            setting.ViewConfig.MainLocation                   = LinearGlobal.MainForm.Location;
            setting.ViewConfig.MainSize                       = new Size(LinearGlobal.MainForm.Size.Width, LinearGlobal.MainForm.Size.Height);
            setting.ViewConfig.ListLocation                   = LinearGlobal.MainForm.ListForm.Location;
            setting.ViewConfig.ListSize                       = LinearGlobal.MainForm.ListForm.Size;
            setting.ViewConfig.ConfigLocation                 = LinearGlobal.MainForm.ConfigForm.Location;
            setting.ViewConfig.ConfigSize                     = LinearGlobal.MainForm.ConfigForm.Size;
            setting.ViewConfig.TitleScroll                    = LinearGlobal.TitleDisplayScroll;
            setting.ViewConfig.TopMost                        = LinearGlobal.MainForm.TopMost;
            setting.ViewConfig.Opacity                        = LinearGlobal.MainForm.Opacity;
            setting.ViewConfig.TagEditDialogLocation          = LinearGlobal.LinearConfig.ViewConfig.TagEditDialogLocation;
            setting.ViewConfig.ColorProfileEditDialogLocation =
                LinearGlobal.LinearConfig.ViewConfig.ColorProfileEditDialogLocation;
            setting.ViewConfig.StyleEditDialogLocation =
                LinearGlobal.LinearConfig.ViewConfig.StyleEditDialogLocation;
            setting.ViewConfig.UseWebInterface        = LinearGlobal.LinearConfig.ViewConfig.UseWebInterface;
            setting.ViewConfig.WebInterfaceListenPort = LinearGlobal.LinearConfig.ViewConfig.WebInterfaceListenPort;
            setting.ViewConfig.WebInterfaceTheme      = LinearGlobal.LinearConfig.ViewConfig.WebInterfaceTheme;

            // Gridの幅を取得
            int i = 0;

            while (i < LinearGlobal.MainForm.ListForm.Grid.ColumnsCount)
            {
                setting.ViewConfig.ColumnHeaderWidth[i] =
                    LinearGlobal.MainForm.ListForm.Grid.Columns.GetWidth(i);
                i++;
            }
            setting.ViewConfig.ColorProfile = LinearGlobal.LinearConfig.ViewConfig.ColorProfile;
            setting.ViewConfig.StyleName    = LinearGlobal.LinearConfig.ViewConfig.StyleName;

            setting.ViewConfig.TitleTemplete        = LinearGlobal.LinearConfig.ViewConfig.TitleTemplete;
            setting.ViewConfig.isTitleCentering     = LinearGlobal.LinearConfig.ViewConfig.isTitleCentering;
            setting.ViewConfig.TitleScrollMode      = LinearGlobal.LinearConfig.ViewConfig.TitleScrollMode;
            setting.ViewConfig.isNotificationWindow = LinearGlobal.LinearConfig.ViewConfig.isNotificationWindow;
            setting.ViewConfig.isSlidePIP           = LinearGlobal.LinearConfig.ViewConfig.isSlidePIP;
            setting.ViewConfig.isGetNetworkArtwork  = LinearGlobal.LinearConfig.ViewConfig.isGetNetworkArtwork;

            setting.ViewConfig.MiniVisualizationLevel = LinearGlobal.LinearConfig.ViewConfig.MiniVisualizationLevel;
            setting.ViewConfig.PIPViewDuration        = LinearGlobal.LinearConfig.ViewConfig.PIPViewDuration;
            setting.ViewConfig.FontBold                   = LinearGlobal.LinearConfig.ViewConfig.FontBold;
            setting.ViewConfig.GroupListOrder             = LinearGlobal.LinearConfig.ViewConfig.GroupListOrder;
            setting.ViewConfig.AlbumJudgeCount            = LinearGlobal.LinearConfig.ViewConfig.AlbumJudgeCount;
            setting.ViewConfig.MiniVisualizationLineCount =
                LinearGlobal.LinearConfig.ViewConfig.MiniVisualizationLineCount;

            // プレイヤー設定
            setting.PlayerConfig.PlayMode      = (int)LinearGlobal.PlayMode;
            setting.PlayerConfig.PlaylistMode  = (int)LinearGlobal.PlaylistMode;
            setting.PlayerConfig.FilteringMode = (int)LinearGlobal.FilteringMode;
            setting.PlayerConfig.ShuffleMode   = (int)LinearGlobal.ShuffleMode;
            // 選択データベース
            setting.PlayerConfig.SelectDatabase =
                LinearGlobal.MainForm.ListForm.DatabaseList.Text;
            setting.PlayerConfig.SelectFilter =
                LinearGlobal.LinearConfig.PlayerConfig.SelectFilter;
            setting.PlayerConfig.GroupMode =
                LinearGlobal.LinearConfig.PlayerConfig.GroupMode;
            // 対応拡張子
            setting.PlayerConfig.SupportAudioExtension =
                LinearGlobal.LinearConfig.PlayerConfig.SupportAudioExtension;
            setting.PlayerConfig.ResumeId       = LinearGlobal.CurrentPlayItemInfo.Id;
            setting.PlayerConfig.ResumePosition = LinearGlobal.LinearConfig.PlayerConfig.ResumePosition;
            setting.PlayerConfig.ResumePlay     = LinearGlobal.LinearConfig.PlayerConfig.ResumePlay;
            setting.PlayerConfig.IsAutoUpdate   = LinearGlobal.LinearConfig.PlayerConfig.IsAutoUpdate;
            // 除外キーワード
            setting.PlayerConfig.ExclusionKeywords       = LinearGlobal.LinearConfig.PlayerConfig.ExclusionKeywords;
            setting.PlayerConfig.TempDirectory           = LinearGlobal.LinearConfig.PlayerConfig.TempDirectory;
            setting.PlayerConfig.isRandomStyleSelect     = LinearGlobal.LinearConfig.PlayerConfig.isRandomStyleSelect;
            setting.PlayerConfig.isAlbumAutoRename       = LinearGlobal.LinearConfig.PlayerConfig.isAlbumAutoRename;
            setting.PlayerConfig.albumAutoRenameTemplete =
                LinearGlobal.LinearConfig.PlayerConfig.albumAutoRenameTemplete;
            setting.PlayerConfig.ExcludePlugins          = LinearGlobal.LinearConfig.PlayerConfig.ExcludePlugins;
            setting.PlayerConfig.IsOpenPlaylist          = LinearGlobal.LinearConfig.PlayerConfig.IsOpenPlaylist;
            setting.PlayerConfig.PlayCountUpRatio        = LinearGlobal.LinearConfig.PlayerConfig.PlayCountUpRatio;
            setting.PlayerConfig.SortMode                = (int)LinearGlobal.SortMode;
            setting.PlayerConfig.IsLinkLibrary           = LinearGlobal.LinearConfig.PlayerConfig.IsLinkLibrary;
            setting.PlayerConfig.RestCount               = LinearGlobal.LinearConfig.PlayerConfig.RestCount;
            setting.PlayerConfig.RestMaxCount            = LinearGlobal.LinearConfig.PlayerConfig.RestMaxCount;
            setting.PlayerConfig.AudioFileAutoRegistInfo =
                LinearGlobal.LinearConfig.PlayerConfig.AudioFileAutoRegistInfo;
            setting.PlayerConfig.MovieSearchUrl = LinearGlobal.LinearConfig.PlayerConfig.MovieSearchUrl;

            // サウンド設定
            // サイレントボリューム前の値を復元する
            if (LinearGlobal.MainForm.ListForm.TmpVolume != -1)
            {
                LinearGlobal.Volume = LinearGlobal.MainForm.ListForm.TmpVolume;
            }
            setting.SoundConfig.Volume       = LinearGlobal.Volume;
            setting.SoundConfig.SilentVolume =
                LinearGlobal.LinearConfig.SoundConfig.SilentVolume;
            setting.SoundConfig.FadeEffect =
                LinearGlobal.LinearConfig.SoundConfig.FadeEffect;
            setting.SoundConfig.FadeDuration =
                LinearGlobal.LinearConfig.SoundConfig.FadeDuration;
            setting.SoundConfig.IsVolumeNormalize =
                LinearGlobal.LinearConfig.SoundConfig.IsVolumeNormalize;

            setting.EngineConfig.PlayEngine =
                LinearGlobal.LinearConfig.EngineConfig.PlayEngine;

            setting.DatabaseConfig.LimitCount = LinearGlobal.LinearConfig.DatabaseConfig.LimitCount;

            /* 設定フォーム */



            return(setting);
        }