本文整理汇总了C#中Song.CopyTo方法的典型用法代码示例。如果您正苦于以下问题:C# Song.CopyTo方法的具体用法?C# Song.CopyTo怎么用?C# Song.CopyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Song
的用法示例。
在下文中一共展示了Song.CopyTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Scrobble
public void Scrobble(Song[] songs)
{
if (!Connected) {
unsubmitted_songs.AddRange (songs);
} else if (songs.Length > 0) {
StringBuilder post_data = new StringBuilder ();
post_data.Append ("s=" + session);
int i = 0;
foreach (Song song in songs) {
if (song.Length > 30000) {
if (i<MaxSongsPerPost) {
post_data.Append ("&a["+i+"]=" + Escape (song.Artist));
post_data.Append ("&t["+i+"]=" + Escape (song.Track));
post_data.Append ("&i["+i+"]=" + Timestamp (song.StartTime));
post_data.Append ("&o["+i+"]=L" + song.TrackAuth);
post_data.Append ("&r["+i+"]=");
post_data.Append ("&l["+i+"]=" + (int) Math.Round ((double) song.Length / 1000));
post_data.Append ("&b["+i+"]=" + Escape (song.Album));
post_data.Append ("&n["+i+"]=");
post_data.Append ("&m["+i+"]=");
i++;
} else {
break;
}
}
}
FMRequest request = new FMRequest ();
request.RequestCompleted += new FMRequest.RequestCompletedHandler (OnSubmissionCompleted);
failed_submitted_songs.Add (request, songs);
request.DoRequest (submission_url, post_data.ToString ());
if (i>=MaxSongsPerPost) {
Song[] s = new Song[songs.Length-MaxSongsPerPost];
songs.CopyTo (s, i);
Scrobble (s);
}
}
}