コード例 #1
0
 // Cleans the lyrics
 private void CleanLyrics()
 {
     LyricText = LyricText.Replace("%quot;", "\"");
     LyricText = LyricText.Replace("<br>", "\r\n");
     LyricText = LyricText.Replace("<br />", "\r\n");
     LyricText = LyricText.Replace("<BR>", "\r\n");
     LyricText = LyricText.Replace("&amp;", "&");
     LyricText = LyricText.Trim();
 }
コード例 #2
0
 // Cleans the lyrics
 private void CleanLyrics()
 {
     LyricText = LyricText.Replace("</span>", "");
     LyricText = LyricText.Replace("&quot;", "\"");
     LyricText = LyricText.Replace("<br>", " ");
     LyricText = LyricText.Replace("<br />", " ");
     LyricText = LyricText.Replace("<BR>", " ");
     LyricText = LyricText.Replace("&amp;", "&");
     LyricText = Regex.Replace(LyricText, ".*(<span class=.*>).*", MatchReplace, RegexOptions.Multiline);
     // Need to execute it twice for some reason the first run didn't clean the first occurence
     LyricText = Regex.Replace(LyricText, ".*(<span class=.*>).*", MatchReplace, RegexOptions.Multiline);
     LyricText = LyricText.Trim();
 }
コード例 #3
0
        private void CleanLyrics()
        {
            while (LyricText.IndexOf("<a ") > -1)
            {
                var startIndex = LyricText.IndexOf("<a ");
                var length     = LyricText.IndexOf("\">") - startIndex + 2;
                LyricText = LyricText.Remove(startIndex, length);
            }

            LyricText = LyricText.Replace("</a>", "");
            LyricText = LyricText.Replace("<br>", "");
            LyricText = LyricText.Replace("<br/>", "");
            LyricText = LyricText.Replace("&quot;", "\"");

            LyricText = LyricText.Trim();
        }
コード例 #4
0
 // Cleans the lyrics
 private void CleanLyrics()
 {
     LyricText = LyricText.Replace("</script>", "");
     LyricText = LyricText.Replace("??s", "'s");
     LyricText = LyricText.Replace("??t", "'t");
     LyricText = LyricText.Replace("??m", "'m");
     LyricText = LyricText.Replace("??l", "'l");
     LyricText = LyricText.Replace("??v", "'v");
     LyricText = LyricText.Replace("?s", "'s");
     LyricText = LyricText.Replace("?t", "'t");
     LyricText = LyricText.Replace("?m", "'m");
     LyricText = LyricText.Replace("?l", "'l");
     LyricText = LyricText.Replace("?v", "'v");
     //LyricText = LyricText.Replace("<br>", "\r\n");
     //LyricText = LyricText.Replace("<br />", "\r\n");
     //LyricText = LyricText.Replace("<BR>", "\r\n");
     LyricText = LyricText.Replace("&amp;", "&");
     LyricText = Regex.Replace(LyricText, @"<span.*</span>", "", RegexOptions.Singleline);
     LyricText = Regex.Replace(LyricText, @"<.*?>", "", RegexOptions.Singleline);
     LyricText = Regex.Replace(LyricText, @"<!--.*-->", "", RegexOptions.Singleline);
     LyricText = LyricText.Trim();
 }
コード例 #5
0
 // Cleans the lyrics
 private void CleanLyrics()
 {
     LyricText = LyricText.Replace("<br>", " ");
     LyricText = LyricText.Replace("</font></p>", " \r\n");
     LyricText = LyricText.Replace("</p>", "");
     LyricText = LyricText.Replace("<p>", "");
     LyricText = LyricText.Replace("<i>", "");
     LyricText = LyricText.Replace("</i>", "");
     LyricText = LyricText.Replace("*", "");
     LyricText = LyricText.Replace("?s", "'s");
     LyricText = LyricText.Replace("?t", "'t");
     LyricText = LyricText.Replace("?m", "'m");
     LyricText = LyricText.Replace("?l", "'l");
     LyricText = LyricText.Replace("?v", "'v");
     LyricText = LyricText.Replace("<p>", " ");
     LyricText = LyricText.Replace("<BR>", " ");
     LyricText = LyricText.Replace("<br />", " ");
     LyricText = LyricText.Replace("&#039;", "'");
     LyricText = LyricText.Replace("&amp;", "&");
     LyricText = LyricText.Replace("%quot;", "\"");
     LyricText = LyricText.Trim();
 }
コード例 #6
0
        private void CallbackMethod(object sender, OpenReadCompletedEventArgs e)
        {
            var thisMayBeTheCorrectLyric = true;

            Stream       reply  = null;
            StreamReader reader = null;

            try
            {
                reply  = e.Result;
                reader = new StreamReader(reply, Encoding.UTF8);

                var line = "";

                while (line.IndexOf(StartString, StringComparison.Ordinal) == -1)
                {
                    if (reader.EndOfStream)
                    {
                        thisMayBeTheCorrectLyric = false;
                        break;
                    }
                    line = reader.ReadLine() ?? "";
                }

                if (thisMayBeTheCorrectLyric)
                {
                    var cutIndex = line.IndexOf(StartString, StringComparison.Ordinal);

                    if (cutIndex != -1)
                    {
                        LyricText = line.Substring(cutIndex + StartString.Length);
                    }

                    var iso8859 = Encoding.GetEncoding("ISO-8859-1");
                    LyricText = Encoding.UTF8.GetString(iso8859.GetBytes(LyricText));

                    LyricText = LyricText.Replace("<br />", "\r\n");
                    LyricText = LyricText.Replace("<i>", "");
                    LyricText = LyricText.Replace("</i>", "");
                    LyricText = LyricText.Replace("<b>", "");
                    LyricText = LyricText.Replace("</b>", "");
                    LyricText = LyricText.Replace("&amp;", "&");

                    LyricText = LyricText.Trim();

                    if (LyricText.Contains("<"))
                    {
                        LyricText = NotFound;
                    }
                }
                else
                {
                    LyricText = NotFound;
                }
            }
            catch
            {
                LyricText = NotFound;
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }

                if (reply != null)
                {
                    reply.Close();
                }
                Complete = true;
            }
        }