11 Commits
Author SHA1 Message Date
kennyboy55 6744c7c40e Visual studio glitch 2015-11-08 19:39:27 +01:00
kennyboy55 3dae7b6258 Load default cover from local storage 2015-11-08 19:38:48 +01:00
kennyboy55 f3485ba283 Added exit to notifyicon 2015-11-08 19:17:30 +01:00
kennyboy55 7e2496dd74 Calculate proper length invalid seconds 2015-11-08 18:51:21 +01:00
kennyboy55 401d832430 Bugfixes with filesaving 2015-11-08 18:50:57 +01:00
kennyboy55 1e974a645c Save buffer to file. Minimize player to system tray 2015-11-08 17:48:15 +01:00
kennyboy55 91e22bf08b Save buffer to file 2015-11-08 17:48:01 +01:00
kennyboy55 69c1d8bd3a Added volume control 2015-11-04 21:33:14 +01:00
kennyboy55 c4d71e60b0 Bugfixes 2015-11-03 12:00:03 +01:00
kennyboy55 870a291b7e Add class diagram 2015-11-03 11:23:12 +01:00
kennyboy55 830c50a947 Fix seeking when song is null 2015-11-03 11:22:55 +01:00
11 changed files with 772 additions and 90 deletions
+73 -39
View File
@@ -13,11 +13,11 @@ namespace MusicPlayer
public class APIHandler
{
private NetworkHandler nw;
private Image defaultCover;
public Image defaultCover;
public APIHandler(NetworkHandler nw)
{
this.nw = nw;
defaultCover = Image.FromStream(nw.downloadArtwork("default-cover.png"));
defaultCover = MusicPlayer.Resource.default_cover;
}
public JObject GetAllBySearch(string search, string album, string artist, string genre)
@@ -36,8 +36,12 @@ namespace MusicPlayer
public string GetSongURLByID(string id)
{
JObject o = nw.SendString("getsongbyid?id=" + id);
if (o["result"].ToString() == "OK") {
return o["songurl"].ToString();
if (o != null)
{
if (o["result"].ToString() == "OK")
{
return o["songurl"].ToString();
}
}
return o["errormsg"].ToString();
}
@@ -70,11 +74,14 @@ namespace MusicPlayer
public List<Genre> Genrify(JObject o)
{
List<Genre> genreslist = new List<Genre>();
if (o["result"].ToString() == "OK")
if (o != null)
{
for (int i = 0; i < o["genres"].Count(); i++)
if (o["result"].ToString() == "OK")
{
genreslist.Add(new Genre(o["genres"][i][0].ToString()));
for (int i = 0; i < o["genres"].Count(); i++)
{
genreslist.Add(new Genre(o["genres"][i][0].ToString()));
}
}
}
return genreslist;
@@ -83,11 +90,14 @@ namespace MusicPlayer
public List<Artist> Artistify(JObject o)
{
List<Artist> artistlist = new List<Artist>();
if (o["result"].ToString() == "OK")
if (o != null)
{
for (int i = 0; i < o["artists"].Count(); i++)
if (o["result"].ToString() == "OK")
{
artistlist.Add(new Artist(o["artists"][i][0].ToString()));
for (int i = 0; i < o["artists"].Count(); i++)
{
artistlist.Add(new Artist(o["artists"][i][0].ToString()));
}
}
}
return artistlist;
@@ -96,12 +106,15 @@ namespace MusicPlayer
public List<Song> Songify(JObject o)
{
List<Song> allsongslist = new List<Song>();
if (o["result"].ToString() == "OK")
if (o != null)
{
dynamic songs = o["songs"];
for (int i = 0; i < songs.Count; i++)
if (o["result"].ToString() == "OK")
{
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));
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;
@@ -110,12 +123,14 @@ namespace MusicPlayer
public List<Album> Albumify(JObject o)
{
List<Album> albumlist = new List<Album>();
if (o["result"].ToString() == "OK")
if (o != null)
{
for (int i = 0; i < o["albums"].Count(); i++)
if (o["result"].ToString() == "OK")
{
albumlist.Add(new Album(o["albums"][i][0].ToString()));
for (int i = 0; i < o["albums"].Count(); i++)
{
albumlist.Add(new Album(o["albums"][i][0].ToString()));
}
}
}
@@ -126,12 +141,15 @@ namespace MusicPlayer
{
List<Song> allsongslist = new List<Song>();
JObject o = nw.SendString("getallsongs?");
if (o["result"].ToString() == "OK")
if (o != null)
{
dynamic songs = o["songs"];
for (int i = 0; i < songs.Count; i++)
if (o["result"].ToString() == "OK")
{
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));
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;
@@ -142,13 +160,16 @@ namespace MusicPlayer
{
List<Song> songslist = new List<Song>();
JObject o = nw.SendString("getsongs?"+args);
if (o["result"].ToString() == "OK")
if (o != null)
{
dynamic songs = o["songs"];
for (int i = 0; i < songs.Count; i++)
if (o["result"].ToString() == "OK")
{
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));
dynamic songs = o["songs"];
for (int i = 0; i < songs.Count; i++)
{
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;
@@ -159,10 +180,14 @@ namespace MusicPlayer
List<Artist> artistlist = new List<Artist>();
JObject o = nw.SendString("getartists?");
if (o["result"].ToString() == "OK")
if (o != null)
{
for (int i = 0; i < o["artists"].Count(); i++) {
artistlist.Add(new Artist(o["artists"][i][0].ToString()));
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;
@@ -183,11 +208,14 @@ namespace MusicPlayer
List<Album> albumlist = new List<Album>();
JObject o = nw.SendString("getalbums?");
if (o["result"].ToString() == "OK")
if (o != null)
{
for (int i = 0; i < o["albums"].Count(); i++)
if (o["result"].ToString() == "OK")
{
albumlist.Add(new Album(o["albums"][i][0].ToString()));
for (int i = 0; i < o["albums"].Count(); i++)
{
albumlist.Add(new Album(o["albums"][i][0].ToString()));
}
}
}
@@ -198,11 +226,14 @@ namespace MusicPlayer
{
List<Year> yearlist = new List<Year> ();
JObject o = nw.SendString("getyears?");
if (o["result"].ToString() == "OK")
if (o != null)
{
for (int i = 0; i < o["years"].Count(); i++)
if (o["result"].ToString() == "OK")
{
yearlist.Add(new Year(o["years"][i][0].ToString()));
for (int i = 0; i < o["years"].Count(); i++)
{
yearlist.Add(new Year(o["years"][i][0].ToString()));
}
}
}
return yearlist;
@@ -212,11 +243,14 @@ namespace MusicPlayer
{
List<Genre> genreslist = new List<Genre>();
JObject o = nw.SendString("getgenres?");
if (o["result"].ToString() == "OK")
if (o != null)
{
for (int i = 0; i < o["genres"].Count(); i++)
if (o["result"].ToString() == "OK")
{
genreslist.Add(new Genre(o["genres"][i][0].ToString()));
for (int i = 0; i < o["genres"].Count(); i++)
{
genreslist.Add(new Genre(o["genres"][i][0].ToString()));
}
}
}
return genreslist;
+23 -1
View File
@@ -31,6 +31,7 @@ namespace MusicPlayer
public int Position { get { return Math.Min((int)((playpos / (double)Length) * 1000), 1000); } }
private long Length { get; set; }
private long playpos = 0;
public float Volume { get; set; }
public int CurrentTime { get; set; }
@@ -51,6 +52,7 @@ namespace MusicPlayer
public AudioHandler(Main main)
{
this.main = main;
Volume = 1.0f;
CreateThreads();
}
@@ -102,6 +104,20 @@ namespace MusicPlayer
}
public bool SaveBufferToFile(string savelocation)
{
if(ms != null && BState == BufferState.DONE)
{
using (FileStream fs = new FileStream(savelocation, FileMode.OpenOrCreate))
{
ms.WriteTo(fs);
return true;
}
}
return false;
}
public void Stop()
{
CreateThreads();
@@ -139,18 +155,22 @@ namespace MusicPlayer
using (WaveOut waveOut = new WaveOut(WaveCallbackInfo.FunctionCallback()))
{
waveOut.Init(blockAlignedStream);
waveOut.Volume = Volume;
waveOut.Play();
if (CurrentSong == null || CurrentSong.Seconds == 0)
Length = ms.Length / waveOut.OutputWaveFormat.AverageBytesPerSecond;
Length = ms.Length;
else
Length = CurrentSong.Seconds * waveOut.OutputWaveFormat.AverageBytesPerSecond;
CurrentTime = (int)(ms.Position / waveOut.OutputWaveFormat.AverageBytesPerSecond);
while (waveOut.PlaybackState != PlaybackState.Stopped)
{
System.Threading.Thread.Sleep(10);
waveOut.Volume = Volume;
if (AState == AudioState.PLAYING && waveOut.PlaybackState == PlaybackState.Paused)
{
blockAlignedStream.Position = position;
@@ -182,10 +202,12 @@ namespace MusicPlayer
}
else
{
BState = BufferState.EMPTY;
AState = AudioState.STOPPED;
}
}
playpos = blockAlignedStream.Position;
CurrentTime = (int)(playpos / waveOut.OutputWaveFormat.AverageBytesPerSecond);
+109
View File
@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<ClassDiagram MajorVersion="1" MinorVersion="1">
<Class Name="MusicPlayer.AdvancedSearch" Collapsed="true">
<Position X="4" Y="3.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AgAAAACAACAABBAAAQCAAAACIAAQAAAAAIAAAAAAAAQ=</HashCode>
<FileName>AdvancedSearch.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="MusicPlayer.Album" Collapsed="true">
<Position X="2.25" Y="2" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAA=</HashCode>
<FileName>Album.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="MusicPlayer.APIHandler" Collapsed="true">
<Position X="4.5" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AACoAAAEAAAAAAwAAEIAQAYAAAAiAQAAAAIEAAAAgII=</HashCode>
<FileName>APIHandler.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="MusicPlayer.Artist" Collapsed="true">
<Position X="2.25" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Artist.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="MusicPlayer.AudioHandler" Collapsed="true">
<Position X="4.5" Y="2" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAgAAAgBQAIAAAwCAAAAADBAAAAAAEApAYIgAQECAY=</HashCode>
<FileName>AudioHandler.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="MusicPlayer.Genre" Collapsed="true">
<Position X="2.25" Y="1.25" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAA=</HashCode>
<FileName>Genre.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="MusicPlayer.Main" Collapsed="true">
<Position X="0.5" Y="3" Width="1.5" />
<TypeIdentifier>
<HashCode>CQQAgAQAQQAQAABEAAAAIIMDAAAgAAAAACAFQABAAAg=</HashCode>
<FileName>Main.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="MusicPlayer.MainForm" Collapsed="true">
<Position X="2.25" Y="3" Width="1.5" />
<TypeIdentifier>
<HashCode>lBiEqv2DtukQMwGvAROAcednBwz2giwRpBQj4IrABKU=</HashCode>
<FileName>MainForm.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="MusicPlayer.NetworkHandler" Collapsed="true">
<Position X="4.5" Y="1.25" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAACAAAgAAAIgAAAAAAA=</HashCode>
<FileName>NetworkHandler.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="MusicPlayer.Playlist" Collapsed="true">
<Position X="6.25" Y="1.25" Width="1.5" />
<TypeIdentifier>
<HashCode>AAABAAAAAAAAAQQAAAAAAAAEAEEEAAAEACAAAAAAgAI=</HashCode>
<FileName>Playlist.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="MusicPlayer.PlaylistHandler" Collapsed="true">
<Position X="6.25" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>CAABABAAAAAAAAAIAAAAAAAAAACAAAAAAAAAIAAAEAQ=</HashCode>
<FileName>PlaylistHandler.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="MusicPlayer.PlaylistMaker" Collapsed="true">
<Position X="4" Y="3" Width="1.5" />
<TypeIdentifier>
<HashCode>iiCCAAAAAKAAABAWQBiAQAACCQAAACAAACAIQAEICAA=</HashCode>
<FileName>PlaylistMaker.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="MusicPlayer.RadioStation" Collapsed="true">
<Position X="0.5" Y="1.25" Width="1.5" />
<TypeIdentifier>
<HashCode>AAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgA=</HashCode>
<FileName>RadioStation.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="MusicPlayer.Song" Collapsed="true">
<Position X="0.5" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAACAAAAAAABAAAEgAIAIAQAAIAIAIAACCABCAAAAAA=</HashCode>
<FileName>Song.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="MusicPlayer.SongsTable" Collapsed="true">
<Position X="0.5" Y="3.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>SongsTable.cs</FileName>
</TypeIdentifier>
</Class>
<Font Name="Segoe UI" Size="9" />
</ClassDiagram>
+3
View File
@@ -42,7 +42,10 @@ namespace MusicPlayer
artists = new List<string>();
currentPlayingList = new List<Song>();
}
public void Init()
{
Populate();
}
+234 -38
View File
@@ -109,9 +109,27 @@ namespace MusicPlayer
this.NotifyMenuStripPlayButton = new System.Windows.Forms.ToolStripMenuItem();
this.NotifyMenuStripPauseButton = new System.Windows.Forms.ToolStripMenuItem();
this.NotifyMenuStripStopButton = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
this.VolumeMenuStripButton = new System.Windows.Forms.ToolStripMenuItem();
this.VolumeCurrentLabel = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator();
this.Volume100Button = new System.Windows.Forms.ToolStripMenuItem();
this.Volume75Button = new System.Windows.Forms.ToolStripMenuItem();
this.Volume50Button = new System.Windows.Forms.ToolStripMenuItem();
this.Volume25Button = new System.Windows.Forms.ToolStripMenuItem();
this.Volume0Button = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
this.VolumeCustomButton = new System.Windows.Forms.ToolStripMenuItem();
this.VolumeCustomTextBox = new System.Windows.Forms.ToolStripTextBox();
this.VolumeCustomSetButton = 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();
this.VolumeControl = new System.Windows.Forms.NumericUpDown();
this.VolumeLabel = new System.Windows.Forms.Label();
this.SaveBufferButton = new System.Windows.Forms.ToolStripMenuItem();
this.ExitNotifyIconMenuStrip = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator();
((System.ComponentModel.ISupportInitialize)(this.SongsTableView)).BeginInit();
this.MainPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.SplitContainer)).BeginInit();
@@ -123,6 +141,7 @@ namespace MusicPlayer
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PositionTrackBar)).BeginInit();
this.NotifyMenuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.VolumeControl)).BeginInit();
this.SuspendLayout();
//
// SongsTableView
@@ -323,8 +342,10 @@ namespace MusicPlayer
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.SaveBufferButton,
this.toolStripSeparator1,
this.exitToolStripMenuItem});
this.fileToolStripMenuItem.ForeColor = System.Drawing.SystemColors.ControlText;
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
this.fileToolStripMenuItem.Text = "File";
@@ -332,12 +353,12 @@ namespace MusicPlayer
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(89, 6);
this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6);
//
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(92, 22);
this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.exitToolStripMenuItem.Text = "Exit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
@@ -355,26 +376,26 @@ namespace MusicPlayer
// overviewToolStripMenuItem
//
this.overviewToolStripMenuItem.Name = "overviewToolStripMenuItem";
this.overviewToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
this.overviewToolStripMenuItem.Size = new System.Drawing.Size(152, 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.Size = new System.Drawing.Size(152, 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);
this.toolStripSeparator4.Size = new System.Drawing.Size(149, 6);
//
// ViewQueueButton
//
this.ViewQueueButton.Name = "ViewQueueButton";
this.ViewQueueButton.Size = new System.Drawing.Size(123, 22);
this.ViewQueueButton.Size = new System.Drawing.Size(152, 22);
this.ViewQueueButton.Text = "Queue";
this.ViewQueueButton.Click += new System.EventHandler(this.ViewCurrentPlaylistButton_Click);
//
@@ -394,7 +415,7 @@ namespace MusicPlayer
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.Size = new System.Drawing.Size(152, 22);
this.PlayNextSongButton.Text = "Play Next";
//
// LoopSongButton
@@ -403,7 +424,7 @@ namespace MusicPlayer
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.Size = new System.Drawing.Size(152, 22);
this.LoopSongButton.Text = "Loop";
//
// ShuffleSongButton
@@ -411,7 +432,7 @@ namespace MusicPlayer
this.ShuffleSongButton.CheckOnClick = true;
this.ShuffleSongButton.Enabled = false;
this.ShuffleSongButton.Name = "ShuffleSongButton";
this.ShuffleSongButton.Size = new System.Drawing.Size(123, 22);
this.ShuffleSongButton.Size = new System.Drawing.Size(152, 22);
this.ShuffleSongButton.Text = "Shuffle";
//
// playlistToolStripMenuItem
@@ -427,19 +448,19 @@ namespace MusicPlayer
// makeToolStripMenuItem
//
this.makeToolStripMenuItem.Name = "makeToolStripMenuItem";
this.makeToolStripMenuItem.Size = new System.Drawing.Size(139, 22);
this.makeToolStripMenuItem.Size = new System.Drawing.Size(152, 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);
this.toolStripSeparator6.Size = new System.Drawing.Size(149, 6);
//
// viewPlaylistToolstripMenuButton
//
this.viewPlaylistToolstripMenuButton.Name = "viewPlaylistToolstripMenuButton";
this.viewPlaylistToolstripMenuButton.Size = new System.Drawing.Size(139, 22);
this.viewPlaylistToolstripMenuButton.Size = new System.Drawing.Size(152, 22);
this.viewPlaylistToolstripMenuButton.Text = "View";
this.viewPlaylistToolstripMenuButton.Click += new System.EventHandler(this.playlistsToolStripMenuItem_Click);
//
@@ -462,7 +483,7 @@ namespace MusicPlayer
this.SearchGenresTextBox,
this.ClearGenreSearchButton});
this.SearchGenresToolStripLabel.Name = "SearchGenresToolStripLabel";
this.SearchGenresToolStripLabel.Size = new System.Drawing.Size(127, 22);
this.SearchGenresToolStripLabel.Size = new System.Drawing.Size(152, 22);
this.SearchGenresToolStripLabel.Text = "Genres";
//
// SearchGenresTextBox
@@ -485,7 +506,7 @@ namespace MusicPlayer
this.SearchArtistsTextBox,
this.ClearArtistSearchButton});
this.SearchArtistToolStripLabel.Name = "SearchArtistToolStripLabel";
this.SearchArtistToolStripLabel.Size = new System.Drawing.Size(127, 22);
this.SearchArtistToolStripLabel.Size = new System.Drawing.Size(152, 22);
this.SearchArtistToolStripLabel.Text = "Artists";
//
// SearchArtistsTextBox
@@ -508,7 +529,7 @@ namespace MusicPlayer
this.SearchSongsTextBox,
this.SearchSongsButton});
this.songsToolStripMenuItem.Name = "songsToolStripMenuItem";
this.songsToolStripMenuItem.Size = new System.Drawing.Size(127, 22);
this.songsToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.songsToolStripMenuItem.Text = "Songs";
//
// SearchSongsTextBox
@@ -527,19 +548,19 @@ namespace MusicPlayer
// toolStripSeparator7
//
this.toolStripSeparator7.Name = "toolStripSeparator7";
this.toolStripSeparator7.Size = new System.Drawing.Size(124, 6);
this.toolStripSeparator7.Size = new System.Drawing.Size(149, 6);
//
// AdvancedSearchButton
//
this.AdvancedSearchButton.Name = "AdvancedSearchButton";
this.AdvancedSearchButton.Size = new System.Drawing.Size(127, 22);
this.AdvancedSearchButton.Size = new System.Drawing.Size(152, 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.Size = new System.Drawing.Size(152, 22);
this.resetToolStripMenuItem.Text = "Reset";
this.resetToolStripMenuItem.Click += new System.EventHandler(this.resetToolStripMenuItem_Click);
//
@@ -555,14 +576,14 @@ namespace MusicPlayer
// SelectServerJancoButton
//
this.SelectServerJancoButton.Name = "SelectServerJancoButton";
this.SelectServerJancoButton.Size = new System.Drawing.Size(148, 22);
this.SelectServerJancoButton.Size = new System.Drawing.Size(152, 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.Size = new System.Drawing.Size(152, 22);
this.SelectServerYorickButton.Text = "imegumii.nl";
this.SelectServerYorickButton.Click += new System.EventHandler(this.SelectServerYorickButton_Click);
//
@@ -582,35 +603,35 @@ namespace MusicPlayer
// toolStripMenuItem2
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(122, 22);
this.toolStripMenuItem2.Size = new System.Drawing.Size(152, 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.Size = new System.Drawing.Size(152, 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.Size = new System.Drawing.Size(152, 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.Size = new System.Drawing.Size(152, 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);
this.toolStripSeparator5.Size = new System.Drawing.Size(149, 6);
//
// customToolStripMenuItem
//
@@ -618,7 +639,7 @@ namespace MusicPlayer
this.RadioStationTextBox,
this.SetRadioStationButton});
this.customToolStripMenuItem.Name = "customToolStripMenuItem";
this.customToolStripMenuItem.Size = new System.Drawing.Size(122, 22);
this.customToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.customToolStripMenuItem.Text = "Custom";
//
// RadioStationTextBox
@@ -687,7 +708,7 @@ namespace MusicPlayer
// CurrentSongLabel
//
this.CurrentSongLabel.AutoSize = true;
this.CurrentSongLabel.Location = new System.Drawing.Point(338, 59);
this.CurrentSongLabel.Location = new System.Drawing.Point(332, 59);
this.CurrentSongLabel.Name = "CurrentSongLabel";
this.CurrentSongLabel.Size = new System.Drawing.Size(111, 13);
this.CurrentSongLabel.TabIndex = 11;
@@ -782,10 +803,14 @@ namespace MusicPlayer
//
// NotifyIcon
//
this.NotifyIcon.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info;
this.NotifyIcon.BalloonTipText = "YJMPD Music player stays active in the background. Click to show.";
this.NotifyIcon.BalloonTipTitle = "YJMPD Minimized";
this.NotifyIcon.ContextMenuStrip = this.NotifyMenuStrip;
this.NotifyIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("NotifyIcon.Icon")));
this.NotifyIcon.Text = "YJMPD Music Player";
this.NotifyIcon.Text = "YJMPD Music Player. Click to show.";
this.NotifyIcon.Visible = true;
this.NotifyIcon.BalloonTipClicked += new System.EventHandler(this.NotifyIcon_BalloonTipClicked);
this.NotifyIcon.MouseUp += new System.Windows.Forms.MouseEventHandler(this.NotifyIcon_Click);
//
// NotifyMenuStrip
@@ -796,11 +821,15 @@ namespace MusicPlayer
this.NotifyMenuStripPlayButton,
this.NotifyMenuStripPauseButton,
this.NotifyMenuStripStopButton,
this.toolStripSeparator8,
this.VolumeMenuStripButton,
this.toolStripSeparator3,
this.NotifyMenuStripNextButton,
this.NotifyMenuStripPreviousButton});
this.NotifyMenuStripPreviousButton,
this.toolStripSeparator11,
this.ExitNotifyIconMenuStrip});
this.NotifyMenuStrip.Name = "NotifyMenuStrip";
this.NotifyMenuStrip.Size = new System.Drawing.Size(120, 148);
this.NotifyMenuStrip.Size = new System.Drawing.Size(153, 226);
//
// NotifyMenuStripPlayingLabel
//
@@ -808,7 +837,7 @@ namespace MusicPlayer
this.NotifyMenuStripPlayingSongLabel});
this.NotifyMenuStripPlayingLabel.Enabled = false;
this.NotifyMenuStripPlayingLabel.Name = "NotifyMenuStripPlayingLabel";
this.NotifyMenuStripPlayingLabel.Size = new System.Drawing.Size(119, 22);
this.NotifyMenuStripPlayingLabel.Size = new System.Drawing.Size(152, 22);
this.NotifyMenuStripPlayingLabel.Text = "Stopped";
//
// NotifyMenuStripPlayingSongLabel
@@ -822,12 +851,12 @@ namespace MusicPlayer
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(116, 6);
this.toolStripSeparator2.Size = new System.Drawing.Size(149, 6);
//
// NotifyMenuStripPlayButton
//
this.NotifyMenuStripPlayButton.Name = "NotifyMenuStripPlayButton";
this.NotifyMenuStripPlayButton.Size = new System.Drawing.Size(119, 22);
this.NotifyMenuStripPlayButton.Size = new System.Drawing.Size(152, 22);
this.NotifyMenuStripPlayButton.Text = "Play";
this.NotifyMenuStripPlayButton.Click += new System.EventHandler(this.NotifyMenuStripPlayButton_Click);
//
@@ -835,7 +864,7 @@ namespace MusicPlayer
//
this.NotifyMenuStripPauseButton.Enabled = false;
this.NotifyMenuStripPauseButton.Name = "NotifyMenuStripPauseButton";
this.NotifyMenuStripPauseButton.Size = new System.Drawing.Size(119, 22);
this.NotifyMenuStripPauseButton.Size = new System.Drawing.Size(152, 22);
this.NotifyMenuStripPauseButton.Text = "Pause";
this.NotifyMenuStripPauseButton.Click += new System.EventHandler(this.NotifyMenuStripPauseButton_Click);
//
@@ -843,34 +872,181 @@ namespace MusicPlayer
//
this.NotifyMenuStripStopButton.Enabled = false;
this.NotifyMenuStripStopButton.Name = "NotifyMenuStripStopButton";
this.NotifyMenuStripStopButton.Size = new System.Drawing.Size(119, 22);
this.NotifyMenuStripStopButton.Size = new System.Drawing.Size(152, 22);
this.NotifyMenuStripStopButton.Text = "Stop";
this.NotifyMenuStripStopButton.Click += new System.EventHandler(this.NotifyMenuStripStopButton_Click);
//
// toolStripSeparator8
//
this.toolStripSeparator8.Name = "toolStripSeparator8";
this.toolStripSeparator8.Size = new System.Drawing.Size(149, 6);
//
// VolumeMenuStripButton
//
this.VolumeMenuStripButton.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.VolumeCurrentLabel,
this.toolStripSeparator10,
this.Volume100Button,
this.Volume75Button,
this.Volume50Button,
this.Volume25Button,
this.Volume0Button,
this.toolStripSeparator9,
this.VolumeCustomButton});
this.VolumeMenuStripButton.Name = "VolumeMenuStripButton";
this.VolumeMenuStripButton.Size = new System.Drawing.Size(152, 22);
this.VolumeMenuStripButton.Text = "Volume";
//
// VolumeCurrentLabel
//
this.VolumeCurrentLabel.Enabled = false;
this.VolumeCurrentLabel.Name = "VolumeCurrentLabel";
this.VolumeCurrentLabel.Size = new System.Drawing.Size(154, 22);
this.VolumeCurrentLabel.Text = "Currently 100%";
//
// toolStripSeparator10
//
this.toolStripSeparator10.Name = "toolStripSeparator10";
this.toolStripSeparator10.Size = new System.Drawing.Size(151, 6);
//
// Volume100Button
//
this.Volume100Button.Name = "Volume100Button";
this.Volume100Button.Size = new System.Drawing.Size(154, 22);
this.Volume100Button.Text = "100%";
this.Volume100Button.Click += new System.EventHandler(this.Volume100Button_Click);
//
// Volume75Button
//
this.Volume75Button.Name = "Volume75Button";
this.Volume75Button.Size = new System.Drawing.Size(154, 22);
this.Volume75Button.Text = "75%";
this.Volume75Button.Click += new System.EventHandler(this.Volume75Button_Click);
//
// Volume50Button
//
this.Volume50Button.Name = "Volume50Button";
this.Volume50Button.Size = new System.Drawing.Size(154, 22);
this.Volume50Button.Text = "50%";
this.Volume50Button.Click += new System.EventHandler(this.Volume50Button_Click);
//
// Volume25Button
//
this.Volume25Button.Name = "Volume25Button";
this.Volume25Button.Size = new System.Drawing.Size(154, 22);
this.Volume25Button.Text = "25%";
this.Volume25Button.Click += new System.EventHandler(this.Volume25Button_Click);
//
// Volume0Button
//
this.Volume0Button.Name = "Volume0Button";
this.Volume0Button.Size = new System.Drawing.Size(154, 22);
this.Volume0Button.Text = "Mute";
this.Volume0Button.Click += new System.EventHandler(this.Volume0Button_Click);
//
// toolStripSeparator9
//
this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(151, 6);
//
// VolumeCustomButton
//
this.VolumeCustomButton.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.VolumeCustomTextBox,
this.VolumeCustomSetButton});
this.VolumeCustomButton.Name = "VolumeCustomButton";
this.VolumeCustomButton.Size = new System.Drawing.Size(154, 22);
this.VolumeCustomButton.Text = "Custom";
//
// VolumeCustomTextBox
//
this.VolumeCustomTextBox.Name = "VolumeCustomTextBox";
this.VolumeCustomTextBox.Size = new System.Drawing.Size(100, 23);
//
// VolumeCustomSetButton
//
this.VolumeCustomSetButton.Name = "VolumeCustomSetButton";
this.VolumeCustomSetButton.Size = new System.Drawing.Size(160, 22);
this.VolumeCustomSetButton.Text = "Set";
this.VolumeCustomSetButton.Click += new System.EventHandler(this.VolumeCustomSetButton_Click);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(116, 6);
this.toolStripSeparator3.Size = new System.Drawing.Size(149, 6);
//
// NotifyMenuStripNextButton
//
this.NotifyMenuStripNextButton.Name = "NotifyMenuStripNextButton";
this.NotifyMenuStripNextButton.Size = new System.Drawing.Size(119, 22);
this.NotifyMenuStripNextButton.Size = new System.Drawing.Size(152, 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.Size = new System.Drawing.Size(152, 22);
this.NotifyMenuStripPreviousButton.Text = "Previous";
this.NotifyMenuStripPreviousButton.Click += new System.EventHandler(this.NotifyMenuStripPreviousButton_Click);
//
// VolumeControl
//
this.VolumeControl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.VolumeControl.BackColor = System.Drawing.SystemColors.GrayText;
this.VolumeControl.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.VolumeControl.Increment = new decimal(new int[] {
5,
0,
0,
0});
this.VolumeControl.Location = new System.Drawing.Point(736, 4);
this.VolumeControl.Name = "VolumeControl";
this.VolumeControl.Size = new System.Drawing.Size(36, 16);
this.VolumeControl.TabIndex = 7;
this.VolumeControl.Value = new decimal(new int[] {
100,
0,
0,
0});
this.VolumeControl.ValueChanged += new System.EventHandler(this.VolumeControl_ValueChanged);
//
// VolumeLabel
//
this.VolumeLabel.AutoSize = true;
this.VolumeLabel.BackColor = System.Drawing.SystemColors.GrayText;
this.VolumeLabel.Location = new System.Drawing.Point(682, 4);
this.VolumeLabel.Name = "VolumeLabel";
this.VolumeLabel.Size = new System.Drawing.Size(48, 13);
this.VolumeLabel.TabIndex = 8;
this.VolumeLabel.Text = "Volume: ";
//
// SaveBufferButton
//
this.SaveBufferButton.Enabled = false;
this.SaveBufferButton.Name = "SaveBufferButton";
this.SaveBufferButton.Size = new System.Drawing.Size(152, 22);
this.SaveBufferButton.Text = "Save";
this.SaveBufferButton.Click += new System.EventHandler(this.SaveBufferButton_Click);
//
// ExitNotifyIconMenuStrip
//
this.ExitNotifyIconMenuStrip.Name = "ExitNotifyIconMenuStrip";
this.ExitNotifyIconMenuStrip.Size = new System.Drawing.Size(152, 22);
this.ExitNotifyIconMenuStrip.Text = "Exit";
this.ExitNotifyIconMenuStrip.Click += new System.EventHandler(this.ExitNotifyIconMenuStrip_Click);
//
// toolStripSeparator11
//
this.toolStripSeparator11.Name = "toolStripSeparator11";
this.toolStripSeparator11.Size = new System.Drawing.Size(149, 6);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(784, 461);
this.Controls.Add(this.VolumeLabel);
this.Controls.Add(this.VolumeControl);
this.Controls.Add(this.ControlsPanel);
this.Controls.Add(this.MainPanel);
this.Controls.Add(this.MenuStrip);
@@ -881,6 +1057,7 @@ namespace MusicPlayer
this.Text = "YJMPD Music Player";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
this.Load += new System.EventHandler(this.MainForm_Load);
this.Resize += new System.EventHandler(this.MainForm_Resize);
((System.ComponentModel.ISupportInitialize)(this.SongsTableView)).EndInit();
this.MainPanel.ResumeLayout(false);
this.MainPanel.PerformLayout();
@@ -895,6 +1072,7 @@ namespace MusicPlayer
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PositionTrackBar)).EndInit();
this.NotifyMenuStrip.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.VolumeControl)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -981,6 +1159,24 @@ namespace MusicPlayer
private System.Windows.Forms.ToolStripMenuItem resetToolStripMenuItem;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label AddToQueueLabel;
private System.Windows.Forms.NumericUpDown VolumeControl;
private System.Windows.Forms.Label VolumeLabel;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator8;
private System.Windows.Forms.ToolStripMenuItem VolumeMenuStripButton;
private System.Windows.Forms.ToolStripMenuItem Volume100Button;
private System.Windows.Forms.ToolStripMenuItem Volume75Button;
private System.Windows.Forms.ToolStripMenuItem Volume50Button;
private System.Windows.Forms.ToolStripMenuItem Volume25Button;
private System.Windows.Forms.ToolStripMenuItem Volume0Button;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator9;
private System.Windows.Forms.ToolStripMenuItem VolumeCustomButton;
private System.Windows.Forms.ToolStripTextBox VolumeCustomTextBox;
private System.Windows.Forms.ToolStripMenuItem VolumeCustomSetButton;
private System.Windows.Forms.ToolStripMenuItem VolumeCurrentLabel;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator10;
private System.Windows.Forms.ToolStripMenuItem SaveBufferButton;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator11;
private System.Windows.Forms.ToolStripMenuItem ExitNotifyIconMenuStrip;
}
}
+118 -11
View File
@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
@@ -24,6 +25,8 @@ namespace MusicPlayer
int startx = 0;
int starty = 0;
bool showed;
public Main main
{
get; set;
@@ -51,11 +54,13 @@ namespace MusicPlayer
};
songFinished = false;
showed = false;
}
private void MainForm_Load(object sender, EventArgs e)
{
UpdateTimer.Start();
main.Init();
}
private void PlayButton_Click(object sender, EventArgs e)
@@ -179,6 +184,16 @@ namespace MusicPlayer
NotifyMenuStripStopButton.Enabled = true;
}
if (main.audio.BState == AudioHandler.BufferState.DONE)
SaveBufferButton.Enabled = true;
else
SaveBufferButton.Enabled = false;
if (VolumeCustomTextBox.Text == "")
VolumeCustomSetButton.Enabled = false;
else
VolumeCustomSetButton.Enabled = true;
if (RadioStationTextBox.Text.Length <= 10)
SetRadioStationButton.Enabled = false;
else
@@ -310,17 +325,8 @@ namespace MusicPlayer
{
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);
}
if(main.audio.CurrentSong != null)
LabelCurrentTime.Text = Main.SecondsToTimestamp((int)(((double)PositionTrackBar.Value / 1000) * main.audio.CurrentSong.Seconds));
}
private void overviewToolStripMenuItem_Click(object sender, EventArgs e)
@@ -625,5 +631,106 @@ namespace MusicPlayer
{
main.Repopulate();
}
private void VolumeControl_ValueChanged(object sender, EventArgs e)
{
main.audio.Volume = (float)(VolumeControl.Value/100);
VolumeCurrentLabel.Text = "Currently " + VolumeControl.Value + "%";
}
private void Volume100Button_Click(object sender, EventArgs e)
{
VolumeControl.Value = 100;
}
private void Volume75Button_Click(object sender, EventArgs e)
{
VolumeControl.Value = 75;
}
private void Volume50Button_Click(object sender, EventArgs e)
{
VolumeControl.Value = 50;
}
private void Volume25Button_Click(object sender, EventArgs e)
{
VolumeControl.Value = 25;
}
private void Volume0Button_Click(object sender, EventArgs e)
{
VolumeControl.Value = 0;
}
private void VolumeCustomSetButton_Click(object sender, EventArgs e)
{
int volume;
bool volumeOK = int.TryParse(VolumeCustomTextBox.Text, out volume);
if(volumeOK)
VolumeControl.Value = Math.Max(Math.Min(volume, 100), 0);
VolumeCustomTextBox.Text = "";
}
private void MainForm_Resize(object sender, EventArgs e)
{
if(this.WindowState == FormWindowState.Minimized)
{
this.ShowInTaskbar = false;
if (!showed)
{
this.NotifyIcon.ShowBalloonTip(0);
showed = true;
}
}
}
private void NotifyIcon_Click(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.WindowState = FormWindowState.Normal;
this.ShowInTaskbar = true;
}
}
private void NotifyIcon_BalloonTipClicked(object sender, EventArgs e)
{
NotifyIcon_Click(sender, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
}
private void SaveBufferButton_Click(object sender, EventArgs e)
{
SaveFileDialog SaveMP3FromBuffer = new SaveFileDialog();
SaveMP3FromBuffer.Filter = "MP3 File|*.mp3";
SaveMP3FromBuffer.Title = "Save current song to mp3 file";
SaveMP3FromBuffer.FileName = main.audio.CurrentSong.Name + ".mp3";
if(SaveMP3FromBuffer.ShowDialog() != DialogResult.OK)
return;
// If the file name is not an empty string open it for saving.
if (SaveMP3FromBuffer.FileName != "")
{
if (main.audio.SaveBufferToFile(SaveMP3FromBuffer.FileName))
{
try {
Process.Start("explorer.exe", @"/select, " + SaveMP3FromBuffer.FileName);
}
catch(Exception)
{
MessageBox.Show("File saved.");
}
}
else
MessageBox.Show("Error while saving file");
}
}
private void ExitNotifyIconMenuStrip_Click(object sender, EventArgs e)
{
ExitProgram();
}
}
}
+11 -1
View File
@@ -92,6 +92,11 @@
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RadioStation.cs" />
<Compile Include="Resource.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resource.resx</DependentUpon>
</Compile>
<Compile Include="Song.cs" />
<Compile Include="SongsTable.cs">
<SubType>Component</SubType>
@@ -115,6 +120,11 @@
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<EmbeddedResource Include="Resource.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resource.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="ClassDiagram1.cd" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@@ -130,7 +140,7 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
<None Include="Resources\default-cover.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@@ -25,10 +25,12 @@ namespace MusicPlayer
{
string encodedstring = Microsoft.Security.Application.Encoder.HtmlEncode(m);
HttpWebRequest server = (HttpWebRequest)WebRequest.Create(ip+":"+port+"/"+encodedstring);
server.ReadWriteTimeout = 500;
server.KeepAlive = false;
try {
HttpWebResponse respond = (HttpWebResponse)server.GetResponse();
Stream streamResponse = respond.GetResponseStream();
streamResponse.ReadTimeout = 500;
StreamReader streamRead = new StreamReader(streamResponse);
Char[] readBuff = new Char[256];
int count = streamRead.Read(readBuff, 0, 256);
@@ -64,9 +66,11 @@ namespace MusicPlayer
{
string encodedstring = Microsoft.Security.Application.Encoder.HtmlEncode(ip + "/music/.artwork/" + album);
WebRequest req = WebRequest.Create(encodedstring);
req.Timeout = 500;
//WebRequest req = WebRequest.Create((ip + "/music/.artwork/" + album).Replace(" ","%20"));
WebResponse response = req.GetResponse();
Stream stream = response.GetResponseStream();
stream.ReadTimeout = 500;
//Download in chuncks
byte[] buffer = new byte[1024];
+73
View File
@@ -0,0 +1,73 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MusicPlayer {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resource {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resource() {
}
/// <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 (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MusicPlayer.Resource", typeof(Resource).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// 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 {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap default_cover {
get {
object obj = ResourceManager.GetObject("default_cover", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}
+124
View File
@@ -0,0 +1,124 @@
<?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.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="default_cover" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\default-cover.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB