private void ultraDropDownButton1_Click(object sender, EventArgs e) { if (scrobblerInit) { if (trackList.Items.Count > 0) { object[] files = trackList.Items.All; if (files.Length > 50) { MessageBox.Show("Scrobbling more than 50 tracks - last.fm response may be lagged.", "Tracks, a lot!", MessageBoxButtons.OK, MessageBoxIcon.Information); } //UltraListViewItem item = (UltraListViewItem)files[0]; C5.ArrayList <TrackInfo> tracks = new C5.ArrayList <TrackInfo>(); try { foreach (object file in files) { UltraListViewItem item = (UltraListViewItem)file; TrackInfo info = new TrackInfo(item.SubItems[1].Value.ToString(), item.SubItems[2].Value.ToString(), item.SubItems[0].Value.ToString()); //artist (!empty), album (may be empty), title (!empty) info.Username = userLogin; info.Duration = (int)TimeSpan.Parse(item.SubItems[3].Value.ToString()).TotalSeconds; info.SourceString = "P"; info.timeStampMe(); for (int i = 0; i < (int)item.SubItems[4].Value; i++) { tracks.Add(info); } } tracks.Shuffle(); ScrobblerCache cache = new ScrobblerCache(userLogin); cache.Append(new List <TrackInfo>(tracks.ToArray()), true); sm.Scrobble(ref cache); MessageBox.Show("Scrobbled successfully!", "Oll Korrect", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception exp) { } } else { MessageBox.Show("Alas, nothing to scrobble!", "Oops, no tracks at all", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { MessageBox.Show("Hold yer horses! Enter user info first - click 'options' and so on", "Methinks we're forgetting something...", MessageBoxButtons.OK, MessageBoxIcon.Hand); } }
private void scrobbleOnThisDate_Click(object sender, EventArgs e) { if (files.Length > 50) { MessageBox.Show("Scrobbling more than 50 tracks - last.fm response may be lagged.", "Tracks, a lot!", MessageBoxButtons.OK, MessageBoxIcon.Information); } C5.ArrayList <TrackInfo> tracks = new C5.ArrayList <TrackInfo>(); try { foreach (object file in this.files) { UltraListViewItem item = (UltraListViewItem)file; TrackInfo info = new TrackInfo(item.SubItems[1].Value.ToString(), item.SubItems[2].Value.ToString(), item.SubItems[0].Value.ToString()); //artist (!empty), album (may be empty), title (!empty) info.Username = this.username; info.Duration = (int)TimeSpan.Parse(item.SubItems[3].Value.ToString()).TotalSeconds; info.SourceString = "P"; info.SetTimeStamp((long)UnixTime.GetUnixTimeOfDate(rTime).TotalSeconds); rTime = rTime.AddSeconds(info.Duration + 10 * ((new Random()).NextDouble())); for (int i = 0; i < (int)item.SubItems[4].Value; i++) { tracks.Add(info); } } //for (int j = 0; j < files.Length; j++) //{ tracks.Shuffle(); //} ScrobblerCache cache = new ScrobblerCache(this.username); cache.Append(new List <TrackInfo>(tracks.ToArray()), true); sm.Scrobble(ref cache); if (MessageBox.Show("Scrobbled successfully! Close date scrobble dialog? ", "Oll Korrect", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { this.Close(); } } catch (Exception exp) { MessageBox.Show(exp.Message, "Something happened!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void ultraDropDownButton1_Click(object sender, EventArgs e) { if (scrobblerInit) { if (trackList.Items.Count > 0) { object[] files = trackList.Items.All; if (files.Length > 50) { MessageBox.Show("Scrobbling more than 50 tracks - last.fm response may be lagged.", "Tracks, a lot!", MessageBoxButtons.OK, MessageBoxIcon.Information); } //UltraListViewItem item = (UltraListViewItem)files[0]; C5.ArrayList<TrackInfo> tracks = new C5.ArrayList<TrackInfo>(); try { foreach (object file in files) { UltraListViewItem item = (UltraListViewItem)file; TrackInfo info = new TrackInfo(item.SubItems[1].Value.ToString(), item.SubItems[2].Value.ToString(), item.SubItems[0].Value.ToString()); //artist (!empty), album (may be empty), title (!empty) info.Username = userLogin; info.Duration = (int)TimeSpan.Parse(item.SubItems[3].Value.ToString()).TotalSeconds; info.SourceString = "P"; info.timeStampMe(); for (int i = 0; i < (int)item.SubItems[4].Value; i++ ) tracks.Add(info); } tracks.Shuffle(); ScrobblerCache cache = new ScrobblerCache(userLogin); cache.Append(new List<TrackInfo>(tracks.ToArray()), true); sm.Scrobble(ref cache); MessageBox.Show("Scrobbled successfully!", "Oll Korrect", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch(Exception exp) { } } else { MessageBox.Show("Alas, nothing to scrobble!", "Oops, no tracks at all", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { MessageBox.Show("Hold yer horses! Enter user info first - click 'options' and so on", "Methinks we're forgetting something...", MessageBoxButtons.OK, MessageBoxIcon.Hand); } }
private void scrobbleOnThisDate_Click(object sender, EventArgs e) { if (files.Length > 50) { MessageBox.Show("Scrobbling more than 50 tracks - last.fm response may be lagged.", "Tracks, a lot!", MessageBoxButtons.OK, MessageBoxIcon.Information); } C5.ArrayList<TrackInfo> tracks = new C5.ArrayList<TrackInfo>(); try { foreach (object file in this.files) { UltraListViewItem item = (UltraListViewItem)file; TrackInfo info = new TrackInfo(item.SubItems[1].Value.ToString(), item.SubItems[2].Value.ToString(), item.SubItems[0].Value.ToString()); //artist (!empty), album (may be empty), title (!empty) info.Username = this.username; info.Duration = (int)TimeSpan.Parse(item.SubItems[3].Value.ToString()).TotalSeconds; info.SourceString = "P"; info.SetTimeStamp((long) UnixTime.GetUnixTimeOfDate(rTime).TotalSeconds); rTime = rTime.AddSeconds(info.Duration + 10 * ( (new Random() ).NextDouble() ) ); for (int i = 0; i < (int)item.SubItems[4].Value; i++) tracks.Add(info); } //for (int j = 0; j < files.Length; j++) //{ tracks.Shuffle(); //} ScrobblerCache cache = new ScrobblerCache(this.username); cache.Append(new List<TrackInfo>(tracks.ToArray()), true); sm.Scrobble(ref cache); if (MessageBox.Show("Scrobbled successfully! Close date scrobble dialog? ", "Oll Korrect", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { this.Close(); } } catch(Exception exp) { MessageBox.Show(exp.Message, "Something happened!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }