コード例 #1
0
            private static GetLyricResult LoadGetLyricResult(XmlTextReader reader)
            {
                var result = new GetLyricResult();

                while (reader.NodeType != XmlNodeType.EndElement)
                {
                    if (reader.IsStartElement())
                    {
                        if (string.Equals(reader.Name, nameof(GetLyricResult.TrackChecksum), StringComparison.OrdinalIgnoreCase))
                        {
                            result.TrackChecksum = Read(reader);
                        }
                        else if (string.Equals(reader.Name, nameof(GetLyricResult.TrackId), StringComparison.OrdinalIgnoreCase))
                        {
                            result.TrackId = Read(reader);
                        }
                        else if (string.Equals(reader.Name, nameof(GetLyricResult.LyricChecksum), StringComparison.OrdinalIgnoreCase))
                        {
                            result.LyricChecksum = Read(reader);
                        }
                        else if (string.Equals(reader.Name, nameof(GetLyricResult.LyricId), StringComparison.OrdinalIgnoreCase))
                        {
                            result.LyricId = Read(reader);
                        }
                        else if (string.Equals(reader.Name, nameof(GetLyricResult.LyricSong), StringComparison.OrdinalIgnoreCase))
                        {
                            result.LyricSong = Read(reader);
                        }
                        else if (string.Equals(reader.Name, nameof(GetLyricResult.LyricArtist), StringComparison.OrdinalIgnoreCase))
                        {
                            result.LyricArtist = Read(reader);
                        }
                        else if (string.Equals(reader.Name, nameof(GetLyricResult.LyricUrl), StringComparison.OrdinalIgnoreCase))
                        {
                            result.LyricUrl = Read(reader);
                        }
                        else if (string.Equals(reader.Name, nameof(GetLyricResult.LyricCovertArtUrl), StringComparison.OrdinalIgnoreCase))
                        {
                            result.LyricCovertArtUrl = Read(reader);
                        }
                        else if (string.Equals(reader.Name, nameof(GetLyricResult.LyricRank), StringComparison.OrdinalIgnoreCase))
                        {
                            result.LyricRank = Read(reader);
                        }
                        else if (string.Equals(reader.Name, nameof(GetLyricResult.LyricCorrectUrl), StringComparison.OrdinalIgnoreCase))
                        {
                            result.LyricCorrectUrl = Read(reader);
                        }
                        else if (string.Equals(reader.Name, nameof(GetLyricResult.Lyric), StringComparison.OrdinalIgnoreCase))
                        {
                            result.Lyric = Read(reader);
                        }
                    }
                }
                return(result);
            }
コード例 #2
0
    public string getLyrics(string music, string song)
    {
        string lyrRes = "without   lyrics";

        apiv1          prx = new apiv1();
        GetLyricResult res = prx.SearchLyricDirect(music, song);

        if (res != null)
        {
            lyrRes = res.Lyric;
        }
        return(lyrRes);
    }
コード例 #3
0
 public static string Lyric(string artist, string song)
 {
     Webref.apiv1 LyrcService = new Webref.apiv1();
     try
     {
         SearchLyricResult[] x = LyrcService.SearchLyric(artist, song);
         int            id     = x[0].LyricId;
         string         cs     = x[0].LyricChecksum;
         GetLyricResult lyc    = LyrcService.GetLyric(id, cs);
         return(lyc.Lyric);
     }
     catch
     {
         return("Lyrics not found");
     }
 }
コード例 #4
0
        public ListaResultados(List <SearchLyricResult> lista)
        {
            InitializeComponent();
            resultList.ItemsSource = lista;

            resultList.ItemSelected += async(sender, e) =>
            {
                var item = e.SelectedItem as SearchLyricResult;
                //await DisplayAlert("Seleccionado", "elemento seleccionado: " + item.ToString(), "Entendido");
                // Crear nueva canción
                SearchLyricResult search      = item;
                LyricsWS          lyricsWS    = new LyricsWS();
                GetLyricResult    lyricResult = await lyricsWS.GetSong(search.lyricId, search.lyricChecksum);

                Song song = new Song(lyricResult);
                // Pasarla
                await Navigation.PushAsync(new DetalleCancion(song, true));
            };
        }