コード例 #1
0
ファイル: Song.cs プロジェクト: gburca/DreamBeam
        /// <summary>
        /// Returns a string containing all the verses (or choruses, or other),
        /// the way a user would have typed them in.
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public int GetVerseCount(LyricsType type, SongVerseSeparator sep)
        {
            int i = 0;

            string separator;

            switch (sep)
            {
            case SongVerseSeparator.TwoBlankLines:
                separator = "\n\n\n";
                break;

            case SongVerseSeparator.OneBlankLine:
            default:
                separator = "\n\n";
                break;
            }

            this.SongLyrics.Sort();
            foreach (LyricsItem item in this.SongLyrics)
            {
                if (item.Type == type)
                {
                    i++;
                }
            }

            return(i);
        }
コード例 #2
0
ファイル: Song.cs プロジェクト: gburca/DreamBeam
        /// <summary>
        /// Ads one ore more lyric item/s to the LyricsList
        /// </summary>
        /// <param name="type"></param>
        /// <param name="text"></param>
        public int AddLyrics(LyricsType type, string text, int number, SongVerseSeparator sep)
        {
            int    num = number;
            string separator;

            switch (sep)
            {
            case SongVerseSeparator.TwoBlankLines:
                separator = "\n\n\n";
                break;

            case SongVerseSeparator.OneBlankLine:
            default:
                separator = "\n\n";
                break;
            }

            foreach (string v in Regex.Split(text, separator))
            {
                string l = v.Trim();
                if (l.Length == 0)
                {
                    continue;                   // Don't add blank verses
                }
                this.SongLyrics.Add(new LyricsItem(type, num++, l));
            }
            return(num);
        }
コード例 #3
0
ファイル: Song.cs プロジェクト: gburca/DreamBeam
        /// <summary>
        /// Returns a string containing all the verses (or choruses, or other),
        /// the way a user would have typed them in.
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public string GetLyrics(LyricsType type, SongVerseSeparator sep)
        {
            StringBuilder s = new StringBuilder("");

            string separator;

            switch (sep)
            {
            case SongVerseSeparator.TwoBlankLines:
                separator = "\n\n\n";
                break;

            case SongVerseSeparator.OneBlankLine:
            default:
                separator = "\n\n";
                break;
            }

            this.SongLyrics.Sort();
            foreach (LyricsItem item in this.SongLyrics)
            {
                if (item.Type == type)
                {
                    s.Append(item.Lyrics + separator);
                }
            }

            return(SanitizeLyrics(s.ToString()));
        }
コード例 #4
0
ファイル: Song.cs プロジェクト: gburca/DreamBeam
        /// <summary>
        /// Replaces all existing lyrics of the type with new ones obtained by
        /// breaking the (user) provided text at blank lines and creating
        /// verses/choruses/etc... out of it
        /// </summary>
        /// <param name="type"></param>
        /// <param name="text"></param>
        public void SetLyrics(LyricsType type, string text, SongVerseSeparator sep)
        {
            ArrayList toRemove = new ArrayList();

            foreach (LyricsItem item in this.SongLyrics)
            {
                if (item.Type == type)
                {
                    toRemove.Add(item);
                }
            }
            foreach (LyricsItem item in toRemove)
            {
                this.SongLyrics.Remove(item);
            }

            int    num = 1;
            string separator;

            switch (sep)
            {
            case SongVerseSeparator.TwoBlankLines:
                separator = "\n\n\n";
                break;

            case SongVerseSeparator.OneBlankLine:
            default:
                separator = "\n\n";
                break;
            }

            foreach (string v in Regex.Split(text, separator))
            {
                string l = v.Trim();
                if (l.Length == 0)
                {
                    continue;                                   // Don't add blank verses
                }
                this.SongLyrics.Add(new LyricsItem(type, num++, l));
                Console.WriteLine("Saving: " + type.ToString() + " " + l);
                Console.WriteLine("");
            }
        }
コード例 #5
0
        private void setColor(CodeVendor.Controls.Grouper p, LyricsType item)
        {
            switch (item)
            {
            case LyricsType.Verse:
                p.BackgroundColor         = Color.AliceBlue;
                p.BackgroundGradientColor = Color.LightBlue;
                break;

            case LyricsType.Chorus:
                p.BackgroundColor         = Color.LightGoldenrodYellow; //Color.LightYellow;
                p.BackgroundGradientColor = Color.Moccasin;
                break;

            case LyricsType.Other:
                p.BackgroundColor         = Color.MintCream;
                p.BackgroundGradientColor = Color.LightGreen;
                break;
            }
        }
コード例 #6
0
        private Color GetColor(LyricsType item)
        {
            switch (item)
            {
            case LyricsType.Verse:
                return(Color.AliceBlue);

                break;

            case LyricsType.Chorus:
                return(Color.Wheat);

                break;

            case LyricsType.Other:
                return(Color.NavajoWhite);

                break;
            }
            return(Color.White);
        }
コード例 #7
0
        private bool AppendAuthorToHg(string song, Dictionary <int, string> resolvedUserNames, HtmlGenerator hgOriginal, LyricsWithRating l, LyricsType lyricsType)
        {
            if (idLoginedUser == l.IDUser)
            {
                hgOriginal.WriteRaw(" (");
                hgOriginal.WriteTagWithAttr("a", "href", LyricsUri.ManageLyrics(this, song, lyricsType, resolvedUserNames[idLoginedUser]));
                hgOriginal.WriteRaw("Spravovat");
                hgOriginal.TerminateTag("a");
                hgOriginal.WriteRaw(")");
                hgOriginal.WriteRaw(" (právě zobrazený)");

                return(false);
            }
            return(true);
        }
コード例 #8
0
ファイル: Song.cs プロジェクト: gburca/DreamBeam
 public LyricsSequenceItem(LyricsType Type, int Number)
 {
     this.Type   = Type;
     this.Number = Number;
 }
コード例 #9
0
ファイル: Song.cs プロジェクト: gburca/DreamBeam
 public LyricsItem(LyricsType Type, int Number, string Lyrics)
 {
     this.Type   = Type;
     this.Number = Number;
     this.Lyrics = Lyrics;
 }
コード例 #10
0
 public string GetLyrics(LyricsType lyricsType)
 {
     return MB.Library_GetLyrics(uri.OriginalString, (int)lyricsType);
 }