Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6659e2dff7 | ||
|
|
4788a80b78 | ||
|
|
2f82bd96c6 | ||
|
|
f385ff773f | ||
|
|
3ea423c87e | ||
|
|
9fb8550dbf | ||
|
|
f07b9e0fdb | ||
|
|
d4b916137b | ||
|
|
e7eba01ac7 | ||
|
|
8e64b6e5b6 | ||
|
|
96683d3b57 | ||
|
|
c760e5a559 | ||
|
|
5a07e6251b | ||
|
|
b9b300b14d | ||
|
|
4e9d2222cf | ||
|
|
4a869f3399 | ||
|
|
0d0a92f33a | ||
|
|
66c5285418 | ||
|
|
292405cf4d | ||
|
|
8d7d8eaabc | ||
|
|
40cb55d7f6 | ||
|
|
56586355d3 | ||
|
|
56a2cb91a4 | ||
|
|
a4031daae8 | ||
|
|
a1bfb15e6b | ||
|
|
c2229db72a | ||
|
|
f81c526255 | ||
|
|
7b712460d2 | ||
|
|
57229fc8b9 | ||
|
|
515f17eb62 | ||
|
|
98f6ab9bc0 | ||
|
|
90f35de242 | ||
|
|
aa85ca5d26 | ||
|
|
270db2d1a4 | ||
|
|
fd629f54ff | ||
|
|
d774e250c5 | ||
|
|
93f9879c14 | ||
|
|
a6514189b0 | ||
|
|
192e132f1d | ||
|
|
d8a900ecb9 | ||
|
|
7e5dcb3cef | ||
|
|
17eaac40bf | ||
|
|
dad829d1dd | ||
|
|
e218b58421 | ||
|
|
7f45afe80f | ||
|
|
05bf1bce21 | ||
|
|
740264099d | ||
|
|
70bed9b661 | ||
|
|
aa769cfad9 | ||
|
|
2f0b1915a3 | ||
|
|
cbf8588855 | ||
|
|
d665d0466d | ||
|
|
e6683f0478 | ||
|
|
46410149b1 | ||
|
|
34771e43c8 | ||
|
|
918bfd8871 | ||
|
|
68ca3af5ff | ||
|
|
bc75eb9d34 | ||
|
|
a8b618cd46 | ||
|
|
00dfd2a78b | ||
|
|
29eb193aea | ||
|
|
78cb6ccee7 | ||
|
|
88681a04e6 | ||
|
|
5af3b29a84 | ||
|
|
2a699353d2 | ||
|
|
6a9b2956de | ||
|
|
3ccfdbe282 | ||
|
|
60f7d41279 | ||
|
|
c99d3955d3 | ||
|
|
87404b0f85 | ||
|
|
f9d92de0ab | ||
|
|
6190a6f0da | ||
|
|
a902b8c370 | ||
|
|
c20a20534b | ||
|
|
9d56e2e3b4 | ||
|
|
006bba7980 | ||
|
|
d5bc7df7e1 | ||
|
|
d31519aeca | ||
|
|
b3e397d0bf | ||
|
|
c7db59a8ab | ||
|
|
a0f52a636c | ||
|
|
ff706d1bf5 | ||
|
|
daf9f6d1ac | ||
|
|
3763e4fb22 | ||
|
|
e2be560a21 | ||
|
|
aaa9382e23 | ||
|
|
9d78ac8b4b | ||
|
|
5f1093dd1c | ||
|
|
e80f9107c0 | ||
|
|
77a6951021 | ||
|
|
08e485d6d4 | ||
|
|
769f153e26 | ||
|
|
d4f6869736 | ||
|
|
c86b48da5f | ||
|
|
bb60d94996 | ||
|
|
ad6ee2f6ed | ||
|
|
b6c90e97bd | ||
|
|
fe2f02a16d | ||
|
|
362a37f0eb | ||
|
|
7b763bac46 | ||
|
|
91893e45e4 | ||
|
|
870c67595b | ||
|
|
c0d5932f09 | ||
|
|
86d96515c0 | ||
|
|
9bec1974f5 | ||
|
|
9a01b9e870 | ||
|
|
41dd995175 | ||
|
|
e6d4eacd1c | ||
|
|
8c988dd475 | ||
|
|
5ad0fd72c2 | ||
|
|
c1f29f76c4 | ||
|
|
52903849f2 | ||
|
|
2d0b38e2d1 | ||
|
|
35097e88b9 | ||
|
|
6090937072 | ||
|
|
23452531f9 | ||
|
|
1c8bde4f1e | ||
|
|
76f5753a6e | ||
|
|
c2afd44654 | ||
|
|
4f5aaee125 | ||
|
|
da378f5fbf | ||
|
|
2ddbe6e9c8 | ||
|
|
85028d04a9 | ||
|
|
1f2983d712 | ||
|
|
615934557c |
Regular → Executable
Regular → Executable
Regular → Executable
@@ -5,16 +5,32 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MusicPlayer;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.IO;
|
||||
using System.Drawing;
|
||||
|
||||
namespace MusicPlayer
|
||||
{
|
||||
public class APIHandler
|
||||
{
|
||||
private NetworkHandler nw;
|
||||
|
||||
private Image defaultCover;
|
||||
public APIHandler(NetworkHandler nw)
|
||||
{
|
||||
this.nw = nw;
|
||||
defaultCover = Image.FromStream(nw.downloadArtwork("default-cover.png"));
|
||||
}
|
||||
|
||||
public JObject GetAllBySearch(string search, string album, string artist, string genre)
|
||||
{
|
||||
// Q artist genre album
|
||||
JObject o = nw.SendString($"search?q={search}&album={album}&genre={genre}&artist={artist}");
|
||||
if (o != null)
|
||||
{
|
||||
Console.WriteLine(o.PropertyValues().ToString());
|
||||
if (o["result"].ToString() == "OK") { return o; }
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public string GetSongURLByID(string id)
|
||||
@@ -46,6 +62,82 @@ namespace MusicPlayer
|
||||
return GetSongsByArgs("album=" + year);
|
||||
}
|
||||
|
||||
public List<Song> GetSongsBySearch(string search)
|
||||
{
|
||||
return GetSongsByArgs("search=" + search);
|
||||
}
|
||||
|
||||
public List<Genre> Genrify(JObject o)
|
||||
{
|
||||
List<Genre> genreslist = new List<Genre>();
|
||||
if (o["result"].ToString() == "OK")
|
||||
{
|
||||
for (int i = 0; i < o["genres"].Count(); i++)
|
||||
{
|
||||
genreslist.Add(new Genre(o["genres"][i][0].ToString()));
|
||||
}
|
||||
}
|
||||
return genreslist;
|
||||
}
|
||||
|
||||
public List<Artist> Artistify(JObject o)
|
||||
{
|
||||
List<Artist> artistlist = new List<Artist>();
|
||||
if (o["result"].ToString() == "OK")
|
||||
{
|
||||
for (int i = 0; i < o["artists"].Count(); i++)
|
||||
{
|
||||
artistlist.Add(new Artist(o["artists"][i][0].ToString()));
|
||||
}
|
||||
}
|
||||
return artistlist;
|
||||
}
|
||||
|
||||
public List<Song> Songify(JObject o)
|
||||
{
|
||||
List<Song> allsongslist = new List<Song>();
|
||||
if (o["result"].ToString() == "OK")
|
||||
{
|
||||
dynamic songs = o["songs"];
|
||||
for (int i = 0; i < songs.Count; i++)
|
||||
{
|
||||
allsongslist.Add(new Song(songs[i][0].ToString(), songs[i][3].ToString(), songs[i][5].ToString(), songs[i][4].ToString(), songs[i][1].ToString(), (int)songs[i][9], this));
|
||||
}
|
||||
}
|
||||
return allsongslist;
|
||||
}
|
||||
|
||||
public List<Album> Albumify(JObject o)
|
||||
{
|
||||
List<Album> albumlist = new List<Album>();
|
||||
|
||||
if (o["result"].ToString() == "OK")
|
||||
{
|
||||
for (int i = 0; i < o["albums"].Count(); i++)
|
||||
{
|
||||
albumlist.Add(new Album(o["albums"][i][0].ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
return albumlist;
|
||||
}
|
||||
|
||||
public List<Song> GetAllSongs()
|
||||
{
|
||||
List<Song> allsongslist = new List<Song>();
|
||||
JObject o = nw.SendString("getallsongs?");
|
||||
if (o["result"].ToString() == "OK")
|
||||
{
|
||||
dynamic songs = o["songs"];
|
||||
for (int i = 0; i < songs.Count; i++)
|
||||
{
|
||||
allsongslist.Add(new Song(songs[i][0].ToString(), songs[i][3].ToString(), songs[i][5].ToString(), songs[i][4].ToString(), songs[i][1].ToString(), (int)songs[i][9], this));
|
||||
}
|
||||
}
|
||||
return allsongslist;
|
||||
|
||||
}
|
||||
|
||||
public List<Song> GetSongsByArgs(string args)
|
||||
{
|
||||
List<Song> songslist = new List<Song>();
|
||||
@@ -55,7 +147,8 @@ namespace MusicPlayer
|
||||
dynamic songs = o["songs"];
|
||||
for (int i = 0; i < songs.Count; i++)
|
||||
{
|
||||
songslist.Add(new Song(songs[i][0].ToString(), songs[i][3].ToString(), songs[i][5].ToString(), songs[i][4].ToString(), this));
|
||||
if(songs[i][2].ToString().EndsWith(".mp3"))
|
||||
songslist.Add(new Song(songs[i][0].ToString(), songs[i][3].ToString(), songs[i][5].ToString(), songs[i][4].ToString(), songs[i][1].ToString(), (int)songs[i][9], this));
|
||||
}
|
||||
}
|
||||
return songslist;
|
||||
@@ -65,7 +158,7 @@ namespace MusicPlayer
|
||||
{
|
||||
List<Artist> artistlist = new List<Artist>();
|
||||
|
||||
JObject o = nw.SendString("getartists?id=hallo");
|
||||
JObject o = nw.SendString("getartists?");
|
||||
if (o["result"].ToString() == "OK")
|
||||
{
|
||||
for (int i = 0; i < o["artists"].Count(); i++) {
|
||||
@@ -75,11 +168,21 @@ namespace MusicPlayer
|
||||
return artistlist;
|
||||
}
|
||||
|
||||
public Image getAlbumCover(string album)
|
||||
{
|
||||
MemoryStream stream = nw.downloadArtwork(album + ".jpg");
|
||||
if(stream != null)
|
||||
{
|
||||
return Image.FromStream(stream);
|
||||
}
|
||||
return defaultCover;
|
||||
}
|
||||
|
||||
public List<Album> GetAlbums()
|
||||
{
|
||||
List<Album> albumlist = new List<Album>();
|
||||
|
||||
JObject o = nw.SendString("getalbums?id=hallo");
|
||||
JObject o = nw.SendString("getalbums?");
|
||||
if (o["result"].ToString() == "OK")
|
||||
{
|
||||
for (int i = 0; i < o["albums"].Count(); i++)
|
||||
@@ -94,7 +197,7 @@ namespace MusicPlayer
|
||||
public List<Year> GetYears()
|
||||
{
|
||||
List<Year> yearlist = new List<Year> ();
|
||||
JObject o = nw.SendString("getyears?id=hallo");
|
||||
JObject o = nw.SendString("getyears?");
|
||||
if (o["result"].ToString() == "OK")
|
||||
{
|
||||
for (int i = 0; i < o["years"].Count(); i++)
|
||||
@@ -104,5 +207,19 @@ namespace MusicPlayer
|
||||
}
|
||||
return yearlist;
|
||||
}
|
||||
|
||||
public List<Genre> GetGenres()
|
||||
{
|
||||
List<Genre> genreslist = new List<Genre>();
|
||||
JObject o = nw.SendString("getgenres?");
|
||||
if (o["result"].ToString() == "OK")
|
||||
{
|
||||
for (int i = 0; i < o["genres"].Count(); i++)
|
||||
{
|
||||
genreslist.Add(new Genre(o["genres"][i][0].ToString()));
|
||||
}
|
||||
}
|
||||
return genreslist;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+177
@@ -0,0 +1,177 @@
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MusicPlayer
|
||||
{
|
||||
partial class AdvancedSearch
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AdvancedSearch));
|
||||
this.SearchTermTextBox = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.AlbumTextBox = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.ArtistTextBox = new System.Windows.Forms.TextBox();
|
||||
this.GenreTextBox = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.SearchButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// SearchTermTextBox
|
||||
//
|
||||
this.SearchTermTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.SearchTermTextBox.Location = new System.Drawing.Point(12, 29);
|
||||
this.SearchTermTextBox.Name = "SearchTermTextBox";
|
||||
this.SearchTermTextBox.Size = new System.Drawing.Size(210, 20);
|
||||
this.SearchTermTextBox.TabIndex = 0;
|
||||
this.SearchTermTextBox.KeyDown += TextBox_KeyDown;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(12, 13);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(68, 13);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "Search Term";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(12, 70);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(36, 13);
|
||||
this.label2.TabIndex = 2;
|
||||
this.label2.Text = "Album";
|
||||
//
|
||||
// AlbumTextBox
|
||||
//
|
||||
this.AlbumTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.AlbumTextBox.Location = new System.Drawing.Point(12, 86);
|
||||
this.AlbumTextBox.Name = "AlbumTextBox";
|
||||
this.AlbumTextBox.Size = new System.Drawing.Size(210, 20);
|
||||
this.AlbumTextBox.TabIndex = 3;
|
||||
this.AlbumTextBox.KeyDown += TextBox_KeyDown;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(12, 119);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(30, 13);
|
||||
this.label3.TabIndex = 4;
|
||||
this.label3.Text = "Artist";
|
||||
//
|
||||
// ArtistTextBox
|
||||
//
|
||||
this.ArtistTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ArtistTextBox.Location = new System.Drawing.Point(12, 135);
|
||||
this.ArtistTextBox.Name = "ArtistTextBox";
|
||||
this.ArtistTextBox.Size = new System.Drawing.Size(210, 20);
|
||||
this.ArtistTextBox.TabIndex = 5;
|
||||
this.ArtistTextBox.KeyDown += TextBox_KeyDown;
|
||||
//
|
||||
// GenreTextBox
|
||||
//
|
||||
this.GenreTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.GenreTextBox.Location = new System.Drawing.Point(12, 187);
|
||||
this.GenreTextBox.Name = "GenreTextBox";
|
||||
this.GenreTextBox.Size = new System.Drawing.Size(210, 20);
|
||||
this.GenreTextBox.TabIndex = 6;
|
||||
this.GenreTextBox.KeyDown += TextBox_KeyDown;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(13, 168);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(36, 13);
|
||||
this.label4.TabIndex = 7;
|
||||
this.label4.Text = "Genre";
|
||||
//
|
||||
// SearchButton
|
||||
//
|
||||
this.SearchButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.SearchButton.Location = new System.Drawing.Point(12, 226);
|
||||
this.SearchButton.Name = "SearchButton";
|
||||
this.SearchButton.Size = new System.Drawing.Size(210, 23);
|
||||
this.SearchButton.TabIndex = 8;
|
||||
this.SearchButton.Text = "Search";
|
||||
this.SearchButton.UseVisualStyleBackColor = true;
|
||||
this.SearchButton.Click += new System.EventHandler(this.SearchButton_Click);
|
||||
//
|
||||
// AdvancedSearch
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(234, 261);
|
||||
this.Controls.Add(this.SearchButton);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.GenreTextBox);
|
||||
this.Controls.Add(this.ArtistTextBox);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.AlbumTextBox);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.SearchTermTextBox);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximumSize = new System.Drawing.Size(450, 300);
|
||||
this.MinimumSize = new System.Drawing.Size(250, 300);
|
||||
this.Name = "AdvancedSearch";
|
||||
this.Text = "Advanced Search";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
private void TextBox_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if(e.KeyCode == Keys.Enter)
|
||||
{
|
||||
SearchButton_Click(sender, new System.EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private TextBox SearchTermTextBox;
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private TextBox AlbumTextBox;
|
||||
private Label label3;
|
||||
private TextBox ArtistTextBox;
|
||||
private TextBox GenreTextBox;
|
||||
private Label label4;
|
||||
private Button SearchButton;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MusicPlayer
|
||||
{
|
||||
public partial class AdvancedSearch : Form
|
||||
{
|
||||
private Main main;
|
||||
|
||||
public AdvancedSearch(Main main)
|
||||
{
|
||||
this.main = main;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void SearchButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(SearchTermTextBox.Text.Length > 1)
|
||||
{
|
||||
SearchTermTextBox.ForeColor = Color.Black;
|
||||
main.AdvancedSearchFilter(SearchTermTextBox.Text, AlbumTextBox.Text, ArtistTextBox.Text, GenreTextBox.Text);
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchTermTextBox.ForeColor = Color.Red;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,7 @@
|
||||
namespace MusicPlayer
|
||||
|
||||
using System.Drawing;
|
||||
|
||||
namespace MusicPlayer
|
||||
{
|
||||
public class Album
|
||||
{
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
+245
-39
@@ -12,47 +12,253 @@ namespace MusicPlayer
|
||||
{
|
||||
public class AudioHandler
|
||||
{
|
||||
public static Stream ms = new MemoryStream();
|
||||
public enum AudioState { PLAYING, WAITING, STOPPED, PAUSED, SEEKING }
|
||||
public enum BufferState { EMPTY, BUFFERING, DONE }
|
||||
public AudioState AState { get; set; }
|
||||
public BufferState BState { get; set; }
|
||||
|
||||
public static void PlayMp3FromUrl(string url)
|
||||
public int Buffered { get
|
||||
{
|
||||
if(CurrentSong is RadioStation)
|
||||
return Math.Min((int)((bufpos - ms.Position) / 1000), 1000);
|
||||
else
|
||||
return Math.Min((int)((bufpos / (double)LengthBuffer) * 1000), 1000);
|
||||
} }
|
||||
private long LengthBuffer { get; set; }
|
||||
private long bufpos = 0;
|
||||
|
||||
|
||||
public int Position { get { return Math.Min((int)((playpos / (double)Length) * 1000), 1000); } }
|
||||
private long Length { get; set; }
|
||||
private long playpos = 0;
|
||||
|
||||
|
||||
public int CurrentTime { get; set; }
|
||||
|
||||
public int TotalTime { get { return CurrentSong != null ? CurrentSong.Seconds : 0; } }
|
||||
|
||||
private long seek = 0;
|
||||
|
||||
private MemoryStream ms;
|
||||
|
||||
private Thread network;
|
||||
private Thread audio;
|
||||
|
||||
public Song CurrentSong;
|
||||
|
||||
private Main main;
|
||||
|
||||
public AudioHandler(Main main)
|
||||
{
|
||||
new Thread(delegate (object o)
|
||||
{
|
||||
var response = WebRequest.Create(url).GetResponse();
|
||||
using (var stream = response.GetResponseStream())
|
||||
{
|
||||
byte[] buffer = new byte[65536]; // 64KB chunks
|
||||
int read;
|
||||
while ((read = stream.Read(buffer, 0, buffer.Length)) > 0)
|
||||
{
|
||||
var pos = ms.Position;
|
||||
ms.Position = ms.Length;
|
||||
ms.Write(buffer, 0, read);
|
||||
ms.Position = pos;
|
||||
}
|
||||
}
|
||||
}).Start();
|
||||
|
||||
new Thread(delegate (object o)
|
||||
{
|
||||
// Pre-buffering some data to allow NAudio to start playing
|
||||
while (ms.Length < 65536 * 10)
|
||||
Thread.Sleep(1000);
|
||||
|
||||
ms.Position = 0;
|
||||
using (WaveStream blockAlignedStream = new BlockAlignReductionStream(WaveFormatConversionStream.CreatePcmStream(new Mp3FileReader(ms))))
|
||||
{
|
||||
using (WaveOut waveOut = new WaveOut(WaveCallbackInfo.FunctionCallback()))
|
||||
{
|
||||
waveOut.Init(blockAlignedStream);
|
||||
waveOut.Play();
|
||||
while (waveOut.PlaybackState == PlaybackState.Playing)
|
||||
{
|
||||
System.Threading.Thread.Sleep(100);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).Start();
|
||||
this.main = main;
|
||||
CreateThreads();
|
||||
}
|
||||
|
||||
private void CreateThreads()
|
||||
{
|
||||
AState = AudioState.STOPPED;
|
||||
BState = BufferState.EMPTY;
|
||||
|
||||
CurrentSong = null;
|
||||
|
||||
Thread.Sleep(10);
|
||||
|
||||
ms = new MemoryStream();
|
||||
|
||||
network = new Thread(LoadAudio);
|
||||
audio = new Thread(PlayAudio);
|
||||
|
||||
network.IsBackground = true;
|
||||
audio.IsBackground = true;
|
||||
|
||||
Length = 1;
|
||||
LengthBuffer = 1;
|
||||
bufpos = 0;
|
||||
playpos = 0;
|
||||
CurrentTime = 0;
|
||||
}
|
||||
|
||||
public void Play(Song s)
|
||||
{
|
||||
if (CurrentSong == s && AState == AudioState.PAUSED)
|
||||
AState = AudioState.PLAYING;
|
||||
else
|
||||
{
|
||||
Stop();
|
||||
|
||||
CurrentSong = s;
|
||||
network.Start(s);
|
||||
audio.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public void Seek(int position)
|
||||
{
|
||||
if (position >= Buffered-1)
|
||||
return;
|
||||
|
||||
seek = Length / 1000 * position;
|
||||
AState = AudioState.SEEKING;
|
||||
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
CreateThreads();
|
||||
}
|
||||
|
||||
public void Pause()
|
||||
{
|
||||
if(CurrentSong == null)
|
||||
AState = AudioState.STOPPED;
|
||||
else
|
||||
AState = AudioState.PAUSED;
|
||||
}
|
||||
|
||||
private void StreamFromMP3(Stream s, long pos, bool firstrun)
|
||||
{
|
||||
long position = 0;
|
||||
ms.Position = position;
|
||||
Mp3FileReader mp3fr = null;
|
||||
|
||||
try
|
||||
{
|
||||
mp3fr = new Mp3FileReader(ms);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
AState = AudioState.STOPPED;
|
||||
//main.form.SongFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
using (WaveStream blockAlignedStream = new BlockAlignReductionStream(WaveFormatConversionStream.CreatePcmStream(mp3fr)))
|
||||
{
|
||||
blockAlignedStream.Position = pos;
|
||||
using (WaveOut waveOut = new WaveOut(WaveCallbackInfo.FunctionCallback()))
|
||||
{
|
||||
waveOut.Init(blockAlignedStream);
|
||||
waveOut.Play();
|
||||
|
||||
if (CurrentSong == null || CurrentSong.Seconds == 0)
|
||||
Length = ms.Length / waveOut.OutputWaveFormat.AverageBytesPerSecond;
|
||||
else
|
||||
Length = CurrentSong.Seconds * waveOut.OutputWaveFormat.AverageBytesPerSecond;
|
||||
CurrentTime = (int)(ms.Position / waveOut.OutputWaveFormat.AverageBytesPerSecond);
|
||||
|
||||
while (waveOut.PlaybackState != PlaybackState.Stopped)
|
||||
{
|
||||
System.Threading.Thread.Sleep(10);
|
||||
|
||||
if (AState == AudioState.PLAYING && waveOut.PlaybackState == PlaybackState.Paused)
|
||||
{
|
||||
blockAlignedStream.Position = position;
|
||||
waveOut.Play();
|
||||
}
|
||||
if (AState == AudioState.PAUSED && waveOut.PlaybackState == PlaybackState.Playing)
|
||||
{
|
||||
position = blockAlignedStream.Position;
|
||||
waveOut.Pause();
|
||||
}
|
||||
if (AState == AudioState.SEEKING)
|
||||
{
|
||||
blockAlignedStream.Seek(seek - (seek % blockAlignedStream.WaveFormat.BlockAlign), SeekOrigin.Begin);
|
||||
AState = AudioState.PLAYING;
|
||||
waveOut.Play();
|
||||
}
|
||||
if (AState == AudioState.STOPPED)
|
||||
{
|
||||
waveOut.Stop();
|
||||
}
|
||||
if (BState == BufferState.DONE && firstrun )
|
||||
{
|
||||
if( ! (CurrentSong is RadioStation))
|
||||
{
|
||||
position = mp3fr.Position;
|
||||
mp3fr.Close();
|
||||
StreamFromMP3(ms, position, false);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
AState = AudioState.STOPPED;
|
||||
}
|
||||
}
|
||||
|
||||
playpos = blockAlignedStream.Position;
|
||||
CurrentTime = (int)(playpos / waveOut.OutputWaveFormat.AverageBytesPerSecond);
|
||||
|
||||
}
|
||||
|
||||
if(AState == AudioState.PLAYING && !firstrun)
|
||||
main.form.SongFinished();
|
||||
AState = AudioState.STOPPED;
|
||||
playpos = 0;
|
||||
CurrentTime = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void PlayAudio()
|
||||
{
|
||||
AState = AudioState.WAITING;
|
||||
|
||||
int buffertime = 0;
|
||||
if (CurrentSong is RadioStation)
|
||||
buffertime = 32768 * 10;
|
||||
else
|
||||
buffertime = 65536 * 10;
|
||||
|
||||
while (ms.Length < buffertime && BState != BufferState.DONE)
|
||||
Thread.Sleep(1000);
|
||||
AState = AudioState.PLAYING;
|
||||
|
||||
StreamFromMP3(ms,0, true);
|
||||
|
||||
}
|
||||
|
||||
private void LoadAudio(object o)
|
||||
{
|
||||
Song s = (Song) o;
|
||||
WebResponse response = null;
|
||||
|
||||
try
|
||||
{
|
||||
response = WebRequest.Create(s.Url).GetResponse();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
BState = BufferState.EMPTY;
|
||||
AState = AudioState.STOPPED;
|
||||
main.form.SongFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
BState = BufferState.EMPTY;
|
||||
LengthBuffer = response.ContentLength;
|
||||
using (var stream = response.GetResponseStream())
|
||||
{
|
||||
byte[] buffer = new byte[65536]; // 64KB chunks
|
||||
|
||||
int read;
|
||||
BState = BufferState.BUFFERING;
|
||||
AState = AudioState.WAITING;
|
||||
|
||||
while ((read = stream.Read(buffer, 0, buffer.Length)) > 0 && AState != AudioState.STOPPED)
|
||||
{
|
||||
var pos = ms.Position;
|
||||
ms.Position = ms.Length;
|
||||
ms.Write(buffer, 0, read);
|
||||
ms.Position = pos;
|
||||
|
||||
this.bufpos = ms.Length;
|
||||
}
|
||||
}
|
||||
|
||||
BState = BufferState.DONE;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
namespace MusicPlayer
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(284, 261);
|
||||
this.Name = "Form1";
|
||||
this.Text = "Form1";
|
||||
this.Load += new System.EventHandler(this.Form1_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
namespace MusicPlayer
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Text = "Form1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
namespace MusicPlayer
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(284, 261);
|
||||
this.Name = "Form1";
|
||||
this.Text = "Form1";
|
||||
this.Load += new System.EventHandler(this.Form1_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
namespace MusicPlayer
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(284, 261);
|
||||
this.Name = "Form1";
|
||||
this.Text = "Form1";
|
||||
this.Load += new System.EventHandler(this.Form1_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
@@ -0,0 +1,11 @@
|
||||
namespace MusicPlayer
|
||||
{
|
||||
public class Genre
|
||||
{
|
||||
public string name { get; set; }
|
||||
public Genre(string name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
+247
-14
@@ -1,8 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace MusicPlayer
|
||||
{
|
||||
@@ -11,41 +14,271 @@ namespace MusicPlayer
|
||||
public APIHandler api;
|
||||
public MainForm form;
|
||||
public NetworkHandler nw;
|
||||
public PlaylistHandler pl;
|
||||
public AudioHandler audio;
|
||||
public SongsTable table;
|
||||
|
||||
private SongsTable table;
|
||||
private List<string> genres;
|
||||
private List<string> artists;
|
||||
|
||||
public Main(NetworkHandler nw, APIHandler api, MainForm form)
|
||||
public List<Song> currentPlayingList;
|
||||
|
||||
public Main(NetworkHandler nw, APIHandler api, MainForm form, PlaylistHandler pl)
|
||||
{
|
||||
this.nw = nw;
|
||||
this.api = api;
|
||||
this.form = form;
|
||||
form.main = this;
|
||||
pl.main = this;
|
||||
pl.Populate();
|
||||
this.pl = pl;
|
||||
|
||||
audio = new AudioHandler();
|
||||
audio = new AudioHandler(this);
|
||||
table = new SongsTable();
|
||||
form.SongsTableView.DataSource = table;
|
||||
form.SongsTableView.Columns[5].Visible = false;
|
||||
|
||||
genres = new List<string>();
|
||||
artists = new List<string>();
|
||||
|
||||
currentPlayingList = new List<Song>();
|
||||
|
||||
Populate();
|
||||
}
|
||||
|
||||
public void SwitchServer(string server)
|
||||
{
|
||||
Clear();
|
||||
nw.ip = server;
|
||||
Populate();
|
||||
}
|
||||
|
||||
private void Clear()
|
||||
{
|
||||
form.GenreListBox.Items.Clear();
|
||||
form.ArtistListBox.Items.Clear();
|
||||
form.AlbumListView.Items.Clear();
|
||||
form.PlaylistBox.Items.Clear();
|
||||
table.Clear();
|
||||
|
||||
genres = new List<string>();
|
||||
artists = new List<string>();
|
||||
|
||||
currentPlayingList = new List<Song>();
|
||||
}
|
||||
|
||||
private void Populate()
|
||||
{
|
||||
table.Add(new Song("102", "Test Song 1", "Test Album 1", "Test Artist 1", api));
|
||||
this.api.GetAlbums().ForEach(a => { form.AlbumListView.Items.Add(a.albumnaam);});
|
||||
this.api.GetArtists().ForEach(a => { artists.Add(a.naam); form.ArtistListBox.Items.Add(a.naam); });
|
||||
this.api.GetGenres().ForEach(g => { genres.Add(g.name); form.GenreListBox.Items.Add(g.name); });
|
||||
this.pl.GetPlaylists().ForEach(p => form.PlaylistBox.Items.Add(p.name));
|
||||
BackgroundWorker bw = new BackgroundWorker();
|
||||
bw.DoWork += new DoWorkEventHandler(
|
||||
delegate (object o, DoWorkEventArgs args)
|
||||
{
|
||||
BackgroundWorker b = o as BackgroundWorker;
|
||||
ImageList imagelist = new ImageList();
|
||||
List<string> templist = new List<string>();
|
||||
Action action = () =>
|
||||
{
|
||||
foreach (ListViewItem item in form.AlbumListView.Items)
|
||||
{
|
||||
templist.Add(item.Text);
|
||||
}
|
||||
};
|
||||
form.Invoke(action);
|
||||
|
||||
form.GenreListBox.Items.Add("Hardcore");
|
||||
form.GenreListBox.Items.Add("Hardstyle");
|
||||
form.GenreListBox.Items.Add("Pop");
|
||||
foreach (string item in templist)
|
||||
{
|
||||
imagelist.Images.Add(item, api.getAlbumCover(item));
|
||||
}
|
||||
|
||||
form.ArtistListBox.Items.Add("Kygo");
|
||||
form.ArtistListBox.Items.Add("Monstercat");
|
||||
form.ArtistListBox.Items.Add("Mozart");
|
||||
action = () => {
|
||||
imagelist.ImageSize = new System.Drawing.Size(64,64);
|
||||
imagelist.ColorDepth = ColorDepth.Depth32Bit;
|
||||
form.AlbumListView.View = View.LargeIcon;
|
||||
form.AlbumListView.LargeImageList = imagelist;
|
||||
foreach (ListViewItem item in form.AlbumListView.Items)
|
||||
{
|
||||
item.ImageKey = item.Text;
|
||||
}
|
||||
};
|
||||
form.Invoke(action);
|
||||
});
|
||||
bw.RunWorkerAsync();
|
||||
}
|
||||
|
||||
form.AlbumListView.Items.Add("Album 1");
|
||||
form.AlbumListView.Items.Add("Album 2");
|
||||
form.AlbumListView.Items.Add("Album 3");
|
||||
public void Repopulate()
|
||||
{
|
||||
form.AlbumListView.Items.Clear();
|
||||
form.ArtistListBox.Items.Clear();
|
||||
form.GenreListBox.Items.Clear();
|
||||
form.PlaylistBox.Items.Clear();
|
||||
|
||||
table.Add(new Song("104", "Test Song 2", "Test Album 2", "Test Artist 2", api));
|
||||
this.api.GetAlbums().ForEach(a => form.AlbumListView.Items.Add(a.albumnaam,a.albumnaam));
|
||||
this.api.GetArtists().ForEach(a => form.ArtistListBox.Items.Add(a.naam));
|
||||
this.api.GetGenres().ForEach(g => form.GenreListBox.Items.Add(g.name));
|
||||
this.pl.GetPlaylists().ForEach(p => form.PlaylistBox.Items.Add(p.name));
|
||||
}
|
||||
|
||||
public void ArtistFilter(string artist)
|
||||
{
|
||||
table.Clear();
|
||||
api.GetSongsByArtist(artist).ForEach(s =>
|
||||
{
|
||||
table.Add(s);
|
||||
});
|
||||
}
|
||||
|
||||
public void SearchFilter(string search)
|
||||
{
|
||||
table.Clear();
|
||||
api.GetSongsBySearch(search).ForEach(s =>
|
||||
{
|
||||
table.Add(s);
|
||||
});
|
||||
}
|
||||
|
||||
public void AdvancedSearchFilter(string search, string album, string artist, string genre)
|
||||
{
|
||||
JObject o = api.GetAllBySearch(search, album, artist, genre);
|
||||
if (o != null)
|
||||
{
|
||||
//q
|
||||
form.AlbumListView.Items.Clear();
|
||||
form.ArtistListBox.Items.Clear();
|
||||
form.GenreListBox.Items.Clear();
|
||||
form.PlaylistBox.Items.Clear();
|
||||
table.Clear();
|
||||
api.Songify(o).ForEach(s => table.Add(s));
|
||||
|
||||
//albums
|
||||
api.Albumify(o).ForEach(a => form.AlbumListView.Items.Add(a.albumnaam, a.albumnaam));
|
||||
|
||||
//artists
|
||||
api.Artistify(o).ForEach(a => form.ArtistListBox.Items.Add(a.naam));
|
||||
|
||||
//genres
|
||||
api.Genrify(o).ForEach(g => form.GenreListBox.Items.Add(g.name));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void FilterCurrentPlaying()
|
||||
{
|
||||
table.Clear();
|
||||
currentPlayingList.ForEach(s =>
|
||||
{
|
||||
table.Add(s);
|
||||
});
|
||||
|
||||
form.GenreListBox.ClearSelected();
|
||||
form.ArtistListBox.ClearSelected();
|
||||
form.PlaylistBox.ClearSelected();
|
||||
form.AlbumListView.SelectedIndices.Clear();
|
||||
}
|
||||
|
||||
public void SearchArtist(string search)
|
||||
{
|
||||
form.ArtistListBox.Items.Clear();
|
||||
|
||||
if (search.Length > 1)
|
||||
{
|
||||
string sPattern = search;
|
||||
|
||||
foreach (string s in artists)
|
||||
{
|
||||
if (System.Text.RegularExpressions.Regex.IsMatch(s, sPattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase))
|
||||
{
|
||||
form.ArtistListBox.Items.Add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
artists.ForEach(a => form.ArtistListBox.Items.Add(a));
|
||||
}
|
||||
}
|
||||
|
||||
public void SearchGenre(string search)
|
||||
{
|
||||
form.GenreListBox.Items.Clear();
|
||||
|
||||
if (search.Length > 1)
|
||||
{
|
||||
string sPattern = search;
|
||||
|
||||
foreach (string s in genres)
|
||||
{
|
||||
if (System.Text.RegularExpressions.Regex.IsMatch(s, sPattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase))
|
||||
{
|
||||
form.GenreListBox.Items.Add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
genres.ForEach(g => form.GenreListBox.Items.Add(g));
|
||||
}
|
||||
}
|
||||
|
||||
public void GenreFilter(string genre)
|
||||
{
|
||||
table.Clear();
|
||||
api.GetSongsByGenre(genre).ForEach(s =>
|
||||
{
|
||||
table.Add(s);
|
||||
});
|
||||
}
|
||||
|
||||
public void PlaylistFilter(string name)
|
||||
{
|
||||
table.Clear();
|
||||
pl.GetPlaylistByName(name).GetSongs().ForEach(s => table.Add(s));
|
||||
|
||||
}
|
||||
|
||||
public void AlbumFilter(string album)
|
||||
{
|
||||
table.Clear();
|
||||
api.GetSongsByAlbum(album).ForEach(s =>
|
||||
{
|
||||
table.Add(s);
|
||||
});
|
||||
}
|
||||
|
||||
public static string SecondsToTimestamp(int seconds)
|
||||
{
|
||||
string str = "";
|
||||
|
||||
//Hours
|
||||
str += (seconds / 3600).ToString("D2") + ":";
|
||||
seconds %= 3600;
|
||||
|
||||
//Minutes
|
||||
str += (seconds / 60).ToString("D2") + ":";
|
||||
seconds %= 60;
|
||||
|
||||
//Seconds
|
||||
str += seconds.ToString("D2");
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
public static bool CheckURLValid(string source)
|
||||
{
|
||||
Uri uriResult;
|
||||
return Uri.TryCreate(source, UriKind.Absolute, out uriResult) && uriResult.Scheme == Uri.UriSchemeHttp;
|
||||
}
|
||||
|
||||
public static string GetDomain(string url)
|
||||
{
|
||||
Uri uri = new Uri(url);
|
||||
return uri.Host;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
+810
-42
@@ -1,4 +1,6 @@
|
||||
namespace MusicPlayer
|
||||
using System;
|
||||
|
||||
namespace MusicPlayer
|
||||
{
|
||||
partial class MainForm
|
||||
{
|
||||
@@ -21,30 +23,106 @@
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
bool clicked = false;
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||
this.SongsTableView = new System.Windows.Forms.DataGridView();
|
||||
this.GenreListBox = new System.Windows.Forms.ListBox();
|
||||
this.AlbumListView = new System.Windows.Forms.ListView();
|
||||
this.ArtistListBox = new System.Windows.Forms.ListBox();
|
||||
this.MainPanel = new System.Windows.Forms.Panel();
|
||||
this.AddToQueueLabel = new System.Windows.Forms.Label();
|
||||
this.SplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.PlaylistBox = new System.Windows.Forms.ListBox();
|
||||
this.AlbumListLabel = new System.Windows.Forms.Label();
|
||||
this.ArtistListLabel = new System.Windows.Forms.Label();
|
||||
this.GenreListLabel = new System.Windows.Forms.Label();
|
||||
this.PlaylistListLabel = new System.Windows.Forms.Label();
|
||||
this.MenuStrip = new System.Windows.Forms.MenuStrip();
|
||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.overviewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.playlistsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.ViewQueueButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.playbackToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.PlayNextSongButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.LoopSongButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ShuffleSongButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.playlistToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.makeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.viewPlaylistToolstripMenuButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.searchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SearchGenresToolStripLabel = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SearchGenresTextBox = new System.Windows.Forms.ToolStripTextBox();
|
||||
this.ClearGenreSearchButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SearchArtistToolStripLabel = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SearchArtistsTextBox = new System.Windows.Forms.ToolStripTextBox();
|
||||
this.ClearArtistSearchButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.songsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SearchSongsTextBox = new System.Windows.Forms.ToolStripTextBox();
|
||||
this.SearchSongsButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.AdvancedSearchButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.resetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.serverToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SelectServerJancoButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SelectServerYorickButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.radioToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.fMToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.slamFMToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.qDanceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.customToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.RadioStationTextBox = new System.Windows.Forms.ToolStripTextBox();
|
||||
this.SetRadioStationButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ControlsPanel = new System.Windows.Forms.Panel();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.NextButton = new System.Windows.Forms.Button();
|
||||
this.PreviousButton = new System.Windows.Forms.Button();
|
||||
this.CurrentSongLabel = new System.Windows.Forms.Label();
|
||||
this.LabelTotalTime = new System.Windows.Forms.Label();
|
||||
this.LabelCurrentTime = new System.Windows.Forms.Label();
|
||||
this.PositionTrackBar = new System.Windows.Forms.TrackBar();
|
||||
this.BufferLabel = new System.Windows.Forms.Label();
|
||||
this.BufferBar = new System.Windows.Forms.ProgressBar();
|
||||
this.StopButton = new System.Windows.Forms.Button();
|
||||
this.PauseButton = new System.Windows.Forms.Button();
|
||||
this.PlayButton = new System.Windows.Forms.Button();
|
||||
this.UpdateTimer = new System.Windows.Forms.Timer(this.components);
|
||||
this.NotifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
|
||||
this.NotifyMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.NotifyMenuStripPlayingLabel = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.NotifyMenuStripPlayingSongLabel = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.NotifyMenuStripPlayButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.NotifyMenuStripPauseButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.NotifyMenuStripStopButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.NotifyMenuStripNextButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.NotifyMenuStripPreviousButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SongsTableView)).BeginInit();
|
||||
this.MainPanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SplitContainer)).BeginInit();
|
||||
this.SplitContainer.Panel1.SuspendLayout();
|
||||
this.SplitContainer.Panel2.SuspendLayout();
|
||||
this.SplitContainer.SuspendLayout();
|
||||
this.MenuStrip.SuspendLayout();
|
||||
this.ControlsPanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PositionTrackBar)).BeginInit();
|
||||
this.NotifyMenuStrip.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// SongsTableView
|
||||
@@ -52,54 +130,74 @@
|
||||
this.SongsTableView.AllowUserToAddRows = false;
|
||||
this.SongsTableView.AllowUserToDeleteRows = false;
|
||||
this.SongsTableView.AllowUserToResizeRows = false;
|
||||
this.SongsTableView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.SongsTableView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
||||
this.SongsTableView.BackgroundColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.ControlLight;
|
||||
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.SongsTableView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
|
||||
this.SongsTableView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.SongsTableView.Location = new System.Drawing.Point(12, 153);
|
||||
this.SongsTableView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.SongsTableView.Location = new System.Drawing.Point(0, 0);
|
||||
this.SongsTableView.MultiSelect = false;
|
||||
this.SongsTableView.Name = "SongsTableView";
|
||||
this.SongsTableView.ReadOnly = true;
|
||||
this.SongsTableView.RowHeadersVisible = false;
|
||||
this.SongsTableView.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.SongsTableView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||
this.SongsTableView.Size = new System.Drawing.Size(760, 148);
|
||||
this.SongsTableView.Size = new System.Drawing.Size(760, 174);
|
||||
this.SongsTableView.TabIndex = 0;
|
||||
this.SongsTableView.SelectionChanged += new System.EventHandler(this.SongsTableView_SelectionChanged);
|
||||
this.SongsTableView.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.SongsTableView_CellDoubleClick);
|
||||
this.SongsTableView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SongsTableView_MouseDown);
|
||||
this.SongsTableView.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SongsTableView_MouseMove);
|
||||
this.SongsTableView.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SongsTableView_MouseUp);
|
||||
//
|
||||
// GenreListBox
|
||||
//
|
||||
this.GenreListBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.GenreListBox.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.GenreListBox.FormattingEnabled = true;
|
||||
this.GenreListBox.Location = new System.Drawing.Point(12, 12);
|
||||
this.GenreListBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.GenreListBox.Name = "GenreListBox";
|
||||
this.GenreListBox.Size = new System.Drawing.Size(124, 134);
|
||||
this.GenreListBox.Size = new System.Drawing.Size(175, 121);
|
||||
this.GenreListBox.Sorted = true;
|
||||
this.GenreListBox.TabIndex = 1;
|
||||
this.GenreListBox.SelectedIndexChanged += new System.EventHandler(this.GenreListBox_SelectedIndexChanged);
|
||||
//
|
||||
// AlbumListView
|
||||
//
|
||||
this.AlbumListView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
this.AlbumListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.AlbumListView.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.AlbumListView.Location = new System.Drawing.Point(272, 12);
|
||||
this.AlbumListView.Location = new System.Drawing.Point(362, 0);
|
||||
this.AlbumListView.MultiSelect = false;
|
||||
this.AlbumListView.Name = "AlbumListView";
|
||||
this.AlbumListView.Size = new System.Drawing.Size(500, 134);
|
||||
this.AlbumListView.Size = new System.Drawing.Size(398, 121);
|
||||
this.AlbumListView.Sorting = System.Windows.Forms.SortOrder.Ascending;
|
||||
this.AlbumListView.TabIndex = 2;
|
||||
this.AlbumListView.TileSize = new System.Drawing.Size(185, 30);
|
||||
this.AlbumListView.UseCompatibleStateImageBehavior = false;
|
||||
this.AlbumListView.View = System.Windows.Forms.View.Tile;
|
||||
this.AlbumListView.SelectedIndexChanged += new System.EventHandler(this.AlbumListView_SelectedIndexChanged);
|
||||
//
|
||||
// ArtistListBox
|
||||
//
|
||||
this.ArtistListBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.ArtistListBox.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.ArtistListBox.FormattingEnabled = true;
|
||||
this.ArtistListBox.Location = new System.Drawing.Point(142, 12);
|
||||
this.ArtistListBox.Location = new System.Drawing.Point(181, 0);
|
||||
this.ArtistListBox.Name = "ArtistListBox";
|
||||
this.ArtistListBox.Size = new System.Drawing.Size(124, 134);
|
||||
this.ArtistListBox.Size = new System.Drawing.Size(175, 121);
|
||||
this.ArtistListBox.Sorted = true;
|
||||
this.ArtistListBox.TabIndex = 3;
|
||||
this.ArtistListBox.SelectedIndexChanged += new System.EventHandler(this.ArtistListBox_SelectedIndexChanged);
|
||||
//
|
||||
// MainPanel
|
||||
//
|
||||
@@ -107,21 +205,115 @@
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.MainPanel.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.MainPanel.Controls.Add(this.GenreListBox);
|
||||
this.MainPanel.Controls.Add(this.ArtistListBox);
|
||||
this.MainPanel.Controls.Add(this.AlbumListView);
|
||||
this.MainPanel.Controls.Add(this.SongsTableView);
|
||||
this.MainPanel.Controls.Add(this.AddToQueueLabel);
|
||||
this.MainPanel.Controls.Add(this.SplitContainer);
|
||||
this.MainPanel.Controls.Add(this.AlbumListLabel);
|
||||
this.MainPanel.Controls.Add(this.ArtistListLabel);
|
||||
this.MainPanel.Controls.Add(this.GenreListLabel);
|
||||
this.MainPanel.Controls.Add(this.PlaylistListLabel);
|
||||
this.MainPanel.Location = new System.Drawing.Point(0, 24);
|
||||
this.MainPanel.Name = "MainPanel";
|
||||
this.MainPanel.Size = new System.Drawing.Size(784, 313);
|
||||
this.MainPanel.Size = new System.Drawing.Size(784, 351);
|
||||
this.MainPanel.TabIndex = 5;
|
||||
//
|
||||
// AddToQueueLabel
|
||||
//
|
||||
this.AddToQueueLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.AddToQueueLabel.AutoSize = true;
|
||||
this.AddToQueueLabel.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.AddToQueueLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.AddToQueueLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.AddToQueueLabel.Location = new System.Drawing.Point(668, 4);
|
||||
this.AddToQueueLabel.Name = "AddToQueueLabel";
|
||||
this.AddToQueueLabel.Size = new System.Drawing.Size(104, 18);
|
||||
this.AddToQueueLabel.TabIndex = 10;
|
||||
this.AddToQueueLabel.Text = "Add to Queue";
|
||||
this.AddToQueueLabel.Visible = false;
|
||||
//
|
||||
// SplitContainer
|
||||
//
|
||||
this.SplitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.SplitContainer.Location = new System.Drawing.Point(12, 25);
|
||||
this.SplitContainer.Name = "SplitContainer";
|
||||
this.SplitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// SplitContainer.Panel1
|
||||
//
|
||||
this.SplitContainer.Panel1.Controls.Add(this.AlbumListView);
|
||||
this.SplitContainer.Panel1.Controls.Add(this.ArtistListBox);
|
||||
this.SplitContainer.Panel1.Controls.Add(this.GenreListBox);
|
||||
this.SplitContainer.Panel1.Controls.Add(this.PlaylistBox);
|
||||
//
|
||||
// SplitContainer.Panel2
|
||||
//
|
||||
this.SplitContainer.Panel2.Controls.Add(this.SongsTableView);
|
||||
this.SplitContainer.Size = new System.Drawing.Size(760, 313);
|
||||
this.SplitContainer.SplitterDistance = 131;
|
||||
this.SplitContainer.SplitterWidth = 8;
|
||||
this.SplitContainer.TabIndex = 9;
|
||||
//
|
||||
// PlaylistBox
|
||||
//
|
||||
this.PlaylistBox.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.PlaylistBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.PlaylistBox.FormattingEnabled = true;
|
||||
this.PlaylistBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.PlaylistBox.Name = "PlaylistBox";
|
||||
this.PlaylistBox.Size = new System.Drawing.Size(760, 131);
|
||||
this.PlaylistBox.TabIndex = 4;
|
||||
this.PlaylistBox.Visible = false;
|
||||
this.PlaylistBox.SelectedIndexChanged += new System.EventHandler(this.PlaylistBox_SelectedIndexChanged);
|
||||
//
|
||||
// AlbumListLabel
|
||||
//
|
||||
this.AlbumListLabel.AutoSize = true;
|
||||
this.AlbumListLabel.Location = new System.Drawing.Point(371, 9);
|
||||
this.AlbumListLabel.Name = "AlbumListLabel";
|
||||
this.AlbumListLabel.Size = new System.Drawing.Size(36, 13);
|
||||
this.AlbumListLabel.TabIndex = 6;
|
||||
this.AlbumListLabel.Text = "Album";
|
||||
//
|
||||
// ArtistListLabel
|
||||
//
|
||||
this.ArtistListLabel.AutoSize = true;
|
||||
this.ArtistListLabel.Location = new System.Drawing.Point(190, 9);
|
||||
this.ArtistListLabel.Name = "ArtistListLabel";
|
||||
this.ArtistListLabel.Size = new System.Drawing.Size(30, 13);
|
||||
this.ArtistListLabel.TabIndex = 5;
|
||||
this.ArtistListLabel.Text = "Artist";
|
||||
//
|
||||
// GenreListLabel
|
||||
//
|
||||
this.GenreListLabel.AutoSize = true;
|
||||
this.GenreListLabel.Location = new System.Drawing.Point(9, 9);
|
||||
this.GenreListLabel.Name = "GenreListLabel";
|
||||
this.GenreListLabel.Size = new System.Drawing.Size(36, 13);
|
||||
this.GenreListLabel.TabIndex = 4;
|
||||
this.GenreListLabel.Text = "Genre";
|
||||
//
|
||||
// PlaylistListLabel
|
||||
//
|
||||
this.PlaylistListLabel.AutoSize = true;
|
||||
this.PlaylistListLabel.Location = new System.Drawing.Point(12, 9);
|
||||
this.PlaylistListLabel.Name = "PlaylistListLabel";
|
||||
this.PlaylistListLabel.Size = new System.Drawing.Size(39, 13);
|
||||
this.PlaylistListLabel.TabIndex = 7;
|
||||
this.PlaylistListLabel.Text = "Playlist";
|
||||
this.PlaylistListLabel.Visible = false;
|
||||
//
|
||||
// MenuStrip
|
||||
//
|
||||
this.MenuStrip.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.MenuStrip.BackColor = System.Drawing.SystemColors.GrayText;
|
||||
this.MenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.fileToolStripMenuItem,
|
||||
this.viewToolStripMenuItem});
|
||||
this.viewToolStripMenuItem,
|
||||
this.playbackToolStripMenuItem,
|
||||
this.playlistToolStripMenuItem,
|
||||
this.searchToolStripMenuItem,
|
||||
this.serverToolStripMenuItem,
|
||||
this.radioToolStripMenuItem});
|
||||
this.MenuStrip.Location = new System.Drawing.Point(0, 0);
|
||||
this.MenuStrip.Name = "MenuStrip";
|
||||
this.MenuStrip.Size = new System.Drawing.Size(784, 24);
|
||||
@@ -131,55 +323,554 @@
|
||||
// fileToolStripMenuItem
|
||||
//
|
||||
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.openToolStripMenuItem,
|
||||
this.saveToolStripMenuItem});
|
||||
this.toolStripSeparator1,
|
||||
this.exitToolStripMenuItem});
|
||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
||||
this.fileToolStripMenuItem.Text = "File";
|
||||
//
|
||||
// openToolStripMenuItem
|
||||
// toolStripSeparator1
|
||||
//
|
||||
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
|
||||
this.openToolStripMenuItem.Size = new System.Drawing.Size(103, 22);
|
||||
this.openToolStripMenuItem.Text = "Open";
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(89, 6);
|
||||
//
|
||||
// saveToolStripMenuItem
|
||||
// exitToolStripMenuItem
|
||||
//
|
||||
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
||||
this.saveToolStripMenuItem.Size = new System.Drawing.Size(103, 22);
|
||||
this.saveToolStripMenuItem.Text = "Save";
|
||||
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(92, 22);
|
||||
this.exitToolStripMenuItem.Text = "Exit";
|
||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
||||
//
|
||||
// viewToolStripMenuItem
|
||||
//
|
||||
this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.overviewToolStripMenuItem,
|
||||
this.playlistsToolStripMenuItem,
|
||||
this.toolStripSeparator4,
|
||||
this.ViewQueueButton});
|
||||
this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
|
||||
this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
|
||||
this.viewToolStripMenuItem.Text = "View";
|
||||
//
|
||||
// overviewToolStripMenuItem
|
||||
//
|
||||
this.overviewToolStripMenuItem.Name = "overviewToolStripMenuItem";
|
||||
this.overviewToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
|
||||
this.overviewToolStripMenuItem.Text = "Overview";
|
||||
this.overviewToolStripMenuItem.Click += new System.EventHandler(this.overviewToolStripMenuItem_Click);
|
||||
//
|
||||
// playlistsToolStripMenuItem
|
||||
//
|
||||
this.playlistsToolStripMenuItem.Name = "playlistsToolStripMenuItem";
|
||||
this.playlistsToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
|
||||
this.playlistsToolStripMenuItem.Text = "Playlists";
|
||||
this.playlistsToolStripMenuItem.Click += new System.EventHandler(this.playlistsToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator4
|
||||
//
|
||||
this.toolStripSeparator4.Name = "toolStripSeparator4";
|
||||
this.toolStripSeparator4.Size = new System.Drawing.Size(120, 6);
|
||||
//
|
||||
// ViewQueueButton
|
||||
//
|
||||
this.ViewQueueButton.Name = "ViewQueueButton";
|
||||
this.ViewQueueButton.Size = new System.Drawing.Size(123, 22);
|
||||
this.ViewQueueButton.Text = "Queue";
|
||||
this.ViewQueueButton.Click += new System.EventHandler(this.ViewCurrentPlaylistButton_Click);
|
||||
//
|
||||
// playbackToolStripMenuItem
|
||||
//
|
||||
this.playbackToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.PlayNextSongButton,
|
||||
this.LoopSongButton,
|
||||
this.ShuffleSongButton});
|
||||
this.playbackToolStripMenuItem.Name = "playbackToolStripMenuItem";
|
||||
this.playbackToolStripMenuItem.Size = new System.Drawing.Size(66, 20);
|
||||
this.playbackToolStripMenuItem.Text = "Playback";
|
||||
//
|
||||
// PlayNextSongButton
|
||||
//
|
||||
this.PlayNextSongButton.Checked = true;
|
||||
this.PlayNextSongButton.CheckOnClick = true;
|
||||
this.PlayNextSongButton.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.PlayNextSongButton.Name = "PlayNextSongButton";
|
||||
this.PlayNextSongButton.Size = new System.Drawing.Size(123, 22);
|
||||
this.PlayNextSongButton.Text = "Play Next";
|
||||
//
|
||||
// LoopSongButton
|
||||
//
|
||||
this.LoopSongButton.Checked = true;
|
||||
this.LoopSongButton.CheckOnClick = true;
|
||||
this.LoopSongButton.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.LoopSongButton.Name = "LoopSongButton";
|
||||
this.LoopSongButton.Size = new System.Drawing.Size(123, 22);
|
||||
this.LoopSongButton.Text = "Loop";
|
||||
//
|
||||
// ShuffleSongButton
|
||||
//
|
||||
this.ShuffleSongButton.CheckOnClick = true;
|
||||
this.ShuffleSongButton.Enabled = false;
|
||||
this.ShuffleSongButton.Name = "ShuffleSongButton";
|
||||
this.ShuffleSongButton.Size = new System.Drawing.Size(123, 22);
|
||||
this.ShuffleSongButton.Text = "Shuffle";
|
||||
//
|
||||
// playlistToolStripMenuItem
|
||||
//
|
||||
this.playlistToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.makeToolStripMenuItem,
|
||||
this.toolStripSeparator6,
|
||||
this.viewPlaylistToolstripMenuButton});
|
||||
this.playlistToolStripMenuItem.Name = "playlistToolStripMenuItem";
|
||||
this.playlistToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
|
||||
this.playlistToolStripMenuItem.Text = "Playlist";
|
||||
//
|
||||
// makeToolStripMenuItem
|
||||
//
|
||||
this.makeToolStripMenuItem.Name = "makeToolStripMenuItem";
|
||||
this.makeToolStripMenuItem.Size = new System.Drawing.Size(139, 22);
|
||||
this.makeToolStripMenuItem.Text = "Create / Edit";
|
||||
this.makeToolStripMenuItem.Click += new System.EventHandler(this.makeToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator6
|
||||
//
|
||||
this.toolStripSeparator6.Name = "toolStripSeparator6";
|
||||
this.toolStripSeparator6.Size = new System.Drawing.Size(136, 6);
|
||||
//
|
||||
// viewPlaylistToolstripMenuButton
|
||||
//
|
||||
this.viewPlaylistToolstripMenuButton.Name = "viewPlaylistToolstripMenuButton";
|
||||
this.viewPlaylistToolstripMenuButton.Size = new System.Drawing.Size(139, 22);
|
||||
this.viewPlaylistToolstripMenuButton.Text = "View";
|
||||
this.viewPlaylistToolstripMenuButton.Click += new System.EventHandler(this.playlistsToolStripMenuItem_Click);
|
||||
//
|
||||
// searchToolStripMenuItem
|
||||
//
|
||||
this.searchToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.SearchGenresToolStripLabel,
|
||||
this.SearchArtistToolStripLabel,
|
||||
this.songsToolStripMenuItem,
|
||||
this.toolStripSeparator7,
|
||||
this.AdvancedSearchButton,
|
||||
this.resetToolStripMenuItem});
|
||||
this.searchToolStripMenuItem.Name = "searchToolStripMenuItem";
|
||||
this.searchToolStripMenuItem.Size = new System.Drawing.Size(54, 20);
|
||||
this.searchToolStripMenuItem.Text = "Search";
|
||||
//
|
||||
// SearchGenresToolStripLabel
|
||||
//
|
||||
this.SearchGenresToolStripLabel.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.SearchGenresTextBox,
|
||||
this.ClearGenreSearchButton});
|
||||
this.SearchGenresToolStripLabel.Name = "SearchGenresToolStripLabel";
|
||||
this.SearchGenresToolStripLabel.Size = new System.Drawing.Size(127, 22);
|
||||
this.SearchGenresToolStripLabel.Text = "Genres";
|
||||
//
|
||||
// SearchGenresTextBox
|
||||
//
|
||||
this.SearchGenresTextBox.Name = "SearchGenresTextBox";
|
||||
this.SearchGenresTextBox.Size = new System.Drawing.Size(100, 23);
|
||||
this.SearchGenresTextBox.KeyUp += new System.Windows.Forms.KeyEventHandler(this.SearchGenresTextBox_KeyUp);
|
||||
//
|
||||
// ClearGenreSearchButton
|
||||
//
|
||||
this.ClearGenreSearchButton.Enabled = false;
|
||||
this.ClearGenreSearchButton.Name = "ClearGenreSearchButton";
|
||||
this.ClearGenreSearchButton.Size = new System.Drawing.Size(160, 22);
|
||||
this.ClearGenreSearchButton.Text = "Clear Search";
|
||||
this.ClearGenreSearchButton.Click += new System.EventHandler(this.ClearGenreSearchButton_Click);
|
||||
//
|
||||
// SearchArtistToolStripLabel
|
||||
//
|
||||
this.SearchArtistToolStripLabel.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.SearchArtistsTextBox,
|
||||
this.ClearArtistSearchButton});
|
||||
this.SearchArtistToolStripLabel.Name = "SearchArtistToolStripLabel";
|
||||
this.SearchArtistToolStripLabel.Size = new System.Drawing.Size(127, 22);
|
||||
this.SearchArtistToolStripLabel.Text = "Artists";
|
||||
//
|
||||
// SearchArtistsTextBox
|
||||
//
|
||||
this.SearchArtistsTextBox.Name = "SearchArtistsTextBox";
|
||||
this.SearchArtistsTextBox.Size = new System.Drawing.Size(100, 23);
|
||||
this.SearchArtistsTextBox.KeyUp += new System.Windows.Forms.KeyEventHandler(this.SearchArtistsTextBox_KeyUp);
|
||||
//
|
||||
// ClearArtistSearchButton
|
||||
//
|
||||
this.ClearArtistSearchButton.Enabled = false;
|
||||
this.ClearArtistSearchButton.Name = "ClearArtistSearchButton";
|
||||
this.ClearArtistSearchButton.Size = new System.Drawing.Size(160, 22);
|
||||
this.ClearArtistSearchButton.Text = "Clear Search";
|
||||
this.ClearArtistSearchButton.Click += new System.EventHandler(this.ClearArtistSearchButton_Click);
|
||||
//
|
||||
// songsToolStripMenuItem
|
||||
//
|
||||
this.songsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.SearchSongsTextBox,
|
||||
this.SearchSongsButton});
|
||||
this.songsToolStripMenuItem.Name = "songsToolStripMenuItem";
|
||||
this.songsToolStripMenuItem.Size = new System.Drawing.Size(127, 22);
|
||||
this.songsToolStripMenuItem.Text = "Songs";
|
||||
//
|
||||
// SearchSongsTextBox
|
||||
//
|
||||
this.SearchSongsTextBox.Name = "SearchSongsTextBox";
|
||||
this.SearchSongsTextBox.Size = new System.Drawing.Size(100, 23);
|
||||
//
|
||||
// SearchSongsButton
|
||||
//
|
||||
this.SearchSongsButton.Enabled = false;
|
||||
this.SearchSongsButton.Name = "SearchSongsButton";
|
||||
this.SearchSongsButton.Size = new System.Drawing.Size(160, 22);
|
||||
this.SearchSongsButton.Text = "Search";
|
||||
this.SearchSongsButton.Click += new System.EventHandler(this.SearchSongsButton_Click);
|
||||
//
|
||||
// toolStripSeparator7
|
||||
//
|
||||
this.toolStripSeparator7.Name = "toolStripSeparator7";
|
||||
this.toolStripSeparator7.Size = new System.Drawing.Size(124, 6);
|
||||
//
|
||||
// AdvancedSearchButton
|
||||
//
|
||||
this.AdvancedSearchButton.Name = "AdvancedSearchButton";
|
||||
this.AdvancedSearchButton.Size = new System.Drawing.Size(127, 22);
|
||||
this.AdvancedSearchButton.Text = "Advanced";
|
||||
this.AdvancedSearchButton.Click += new System.EventHandler(this.AdvancedSearchButton_Click);
|
||||
//
|
||||
// resetToolStripMenuItem
|
||||
//
|
||||
this.resetToolStripMenuItem.Name = "resetToolStripMenuItem";
|
||||
this.resetToolStripMenuItem.Size = new System.Drawing.Size(127, 22);
|
||||
this.resetToolStripMenuItem.Text = "Reset";
|
||||
this.resetToolStripMenuItem.Click += new System.EventHandler(this.resetToolStripMenuItem_Click);
|
||||
//
|
||||
// serverToolStripMenuItem
|
||||
//
|
||||
this.serverToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.SelectServerJancoButton,
|
||||
this.SelectServerYorickButton});
|
||||
this.serverToolStripMenuItem.Name = "serverToolStripMenuItem";
|
||||
this.serverToolStripMenuItem.Size = new System.Drawing.Size(51, 20);
|
||||
this.serverToolStripMenuItem.Text = "Server";
|
||||
//
|
||||
// SelectServerJancoButton
|
||||
//
|
||||
this.SelectServerJancoButton.Name = "SelectServerJancoButton";
|
||||
this.SelectServerJancoButton.Size = new System.Drawing.Size(148, 22);
|
||||
this.SelectServerJancoButton.Text = "jancokock.me";
|
||||
this.SelectServerJancoButton.Click += new System.EventHandler(this.SelectServerJancoButton_Click);
|
||||
//
|
||||
// SelectServerYorickButton
|
||||
//
|
||||
this.SelectServerYorickButton.Name = "SelectServerYorickButton";
|
||||
this.SelectServerYorickButton.Size = new System.Drawing.Size(148, 22);
|
||||
this.SelectServerYorickButton.Text = "imegumii.nl";
|
||||
this.SelectServerYorickButton.Click += new System.EventHandler(this.SelectServerYorickButton_Click);
|
||||
//
|
||||
// radioToolStripMenuItem
|
||||
//
|
||||
this.radioToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripMenuItem2,
|
||||
this.fMToolStripMenuItem,
|
||||
this.slamFMToolStripMenuItem,
|
||||
this.qDanceToolStripMenuItem,
|
||||
this.toolStripSeparator5,
|
||||
this.customToolStripMenuItem});
|
||||
this.radioToolStripMenuItem.Name = "radioToolStripMenuItem";
|
||||
this.radioToolStripMenuItem.Size = new System.Drawing.Size(49, 20);
|
||||
this.radioToolStripMenuItem.Text = "Radio";
|
||||
//
|
||||
// toolStripMenuItem2
|
||||
//
|
||||
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
|
||||
this.toolStripMenuItem2.Size = new System.Drawing.Size(122, 22);
|
||||
this.toolStripMenuItem2.Text = "538";
|
||||
this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click);
|
||||
//
|
||||
// fMToolStripMenuItem
|
||||
//
|
||||
this.fMToolStripMenuItem.Name = "fMToolStripMenuItem";
|
||||
this.fMToolStripMenuItem.Size = new System.Drawing.Size(122, 22);
|
||||
this.fMToolStripMenuItem.Text = "3FM";
|
||||
this.fMToolStripMenuItem.Click += new System.EventHandler(this.fMToolStripMenuItem_Click);
|
||||
//
|
||||
// slamFMToolStripMenuItem
|
||||
//
|
||||
this.slamFMToolStripMenuItem.Name = "slamFMToolStripMenuItem";
|
||||
this.slamFMToolStripMenuItem.Size = new System.Drawing.Size(122, 22);
|
||||
this.slamFMToolStripMenuItem.Text = "Slam-FM";
|
||||
this.slamFMToolStripMenuItem.Click += new System.EventHandler(this.slamFMToolStripMenuItem_Click);
|
||||
//
|
||||
// qDanceToolStripMenuItem
|
||||
//
|
||||
this.qDanceToolStripMenuItem.Name = "qDanceToolStripMenuItem";
|
||||
this.qDanceToolStripMenuItem.Size = new System.Drawing.Size(122, 22);
|
||||
this.qDanceToolStripMenuItem.Text = "Q-Dance";
|
||||
this.qDanceToolStripMenuItem.Click += new System.EventHandler(this.qDanceToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator5
|
||||
//
|
||||
this.toolStripSeparator5.Name = "toolStripSeparator5";
|
||||
this.toolStripSeparator5.Size = new System.Drawing.Size(119, 6);
|
||||
//
|
||||
// customToolStripMenuItem
|
||||
//
|
||||
this.customToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.RadioStationTextBox,
|
||||
this.SetRadioStationButton});
|
||||
this.customToolStripMenuItem.Name = "customToolStripMenuItem";
|
||||
this.customToolStripMenuItem.Size = new System.Drawing.Size(122, 22);
|
||||
this.customToolStripMenuItem.Text = "Custom";
|
||||
//
|
||||
// RadioStationTextBox
|
||||
//
|
||||
this.RadioStationTextBox.Name = "RadioStationTextBox";
|
||||
this.RadioStationTextBox.Size = new System.Drawing.Size(100, 23);
|
||||
//
|
||||
// SetRadioStationButton
|
||||
//
|
||||
this.SetRadioStationButton.Name = "SetRadioStationButton";
|
||||
this.SetRadioStationButton.Size = new System.Drawing.Size(160, 22);
|
||||
this.SetRadioStationButton.Text = "Set";
|
||||
this.SetRadioStationButton.Click += new System.EventHandler(this.SetRadioStationButton_Click);
|
||||
//
|
||||
// ControlsPanel
|
||||
//
|
||||
this.ControlsPanel.BackColor = System.Drawing.SystemColors.WindowFrame;
|
||||
this.ControlsPanel.BackColor = System.Drawing.SystemColors.GrayText;
|
||||
this.ControlsPanel.Controls.Add(this.pictureBox1);
|
||||
this.ControlsPanel.Controls.Add(this.NextButton);
|
||||
this.ControlsPanel.Controls.Add(this.PreviousButton);
|
||||
this.ControlsPanel.Controls.Add(this.CurrentSongLabel);
|
||||
this.ControlsPanel.Controls.Add(this.LabelTotalTime);
|
||||
this.ControlsPanel.Controls.Add(this.LabelCurrentTime);
|
||||
this.ControlsPanel.Controls.Add(this.PositionTrackBar);
|
||||
this.ControlsPanel.Controls.Add(this.BufferLabel);
|
||||
this.ControlsPanel.Controls.Add(this.BufferBar);
|
||||
this.ControlsPanel.Controls.Add(this.StopButton);
|
||||
this.ControlsPanel.Controls.Add(this.PauseButton);
|
||||
this.ControlsPanel.Controls.Add(this.PlayButton);
|
||||
this.ControlsPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.ControlsPanel.Location = new System.Drawing.Point(0, 343);
|
||||
this.ControlsPanel.Location = new System.Drawing.Point(0, 378);
|
||||
this.ControlsPanel.Name = "ControlsPanel";
|
||||
this.ControlsPanel.Size = new System.Drawing.Size(784, 119);
|
||||
this.ControlsPanel.Size = new System.Drawing.Size(784, 83);
|
||||
this.ControlsPanel.TabIndex = 4;
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
this.pictureBox1.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.pictureBox1.Location = new System.Drawing.Point(5, 5);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.Size = new System.Drawing.Size(72, 72);
|
||||
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.pictureBox1.TabIndex = 14;
|
||||
this.pictureBox1.TabStop = false;
|
||||
//
|
||||
// NextButton
|
||||
//
|
||||
this.NextButton.Location = new System.Drawing.Point(295, 54);
|
||||
this.NextButton.Name = "NextButton";
|
||||
this.NextButton.Size = new System.Drawing.Size(31, 23);
|
||||
this.NextButton.TabIndex = 13;
|
||||
this.NextButton.Text = ">";
|
||||
this.NextButton.UseVisualStyleBackColor = true;
|
||||
this.NextButton.Click += new System.EventHandler(this.NextButton_Click);
|
||||
//
|
||||
// PreviousButton
|
||||
//
|
||||
this.PreviousButton.Location = new System.Drawing.Point(258, 54);
|
||||
this.PreviousButton.Name = "PreviousButton";
|
||||
this.PreviousButton.Size = new System.Drawing.Size(31, 23);
|
||||
this.PreviousButton.TabIndex = 12;
|
||||
this.PreviousButton.Text = "<";
|
||||
this.PreviousButton.UseVisualStyleBackColor = true;
|
||||
this.PreviousButton.Click += new System.EventHandler(this.PreviousButton_Click);
|
||||
//
|
||||
// CurrentSongLabel
|
||||
//
|
||||
this.CurrentSongLabel.AutoSize = true;
|
||||
this.CurrentSongLabel.Location = new System.Drawing.Point(338, 59);
|
||||
this.CurrentSongLabel.Name = "CurrentSongLabel";
|
||||
this.CurrentSongLabel.Size = new System.Drawing.Size(111, 13);
|
||||
this.CurrentSongLabel.TabIndex = 11;
|
||||
this.CurrentSongLabel.Text = "Not playing any songs";
|
||||
//
|
||||
// LabelTotalTime
|
||||
//
|
||||
this.LabelTotalTime.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.LabelTotalTime.AutoSize = true;
|
||||
this.LabelTotalTime.Location = new System.Drawing.Point(723, 26);
|
||||
this.LabelTotalTime.Name = "LabelTotalTime";
|
||||
this.LabelTotalTime.Size = new System.Drawing.Size(49, 13);
|
||||
this.LabelTotalTime.TabIndex = 9;
|
||||
this.LabelTotalTime.Text = "00:00:00";
|
||||
//
|
||||
// LabelCurrentTime
|
||||
//
|
||||
this.LabelCurrentTime.AutoSize = true;
|
||||
this.LabelCurrentTime.Location = new System.Drawing.Point(93, 29);
|
||||
this.LabelCurrentTime.Name = "LabelCurrentTime";
|
||||
this.LabelCurrentTime.Size = new System.Drawing.Size(49, 13);
|
||||
this.LabelCurrentTime.TabIndex = 8;
|
||||
this.LabelCurrentTime.Text = "00:00:00";
|
||||
//
|
||||
// PositionTrackBar
|
||||
//
|
||||
this.PositionTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.PositionTrackBar.Enabled = false;
|
||||
this.PositionTrackBar.Location = new System.Drawing.Point(83, 3);
|
||||
this.PositionTrackBar.Maximum = 1000;
|
||||
this.PositionTrackBar.Name = "PositionTrackBar";
|
||||
this.PositionTrackBar.Size = new System.Drawing.Size(698, 45);
|
||||
this.PositionTrackBar.TabIndex = 7;
|
||||
this.PositionTrackBar.TickStyle = System.Windows.Forms.TickStyle.None;
|
||||
this.PositionTrackBar.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PositionTrackBar_MouseDown);
|
||||
//
|
||||
// BufferLabel
|
||||
//
|
||||
this.BufferLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.BufferLabel.AutoSize = true;
|
||||
this.BufferLabel.Location = new System.Drawing.Point(601, 56);
|
||||
this.BufferLabel.Name = "BufferLabel";
|
||||
this.BufferLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.BufferLabel.TabIndex = 5;
|
||||
this.BufferLabel.Text = "Buffer";
|
||||
//
|
||||
// BufferBar
|
||||
//
|
||||
this.BufferBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.BufferBar.Location = new System.Drawing.Point(642, 51);
|
||||
this.BufferBar.Name = "BufferBar";
|
||||
this.BufferBar.Size = new System.Drawing.Size(130, 23);
|
||||
this.BufferBar.TabIndex = 3;
|
||||
//
|
||||
// StopButton
|
||||
//
|
||||
this.StopButton.Enabled = false;
|
||||
this.StopButton.Location = new System.Drawing.Point(203, 54);
|
||||
this.StopButton.Name = "StopButton";
|
||||
this.StopButton.Size = new System.Drawing.Size(49, 23);
|
||||
this.StopButton.TabIndex = 2;
|
||||
this.StopButton.Text = "Stop";
|
||||
this.StopButton.UseVisualStyleBackColor = true;
|
||||
this.StopButton.Click += new System.EventHandler(this.StopButton_Click);
|
||||
//
|
||||
// PauseButton
|
||||
//
|
||||
this.PauseButton.Enabled = false;
|
||||
this.PauseButton.Location = new System.Drawing.Point(148, 54);
|
||||
this.PauseButton.Name = "PauseButton";
|
||||
this.PauseButton.Size = new System.Drawing.Size(49, 23);
|
||||
this.PauseButton.TabIndex = 1;
|
||||
this.PauseButton.Text = "Pause";
|
||||
this.PauseButton.UseVisualStyleBackColor = true;
|
||||
this.PauseButton.Click += new System.EventHandler(this.PauseButton_Click);
|
||||
//
|
||||
// PlayButton
|
||||
//
|
||||
this.PlayButton.Location = new System.Drawing.Point(12, 13);
|
||||
this.PlayButton.Location = new System.Drawing.Point(93, 54);
|
||||
this.PlayButton.Name = "PlayButton";
|
||||
this.PlayButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.PlayButton.Size = new System.Drawing.Size(49, 23);
|
||||
this.PlayButton.TabIndex = 0;
|
||||
this.PlayButton.Text = "Play";
|
||||
this.PlayButton.UseVisualStyleBackColor = true;
|
||||
this.PlayButton.Click += new System.EventHandler(this.PlayButton_Click);
|
||||
//
|
||||
// UpdateTimer
|
||||
//
|
||||
this.UpdateTimer.Interval = 200;
|
||||
this.UpdateTimer.Tick += new System.EventHandler(this.UpdateTimer_Tick);
|
||||
//
|
||||
// NotifyIcon
|
||||
//
|
||||
this.NotifyIcon.ContextMenuStrip = this.NotifyMenuStrip;
|
||||
this.NotifyIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("NotifyIcon.Icon")));
|
||||
this.NotifyIcon.Text = "YJMPD Music Player";
|
||||
this.NotifyIcon.Visible = true;
|
||||
this.NotifyIcon.MouseUp += new System.Windows.Forms.MouseEventHandler(this.NotifyIcon_Click);
|
||||
//
|
||||
// NotifyMenuStrip
|
||||
//
|
||||
this.NotifyMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.NotifyMenuStripPlayingLabel,
|
||||
this.toolStripSeparator2,
|
||||
this.NotifyMenuStripPlayButton,
|
||||
this.NotifyMenuStripPauseButton,
|
||||
this.NotifyMenuStripStopButton,
|
||||
this.toolStripSeparator3,
|
||||
this.NotifyMenuStripNextButton,
|
||||
this.NotifyMenuStripPreviousButton});
|
||||
this.NotifyMenuStrip.Name = "NotifyMenuStrip";
|
||||
this.NotifyMenuStrip.Size = new System.Drawing.Size(120, 148);
|
||||
//
|
||||
// NotifyMenuStripPlayingLabel
|
||||
//
|
||||
this.NotifyMenuStripPlayingLabel.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.NotifyMenuStripPlayingSongLabel});
|
||||
this.NotifyMenuStripPlayingLabel.Enabled = false;
|
||||
this.NotifyMenuStripPlayingLabel.Name = "NotifyMenuStripPlayingLabel";
|
||||
this.NotifyMenuStripPlayingLabel.Size = new System.Drawing.Size(119, 22);
|
||||
this.NotifyMenuStripPlayingLabel.Text = "Stopped";
|
||||
//
|
||||
// NotifyMenuStripPlayingSongLabel
|
||||
//
|
||||
this.NotifyMenuStripPlayingSongLabel.Enabled = false;
|
||||
this.NotifyMenuStripPlayingSongLabel.Name = "NotifyMenuStripPlayingSongLabel";
|
||||
this.NotifyMenuStripPlayingSongLabel.Size = new System.Drawing.Size(118, 22);
|
||||
this.NotifyMenuStripPlayingSongLabel.Text = "Stopped";
|
||||
this.NotifyMenuStripPlayingSongLabel.Visible = false;
|
||||
//
|
||||
// toolStripSeparator2
|
||||
//
|
||||
this.toolStripSeparator2.Name = "toolStripSeparator2";
|
||||
this.toolStripSeparator2.Size = new System.Drawing.Size(116, 6);
|
||||
//
|
||||
// NotifyMenuStripPlayButton
|
||||
//
|
||||
this.NotifyMenuStripPlayButton.Name = "NotifyMenuStripPlayButton";
|
||||
this.NotifyMenuStripPlayButton.Size = new System.Drawing.Size(119, 22);
|
||||
this.NotifyMenuStripPlayButton.Text = "Play";
|
||||
this.NotifyMenuStripPlayButton.Click += new System.EventHandler(this.NotifyMenuStripPlayButton_Click);
|
||||
//
|
||||
// NotifyMenuStripPauseButton
|
||||
//
|
||||
this.NotifyMenuStripPauseButton.Enabled = false;
|
||||
this.NotifyMenuStripPauseButton.Name = "NotifyMenuStripPauseButton";
|
||||
this.NotifyMenuStripPauseButton.Size = new System.Drawing.Size(119, 22);
|
||||
this.NotifyMenuStripPauseButton.Text = "Pause";
|
||||
this.NotifyMenuStripPauseButton.Click += new System.EventHandler(this.NotifyMenuStripPauseButton_Click);
|
||||
//
|
||||
// NotifyMenuStripStopButton
|
||||
//
|
||||
this.NotifyMenuStripStopButton.Enabled = false;
|
||||
this.NotifyMenuStripStopButton.Name = "NotifyMenuStripStopButton";
|
||||
this.NotifyMenuStripStopButton.Size = new System.Drawing.Size(119, 22);
|
||||
this.NotifyMenuStripStopButton.Text = "Stop";
|
||||
this.NotifyMenuStripStopButton.Click += new System.EventHandler(this.NotifyMenuStripStopButton_Click);
|
||||
//
|
||||
// toolStripSeparator3
|
||||
//
|
||||
this.toolStripSeparator3.Name = "toolStripSeparator3";
|
||||
this.toolStripSeparator3.Size = new System.Drawing.Size(116, 6);
|
||||
//
|
||||
// NotifyMenuStripNextButton
|
||||
//
|
||||
this.NotifyMenuStripNextButton.Name = "NotifyMenuStripNextButton";
|
||||
this.NotifyMenuStripNextButton.Size = new System.Drawing.Size(119, 22);
|
||||
this.NotifyMenuStripNextButton.Text = "Next";
|
||||
this.NotifyMenuStripNextButton.Click += new System.EventHandler(this.NotifyMenuStripNextButton_Click);
|
||||
//
|
||||
// NotifyMenuStripPreviousButton
|
||||
//
|
||||
this.NotifyMenuStripPreviousButton.Name = "NotifyMenuStripPreviousButton";
|
||||
this.NotifyMenuStripPreviousButton.Size = new System.Drawing.Size(119, 22);
|
||||
this.NotifyMenuStripPreviousButton.Text = "Previous";
|
||||
this.NotifyMenuStripPreviousButton.Click += new System.EventHandler(this.NotifyMenuStripPreviousButton_Click);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(784, 462);
|
||||
this.ClientSize = new System.Drawing.Size(784, 461);
|
||||
this.Controls.Add(this.ControlsPanel);
|
||||
this.Controls.Add(this.MainPanel);
|
||||
this.Controls.Add(this.MenuStrip);
|
||||
@@ -188,12 +879,22 @@
|
||||
this.MinimumSize = new System.Drawing.Size(800, 500);
|
||||
this.Name = "MainForm";
|
||||
this.Text = "YJMPD Music Player";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
|
||||
this.Load += new System.EventHandler(this.MainForm_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.SongsTableView)).EndInit();
|
||||
this.MainPanel.ResumeLayout(false);
|
||||
this.MainPanel.PerformLayout();
|
||||
this.SplitContainer.Panel1.ResumeLayout(false);
|
||||
this.SplitContainer.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.SplitContainer)).EndInit();
|
||||
this.SplitContainer.ResumeLayout(false);
|
||||
this.MenuStrip.ResumeLayout(false);
|
||||
this.MenuStrip.PerformLayout();
|
||||
this.ControlsPanel.ResumeLayout(false);
|
||||
this.ControlsPanel.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PositionTrackBar)).EndInit();
|
||||
this.NotifyMenuStrip.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -208,11 +909,78 @@
|
||||
private System.Windows.Forms.Panel MainPanel;
|
||||
private System.Windows.Forms.MenuStrip MenuStrip;
|
||||
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;
|
||||
private System.Windows.Forms.Panel ControlsPanel;
|
||||
private System.Windows.Forms.Button PlayButton;
|
||||
private System.Windows.Forms.Button StopButton;
|
||||
private System.Windows.Forms.Button PauseButton;
|
||||
private System.Windows.Forms.Label BufferLabel;
|
||||
private System.Windows.Forms.ProgressBar BufferBar;
|
||||
private System.Windows.Forms.Timer UpdateTimer;
|
||||
private System.Windows.Forms.TrackBar PositionTrackBar;
|
||||
private System.Windows.Forms.Label LabelTotalTime;
|
||||
private System.Windows.Forms.Label LabelCurrentTime;
|
||||
private System.Windows.Forms.NotifyIcon NotifyIcon;
|
||||
private System.Windows.Forms.Label CurrentSongLabel;
|
||||
private System.Windows.Forms.Label AlbumListLabel;
|
||||
private System.Windows.Forms.Label ArtistListLabel;
|
||||
private System.Windows.Forms.Label GenreListLabel;
|
||||
private System.Windows.Forms.ToolStripMenuItem playlistsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem overviewToolStripMenuItem;
|
||||
public System.Windows.Forms.ListBox PlaylistBox;
|
||||
private System.Windows.Forms.Label PlaylistListLabel;
|
||||
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem playlistToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
||||
private System.Windows.Forms.ContextMenuStrip NotifyMenuStrip;
|
||||
private System.Windows.Forms.ToolStripMenuItem NotifyMenuStripPlayButton;
|
||||
private System.Windows.Forms.ToolStripMenuItem NotifyMenuStripPauseButton;
|
||||
private System.Windows.Forms.ToolStripMenuItem NotifyMenuStripStopButton;
|
||||
private System.Windows.Forms.ToolStripMenuItem NotifyMenuStripPlayingLabel;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
|
||||
private System.Windows.Forms.ToolStripMenuItem NotifyMenuStripPlayingSongLabel;
|
||||
private System.Windows.Forms.SplitContainer SplitContainer;
|
||||
private System.Windows.Forms.ToolStripMenuItem makeToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem searchToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem SearchArtistToolStripLabel;
|
||||
private System.Windows.Forms.ToolStripTextBox SearchArtistsTextBox;
|
||||
private System.Windows.Forms.ToolStripMenuItem SearchGenresToolStripLabel;
|
||||
private System.Windows.Forms.ToolStripTextBox SearchGenresTextBox;
|
||||
private System.Windows.Forms.ToolStripMenuItem ClearArtistSearchButton;
|
||||
private System.Windows.Forms.ToolStripMenuItem ClearGenreSearchButton;
|
||||
private System.Windows.Forms.ToolStripMenuItem playbackToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem ShuffleSongButton;
|
||||
private System.Windows.Forms.ToolStripMenuItem LoopSongButton;
|
||||
private System.Windows.Forms.ToolStripMenuItem PlayNextSongButton;
|
||||
private System.Windows.Forms.Button NextButton;
|
||||
private System.Windows.Forms.Button PreviousButton;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
|
||||
private System.Windows.Forms.ToolStripMenuItem NotifyMenuStripNextButton;
|
||||
private System.Windows.Forms.ToolStripMenuItem NotifyMenuStripPreviousButton;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
|
||||
private System.Windows.Forms.ToolStripMenuItem ViewQueueButton;
|
||||
private System.Windows.Forms.ToolStripMenuItem serverToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem SelectServerJancoButton;
|
||||
private System.Windows.Forms.ToolStripMenuItem SelectServerYorickButton;
|
||||
private System.Windows.Forms.ToolStripMenuItem radioToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
|
||||
private System.Windows.Forms.ToolStripMenuItem qDanceToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem customToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripTextBox RadioStationTextBox;
|
||||
private System.Windows.Forms.ToolStripMenuItem SetRadioStationButton;
|
||||
private System.Windows.Forms.ToolStripMenuItem fMToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
|
||||
private System.Windows.Forms.ToolStripMenuItem slamFMToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator6;
|
||||
private System.Windows.Forms.ToolStripMenuItem viewPlaylistToolstripMenuButton;
|
||||
private System.Windows.Forms.ToolStripMenuItem songsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripTextBox SearchSongsTextBox;
|
||||
private System.Windows.Forms.ToolStripMenuItem SearchSongsButton;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator7;
|
||||
private System.Windows.Forms.ToolStripMenuItem AdvancedSearchButton;
|
||||
private System.Windows.Forms.ToolStripMenuItem resetToolStripMenuItem;
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private System.Windows.Forms.Label AddToQueueLabel;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -17,6 +18,12 @@ namespace MusicPlayer
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
bool songFinished;
|
||||
bool draggedstarted = false;
|
||||
bool draggedcompleted = false;
|
||||
int startx = 0;
|
||||
int starty = 0;
|
||||
|
||||
public Main main
|
||||
{
|
||||
get; set;
|
||||
@@ -25,21 +32,598 @@ namespace MusicPlayer
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
PositionTrackBar.Scroll += (s, e) =>
|
||||
{
|
||||
this.PositionTrackBar_ValueChanged();
|
||||
};
|
||||
PositionTrackBar.MouseDown += (s, e) =>
|
||||
{
|
||||
clicked = true;
|
||||
};
|
||||
PositionTrackBar.MouseUp += (s, e) =>
|
||||
{
|
||||
if (!clicked)
|
||||
return;
|
||||
|
||||
clicked = false;
|
||||
this.PositionTrackBar_ValueChanged();
|
||||
};
|
||||
|
||||
songFinished = false;
|
||||
}
|
||||
|
||||
private void MainForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
UpdateTimer.Start();
|
||||
}
|
||||
|
||||
private void PlayButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
AudioHandler.PlayMp3FromUrl("http://imegumii.nl/music/English/Monstercat/Direct%20-%20Eternity.mp3");
|
||||
if (main.audio.AState == AudioHandler.AudioState.PAUSED)
|
||||
main.audio.Play(main.audio.CurrentSong);
|
||||
else
|
||||
SongsTableView_CellDoubleClick(sender, new DataGridViewCellEventArgs(0, 0));
|
||||
}
|
||||
|
||||
private void SongsTableView_SelectionChanged(object sender, EventArgs e)
|
||||
private void PauseButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DataGridViewSelectedRowCollection col = SongsTableView.SelectedRows;
|
||||
main.audio.Pause();
|
||||
}
|
||||
|
||||
private void StopButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
main.audio.Stop();
|
||||
}
|
||||
|
||||
public void SongFinished()
|
||||
{
|
||||
songFinished = true;
|
||||
}
|
||||
|
||||
private void UpdateTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
//Trackbar
|
||||
if (main.audio.BState == AudioHandler.BufferState.DONE)
|
||||
PositionTrackBar.Enabled = true;
|
||||
else
|
||||
PositionTrackBar.Enabled = false;
|
||||
if (!clicked)
|
||||
PositionTrackBar.Value = Math.Max(main.audio.Position, 0);
|
||||
|
||||
//Buffer display
|
||||
if(main.audio.Buffered / 10 >= BufferBar.Minimum && main.audio.Buffered / 10 <= BufferBar.Maximum)
|
||||
BufferBar.Value = main.audio.Buffered / 10;
|
||||
|
||||
//Time labels
|
||||
if (!clicked)
|
||||
LabelCurrentTime.Text = Main.SecondsToTimestamp(main.audio.CurrentTime);
|
||||
LabelTotalTime.Text = Main.SecondsToTimestamp(main.audio.TotalTime);
|
||||
|
||||
//Current song label
|
||||
if (main.audio.CurrentSong == null)
|
||||
CurrentSongLabel.Text = "Not playing any songs";
|
||||
else
|
||||
{
|
||||
if (main.audio.CurrentSong.Seconds < 1)
|
||||
PositionTrackBar.Enabled = false;
|
||||
CurrentSongLabel.Text = "Currently playing: " + main.audio.CurrentSong.Name;
|
||||
}
|
||||
|
||||
//image box
|
||||
if (AlbumListView.LargeImageList != null && main.audio.CurrentSong != null)
|
||||
{
|
||||
//Console.WriteLine(AlbumListView.LargeImageList.Images["Get Wet"]);
|
||||
pictureBox1.Image = AlbumListView.LargeImageList.Images[main.audio.CurrentSong.Album];
|
||||
}
|
||||
|
||||
//Buttons and context menu
|
||||
if (main.audio.AState == AudioHandler.AudioState.PLAYING)
|
||||
{
|
||||
PlayButton.Enabled = false;
|
||||
NotifyMenuStripPlayButton.Enabled = false;
|
||||
NotifyMenuStripPlayingLabel.Text = "Playing";
|
||||
NotifyMenuStripPlayingLabel.Enabled = true;
|
||||
NotifyMenuStripPlayingSongLabel.Visible = true;
|
||||
NotifyMenuStripPlayingSongLabel.Text = main.audio.CurrentSong.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayButton.Enabled = true;
|
||||
NotifyMenuStripPlayButton.Enabled = true;
|
||||
NotifyMenuStripPlayingSongLabel.Visible = false;
|
||||
}
|
||||
|
||||
if (main.nw.ip == "http://jancokock.me")
|
||||
SelectServerJancoButton.Enabled = false;
|
||||
else
|
||||
SelectServerJancoButton.Enabled = true;
|
||||
|
||||
if (main.nw.ip == "http://imegumii.nl")
|
||||
SelectServerYorickButton.Enabled = false;
|
||||
else
|
||||
SelectServerYorickButton.Enabled = true;
|
||||
|
||||
if (SearchSongsTextBox.Text.Length == 0)
|
||||
SearchSongsButton.Enabled = false;
|
||||
else
|
||||
SearchSongsButton.Enabled = true;
|
||||
|
||||
if (main.audio.AState == AudioHandler.AudioState.PAUSED)
|
||||
{
|
||||
PauseButton.Enabled = false;
|
||||
NotifyMenuStripPauseButton.Enabled = false;
|
||||
NotifyMenuStripPlayingLabel.Text = "Paused";
|
||||
NotifyMenuStripPlayingLabel.Enabled = true;
|
||||
NotifyMenuStripPlayingSongLabel.Visible = true;
|
||||
NotifyMenuStripPlayingSongLabel.Text = main.audio.CurrentSong.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
PauseButton.Enabled = true;
|
||||
NotifyMenuStripPauseButton.Enabled = true;
|
||||
}
|
||||
|
||||
if (main.audio.AState == AudioHandler.AudioState.STOPPED)
|
||||
{
|
||||
StopButton.Enabled = false;
|
||||
NotifyMenuStripStopButton.Enabled = false;
|
||||
NotifyMenuStripPlayingLabel.Text = "Stopped";
|
||||
NotifyMenuStripPlayingLabel.Enabled = false;
|
||||
NotifyMenuStripPlayingSongLabel.Visible = false;
|
||||
NotifyMenuStripPlayingSongLabel.Text = "Stopped";
|
||||
}
|
||||
else
|
||||
{
|
||||
StopButton.Enabled = true;
|
||||
NotifyMenuStripStopButton.Enabled = true;
|
||||
}
|
||||
|
||||
if (RadioStationTextBox.Text.Length <= 10)
|
||||
SetRadioStationButton.Enabled = false;
|
||||
else
|
||||
SetRadioStationButton.Enabled = true;
|
||||
|
||||
if(PlayNextSongButton.Checked)
|
||||
{
|
||||
ShuffleSongButton.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ShuffleSongButton.Enabled = false;
|
||||
ShuffleSongButton.Checked = false;
|
||||
}
|
||||
|
||||
if (main.currentPlayingList.Count <= 1)
|
||||
{
|
||||
PreviousButton.Enabled = false;
|
||||
NextButton.Enabled = false;
|
||||
NotifyMenuStripPreviousButton.Enabled = false;
|
||||
NotifyMenuStripNextButton.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (main.audio.CurrentSong is RadioStation)
|
||||
{
|
||||
main.currentPlayingList.Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
NextButton.Enabled = true;
|
||||
NotifyMenuStripNextButton.Enabled = true;
|
||||
|
||||
if (ShuffleSongButton.Checked)
|
||||
{
|
||||
PreviousButton.Enabled = false;
|
||||
NotifyMenuStripPreviousButton.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
PreviousButton.Enabled = true;
|
||||
NotifyMenuStripPreviousButton.Enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (songFinished)
|
||||
{
|
||||
if (! (main.audio.CurrentSong is RadioStation) )
|
||||
{
|
||||
Thread.Sleep(20);
|
||||
|
||||
if (PlayNextSongButton.Checked)
|
||||
{
|
||||
NextButton_Click(this, new EventArgs());
|
||||
}
|
||||
else if (LoopSongButton.Checked)
|
||||
{
|
||||
main.audio.Play(main.audio.CurrentSong);
|
||||
}
|
||||
}
|
||||
|
||||
songFinished = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void GenreListBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (GenreListBox.SelectedItems.Count != 0)
|
||||
{
|
||||
main.GenreFilter(GenreListBox.SelectedItems[0].ToString());
|
||||
ArtistListBox.ClearSelected();
|
||||
PlaylistBox.ClearSelected();
|
||||
AlbumListView.SelectedIndices.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
private void PlaylistBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (PlaylistBox.SelectedItems.Count != 0)
|
||||
{
|
||||
main.PlaylistFilter(PlaylistBox.SelectedItems[0].ToString());
|
||||
GenreListBox.ClearSelected();
|
||||
ArtistListBox.ClearSelected();
|
||||
AlbumListView.SelectedIndices.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
private void ArtistListBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (ArtistListBox.SelectedItems.Count != 0)
|
||||
{
|
||||
main.ArtistFilter(ArtistListBox.SelectedItems[0].ToString());
|
||||
GenreListBox.ClearSelected();
|
||||
PlaylistBox.ClearSelected();
|
||||
AlbumListView.SelectedIndices.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
private void AlbumListView_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (AlbumListView.SelectedItems.Count != 0)
|
||||
{
|
||||
main.AlbumFilter(AlbumListView.SelectedItems[0].Text);
|
||||
PlaylistBox.ClearSelected();
|
||||
ArtistListBox.ClearSelected();
|
||||
GenreListBox.ClearSelected();
|
||||
}
|
||||
}
|
||||
|
||||
private void SongsTableView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.RowIndex != -1)
|
||||
{
|
||||
SongsTable s = new SongsTable();
|
||||
if (SongsTableView.SelectedRows.Count > 0)
|
||||
{
|
||||
main.currentPlayingList = main.table.AsEnumerable().Select(x => x[5] as Song).ToList();
|
||||
|
||||
var drv = SongsTableView.SelectedRows[0].DataBoundItem as DataRowView;
|
||||
var row = drv.Row as DataRow;
|
||||
s.ImportRow(row);
|
||||
main.audio.Play((s.Rows[0][5] as Song));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void PositionTrackBar_ValueChanged()
|
||||
{
|
||||
if (!clicked)
|
||||
main.audio.Seek(PositionTrackBar.Value);
|
||||
|
||||
LabelCurrentTime.Text = Main.SecondsToTimestamp((int)(((double)PositionTrackBar.Value / 1000) * main.audio.CurrentSong.Seconds));
|
||||
}
|
||||
|
||||
private void NotifyIcon_Click(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
MethodInfo mi = typeof(NotifyIcon).GetMethod("ShowContextMenu", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
mi.Invoke(NotifyIcon, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void overviewToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.PlaylistBox.Visible = false;
|
||||
this.GenreListBox.Visible = true;
|
||||
this.ArtistListBox.Visible = true;
|
||||
this.AlbumListView.Visible = true;
|
||||
this.GenreListLabel.Visible = true;
|
||||
this.AlbumListLabel.Visible = true;
|
||||
this.ArtistListLabel.Visible = true;
|
||||
this.PlaylistListLabel.Visible = false;
|
||||
}
|
||||
|
||||
private void playlistsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.PlaylistBox.Visible = true;
|
||||
this.GenreListBox.Visible = false;
|
||||
this.ArtistListBox.Visible = false;
|
||||
this.AlbumListView.Visible = false;
|
||||
this.GenreListLabel.Visible = false;
|
||||
this.AlbumListLabel.Visible = false;
|
||||
this.ArtistListLabel.Visible = false;
|
||||
this.PlaylistListLabel.Visible = true;
|
||||
}
|
||||
|
||||
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
ExitProgram();
|
||||
}
|
||||
|
||||
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
ExitProgram();
|
||||
}
|
||||
|
||||
private void ExitProgram()
|
||||
{
|
||||
main.audio.AState = AudioHandler.AudioState.STOPPED;
|
||||
NotifyIcon.Visible = false;
|
||||
NotifyIcon.Icon = null;
|
||||
System.Windows.Forms.Application.Exit();
|
||||
}
|
||||
|
||||
private void NotifyMenuStripPlayButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
PlayButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void NotifyMenuStripPauseButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
PauseButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void NotifyMenuStripStopButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
StopButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void makeToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
PlaylistMaker p = new PlaylistMaker(main.pl, main.api);
|
||||
p.ShowDialog();
|
||||
main.Repopulate();
|
||||
}
|
||||
|
||||
private void SearchArtistsTextBox_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
main.SearchArtist(SearchArtistsTextBox.Text);
|
||||
if (SearchArtistsTextBox.Text.Length < 1)
|
||||
ClearArtistSearchButton.Enabled = false;
|
||||
else
|
||||
ClearArtistSearchButton.Enabled = true;
|
||||
}
|
||||
|
||||
private void SearchGenresTextBox_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
main.SearchGenre(SearchGenresTextBox.Text);
|
||||
if (SearchGenresTextBox.Text.Length < 1)
|
||||
ClearGenreSearchButton.Enabled = false;
|
||||
else
|
||||
ClearGenreSearchButton.Enabled = true;
|
||||
}
|
||||
|
||||
private void ClearArtistSearchButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
main.SearchArtist("");
|
||||
SearchArtistsTextBox.Text = "";
|
||||
ClearArtistSearchButton.Enabled = false;
|
||||
}
|
||||
|
||||
private void ClearGenreSearchButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
main.SearchGenre("");
|
||||
SearchGenresTextBox.Text = "";
|
||||
ClearGenreSearchButton.Enabled = false;
|
||||
}
|
||||
|
||||
private void PositionTrackBar_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
clicked = true;
|
||||
double dblValue;
|
||||
//dblValue = ((double)(e.X+PositionTrackBar.Location.X) / (double)(PositionTrackBar.Width + PositionTrackBar.Location.X)) * (PositionTrackBar.Maximum - PositionTrackBar.Minimum);
|
||||
dblValue = ((double)e.X / (double)PositionTrackBar.Width) * (PositionTrackBar.Maximum - PositionTrackBar.Minimum);
|
||||
PositionTrackBar.Value = Convert.ToInt32(dblValue);
|
||||
}
|
||||
|
||||
private void PreviousButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
int selected = 0;
|
||||
selected = main.currentPlayingList.IndexOf(main.audio.CurrentSong) - 1;
|
||||
|
||||
if (selected < 0)
|
||||
{
|
||||
if (LoopSongButton.Checked)
|
||||
selected = main.currentPlayingList.Count-1;
|
||||
}
|
||||
|
||||
main.FilterCurrentPlaying();
|
||||
SongsTableView.CurrentCell = SongsTableView.Rows[selected].Cells[0];
|
||||
main.audio.Play(main.currentPlayingList[selected]);
|
||||
}
|
||||
|
||||
private void NextButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
int selected = 0;
|
||||
|
||||
if (ShuffleSongButton.Checked)
|
||||
{
|
||||
Random r = new Random();
|
||||
selected = r.Next(0, main.currentPlayingList.Count);
|
||||
while (selected == main.currentPlayingList.IndexOf(main.audio.CurrentSong) && main.currentPlayingList.Count > 1)
|
||||
selected = r.Next(0, main.currentPlayingList.Count);
|
||||
}
|
||||
else
|
||||
selected = main.currentPlayingList.IndexOf(main.audio.CurrentSong) + 1;
|
||||
|
||||
if (selected >= main.currentPlayingList.Count)
|
||||
{
|
||||
if (LoopSongButton.Checked)
|
||||
selected = 0;
|
||||
else
|
||||
{
|
||||
songFinished = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
main.FilterCurrentPlaying();
|
||||
SongsTableView.CurrentCell = SongsTableView.Rows[selected].Cells[0];
|
||||
main.audio.Play(main.currentPlayingList[selected]);
|
||||
}
|
||||
|
||||
private void NotifyMenuStripNextButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
NextButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void NotifyMenuStripPreviousButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
PreviousButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void ViewCurrentPlaylistButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
main.FilterCurrentPlaying();
|
||||
int selected = main.currentPlayingList.IndexOf(main.audio.CurrentSong);
|
||||
if(main.currentPlayingList.Count >= 1 && selected >= 0)
|
||||
SongsTableView.CurrentCell = SongsTableView.Rows[selected].Cells[0];
|
||||
}
|
||||
|
||||
|
||||
private void SongsTableView_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
draggedstarted = true;
|
||||
draggedcompleted = false;
|
||||
startx = e.X;
|
||||
starty = e.Y;
|
||||
}
|
||||
|
||||
private void SongsTableView_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (draggedcompleted)
|
||||
{
|
||||
Cursor.Current = Cursors.Default;
|
||||
Point point = PlaylistBox.PointToClient(Cursor.Position);
|
||||
Point point2 = AddToQueueLabel.PointToClient(Cursor.Position);
|
||||
bool queue = AddToQueueLabel.ClientRectangle.Contains(point2);
|
||||
int index = PlaylistBox.IndexFromPoint(point);
|
||||
if (index < 0 && !queue) //nope, niet op een playlist gesleept
|
||||
{
|
||||
draggedstarted = false;
|
||||
draggedcompleted = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (queue)
|
||||
{
|
||||
SongsTable s = new SongsTable();
|
||||
if (SongsTableView.SelectedRows.Count > 0)
|
||||
{
|
||||
var drv = SongsTableView.SelectedRows[0].DataBoundItem as DataRowView;
|
||||
var row = drv.Row as DataRow;
|
||||
s.ImportRow(row);
|
||||
main.currentPlayingList.Add((s.Rows[0][5] as Song));
|
||||
ViewCurrentPlaylistButton_Click(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Playlist currentPlaylist = main.pl.GetPlaylistByName(PlaylistBox.Items[index].ToString());
|
||||
SongsTable s = new SongsTable();
|
||||
if (SongsTableView.SelectedRows.Count > 0)
|
||||
{
|
||||
var drv = SongsTableView.SelectedRows[0].DataBoundItem as DataRowView;
|
||||
var row = drv.Row as DataRow;
|
||||
s.ImportRow(row);
|
||||
currentPlaylist.AddSong((s.Rows[0][5] as Song));
|
||||
currentPlaylist.WriteToFile();
|
||||
}
|
||||
}
|
||||
|
||||
AddToQueueLabel.Visible = false;
|
||||
}
|
||||
|
||||
draggedcompleted = false;
|
||||
draggedstarted = false;
|
||||
}
|
||||
|
||||
private void SongsTableView_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
int deltax = Math.Abs(startx - e.X);
|
||||
int deltay = Math.Abs(starty - e.Y);
|
||||
|
||||
if ((deltax > 5 || deltay > 5) && draggedstarted && !draggedcompleted)
|
||||
{
|
||||
draggedcompleted = true;
|
||||
playlistsToolStripMenuItem_Click(this, new EventArgs());
|
||||
AddToQueueLabel.Visible = true;
|
||||
Cursor.Current = Cursors.Hand;
|
||||
}
|
||||
}
|
||||
|
||||
private void SelectServerJancoButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
main.SwitchServer("http://jancokock.me");
|
||||
}
|
||||
|
||||
private void SelectServerYorickButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
main.SwitchServer("http://imegumii.nl");
|
||||
}
|
||||
|
||||
private void toolStripMenuItem2_Click(object sender, EventArgs e)
|
||||
{
|
||||
main.audio.Play(new RadioStation("538", main.api, "http://vip-icecast.538.lw.triple-it.nl:80/RADIO538_MP3"));
|
||||
}
|
||||
|
||||
private void qDanceToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
main.audio.Play(new RadioStation("Q-Dance", main.api, "http://stream01.platform02.true.nl:8000/qdance-hard"));
|
||||
}
|
||||
|
||||
private void fMToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
main.audio.Play(new RadioStation("3FM", main.api, "http://icecast.omroep.nl:80/3fm-bb-mp3"));
|
||||
}
|
||||
|
||||
private void slamFMToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
main.audio.Play(new RadioStation("Slam-FM", main.api, "http://vip-icecast.538.lw.triple-it.nl/SLAMFM_MP3"));
|
||||
}
|
||||
|
||||
private void SetRadioStationButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
string input = RadioStationTextBox.Text;
|
||||
|
||||
if(Main.CheckURLValid(input))
|
||||
{
|
||||
main.audio.Play(new RadioStation(Main.GetDomain(input), main.api, input));
|
||||
}
|
||||
|
||||
RadioStationTextBox.Text = "";
|
||||
}
|
||||
|
||||
private void SearchSongsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(SearchSongsTextBox.Text.Length > 0)
|
||||
{
|
||||
main.SearchFilter(SearchSongsTextBox.Text);
|
||||
SearchSongsTextBox.Text = "";
|
||||
}
|
||||
}
|
||||
|
||||
private void AdvancedSearchButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
AdvancedSearch av = new AdvancedSearch(main);
|
||||
av.ShowDialog();
|
||||
}
|
||||
|
||||
private void resetToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
main.Repopulate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Regular → Executable
+29
-5
@@ -33,6 +33,14 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="AntiXssLibrary, Version=4.3.0.0, Culture=neutral, PublicKeyToken=d127efab8a9c114f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\AntiXSS.4.3.0\lib\net40\AntiXssLibrary.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="HtmlSanitizationLibrary, Version=4.3.0.0, Culture=neutral, PublicKeyToken=d127efab8a9c114f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\AntiXSS.4.3.0\lib\net40\HtmlSanitizationLibrary.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@@ -55,6 +63,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AudioHandler.cs" />
|
||||
<Compile Include="Genre.cs" />
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="MainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
@@ -66,14 +75,23 @@
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="NetworkHandler.cs" />
|
||||
<Compile Include="NotificationPopup.cs">
|
||||
<Compile Include="Playlist.cs" />
|
||||
<Compile Include="PlaylistHandler.cs" />
|
||||
<Compile Include="AdvancedSearch.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="NotificationPopup.Designer.cs">
|
||||
<DependentUpon>NotificationPopup.cs</DependentUpon>
|
||||
<Compile Include="AdvancedSearch.Designer.cs">
|
||||
<DependentUpon>AdvancedSearch.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="PlaylistMaker.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="PlaylistMaker.Designer.cs">
|
||||
<DependentUpon>PlaylistMaker.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RadioStation.cs" />
|
||||
<Compile Include="Song.cs" />
|
||||
<Compile Include="SongsTable.cs">
|
||||
<SubType>Component</SubType>
|
||||
@@ -82,8 +100,11 @@
|
||||
<EmbeddedResource Include="MainForm.resx">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="NotificationPopup.resx">
|
||||
<DependentUpon>NotificationPopup.cs</DependentUpon>
|
||||
<EmbeddedResource Include="AdvancedSearch.resx">
|
||||
<DependentUpon>AdvancedSearch.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="PlaylistMaker.resx">
|
||||
<DependentUpon>PlaylistMaker.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
@@ -108,6 +129,9 @@
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{E2B99339-3251-48BE-91C9-FAB21CD07A39}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MusicPlayer</RootNamespace>
|
||||
<AssemblyName>MusicPlayer</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MainForm.cs" >
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Album.cs" />
|
||||
<Compile Include="APIHandler.cs" />
|
||||
<Compile Include="Artist.cs" />
|
||||
<Compile Include="MainForm.Designer.cs">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="NetworkHandler.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<<<<<<< HEAD
|
||||
<EmbeddedResource Include="MainForm.resx">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
=======
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
>>>>>>> origin/api
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -2,8 +2,10 @@
|
||||
using System.Text;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using System.Net;
|
||||
using System.IO;
|
||||
using Microsoft.Security.Application;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
|
||||
@@ -12,7 +14,7 @@ namespace MusicPlayer
|
||||
public class NetworkHandler
|
||||
{
|
||||
private int port = 8585;
|
||||
private string ip;
|
||||
public string ip { get; set; }
|
||||
|
||||
public NetworkHandler(string ip)
|
||||
{
|
||||
@@ -21,25 +23,80 @@ namespace MusicPlayer
|
||||
|
||||
public JObject SendString(string m)
|
||||
{
|
||||
HttpWebRequest server = (HttpWebRequest)WebRequest.Create(ip+":"+port+"/"+m);
|
||||
string encodedstring = Microsoft.Security.Application.Encoder.HtmlEncode(m);
|
||||
HttpWebRequest server = (HttpWebRequest)WebRequest.Create(ip+":"+port+"/"+encodedstring);
|
||||
server.KeepAlive = false;
|
||||
HttpWebResponse respond = (HttpWebResponse)server.GetResponse();
|
||||
Stream streamResponse = respond.GetResponseStream();
|
||||
StreamReader streamRead = new StreamReader(streamResponse);
|
||||
Char[] readBuff = new Char[256];
|
||||
int count = streamRead.Read(readBuff, 0, 256);
|
||||
string data = "";
|
||||
while (count > 0)
|
||||
{
|
||||
String outputData = new String(readBuff, 0, count);
|
||||
data +=outputData;
|
||||
count = streamRead.Read(readBuff, 0, 256);
|
||||
try {
|
||||
HttpWebResponse respond = (HttpWebResponse)server.GetResponse();
|
||||
Stream streamResponse = respond.GetResponseStream();
|
||||
StreamReader streamRead = new StreamReader(streamResponse);
|
||||
Char[] readBuff = new Char[256];
|
||||
int count = streamRead.Read(readBuff, 0, 256);
|
||||
string data = "";
|
||||
while (count > 0)
|
||||
{
|
||||
String outputData = new String(readBuff, 0, count);
|
||||
data += outputData;
|
||||
count = streamRead.Read(readBuff, 0, 256);
|
||||
}
|
||||
JObject o = JObject.Parse(data);
|
||||
respond.Close();
|
||||
streamResponse.Close();
|
||||
streamRead.Close();
|
||||
return o;
|
||||
}
|
||||
catch(WebException e)
|
||||
{
|
||||
Console.WriteLine("Server is offline");
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Console.WriteLine("Er is iets fout gegaan bij het communiceren met de server.");
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public MemoryStream downloadArtwork(string album)
|
||||
{
|
||||
try
|
||||
{
|
||||
string encodedstring = Microsoft.Security.Application.Encoder.HtmlEncode(ip + "/music/.artwork/" + album);
|
||||
WebRequest req = WebRequest.Create(encodedstring);
|
||||
//WebRequest req = WebRequest.Create((ip + "/music/.artwork/" + album).Replace(" ","%20"));
|
||||
WebResponse response = req.GetResponse();
|
||||
Stream stream = response.GetResponseStream();
|
||||
|
||||
//Download in chuncks
|
||||
byte[] buffer = new byte[1024];
|
||||
//Get Total Size
|
||||
int dataLength = (int)response.ContentLength;
|
||||
//Download to memory
|
||||
MemoryStream memStream = new MemoryStream();
|
||||
while (true)
|
||||
{
|
||||
//Try to read the data
|
||||
int bytesRead = stream.Read(buffer, 0, buffer.Length);
|
||||
if (bytesRead == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
memStream.Write(buffer, 0, bytesRead);
|
||||
}
|
||||
}
|
||||
//Clean up
|
||||
stream.Close();
|
||||
|
||||
//Convert the downloaded stream to a byte array
|
||||
return memStream;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
JObject o = JObject.Parse(data);
|
||||
respond.Close();
|
||||
streamResponse.Close();
|
||||
streamRead.Close();
|
||||
return o;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
namespace MusicPlayer
|
||||
{
|
||||
partial class NotificationPopup
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NotificationPopup));
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.pictureBox2 = new System.Windows.Forms.PictureBox();
|
||||
this.pictureBox3 = new System.Windows.Forms.PictureBox();
|
||||
this.groupBox1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.BackColor = System.Drawing.Color.White;
|
||||
this.groupBox1.Controls.Add(this.pictureBox3);
|
||||
this.groupBox1.Controls.Add(this.pictureBox2);
|
||||
this.groupBox1.Controls.Add(this.pictureBox1);
|
||||
resources.ApplyResources(this.groupBox1, "groupBox1");
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.TabStop = false;
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
resources.ApplyResources(this.pictureBox1, "pictureBox1");
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.TabStop = false;
|
||||
//
|
||||
// pictureBox2
|
||||
//
|
||||
resources.ApplyResources(this.pictureBox2, "pictureBox2");
|
||||
this.pictureBox2.Name = "pictureBox2";
|
||||
this.pictureBox2.TabStop = false;
|
||||
//
|
||||
// pictureBox3
|
||||
//
|
||||
resources.ApplyResources(this.pictureBox3, "pictureBox3");
|
||||
this.pictureBox3.Name = "pictureBox3";
|
||||
this.pictureBox3.TabStop = false;
|
||||
//
|
||||
// NotificationPopup
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "NotificationPopup";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.PictureBox pictureBox3;
|
||||
private System.Windows.Forms.PictureBox pictureBox2;
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MusicPlayer
|
||||
{
|
||||
public partial class NotificationPopup : Form
|
||||
{
|
||||
public NotificationPopup()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,276 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="pictureBox3.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQffCh0UITh4zTVoAAABr0lEQVRYR8WXQW7CMBRE
|
||||
wxVY9AA9D0k4QXqCrqqqaqtKPQOVWHOgcgyWHIHCjPmmcRjiOInISE8B/+/xF9ixnaWoKJYVWINfsAcH
|
||||
g5/Zxlhl6eMIhnOwAcdE2GduNmlCR/9cmdkQVnXPqJA4Aw9gB5RhH+hFz5kNo8UE8AiUyRjQWxeBAGGV
|
||||
quOYcAwbtSEExvzZb7Gz4UIh0HfC/Ym2GG5iXoQGLjWVGONJtHXlf4niS/I6z/Pli/WV8Q5s3OCUCMZ4
|
||||
ta5DCjh6A75eZcIN3lxHk4inUNGA728VVLzbuBeJnBTWNOAmooINyk8bM5DODWhbJVsacCdTwTpfNl4g
|
||||
tLe/WqGGT5M9E7idqqDn6mdPkfCrc4gWkOflh3n1kvKs4QqI/gUo4tv8AiE2yl/QaRK2FCHza0QnYedl
|
||||
qIpQeQm4ZZj0ImoWoXISOJ8fRaCVehEq3hWzcCY9NqNzESrWkWAz6rkdl8+6Pc5iUYQnZjTe80DyY8OG
|
||||
QmDSIxmZ/FA63bHciwmAVd7/YuKFRP8c42rmJhyezjNZ6Nj7cnq11IYKpv56vgXN6znbEq/nWXYCplmG
|
||||
3mQZHZoAAAAASUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="pictureBox3.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="pictureBox3.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>75, 158</value>
|
||||
</data>
|
||||
<data name="pictureBox3.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>33, 32</value>
|
||||
</data>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="pictureBox3.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name=">>pictureBox3.Name" xml:space="preserve">
|
||||
<value>pictureBox3</value>
|
||||
</data>
|
||||
<data name=">>pictureBox3.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>pictureBox3.Parent" xml:space="preserve">
|
||||
<value>groupBox1</value>
|
||||
</data>
|
||||
<data name=">>pictureBox3.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="pictureBox2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQffCh0UIRU9EmkdAAABx0lEQVRYR81XS26DMBDl
|
||||
EJGSdaXeoLkG0C7KtZIDZJWTdNlK6S2yzA2atu8NM9S4JnyMS5/0NMYzfjOAMXbWh6IotcX2YwUewHfw
|
||||
Al6VbLOPvkrDGa+tCbDBsBvwCH6NJMdsqJHnPzcxCBhodqdiMdy7mr1gILgCz2BIcAqptSrLJ83SAQSR
|
||||
dyDfa0gohtSEdkcRcNqdp0hupDZzaFZFnjfvfM7H3sVzndObmHDcmnCfgb4Y7jRt8+j5qYUCXd6Db15f
|
||||
DNfNU8BF73deR0rsFpyjkKNKimgooEUNlSemloW8mn8KTYjLazDApQQ7QJ/ZmEIqCnD9DjlblGwBwGd2
|
||||
SiEHDuRPJORsUbLcAGLMjinkxAH8k4WcLYr6ACDW7APYV8iFgYNWPlEdAYwxyyfyYjoer/+igFSvYMhc
|
||||
kFew+CRc/DNcciF6NpGQs0UJBNA2G5NYKEIELpb7GaFBLvI7BqUGAS72jtNnug0JYRsDOP5sS1YUheRs
|
||||
AAeZelP6Af7elBq4ZYYz1bacyamt2TqgRSQ5mICapQcWCDvH0UwmHKxoDoZzVuDnMvVwuq41vAk3Bu4B
|
||||
AoJ2PD+B/vGcffTVyyuAtra6kGXfchVyMfY7IlMAAAAASUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="pictureBox2.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="pictureBox2.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>114, 158</value>
|
||||
</data>
|
||||
<data name="pictureBox2.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>33, 32</value>
|
||||
</data>
|
||||
<data name="pictureBox2.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name=">>pictureBox2.Name" xml:space="preserve">
|
||||
<value>pictureBox2</value>
|
||||
</data>
|
||||
<data name=">>pictureBox2.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>pictureBox2.Parent" xml:space="preserve">
|
||||
<value>groupBox1</value>
|
||||
</data>
|
||||
<data name=">>pictureBox2.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="pictureBox1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQffCh0UHx1yDPpSAAABo0lEQVRYR8WXTW7CMBCF
|
||||
wxVY9AA9D4ScID1BV1VVFVSpZ6ASaw5Ej8GSI1D63nRME2si/8SQJ30ieMbPI7Bju0pRXTct2IFvcAJn
|
||||
hc9sY6zV9DJaLOo5TPfgkgj7zNUmTejoPr/UbAzbrmdQSJyBB3AElmEO9KLnTIexxQTwCCyTEtDbLgIB
|
||||
wiqtjiXhGDqqJwRK/uxDHHW4vhDImXA/RlsMMjGv0qVmJUawerbbg/wvUXzJWecC+y+Xq08rFmAvg1NG
|
||||
MBq1yCpCOuKBr1czIQYxUWUU0bIAvr+tYBQ69lWJRexYADcRK0iCs1zH7SmhiAML4E5mBQX1HBRyzDdb
|
||||
ZBEnGnA7tYKC+mUJRawtzw7nmxaA/u++n4cUcJO/AO0fXZ8B5C8oPgnxdtxYuQYyCYsuQ7SFfvYusgyL
|
||||
vYjw/c2PB/g7PxqBaMQAwvOrHwuhXaXzyM2oebFiAXqb0YjtuHky2mLon5jRsPUSYihzIHFCYNIjGZn8
|
||||
UDrdsdyJCYBV3v9i4oRE95kzMX3Srma+0PH+l9MhwdBdzw/Av56zLfF6XlW/G66G3g3Cfq0AAAAASUVO
|
||||
RK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="pictureBox1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>153, 158</value>
|
||||
</data>
|
||||
<data name="pictureBox1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>33, 32</value>
|
||||
</data>
|
||||
<data name="pictureBox1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name=">>pictureBox1.Name" xml:space="preserve">
|
||||
<value>pictureBox1</value>
|
||||
</data>
|
||||
<data name=">>pictureBox1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>pictureBox1.Parent" xml:space="preserve">
|
||||
<value>groupBox1</value>
|
||||
</data>
|
||||
<data name=">>pictureBox1.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>12, 12</value>
|
||||
</data>
|
||||
<data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>266, 196</value>
|
||||
</data>
|
||||
<data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name=">>groupBox1.Name" xml:space="preserve">
|
||||
<value>groupBox1</value>
|
||||
</data>
|
||||
<data name=">>groupBox1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>groupBox1.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>groupBox1.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>6, 13</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>290, 220</value>
|
||||
</data>
|
||||
<data name="$this.Text" xml:space="preserve">
|
||||
<value>NotificationPopup</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>NotificationPopup</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace MusicPlayer
|
||||
{
|
||||
public class Playlist
|
||||
{
|
||||
public string name { get; }
|
||||
private string basedir;
|
||||
public List<Song> songs;
|
||||
public string server;
|
||||
|
||||
private APIHandler api;
|
||||
public Playlist(string name, string basedir, string server, APIHandler api)
|
||||
{
|
||||
this.songs = new List<Song>();
|
||||
this.name = name;
|
||||
this.api = api;
|
||||
this.basedir = basedir;
|
||||
this.server = server;
|
||||
this.ReadFromFile();
|
||||
}
|
||||
|
||||
public void AddSong(Song s)
|
||||
{
|
||||
this.songs.Add(s);
|
||||
}
|
||||
|
||||
public List<Song> GetSongs()
|
||||
{
|
||||
return songs;
|
||||
}
|
||||
|
||||
public void ReadFromFile()
|
||||
{
|
||||
try {
|
||||
using (StreamReader str = new StreamReader(basedir + name + ".txt"))
|
||||
{
|
||||
server = str.ReadLine();
|
||||
|
||||
string readline;
|
||||
while ((readline = str.ReadLine()) != null)
|
||||
{
|
||||
string[] songsvalues = readline.Split('|');
|
||||
|
||||
songs.Add(new Song(songsvalues[0], songsvalues[1], songsvalues[2], songsvalues[3], songsvalues[4], Int32.Parse(songsvalues[5]), api));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
FileStream fs = new FileStream(basedir + name + ".txt", FileMode.CreateNew);
|
||||
fs.Close();
|
||||
File.WriteAllText(basedir + name + ".txt", server);
|
||||
ReadFromFile();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void WriteToFile()
|
||||
{
|
||||
using (StreamWriter stw = new StreamWriter(basedir + name + ".txt"))
|
||||
{
|
||||
stw.WriteLine(server.ToString());
|
||||
|
||||
this.songs.ForEach(s =>
|
||||
{
|
||||
stw.WriteLine(s.ToString());
|
||||
});
|
||||
stw.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete()
|
||||
{
|
||||
try {
|
||||
System.IO.File.Move(basedir + name + ".txt", basedir + name + ".txt.old");
|
||||
}
|
||||
catch(Exception)
|
||||
{
|
||||
//Already removed.
|
||||
}
|
||||
}
|
||||
|
||||
internal void RemoveSong(Song s)
|
||||
{
|
||||
this.songs.Remove(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace MusicPlayer
|
||||
{
|
||||
public class PlaylistHandler
|
||||
{
|
||||
private List<Playlist> playlists;
|
||||
public Main main
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
private readonly string basedir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\.mpplaylists\\";
|
||||
public PlaylistHandler()
|
||||
{
|
||||
this.playlists = new List<Playlist>();
|
||||
}
|
||||
|
||||
public void Populate()
|
||||
{
|
||||
playlists.Clear();
|
||||
|
||||
try {
|
||||
Directory.GetFiles(basedir).ToList().ForEach(f =>
|
||||
{
|
||||
if (f.EndsWith(".txt"))
|
||||
{
|
||||
playlists.Add(new Playlist(Path.GetFileName(f.Replace(".txt","")) ,basedir, main.nw.ip, main.api));
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
{
|
||||
Directory.CreateDirectory(basedir);
|
||||
Populate();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void MakeNewPlaylistByName(string name)
|
||||
{
|
||||
playlists.Add(new Playlist(name, basedir, main.nw.ip, main.api));
|
||||
}
|
||||
|
||||
public Playlist GetPlaylistByName(string name)
|
||||
{
|
||||
Playlist toFind = null;
|
||||
playlists.ForEach(p =>
|
||||
{
|
||||
if (p.name == name) { toFind = p; }
|
||||
});
|
||||
return toFind;
|
||||
}
|
||||
|
||||
public List<Playlist> GetPlaylists()
|
||||
{
|
||||
List<Playlist> currentPlaylists = new List<Playlist>();
|
||||
foreach(Playlist pl in playlists)
|
||||
{
|
||||
if (pl.server == main.nw.ip)
|
||||
currentPlaylists.Add(pl);
|
||||
}
|
||||
return currentPlaylists;
|
||||
}
|
||||
|
||||
internal void RemovePlaylistByName(string name)
|
||||
{
|
||||
Playlist toRemove = null;
|
||||
playlists.ForEach(p =>
|
||||
{
|
||||
if (p.name == name) { toRemove = p; }
|
||||
});
|
||||
|
||||
if(toRemove != null)
|
||||
{
|
||||
toRemove.Delete();
|
||||
playlists.Remove(toRemove);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+239
@@ -0,0 +1,239 @@
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MusicPlayer
|
||||
{
|
||||
partial class PlaylistMaker
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PlaylistMaker));
|
||||
this.PlaylistSelectBox = new System.Windows.Forms.ComboBox();
|
||||
this.PlaylistSongSelector = new System.Windows.Forms.ListBox();
|
||||
this.PlaylistAddSongsButton = new System.Windows.Forms.Button();
|
||||
this.PlaylistSongContainer = new System.Windows.Forms.ListBox();
|
||||
this.PlaylistNewButton = new System.Windows.Forms.Button();
|
||||
this.PlaylistNewInputfield = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.FilterTextBox = new System.Windows.Forms.TextBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.DeletePlaylistButton = new System.Windows.Forms.Button();
|
||||
this.DeleteSongsButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// PlaylistSelectBox
|
||||
//
|
||||
this.PlaylistSelectBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.PlaylistSelectBox.FormattingEnabled = true;
|
||||
this.PlaylistSelectBox.Location = new System.Drawing.Point(10, 96);
|
||||
this.PlaylistSelectBox.Name = "PlaylistSelectBox";
|
||||
this.PlaylistSelectBox.Size = new System.Drawing.Size(306, 21);
|
||||
this.PlaylistSelectBox.TabIndex = 0;
|
||||
this.PlaylistSelectBox.SelectedIndexChanged += new System.EventHandler(this.PlaylistSelectBox_SelectedIndexChanged);
|
||||
//
|
||||
// PlaylistSongSelector
|
||||
//
|
||||
this.PlaylistSongSelector.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.PlaylistSongSelector.FormattingEnabled = true;
|
||||
this.PlaylistSongSelector.Location = new System.Drawing.Point(11, 149);
|
||||
this.PlaylistSongSelector.Name = "PlaylistSongSelector";
|
||||
this.PlaylistSongSelector.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
|
||||
this.PlaylistSongSelector.Size = new System.Drawing.Size(305, 108);
|
||||
this.PlaylistSongSelector.TabIndex = 1;
|
||||
//
|
||||
// PlaylistAddSongsButton
|
||||
//
|
||||
this.PlaylistAddSongsButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.PlaylistAddSongsButton.Location = new System.Drawing.Point(10, 263);
|
||||
this.PlaylistAddSongsButton.Name = "PlaylistAddSongsButton";
|
||||
this.PlaylistAddSongsButton.Size = new System.Drawing.Size(306, 23);
|
||||
this.PlaylistAddSongsButton.TabIndex = 2;
|
||||
this.PlaylistAddSongsButton.Text = "Add selected to playlist";
|
||||
this.PlaylistAddSongsButton.UseVisualStyleBackColor = true;
|
||||
this.PlaylistAddSongsButton.Click += new System.EventHandler(this.PlaylistAddSongsButton_Click);
|
||||
//
|
||||
// PlaylistSongContainer
|
||||
//
|
||||
this.PlaylistSongContainer.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.PlaylistSongContainer.FormattingEnabled = true;
|
||||
this.PlaylistSongContainer.Location = new System.Drawing.Point(10, 319);
|
||||
this.PlaylistSongContainer.Name = "PlaylistSongContainer";
|
||||
this.PlaylistSongContainer.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
|
||||
this.PlaylistSongContainer.Size = new System.Drawing.Size(306, 82);
|
||||
this.PlaylistSongContainer.TabIndex = 3;
|
||||
//
|
||||
// PlaylistNewButton
|
||||
//
|
||||
this.PlaylistNewButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.PlaylistNewButton.Location = new System.Drawing.Point(242, 23);
|
||||
this.PlaylistNewButton.Name = "PlaylistNewButton";
|
||||
this.PlaylistNewButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.PlaylistNewButton.TabIndex = 4;
|
||||
this.PlaylistNewButton.Text = "New";
|
||||
this.PlaylistNewButton.UseVisualStyleBackColor = true;
|
||||
this.PlaylistNewButton.Click += new System.EventHandler(this.PlaylistNewButton_Click);
|
||||
//
|
||||
// PlaylistNewInputfield
|
||||
//
|
||||
this.PlaylistNewInputfield.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.PlaylistNewInputfield.Location = new System.Drawing.Point(11, 25);
|
||||
this.PlaylistNewInputfield.Name = "PlaylistNewInputfield";
|
||||
this.PlaylistNewInputfield.Size = new System.Drawing.Size(225, 20);
|
||||
this.PlaylistNewInputfield.TabIndex = 5;
|
||||
this.PlaylistNewInputfield.KeyUp += new System.Windows.Forms.KeyEventHandler(this.PlaylistNewInputfield_KeyUp);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(12, 9);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(95, 13);
|
||||
this.label1.TabIndex = 6;
|
||||
this.label1.Text = "Create new playlist";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(8, 75);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(97, 13);
|
||||
this.label2.TabIndex = 7;
|
||||
this.label2.Text = "Edit existing playlist";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(11, 297);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(82, 13);
|
||||
this.label3.TabIndex = 8;
|
||||
this.label3.Text = "Songs in playlist";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(11, 130);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(49, 13);
|
||||
this.label4.TabIndex = 9;
|
||||
this.label4.Text = "All songs";
|
||||
//
|
||||
// FilterTextBox
|
||||
//
|
||||
this.FilterTextBox.Location = new System.Drawing.Point(172, 127);
|
||||
this.FilterTextBox.Name = "FilterTextBox";
|
||||
this.FilterTextBox.Size = new System.Drawing.Size(144, 20);
|
||||
this.FilterTextBox.TabIndex = 10;
|
||||
this.FilterTextBox.KeyUp += new System.Windows.Forms.KeyEventHandler(this.FilterTextBox_KeyUp);
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(137, 130);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(29, 13);
|
||||
this.label5.TabIndex = 11;
|
||||
this.label5.Text = "Filter";
|
||||
//
|
||||
// DeletePlaylistButton
|
||||
//
|
||||
this.DeletePlaylistButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.DeletePlaylistButton.Location = new System.Drawing.Point(225, 70);
|
||||
this.DeletePlaylistButton.Name = "DeletePlaylistButton";
|
||||
this.DeletePlaylistButton.Size = new System.Drawing.Size(92, 23);
|
||||
this.DeletePlaylistButton.TabIndex = 12;
|
||||
this.DeletePlaylistButton.Text = "Delete Playlist";
|
||||
this.DeletePlaylistButton.UseVisualStyleBackColor = true;
|
||||
this.DeletePlaylistButton.Click += new System.EventHandler(this.DeletePlaylistButton_Click);
|
||||
//
|
||||
// DeleteSongsButton
|
||||
//
|
||||
this.DeleteSongsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.DeleteSongsButton.Location = new System.Drawing.Point(172, 292);
|
||||
this.DeleteSongsButton.Name = "DeleteSongsButton";
|
||||
this.DeleteSongsButton.Size = new System.Drawing.Size(143, 23);
|
||||
this.DeleteSongsButton.TabIndex = 13;
|
||||
this.DeleteSongsButton.Text = "Delete Selected Songs";
|
||||
this.DeleteSongsButton.UseVisualStyleBackColor = true;
|
||||
this.DeleteSongsButton.Click += new System.EventHandler(this.DeleteSongsButton_Click);
|
||||
//
|
||||
// PlaylistMaker
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(334, 411);
|
||||
this.Controls.Add(this.DeleteSongsButton);
|
||||
this.Controls.Add(this.DeletePlaylistButton);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.FilterTextBox);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.PlaylistNewInputfield);
|
||||
this.Controls.Add(this.PlaylistNewButton);
|
||||
this.Controls.Add(this.PlaylistSongContainer);
|
||||
this.Controls.Add(this.PlaylistAddSongsButton);
|
||||
this.Controls.Add(this.PlaylistSongSelector);
|
||||
this.Controls.Add(this.PlaylistSelectBox);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MinimumSize = new System.Drawing.Size(300, 425);
|
||||
this.Name = "PlaylistMaker";
|
||||
this.Text = "Create / Edit playlists";
|
||||
this.Shown += new System.EventHandler(this.PlaylistMaker_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ComboBox PlaylistSelectBox;
|
||||
private System.Windows.Forms.ListBox PlaylistSongSelector;
|
||||
private System.Windows.Forms.Button PlaylistAddSongsButton;
|
||||
private System.Windows.Forms.ListBox PlaylistSongContainer;
|
||||
private Button PlaylistNewButton;
|
||||
private TextBox PlaylistNewInputfield;
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private Label label4;
|
||||
private TextBox FilterTextBox;
|
||||
private Label label5;
|
||||
private Button DeletePlaylistButton;
|
||||
private Button DeleteSongsButton;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MusicPlayer
|
||||
{
|
||||
public partial class PlaylistMaker : Form
|
||||
{
|
||||
private PlaylistHandler pl;
|
||||
private APIHandler api;
|
||||
|
||||
private List<Song> allPlaylistSongs;
|
||||
private List<Song> allsongs;
|
||||
|
||||
public PlaylistMaker(PlaylistHandler pl, APIHandler api)
|
||||
{
|
||||
this.pl = pl;
|
||||
this.api = api;
|
||||
this.allPlaylistSongs = new List<Song>();
|
||||
this.allsongs = new List<Song>();
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void PlaylistSelectBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (PlaylistSelectBox.SelectedItem != null)
|
||||
{
|
||||
PlaylistSongContainer.Items.Clear();
|
||||
allPlaylistSongs = pl.GetPlaylistByName(PlaylistSelectBox.SelectedItem.ToString()).GetSongs();
|
||||
allPlaylistSongs.ForEach(s => PlaylistSongContainer.Items.Add(s.Name));
|
||||
}
|
||||
}
|
||||
|
||||
public void Repopulate(bool lastIndex)
|
||||
{
|
||||
int selection = PlaylistSelectBox.SelectedIndex;
|
||||
PlaylistSelectBox.Items.Clear();
|
||||
pl.GetPlaylists().ForEach(p => PlaylistSelectBox.Items.Add(p.name));
|
||||
if (lastIndex)
|
||||
PlaylistSelectBox.SelectedIndex = PlaylistSelectBox.Items.Count - 1;
|
||||
else
|
||||
PlaylistSelectBox.SelectedIndex = selection;
|
||||
PlaylistSongContainer.Items.Clear();
|
||||
if (PlaylistSelectBox.SelectedItem != null)
|
||||
{
|
||||
allPlaylistSongs = pl.GetPlaylistByName(PlaylistSelectBox.SelectedItem.ToString()).GetSongs();
|
||||
allPlaylistSongs.ForEach(s => PlaylistSongContainer.Items.Add(s.Name));
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaylistSelectBox.SelectedIndex = -1;
|
||||
PlaylistSelectBox.Text = "";
|
||||
}
|
||||
}
|
||||
|
||||
public void Repopulate()
|
||||
{
|
||||
Repopulate(false);
|
||||
}
|
||||
|
||||
public void Populate()
|
||||
{
|
||||
pl.GetPlaylists().ForEach(p => PlaylistSelectBox.Items.Add(p.name));
|
||||
if (PlaylistSelectBox.Items.Count > 0)
|
||||
PlaylistSelectBox.SelectedIndex = 0;
|
||||
allsongs = api.GetAllSongs();
|
||||
allsongs.ForEach(s => PlaylistSongSelector.Items.Add(s.Name));
|
||||
|
||||
if (PlaylistSelectBox.SelectedItem != null)
|
||||
{
|
||||
allPlaylistSongs = pl.GetPlaylistByName(PlaylistSelectBox.SelectedItem.ToString()).GetSongs();
|
||||
allPlaylistSongs.ForEach(s => PlaylistSongContainer.Items.Add(s.Name));
|
||||
}
|
||||
}
|
||||
|
||||
private void PlaylistAddSongsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (PlaylistSelectBox.SelectedItem!=null)
|
||||
{
|
||||
Playlist currentPlaylist = pl.GetPlaylistByName(PlaylistSelectBox.SelectedItem.ToString());
|
||||
foreach (string song in PlaylistSongSelector.SelectedItems)
|
||||
{
|
||||
foreach (Song s in allsongs) {
|
||||
if (s.Name == song)
|
||||
{
|
||||
currentPlaylist.AddSong(s);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
currentPlaylist.WriteToFile();
|
||||
}
|
||||
Thread.Sleep(10);
|
||||
Repopulate();
|
||||
}
|
||||
|
||||
public void SearchAllSongs(string search)
|
||||
{
|
||||
PlaylistSongSelector.Items.Clear();
|
||||
|
||||
if (search.Length > 1)
|
||||
{
|
||||
string sPattern = search;
|
||||
|
||||
foreach (Song s in allsongs)
|
||||
{
|
||||
if (System.Text.RegularExpressions.Regex.IsMatch(s.Name, sPattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase))
|
||||
{
|
||||
PlaylistSongSelector.Items.Add(s.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
allsongs.ForEach(s => PlaylistSongSelector.Items.Add(s.Name));
|
||||
}
|
||||
}
|
||||
|
||||
private void PlaylistNewButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
string name = PlaylistNewInputfield.Text;
|
||||
PlaylistNewInputfield.Text = "";
|
||||
name = name.Replace('/', '-');
|
||||
name = name.Replace('\\', '-');
|
||||
pl.MakeNewPlaylistByName(name);
|
||||
Repopulate(true);
|
||||
}
|
||||
|
||||
private void PlaylistMaker_Load(object sender, EventArgs e)
|
||||
{
|
||||
Populate();
|
||||
}
|
||||
|
||||
private void FilterTextBox_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
SearchAllSongs(FilterTextBox.Text);
|
||||
}
|
||||
|
||||
private void PlaylistNewInputfield_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
if(e.KeyCode == Keys.Enter)
|
||||
{
|
||||
PlaylistNewButton_Click(sender, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
private void DeletePlaylistButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (PlaylistSelectBox.SelectedItem != null)
|
||||
if (MessageBox.Show("Are you sure to delete " + PlaylistSelectBox.SelectedItem.ToString() + "?", "Confirm Delete!", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||
{
|
||||
pl.RemovePlaylistByName(PlaylistSelectBox.SelectedItem.ToString());
|
||||
Repopulate(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteSongsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (PlaylistSelectBox.SelectedItem != null)
|
||||
{
|
||||
Playlist currentPlaylist = pl.GetPlaylistByName(PlaylistSelectBox.SelectedItem.ToString());
|
||||
foreach (string song in PlaylistSongSelector.SelectedItems)
|
||||
{
|
||||
for (int i = currentPlaylist.GetSongs().Count - 1; i > 0; i--)
|
||||
{
|
||||
Song s = currentPlaylist.GetSongs()[i];
|
||||
if (s.Name == song)
|
||||
{
|
||||
currentPlaylist.RemoveSong(s);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
currentPlaylist.WriteToFile();
|
||||
}
|
||||
Thread.Sleep(10);
|
||||
Repopulate();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -17,26 +17,11 @@ namespace MusicPlayer
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
|
||||
NetworkHandler nw = new NetworkHandler("http://www.imegumii.nl");
|
||||
NetworkHandler nw = new NetworkHandler("http://imegumii.nl");
|
||||
APIHandler api = new APIHandler(nw);
|
||||
// api.GetSongsByArtist("Amon Amarth").ForEach(s =>
|
||||
// {
|
||||
// Console.WriteLine(s.SongID);
|
||||
// });
|
||||
// api.GetSongsByYear("2009").ForEach(s =>
|
||||
// {
|
||||
// Console.WriteLine(s.Name);
|
||||
// });
|
||||
api.GetSongsByGenre("Melodic Death Metal").ForEach(s =>
|
||||
{
|
||||
Console.WriteLine(s.Name);
|
||||
});
|
||||
// api.GetSongsByAlbum("Stronger").ForEach(s =>
|
||||
// {
|
||||
// Console.WriteLine(s.Name);
|
||||
// });
|
||||
MainForm form = new MainForm();
|
||||
new Main(nw, api, form);
|
||||
PlaylistHandler pl = new PlaylistHandler();
|
||||
new Main(nw, api, form,pl);
|
||||
|
||||
Application.Run(form);
|
||||
}
|
||||
|
||||
Regular → Executable
+10
-18
@@ -8,8 +8,8 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace MusicPlayer.Properties
|
||||
{
|
||||
namespace MusicPlayer.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -22,28 +22,23 @@ namespace MusicPlayer.Properties
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MusicPlayer.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
@@ -56,14 +51,11 @@ namespace MusicPlayer.Properties
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
@@ -60,6 +60,7 @@
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
@@ -68,9 +69,10 @@
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
@@ -85,9 +87,10 @@
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
@@ -109,9 +112,9 @@
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
Regular → Executable
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MusicPlayer
|
||||
{
|
||||
class RadioStation :Song
|
||||
{
|
||||
string radiourl;
|
||||
public RadioStation(string name, APIHandler api, string url):base("-1", name,"","","",0,api)
|
||||
{
|
||||
radiourl = url;
|
||||
}
|
||||
|
||||
protected override string GetURL()
|
||||
{
|
||||
return radiourl;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -12,25 +12,29 @@ namespace MusicPlayer
|
||||
public string Name { get; set; }
|
||||
public string Album { get; set; }
|
||||
public string Artist { get; set; }
|
||||
public string Genre { get; set; }
|
||||
public string Url { get { return GetURL(); } set { SetURL(value); } }
|
||||
public int Seconds { get; set; }
|
||||
|
||||
private APIHandler api;
|
||||
|
||||
private string url;
|
||||
|
||||
public Song(string songid, string name, string album, string artist, APIHandler api)
|
||||
public Song(string songid, string name, string album, string artist, string genre, int seconds, APIHandler api)
|
||||
{
|
||||
SongID = songid;
|
||||
Name = name;
|
||||
Album = album;
|
||||
Artist = artist;
|
||||
Seconds = seconds;
|
||||
Genre = genre;
|
||||
|
||||
this.api = api;
|
||||
|
||||
url = "";
|
||||
}
|
||||
|
||||
private string GetURL()
|
||||
protected virtual string GetURL()
|
||||
{
|
||||
if (url == "")
|
||||
{
|
||||
@@ -44,5 +48,34 @@ namespace MusicPlayer
|
||||
{
|
||||
url = str;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{this.SongID}|{this.Name}|{this.Album}|{this.Artist}|{this.Genre}|{this.Seconds}";
|
||||
}
|
||||
|
||||
public override bool Equals(System.Object obj)
|
||||
{
|
||||
// If parameter is null return false.
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// If parameter cannot be cast to Point return false.
|
||||
Song s = obj as Song;
|
||||
if ((System.Object)s == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Return true if the fields match:
|
||||
return (s.Name == Name) && (s.SongID == SongID);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return int.Parse(this.SongID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+7
-4
@@ -7,19 +7,22 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace MusicPlayer
|
||||
{
|
||||
class SongsTable : DataTable
|
||||
public class SongsTable : DataTable
|
||||
{
|
||||
public SongsTable() : base()
|
||||
{
|
||||
this.Columns.Clear();
|
||||
this.Columns.Add("Naam", typeof(string));
|
||||
this.Columns.Add("Name", typeof(string));
|
||||
this.Columns.Add("Album", typeof(string));
|
||||
this.Columns.Add("Artiest", typeof(string));
|
||||
this.Columns.Add("Artist", typeof(string));
|
||||
this.Columns.Add("Genre", typeof(string));
|
||||
this.Columns.Add("Duration", typeof(string));
|
||||
this.Columns.Add("song", typeof(Song));
|
||||
}
|
||||
|
||||
public void Add(Song s)
|
||||
{
|
||||
this.Rows.Add(s.Name, s.Album, s.Artist);
|
||||
this.Rows.Add(s.Name, s.Album, s.Artist, s.Genre, Main.SecondsToTimestamp(s.Seconds), s);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Regular → Executable
Regular → Executable
+1
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="AntiXSS" version="4.3.0" targetFramework="net452" />
|
||||
<package id="NAudio" version="1.7.3" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net452" />
|
||||
</packages>
|
||||
@@ -1,12 +1,10 @@
|
||||
# musicplayer
|
||||
|
||||
##Onderdelen
|
||||
- Server/Client
|
||||
- Threading/Threadpools
|
||||
- File IO
|
||||
- Socket communicatie
|
||||
- Klasse Structuur
|
||||
- Forms Applicatie
|
||||
- Specifieke C# - Delegates/Lambda...
|
||||
|
||||
|
||||
## todo
|
||||
- afvangen server niet online
|
||||
- server opslaan bij playlist
|
||||
- doorzoeken van alle liedjes via API
|
||||
- doorzoeken van albums
|
||||
- playlist verwijderen
|
||||
- liedjes uit playlist verwijderen
|
||||
- presentatie
|
||||
|
||||
Reference in New Issue
Block a user