Esempio n. 1
0
        // --------------------------------------------------------------------
        // 1 つの番組のまとまりを開始する
        // --------------------------------------------------------------------
        private void BeginProgram(StringBuilder oSB, TFound oTFound, ref Int32 oProgramIndex)
        {
            // 番組名挿入
            oSB.Append("<input type=\"checkbox\" id=\"label" + oProgramIndex + "\" class=\"accparent\"");

            // 番組名 == 頭文字、の場合(ボカロ等)は、リストが最初から開いた状態にする
            if (oTFound.ProgramName == oTFound.Head)
            {
                oSB.Append(" checked=\"checked\"");
            }
            oSB.Append(">\n");
            oSB.Append("<label for=\"label" + oProgramIndex + "\">" + oTFound.ProgramName + " " + HTML_VAR_NUM_SONGS + "</label>\n");
            oSB.Append("<div class=\"accchild\">\n");

            // テーブルを開く
            oSB.Append("<table>\n");
            oSB.Append("  <tr>\n    ");
            foreach (OutputItems aOutputItem in mRuntimeOutputItems)
            {
                if (aOutputItem == OutputItems.ProgramName)
                {
                    continue;
                }

                oSB.Append("<th>" + mThNames[(Int32)aOutputItem] + "</th>");
            }
            oSB.Append("\n  </tr>\n");

            oProgramIndex++;
        }
Esempio n. 2
0
        // --------------------------------------------------------------------
        // 番組分類・頭文字ごとのファイルを出力
        // --------------------------------------------------------------------
        private Dictionary <String, List <HeadInfo> > OutputCategoryAndHeads()
        {
            Dictionary <String, List <HeadInfo> > aCategoriesAndHeadInfos = new Dictionary <String, List <HeadInfo> >();

            StringBuilder       aSB          = new StringBuilder();
            IQueryable <TFound> aQueryResult =
                from x in TableFound
                orderby x.ProgramCategory, 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 &&
                    (aTFound.ProgramCategory != aPrevTFound.ProgramCategory || aTFound.Head != aPrevTFound.Head))
                {
                    // これまでの内容を出力
                    OutputCategoryAndHead(aPrevTFound, aSB, aNumProgramSongs, aNumHeadSongs, aCategoriesAndHeadInfos);
                    aSB.Clear();
                    aPrevTFound   = null;
                    aProgramIndex = 0;
                    aNumHeadSongs = 0;
                }

                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 (aPrevTFound != null)
            {
                OutputCategoryAndHead(aPrevTFound, aSB, aNumProgramSongs, aNumHeadSongs, aCategoriesAndHeadInfos);
            }

            return(aCategoriesAndHeadInfos);
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
        // --------------------------------------------------------------------
        // 番組分類・番組名の頭文字 1 つ分の内容をファイルに出力
        // --------------------------------------------------------------------
        private void OutputCategoryAndHead(TFound oTFound, StringBuilder oSB, Int32 oNumProgramSongs, Int32 oNumHeadSongs,
                                           Dictionary <String, List <HeadInfo> > oCategoriesAndHeads)
        {
            // 閉じる
            EndProgram(oSB, oNumProgramSongs);

            String aTemplate = LoadTemplate("HtmlProgramHeadChar");

            // 階層
            String aCategory = oTFound.ProgramCategory;

            if (String.IsNullOrEmpty(aCategory))
            {
                aCategory = NklCommon.CATEGORY_MISC;
            }
            aTemplate = aTemplate.Replace(HTML_VAR_TITLE, mDirectoryTopName + " &gt; " + aCategory + " &gt; " + oTFound.Head);
            aTemplate = aTemplate.Replace(HTML_VAR_ADDITIONAL_HEADER, mAdditionalHeader);
            aTemplate = aTemplate.Replace(HTML_VAR_DIRECTORY, mDirectoryTopLink + " &gt; " + aCategory + " &gt; " + oTFound.Head);
            aTemplate = aTemplate.Replace(HTML_VAR_NUM_SONGS, "(" + oNumHeadSongs.ToString("#,0") + " 曲)");
            aTemplate = aTemplate.Replace(HTML_VAR_ADDITIONAL_DESCRIPTION, mAdditionalDescription);
            aTemplate = aTemplate.Replace(HTML_VAR_GENERATOR, NklCommon.APP_NAME_J + "  " + NklCommon.APP_VER);
            aTemplate = aTemplate.Replace(HTML_VAR_GENERATE_DATE, DateTime.Now.ToString(NklCommon.DATE_FORMAT));
            aTemplate = aTemplate.Replace(HTML_VAR_PROGRAMS, oSB.ToString());

            File.WriteAllText(FolderPath + OutputFileName(aCategory, oTFound.Head), aTemplate, Encoding.UTF8);

            HeadInfo aHeadInfo = new HeadInfo();

            aHeadInfo.Head     = oTFound.Head;
            aHeadInfo.NumSongs = oNumHeadSongs;
            if (oCategoriesAndHeads.ContainsKey(aCategory))
            {
                oCategoriesAndHeads[aCategory].Add(aHeadInfo);
            }
            else
            {
                List <HeadInfo> aHeadInfos = new List <HeadInfo>();
                aHeadInfos.Add(aHeadInfo);
                oCategoriesAndHeads[aCategory] = aHeadInfos;
            }
            //Debug.WriteLine("OutputCategoryAndHead() aCategory: " + aCategory + ", aHead: " + oTFound.Head);
        }
Esempio n. 5
0
        // ====================================================================
        // private メンバー関数
        // ====================================================================

        // --------------------------------------------------------------------
        // 曲情報を文字列に追加する
        // --------------------------------------------------------------------
        private void AppendSongInfo(StringBuilder oSB, TFound oTFound, Int32 oNumProgramSongs)
        {
            oSB.Append("  <tr class=\"");
            if (oNumProgramSongs % 2 == 0)
            {
                oSB.Append("even");
            }
            else
            {
                oSB.Append("odd");
            }
            oSB.Append("\">\n    ");

            foreach (OutputItems aOutputItem in mRuntimeOutputItems)
            {
                if (aOutputItem == OutputItems.ProgramName)
                {
                    continue;
                }

                switch (aOutputItem)
                {
                case OutputItems.Path:
                    oSB.Append("<td class=\"small\">" + FileNameDescription(oTFound.Path) + "</td>");
                    break;

                case OutputItems.FileName:
                    oSB.Append("<td class=\"small\">" + FileNameDescription(Path.GetFileName(oTFound.Path)) + "</td>");
                    break;

                case OutputItems.Head:
                    oSB.Append("<td>" + oTFound.Head + "</td>");
                    break;

                case OutputItems.Worker:
                    oSB.Append("<td>" + oTFound.Worker + "</td>");
                    break;

                case OutputItems.Track:
                    oSB.Append("<td>" + oTFound.Track + "</td>");
                    break;

                case OutputItems.SmartTrack:
                    oSB.Append("<td>" + (oTFound.SmartTrackOnVocal == NklCommon.RULE_VALUE_VOCAL_DEFAULT ? SMART_TRACK_VALID_MARK : null) + "</td>");
                    oSB.Append("<td>" + (oTFound.SmartTrackOffVocal == NklCommon.RULE_VALUE_VOCAL_DEFAULT ? SMART_TRACK_VALID_MARK : null) + "</td>");
                    break;

                case OutputItems.Comment:
                    oSB.Append("<td class=\"small\">" + oTFound.Comment + "</td>");
                    break;

                case OutputItems.LastWriteTime:
                    oSB.Append("<td class=\"small\">" + JulianDay.JulianDayToDateTime(oTFound.LastWriteTime).ToString(
                                   NklCommon.DATE_FORMAT + " " + NklCommon.TIME_FORMAT) + "</td>");
                    break;

                case OutputItems.FileSize:
                    oSB.Append("<td class=\"small\">" + (oTFound.FileSize / (1024 * 1024)).ToString("#,0") + " MB</td>");
                    break;

                case OutputItems.ProgramCategory:
                    oSB.Append("<td>" + oTFound.ProgramCategory + "</td>");
                    break;

                case OutputItems.ProgramGameCategory:
                    oSB.Append("<td>" + oTFound.ProgramGameCategory + "</td>");
                    break;

                case OutputItems.ProgramName:
                    oSB.Append("<td>" + oTFound.ProgramName + "</td>");
                    break;

                case OutputItems.ProgramRuby:
                    oSB.Append("<td>" + oTFound.ProgramRuby + "</td>");
                    break;

                case OutputItems.ProgramSubName:
                    oSB.Append("<td>" + oTFound.ProgramSubName + "</td>");
                    break;

                case OutputItems.ProgramSubRuby:
                    oSB.Append("<td>" + oTFound.ProgramSubRuby + "</td>");
                    break;

                case OutputItems.ProgramNumStories:
                    oSB.Append("<td>" + oTFound.ProgramNumStories + "</td>");
                    break;

                case OutputItems.ProgramAgeLimit:
                    oSB.Append("<td>" + oTFound.ProgramAgeLimit + "</td>");
                    break;

                case OutputItems.ProgramBeginDate:
                    if (oTFound.ProgramBeginDate != 0.0d)
                    {
                        oSB.Append("<td class=\"small\">" + JulianDay.JulianDayToDateTime(oTFound.ProgramBeginDate).ToString(NklCommon.DATE_FORMAT) + "</td>");
                    }
                    else
                    {
                        oSB.Append("<td></td>");
                    }
                    break;

                case OutputItems.SongOpEd:
                    oSB.Append("<td>" + oTFound.SongOpEd + "</td>");
                    break;

                case OutputItems.SongCastSeq:
                    oSB.Append("<td>" + oTFound.SongCastSeq + "</td>");
                    break;

                case OutputItems.SongName:
                    oSB.Append("<td>" + oTFound.SongName + "</td>");
                    break;

                case OutputItems.SongRuby:
                    oSB.Append("<td>" + oTFound.SongRuby + "</td>");
                    break;

                case OutputItems.SongArtist:
                    oSB.Append("<td>" + oTFound.SongArtist + "</td>");
                    break;

                default:
                    Debug.Assert(false, "AppendSongInfo() bad aOutputItem");
                    break;
                }
            }

            oSB.Append("\n  </tr>\n");
        }