Merge remote-tracking branch 'origin/developer'

This commit is contained in:
Yorick Rommers
2015-10-29 22:59:19 +01:00
21 changed files with 2320 additions and 8 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ bld/
# Visual Studio 2015 cache/options directory # Visual Studio 2015 cache/options directory
.vs/ .vs/
*.csproj
# MSTest test Results # MSTest test Results
[Tt]est[Rr]esult*/ [Tt]est[Rr]esult*/
[Bb]uild[Ll]og.* [Bb]uild[Ll]og.*
+108
View File
@@ -0,0 +1,108 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MusicPlayer;
using Newtonsoft.Json.Linq;
namespace MusicPlayer
{
public class APIHandler
{
private NetworkHandler nw;
public APIHandler(NetworkHandler nw)
{
this.nw = nw;
}
public string GetSongURLByID(string id)
{
JObject o = nw.SendString("getsongbyid?id=" + id);
if (o["result"].ToString() == "OK") {
return o["songurl"].ToString();
}
return o["errormsg"].ToString();
}
public List<Song> GetSongsByAlbum(string albumname)
{
return GetSongsByArgs("album=" + albumname);
}
public List<Song> GetSongsByArtist(string artistname)
{
return GetSongsByArgs("artist=" + artistname);
}
public List<Song> GetSongsByGenre(string genre)
{
return GetSongsByArgs("genre=" + genre);
}
public List<Song> GetSongsByYear(string year)
{
return GetSongsByArgs("album=" + year);
}
public List<Song> GetSongsByArgs(string args)
{
List<Song> songslist = new List<Song>();
JObject o = nw.SendString("getsongs?"+args);
if (o["result"].ToString() == "OK")
{
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));
}
}
return songslist;
}
public List<Artist> GetArtists()
{
List<Artist> artistlist = new List<Artist>();
JObject o = nw.SendString("getartists?id=hallo");
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<Album> GetAlbums()
{
List<Album> albumlist = new List<Album>();
JObject o = nw.SendString("getalbums?id=hallo");
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<Year> GetYears()
{
List<Year> yearlist = new List<Year> ();
JObject o = nw.SendString("getyears?id=hallo");
if (o["result"].ToString() == "OK")
{
for (int i = 0; i < o["years"].Count(); i++)
{
yearlist.Add(new Year(o["years"][i][0].ToString()));
}
}
return yearlist;
}
}
}
+12
View File
@@ -0,0 +1,12 @@
namespace MusicPlayer
{
public class Album
{
public string albumnaam { get; set; }
public Album(string albumnaam)
{
this.albumnaam = albumnaam;
}
}
}
+13
View File
@@ -0,0 +1,13 @@
namespace MusicPlayer
{
public class Artist
{
public string naam { get; set; }
public Artist(string naam)
{
this.naam = naam;
}
}
}
+58
View File
@@ -0,0 +1,58 @@
using NAudio.Wave;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace MusicPlayer
{
public class AudioHandler
{
public static Stream ms = new MemoryStream();
public static void PlayMp3FromUrl(string url)
{
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();
}
}
}
+10 -1
View File
@@ -28,9 +28,18 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); this.SuspendLayout();
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 261);
this.Name = "Form1";
this.Text = "Form1"; this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
} }
#endregion #endregion
+120
View File
@@ -0,0 +1,120 @@
<?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>
</root>
+51
View File
@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MusicPlayer
{
public class Main
{
public APIHandler api;
public MainForm form;
public NetworkHandler nw;
public AudioHandler audio;
private SongsTable table;
public Main(NetworkHandler nw, APIHandler api, MainForm form)
{
this.nw = nw;
this.api = api;
this.form = form;
form.main = this;
audio = new AudioHandler();
table = new SongsTable();
form.SongsTableView.DataSource = table;
Populate();
}
private void Populate()
{
table.Add(new Song("102", "Test Song 1", "Test Album 1", "Test Artist 1", api));
form.GenreListBox.Items.Add("Hardcore");
form.GenreListBox.Items.Add("Hardstyle");
form.GenreListBox.Items.Add("Pop");
form.ArtistListBox.Items.Add("Kygo");
form.ArtistListBox.Items.Add("Monstercat");
form.ArtistListBox.Items.Add("Mozart");
form.AlbumListView.Items.Add("Album 1");
form.AlbumListView.Items.Add("Album 2");
form.AlbumListView.Items.Add("Album 3");
table.Add(new Song("104", "Test Song 2", "Test Album 2", "Test Artist 2", api));
}
}
}
+218
View File
@@ -0,0 +1,218 @@
namespace MusicPlayer
{
partial class MainForm
{
/// <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(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.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.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ControlsPanel = new System.Windows.Forms.Panel();
this.PlayButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.SongsTableView)).BeginInit();
this.MainPanel.SuspendLayout();
this.MenuStrip.SuspendLayout();
this.ControlsPanel.SuspendLayout();
this.SuspendLayout();
//
// SongsTableView
//
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;
this.SongsTableView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.SongsTableView.Location = new System.Drawing.Point(12, 153);
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.TabIndex = 0;
this.SongsTableView.SelectionChanged += new System.EventHandler(this.SongsTableView_SelectionChanged);
//
// GenreListBox
//
this.GenreListBox.BackColor = System.Drawing.SystemColors.Control;
this.GenreListBox.FormattingEnabled = true;
this.GenreListBox.Location = new System.Drawing.Point(12, 12);
this.GenreListBox.Name = "GenreListBox";
this.GenreListBox.Size = new System.Drawing.Size(124, 134);
this.GenreListBox.Sorted = true;
this.GenreListBox.TabIndex = 1;
//
// AlbumListView
//
this.AlbumListView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | 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.Name = "AlbumListView";
this.AlbumListView.Size = new System.Drawing.Size(500, 134);
this.AlbumListView.Sorting = System.Windows.Forms.SortOrder.Ascending;
this.AlbumListView.TabIndex = 2;
this.AlbumListView.UseCompatibleStateImageBehavior = false;
//
// ArtistListBox
//
this.ArtistListBox.BackColor = System.Drawing.SystemColors.Control;
this.ArtistListBox.FormattingEnabled = true;
this.ArtistListBox.Location = new System.Drawing.Point(142, 12);
this.ArtistListBox.Name = "ArtistListBox";
this.ArtistListBox.Size = new System.Drawing.Size(124, 134);
this.ArtistListBox.Sorted = true;
this.ArtistListBox.TabIndex = 3;
//
// MainPanel
//
this.MainPanel.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.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.Location = new System.Drawing.Point(0, 24);
this.MainPanel.Name = "MainPanel";
this.MainPanel.Size = new System.Drawing.Size(784, 313);
this.MainPanel.TabIndex = 5;
//
// MenuStrip
//
this.MenuStrip.BackColor = System.Drawing.SystemColors.Window;
this.MenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
this.viewToolStripMenuItem});
this.MenuStrip.Location = new System.Drawing.Point(0, 0);
this.MenuStrip.Name = "MenuStrip";
this.MenuStrip.Size = new System.Drawing.Size(784, 24);
this.MenuStrip.TabIndex = 6;
this.MenuStrip.Text = "Menu";
//
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.openToolStripMenuItem,
this.saveToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
this.fileToolStripMenuItem.Text = "File";
//
// openToolStripMenuItem
//
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
this.openToolStripMenuItem.Size = new System.Drawing.Size(103, 22);
this.openToolStripMenuItem.Text = "Open";
//
// saveToolStripMenuItem
//
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.Size = new System.Drawing.Size(103, 22);
this.saveToolStripMenuItem.Text = "Save";
//
// viewToolStripMenuItem
//
this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.viewToolStripMenuItem.Text = "View";
//
// ControlsPanel
//
this.ControlsPanel.BackColor = System.Drawing.SystemColors.WindowFrame;
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.Name = "ControlsPanel";
this.ControlsPanel.Size = new System.Drawing.Size(784, 119);
this.ControlsPanel.TabIndex = 4;
//
// PlayButton
//
this.PlayButton.Location = new System.Drawing.Point(12, 13);
this.PlayButton.Name = "PlayButton";
this.PlayButton.Size = new System.Drawing.Size(75, 23);
this.PlayButton.TabIndex = 0;
this.PlayButton.Text = "Play";
this.PlayButton.UseVisualStyleBackColor = true;
this.PlayButton.Click += new System.EventHandler(this.PlayButton_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.Controls.Add(this.ControlsPanel);
this.Controls.Add(this.MainPanel);
this.Controls.Add(this.MenuStrip);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.MenuStrip;
this.MinimumSize = new System.Drawing.Size(800, 500);
this.Name = "MainForm";
this.Text = "YJMPD Music Player";
this.Load += new System.EventHandler(this.MainForm_Load);
((System.ComponentModel.ISupportInitialize)(this.SongsTableView)).EndInit();
this.MainPanel.ResumeLayout(false);
this.MenuStrip.ResumeLayout(false);
this.MenuStrip.PerformLayout();
this.ControlsPanel.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
public System.Windows.Forms.DataGridView SongsTableView;
public System.Windows.Forms.ListBox GenreListBox;
public System.Windows.Forms.ListView AlbumListView;
public System.Windows.Forms.ListBox ArtistListBox;
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;
}
}
+45
View File
@@ -0,0 +1,45 @@
using NAudio.Wave;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MusicPlayer
{
public partial class MainForm : Form
{
public Main main
{
get; set;
}
public MainForm()
{
InitializeComponent();
}
private void MainForm_Load(object sender, EventArgs e)
{
}
private void PlayButton_Click(object sender, EventArgs e)
{
AudioHandler.PlayMp3FromUrl("http://imegumii.nl/music/English/Monstercat/Direct%20-%20Eternity.mp3");
}
private void SongsTableView_SelectionChanged(object sender, EventArgs e)
{
DataGridViewSelectedRowCollection col = SongsTableView.SelectedRows;
}
}
}
File diff suppressed because it is too large Load Diff
+35 -3
View File
@@ -33,6 +33,14 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<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>
</Reference>
<Reference Include="NAudio, Version=1.7.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\NAudio.1.7.3\lib\net35\NAudio.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
@@ -46,14 +54,37 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Form1.cs"> <Compile Include="AudioHandler.cs" />
<Compile Include="Main.cs" />
<Compile Include="MainForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="Form1.Designer.cs"> <Compile Include="Album.cs" />
<DependentUpon>Form1.cs</DependentUpon> <Compile Include="APIHandler.cs" />
<Compile Include="Artist.cs" />
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="NetworkHandler.cs" />
<Compile Include="NotificationPopup.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="NotificationPopup.Designer.cs">
<DependentUpon>NotificationPopup.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Song.cs" />
<Compile Include="SongsTable.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Year.cs" />
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="NotificationPopup.resx">
<DependentUpon>NotificationPopup.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
@@ -63,6 +94,7 @@
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
</Compile> </Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+45
View File
@@ -0,0 +1,45 @@
using System;
using System.Text;
using System.Net.Sockets;
using System.Threading;
using System.Net;
using System.IO;
using Newtonsoft.Json.Linq;
namespace MusicPlayer
{
public class NetworkHandler
{
private int port = 8585;
private string ip;
public NetworkHandler(string ip)
{
this.ip = ip;
}
public JObject SendString(string m)
{
HttpWebRequest server = (HttpWebRequest)WebRequest.Create(ip+":"+port+"/"+m);
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);
}
JObject o = JObject.Parse(data);
respond.Close();
streamResponse.Close();
streamRead.Close();
return o;
}
}
}
+97
View File
@@ -0,0 +1,97 @@
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;
}
}
@@ -10,9 +10,9 @@ using System.Windows.Forms;
namespace MusicPlayer namespace MusicPlayer
{ {
public partial class Form1 : Form public partial class NotificationPopup : Form
{ {
public Form1() public NotificationPopup()
{ {
InitializeComponent(); InitializeComponent();
} }
@@ -0,0 +1,276 @@
<?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="&gt;&gt;pictureBox3.Name" xml:space="preserve">
<value>pictureBox3</value>
</data>
<data name="&gt;&gt;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="&gt;&gt;pictureBox3.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;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="&gt;&gt;pictureBox2.Name" xml:space="preserve">
<value>pictureBox2</value>
</data>
<data name="&gt;&gt;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="&gt;&gt;pictureBox2.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;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="&gt;&gt;pictureBox1.Name" xml:space="preserve">
<value>pictureBox1</value>
</data>
<data name="&gt;&gt;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="&gt;&gt;pictureBox1.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;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="&gt;&gt;groupBox1.Name" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;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="&gt;&gt;groupBox1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;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="&gt;&gt;$this.Name" xml:space="preserve">
<value>NotificationPopup</value>
</data>
<data name="&gt;&gt;$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>
+23 -1
View File
@@ -16,7 +16,29 @@ namespace MusicPlayer
{ {
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
NetworkHandler nw = new NetworkHandler("http://www.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);
Application.Run(form);
} }
} }
} }
+48
View File
@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MusicPlayer
{
public class Song
{
public string SongID { get; set; }
public string Name { get; set; }
public string Album { get; set; }
public string Artist { get; set; }
public string Url { get { return GetURL(); } set { SetURL(value); } }
private APIHandler api;
private string url;
public Song(string songid, string name, string album, string artist, APIHandler api)
{
SongID = songid;
Name = name;
Album = album;
Artist = artist;
this.api = api;
url = "";
}
private string GetURL()
{
if (url == "")
{
url = api.GetSongURLByID(SongID);
}
return url;
}
private void SetURL(string str)
{
url = str;
}
}
}
+26
View File
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MusicPlayer
{
class SongsTable : DataTable
{
public SongsTable() : base()
{
this.Columns.Clear();
this.Columns.Add("Naam", typeof(string));
this.Columns.Add("Album", typeof(string));
this.Columns.Add("Artiest", typeof(string));
}
public void Add(Song s)
{
this.Rows.Add(s.Name, s.Album, s.Artist);
}
}
}
+12
View File
@@ -0,0 +1,12 @@
namespace MusicPlayer
{
public class Year
{
public string year { get; set; }
public Year(string year)
{
this.year = year;
}
}
}
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NAudio" version="1.7.3" targetFramework="net452" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net452" />
</packages>