예제 #1
0
        // --------------------------------------------------------------------
        // 設定をコンポーネントに反映
        // --------------------------------------------------------------------
        public override void SettingsToCompos()
        {
            base.SettingsToCompos();
            WebOutputSettings aWebOutputSettings = (WebOutputSettings)OutputSettings;

            // 新着
            CheckBoxEnableNew.Checked = aWebOutputSettings.EnableNew;
            TextBoxNewDays.Text       = aWebOutputSettings.NewDays.ToString();
            UpdateTextBoxNewDays();
        }
예제 #2
0
        // --------------------------------------------------------------------
        // 新着を出力
        // --------------------------------------------------------------------
        private Int32 OutputNew()
        {
            WebOutputSettings aWebOutputSettings = (WebOutputSettings)OutputSettings;

            if (!aWebOutputSettings.EnableNew)
            {
                return(0);
            }

            Double aNewDate = JulianDay.DateTimeToJulianDay(DateTime.Now.AddDays(-aWebOutputSettings.NewDays));

            StringBuilder       aSB          = new StringBuilder();
            IQueryable <TFound> aQueryResult =
                from x in TableFound
                where x.LastWriteTime >= aNewDate
                orderby x.Head, x.ProgramRuby, x.ProgramName, x.SongRuby, x.SongName
            select x;
            TFound aPrevTFound = null;

            Int32 aNumProgramSongs = 0;
            Int32 aNumHeadSongs    = 0;
            Int32 aProgramIndex    = 0;

            foreach (TFound aTFound in aQueryResult)
            {
                if (aPrevTFound == null ||
                    aPrevTFound != null && aTFound.ProgramName != aPrevTFound.ProgramName)
                {
                    if (aPrevTFound != null)
                    {
                        // 番組の区切り(終了)
                        EndProgram(aSB, aNumProgramSongs);
                    }

                    // 番組の区切り(開始)
                    BeginProgram(aSB, aTFound, ref aProgramIndex);
                    aNumProgramSongs = 0;
                }

                // 曲情報追加
                AppendSongInfo(aSB, aTFound, aNumProgramSongs);

                // ループ処理
                aPrevTFound = aTFound;
                aNumProgramSongs++;
                aNumHeadSongs++;
            }

            if (aNumHeadSongs > 0)
            {
                OutputNew(aSB, aNumProgramSongs, aNumHeadSongs);
            }

            return(aNumHeadSongs);
        }
예제 #3
0
        // --------------------------------------------------------------------
        // コンポーネントから設定に反映
        // --------------------------------------------------------------------
        public override void ComposToSettings()
        {
            base.ComposToSettings();

            WebOutputSettings aWebOutputSettings = (WebOutputSettings)OutputSettings;

            // 新着
            aWebOutputSettings.EnableNew = CheckBoxEnableNew.Checked;
            Int32 aNewDays;

            Int32.TryParse(TextBoxNewDays.Text, out aNewDays);
            aWebOutputSettings.NewDays = aNewDays;
        }
        // --------------------------------------------------------------------
        // 保存
        // --------------------------------------------------------------------
        public override void Save()
        {
            // 自クラス保存
            try
            {
                WebOutputSettings aTmp = new WebOutputSettings();
                Common.ShallowCopy(this, aTmp);
                Common.Serialize(NklCommon.SettingsPath() + FILE_NAME_WEB_OUTPUT_SETTINGS_CONFIG, aTmp);
            }
            catch (Exception)
            {
            }

            // 基底クラス保存
            base.Save();
        }
        // ====================================================================
        // public メンバー関数
        // ====================================================================

        // --------------------------------------------------------------------
        // 読み込み
        // --------------------------------------------------------------------
        public override void Load()
        {
            // 自クラス読み込み
            try
            {
                WebOutputSettings aTmp = Common.Deserialize <WebOutputSettings>(NklCommon.SettingsPath() + FILE_NAME_WEB_OUTPUT_SETTINGS_CONFIG);
                Common.ShallowCopy(aTmp, this);
            }
            catch (Exception)
            {
            }

            // 基底クラス読み込み
            base.Load();

            // 初期化
            InitIfNeeded();
        }