Пример #1
0
        private static string findNamedSongSections(string lyrics)
        {
            var lyricsContent = SongProcessor.multiLineToStringArray(lyrics, removeEmptyEntries: false);

            StringBuilder sbLyrics = new StringBuilder();

            for (int i = 0; i < lyricsContent.Count(); i++)
            {
                var line = lyricsContent[i];
                if (line.Contains((char)65533))
                {
                    line = line.Replace((char)65533, "'"[0]);
                }

                line = regexReplaceFix(line, @"CHORUS\s?(\d*)\s*:?", "[C$1] ");
                line = regexReplaceFix(line, @"BRIDGE\s?(\d*)\s*:?", "[B$1] ");
                line = regexReplaceFix(line, @"INTRO\s?(\d*)\s*:?", "[I$1] ");
                line = regexReplaceFix(line, @"Interlude\s?(\d*)\s*:?", "[I$1] ");
                line = regexReplaceFix(line, @"Verse\s?(\d*)\s*:?", @"[V$1] ");
                line = regexReplaceFix(line, @"Refrain\s?(\d*)\s*:?", @"[R$1] ");
                line = regexReplaceFix(line, @"Ending\s?(\d*)\s*:?", @"[E$1] ");
                line = regexReplaceFix(line, @"Outro\s?(\d*)\s*:?", @"[E$1] ");
                sbLyrics.Append(line + "\n");
            }

            return(sbLyrics.ToString());
        }
Пример #2
0
        public static string FixSongNameSections(string lyrics)
        {
            var lyricsContent = SongProcessor.multiLineToStringArray(lyrics, removeEmptyEntries: false);

            StringBuilder sbLyrics = new StringBuilder();

            for (int i = 0; i < lyricsContent.Count(); i++)
            {
                var line = lyricsContent[i];
                if (line.Contains((char)65533))
                {
                    line = line.Replace((char)65533, "'"[0]);
                }

                line = regexReplaceFix(line, @"\[?CHORUS\s?(\d*)\]?\s*:?", "[C$1] ");
                line = regexReplaceFix(line, @"\[?BRIDGE\s?(\d*)\]?\s*:?", "[B$1] ");
                line = regexReplaceFix(line, @"\[?INTRO\s?(\d*)\]?\s*:?", "[I$1] ");
                line = regexReplaceFix(line, @"\[?Interlude\s?(\d*)\]?\s*:?", "[I$1] ");
                line = regexReplaceFix(line, @"\[?Instrumental\s?(\d*)\]?\s*:?", "[I$1] ");
                line = regexReplaceFix(line, @"\[?Verse\s?(\d*)\]?\s*:?", "[V$1] ");
                line = regexReplaceFix(line, @"\[?Refrain\s?(\d*)\]?\s*:?", "[R$1] ");
                line = regexReplaceFix(line, @"\[?Ending\s?(\d*)\]?\s*:?", "[E$1] ");
                line = regexReplaceFix(line, @"\[?Tag\s?(\d*)\]?\s*:?", "[T$1] ");
                line = regexReplaceFix(line, @"\[?Outro\s?(\d*)\]?\s*:?", "[E$1] ");
                if (!line.Contains("["))
                {
                    sbLyrics.Append(line + "\n");
                }
                else
                {
                    sbLyrics.Append(line);
                }
            }

            return(sbLyrics.ToString());
        }