diff --git a/MusicPlayer/MusicPlayer/APIHandler.cs b/MusicPlayer/MusicPlayer/APIHandler.cs new file mode 100644 index 0000000..92583ea --- /dev/null +++ b/MusicPlayer/MusicPlayer/APIHandler.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using MusicPlayer; + +namespace MusicPlayer +{ + internal class APIHandler + { + public APIHandler() + { + + } + + public List GetArtists() + { + return null; + } + + public List GetAlbums() + { + return null; + } + } +} diff --git a/MusicPlayer/MusicPlayer/Album.cs b/MusicPlayer/MusicPlayer/Album.cs new file mode 100644 index 0000000..c1d00ad --- /dev/null +++ b/MusicPlayer/MusicPlayer/Album.cs @@ -0,0 +1,12 @@ +namespace MusicPlayer +{ + public class Album + { + public string albumnaam { get; set; } + + public Album(string albumnaam) + { + this.albumnaam = albumnaam; + } + } +} \ No newline at end of file diff --git a/MusicPlayer/MusicPlayer/Artist.cs b/MusicPlayer/MusicPlayer/Artist.cs new file mode 100644 index 0000000..bf3efd7 --- /dev/null +++ b/MusicPlayer/MusicPlayer/Artist.cs @@ -0,0 +1,13 @@ +namespace MusicPlayer +{ + public class Artist + { + public string naam { get; set; } + + public Artist(string naam) + { + this.naam = naam; + + } + } +} \ No newline at end of file diff --git a/MusicPlayer/MusicPlayer/Form1.resx b/MusicPlayer/MusicPlayer/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/MusicPlayer/MusicPlayer/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/MusicPlayer/MusicPlayer/MainForm.cs b/MusicPlayer/MusicPlayer/MainForm.cs index 7df1874..3bc9e55 100644 --- a/MusicPlayer/MusicPlayer/MainForm.cs +++ b/MusicPlayer/MusicPlayer/MainForm.cs @@ -8,6 +8,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; + namespace MusicPlayer { public partial class MainForm : Form @@ -15,6 +16,9 @@ namespace MusicPlayer public MainForm() { InitializeComponent(); + APIHandler api = new APIHandler(); + NetworkHandler nw = new NetworkHandler("83.128.250.123", api); + } } } diff --git a/MusicPlayer/MusicPlayer/MusicPlayer.csproj b/MusicPlayer/MusicPlayer/MusicPlayer.csproj index e25b830..fd24d57 100644 --- a/MusicPlayer/MusicPlayer/MusicPlayer.csproj +++ b/MusicPlayer/MusicPlayer/MusicPlayer.csproj @@ -47,11 +47,15 @@ + + + Form MainForm.cs + diff --git a/MusicPlayer/MusicPlayer/NetworkHandler.cs b/MusicPlayer/MusicPlayer/NetworkHandler.cs new file mode 100644 index 0000000..2ac9dcf --- /dev/null +++ b/MusicPlayer/MusicPlayer/NetworkHandler.cs @@ -0,0 +1,41 @@ +using System.Text; +using System.Net.Sockets; +using System.Threading; + +namespace MusicPlayer +{ + class NetworkHandler + { + private int port = 8585; + private Socket s; + private APIHandler api; + + public NetworkHandler(string ip, APIHandler apihandler) + { + s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + s.Connect(ip, port); + ThreadStart thread = new ThreadStart(ReceiveData); + Thread childThread = new Thread(thread); + childThread.Start(); + api = apihandler; + } + + public void SendString(string m) + { + byte[] req_as_bytes = Encoding.UTF8.GetBytes(m); + s.Send(req_as_bytes); + } + + public void ReceiveData() + { + while (s.Connected) + { + byte[] data = new byte[1024 * 200]; + s.Receive(data); + string message = Encoding.ASCII.GetString(data); + System.Console.WriteLine(message); + //Iets doen met api calls + } + } + } +}