Added Files

This commit is contained in:
Johnny @PC 2014-02-01 13:52:33 +01:00
parent 247bddd685
commit 62bb797150
29 changed files with 1099 additions and 212 deletions

View File

@ -1,90 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SpotifyAPIv1;
using System.Threading;
using System.Diagnostics;
using System.Drawing;
namespace DebugExample
{
class Program
{
static SpotifyAPI spotify;
static int title;
static int artist;
static int album;
static int time;
static void Main(string[] args)
{
API.API_DestroyAllVisual();
int boxid = API.API_BoxCreate(620, 150, 140, 60, 0xB6000000,true);
API.API_BoxSetBorderColor(boxid, 0xFFFF7700);
spotify = new SpotifyAPI();
spotify.Connect();
log("Connected...");
spotify.Update();
log("Updating first time...");
spotify.GetEventHandler().OnTrackChange += new SpotifyAPIv1.EventHandler.TrackChangeEventHandler(namechange);
spotify.GetEventHandler().OnPlayStateChange += new SpotifyAPIv1.EventHandler.PlayStateEventHandler(playstate);
spotify.GetEventHandler().OnVolumeChange += new SpotifyAPIv1.EventHandler.VolumeChangeEventHandler(volumechange);
spotify.GetEventHandler().OnTrackTimeChange += new SpotifyAPIv1.EventHandler.TrackTimeChangeEventHandler(timechange);
spotify.GetEventHandler().ListenForEvents(true);
title = API.API_TextCreate("Arial", 19, true, false, 620, 150, 0xFFFFFFFF, spotify.GetMusicHandler().GetCurrentTrack().GetName(), true);
artist = API.API_TextCreate("Arial", 19, true, false, 620, 160, 0xFFFFFFFF, "von: " + spotify.GetMusicHandler().GetCurrentTrack().GetArtist(), true);
album = API.API_TextCreate("Arial", 19, true, false, 620, 170, 0xFFFFFFFF, "Album: " + spotify.GetMusicHandler().GetCurrentTrack().GetAlbum(), true);
Console.WriteLine(spotify.GetMusicHandler().GetTrackPosition());
time = API.API_TextCreate("Arial", 19, false, false, 620, 180, 0xFFFFFFFF, "Time: " + timede(spotify.GetMusicHandler().GetTrackPosition()), true);
String input = "";
while((input = Console.ReadLine()) != "q")
{
if (input == "pause")
spotify.GetMusicHandler().Pause();
if (input == "play")
spotify.GetMusicHandler().Play();
if (input == "skip")
spotify.GetMusicHandler().Skip();
if (input == "prev")
spotify.GetMusicHandler().Previous();
}
API.API_DestroyAllVisual();
}
private static String timede(double sec)
{
String test = "{0}:{1}";
TimeSpan span = TimeSpan.FromSeconds(sec);
return String.Format(test, span.Minutes, span.Seconds);
}
private static void timechange(TrackTimeChangeEventArgs e)
{
log(e.track_time.ToString());
API.API_TextSetString(time, "Time: " + timede(spotify.GetMusicHandler().GetTrackPosition()));
}
public static void namechange(TrackChangeEventArgs e)
{
API.API_TextSetString(title, e.new_track.GetName());
API.API_TextSetString(artist,"Von :" + e.new_track.GetArtist());
API.API_TextSetString(album, "Album: " + e.new_track.GetAlbum());
log("Old Name: " + e.old_track.GetName());
log("New Name: " + e.new_track.GetName());
}
public static void playstate(PlayStateEventArgs e)
{
log("PlayState: " + e.playing);
}
public static void volumechange(VolumeChangeEventArgs e)
{
log("New Volume: " + e.new_volume);
}
public static void log(String log)
{
Console.WriteLine("[" + DateTime.Now.ToString("HH:mm:ss.fff") + "] " + log);
}
}
}

BIN
ILMerge/ILMerge.exe Normal file

Binary file not shown.

1
ILMerge/compile.bat Normal file
View File

@ -0,0 +1 @@
ilmerge /targetplatform:"v4" /log:log.txt /out:SpotifyAPIMerged.dll "Newtonsoft.Json.dll" "SpotifyAPI.dll" /target:library

BIN
Newtonsoft.Json.dll Normal file

Binary file not shown.

BIN
SpotifyAPI.dll Normal file

Binary file not shown.

3
SpotifyAPI.dll.config Normal file
View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
</configuration>

View File

@ -5,7 +5,7 @@ VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpotifyAPI", "SpotifyAPI\SpotifyAPI.csproj", "{EBBE35E2-7B91-4D7D-B8FC-3A0472F5119D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DebugExample", "DebugExample\DebugExample.csproj", "{41F89F0F-4D54-4551-B352-460BA6AB89BB}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpotifyAPI_Example", "SpotifyAPI_Example\SpotifyAPI_Example.csproj", "{C12D46F9-BB35-46D6-B821-522B8F9C3CBE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -17,10 +17,10 @@ Global
{EBBE35E2-7B91-4D7D-B8FC-3A0472F5119D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EBBE35E2-7B91-4D7D-B8FC-3A0472F5119D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EBBE35E2-7B91-4D7D-B8FC-3A0472F5119D}.Release|Any CPU.Build.0 = Release|Any CPU
{41F89F0F-4D54-4551-B352-460BA6AB89BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{41F89F0F-4D54-4551-B352-460BA6AB89BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41F89F0F-4D54-4551-B352-460BA6AB89BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{41F89F0F-4D54-4551-B352-460BA6AB89BB}.Release|Any CPU.Build.0 = Release|Any CPU
{C12D46F9-BB35-46D6-B821-522B8F9C3CBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C12D46F9-BB35-46D6-B821-522B8F9C3CBE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C12D46F9-BB35-46D6-B821-522B8F9C3CBE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C12D46F9-BB35-46D6-B821-522B8F9C3CBE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -8,7 +8,15 @@ namespace SpotifyAPIv1
{
class CFID
{
public String error { get; set; }
public String token { get; set; }
public Error error { get; set; }
public String token { get; set; }
public String version { get; set; }
public String client_version { get; set; }
public Boolean running { get; set; }
}
class Error
{
public String type { get; set; }
public String message { get; set; }
}
}

View File

@ -6,10 +6,16 @@ using System.Threading.Tasks;
namespace SpotifyAPIv1
{
public enum SizeEnum
public enum AlbumArtSize
{
SIZE_160 = 160,
SIZE_320 = 320,
SIZE_640 = 640
SIZE_160,
SIZE_320,
SIZE_640
}
public enum CFIDResponse
{
SUCCESS,
ERROR,
NOT_LOGGED_IN
}
}

View File

@ -6,10 +6,6 @@ using System.Threading.Tasks;
namespace SpotifyAPIv1
{
class Events
{
}
public class TrackChangeEventArgs
{
public Track old_track { get; set; }

View File

@ -18,7 +18,7 @@ namespace SpotifyAPIv1
public String host = "127.0.0.1";
WebClient wc;
MusicHandler mh;
SpotifyMusicHandler mh;
internal static RemoteHandler GetInstance()
{
return instance;
@ -39,24 +39,30 @@ namespace SpotifyAPIv1
}
internal void SendPauseRequest()
{
recv("remote/pause.json?pause=true", true, true, -1);
}
internal void SetVolumeRequest()
{
Console.WriteLine(recv("remote/info.json", true, true, -1));
query("remote/pause.json?pause=true", true, true, -1);
}
internal void SendPlayRequest()
{
recv("remote/pause.json?pause=false", true, true, -1);
query("remote/pause.json?pause=false", true, true, -1);
}
internal void SendPlayRequest(String url)
{
query("remote/play.json?uri=" + url, true, true, -1);
}
public void SendVolumeRequest()
{
String s = query("remote/volume.json?volume=" + 50, false, false, -1);
}
internal StatusResponse Update()
{
String response = recv("remote/status.json", true, true, -1);
String response = query("remote/status.json", true, true, -1);
if(response == "")
{
return Update();
}
response = response.Replace("\\n", "");
byte[] bytes = Encoding.Default.GetBytes(response);
response = Encoding.UTF8.GetString(bytes);
List<StatusResponse> raw = (List<StatusResponse>)JsonConvert.DeserializeObject(response,typeof(List<StatusResponse>));
return raw[0];
}
@ -74,15 +80,18 @@ namespace SpotifyAPIv1
private String GetCFID()
{
string a = recv("simplecsrf/token.json", false, false, -1);
string a = query("simplecsrf/token.json", false, false, -1);
a = a.Replace(@"\", "");
List<CFID> d = (List<CFID>)JsonConvert.DeserializeObject(a, typeof(List<CFID>));
if (d.Count != 1)
throw new Exception("CFID konnte nicht geladen werden.");
throw new Exception("CFID couldn't be loaded");
if (d[0].error != null)
throw new Exception("SpotifyWebHelper Error: " + d[0].error.message);
return d[0].token;
}
private string recv(string request, bool oauth, bool cfid, int wait)
private string query(string request, bool oauth, bool cfid, int wait)
{
string parameters = "?&ref=&cors=&_=" + TimeStamp;
string parameters = "?&ref=&cors=&_=" + GetTimestamp();
if (request.Contains("?"))
{
parameters = parameters.Substring(1);
@ -116,12 +125,9 @@ namespace SpotifyAPIv1
}
return derp;
}
private int TimeStamp
private int GetTimestamp()
{
get
{
return Convert.ToInt32((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds);
}
return Convert.ToInt32((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds);
}
}
}

View File

@ -15,46 +15,70 @@ namespace SpotifyAPIv1
{
public class SpotifyAPI
{
MusicHandler mh;
SpotifyMusicHandler mh;
RemoteHandler rh;
EventHandler eh;
SpotifyEventHandler eh;
public SpotifyAPI()
{
rh = RemoteHandler.GetInstance();
mh = new MusicHandler();
eh = new EventHandler(this, mh);
mh = new SpotifyMusicHandler();
eh = new SpotifyEventHandler(this, mh);
}
public void Connect()
{
rh.Init();
}
public MusicHandler GetMusicHandler()
public SpotifyMusicHandler GetMusicHandler()
{
return mh;
}
public EventHandler GetEventHandler()
public SpotifyEventHandler GetEventHandler()
{
return eh;
}
public Boolean IsSpotifyRunning(Boolean runIt)
public static Boolean IsSpotifyRunning()
{
if (Process.GetProcessesByName("SpotifyWebHelper").Length < 1)
if (Process.GetProcessesByName("spotify").Length < 1)
{
if (runIt)
{
System.Diagnostics.Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Spotify\\Data\\SpotifyWebHelper.exe");
return IsSpotifyRunning(false);
}
else
return false;
return false;
}
else
return true;
}
public static Boolean IsSpotifyWebHelperRunning()
{
if (Process.GetProcessesByName("SpotifyWebHelper").Length < 1)
{
return false;
}
else
return true;
}
public void RunSpotify()
{
if(!IsSpotifyRunning())
Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Spotify\\spotify.exe");
}
public void RunSpotifyWebHelper()
{
if (!IsSpotifyWebHelperRunning())
Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Spotify\\Data\\SpotifyWebHelper.exe");
}
public Boolean IsValidSpotifyURL(String url)
{
String[] types = new String[] { "track","album","local","artist"};
String[] split = url.Split(':');
if (split.Length < 3)
return false;
return split[0] == "spotify" && Array.IndexOf(types, split[1]) > -1 && split[2].Length == 22;
}
public void Update()
{
if (!SpotifyAPI.IsSpotifyWebHelperRunning())
return;
mh.Update(rh.Update());
rh.SendVolumeRequest();
}
}
}

View File

@ -16,7 +16,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\DebugExample\bin\Debug\</OutputPath>
<OutputPath>..\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@ -32,7 +32,7 @@
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DebugExample\bin\Debug\Newtonsoft.Json.dll</HintPath>
<HintPath>..\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@ -47,9 +47,9 @@
<ItemGroup>
<Compile Include="CFID.cs" />
<Compile Include="Enum.cs" />
<Compile Include="EventHandler.cs" />
<Compile Include="SpotifyEventHandler.cs" />
<Compile Include="Events.cs" />
<Compile Include="MusicHandler.cs" />
<Compile Include="SpotifyMusicHandler.cs" />
<Compile Include="RemoteHandler.cs" />
<Compile Include="SpotifyAPI.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />

View File

@ -3,15 +3,16 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SpotifyAPIv1;
namespace SpotifyAPIv1
{
public class EventHandler
public class SpotifyEventHandler
{
private Boolean listen = false;
private System.Timers.Timer timer;
private SpotifyAPI api;
private MusicHandler mh;
private SpotifyMusicHandler mh;
private StatusResponse response;
@ -24,7 +25,7 @@ namespace SpotifyAPIv1
public event VolumeChangeEventHandler OnVolumeChange;
public event TrackTimeChangeEventHandler OnTrackTimeChange;
public EventHandler(SpotifyAPI api, MusicHandler mh)
public SpotifyEventHandler(SpotifyAPI api, SpotifyMusicHandler mh)
{
timer = new System.Timers.Timer();
timer.Interval = 50;
@ -41,7 +42,10 @@ namespace SpotifyAPIv1
{
this.listen = listen;
}
public void SetSynchronizingObject(System.ComponentModel.ISynchronizeInvoke obj)
{
timer.SynchronizingObject = obj;
}
private void tick(object sender, EventArgs e)
{
if (!listen)
@ -57,7 +61,9 @@ namespace SpotifyAPIv1
return;
}
StatusResponse new_response = mh.GetStatusResponse();
if (new_response.track.GetName() != response.track.GetName() && OnTrackChange != null)
if (!new_response.running && new_response.track == null)
return;
if (new_response.track.GetTrackName() != response.track.GetTrackName() && OnTrackChange != null)
{
OnTrackChange(new TrackChangeEventArgs()
{

View File

@ -5,20 +5,23 @@ using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.IO;
namespace SpotifyAPIv1
{
public class MusicHandler
public class SpotifyMusicHandler
{
[DllImport("user32.dll")]
static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, int dwExtraInfo);
[DllImport("nircmd.dll")]
public static extern bool DoNirCmd(String NirCmdStr);
RemoteHandler rh;
StatusResponse sr;
const byte VK_MEDIA_NEXT_TRACK = 0xb0;
const byte VK_MEDIA_PREV_TRACK = 0xb1;
public MusicHandler()
public SpotifyMusicHandler()
{
rh = RemoteHandler.GetInstance();
}
@ -33,7 +36,18 @@ namespace SpotifyAPIv1
{
return sr.playing;
}
public double GetVolume()
{
return sr.volume;
}
public void PlayURL(String url)
{
rh.SendPlayRequest(url);
}
public Boolean IsAdRunning()
{
return !sr.next_enabled && !sr.prev_enabled;
}
public Track GetCurrentTrack()
{
return sr.track;
@ -46,6 +60,16 @@ namespace SpotifyAPIv1
{
return sr.playing_position;
}
public void Mute()
{
if(File.Exists("nircmd.dll"))
DoNirCmd("muteappvolume spotify.exe 1");
}
public void UnMute()
{
if (File.Exists("nircmd.dll"))
DoNirCmd("muteappvolume spotify.exe 0");
}
public void Previous()
{
PressKey(VK_MEDIA_PREV_TRACK);

View File

@ -17,7 +17,7 @@ namespace SpotifyAPIv1
public int length { get; set; }
public string track_type { get; set; }
public String GetName()
public String GetTrackName()
{
return track_resource.name;
}
@ -25,31 +25,40 @@ namespace SpotifyAPIv1
{
return length;
}
public String GetFormatedLength()
public String GetAlbumURI()
{
String format = "{0}:{1}";
return String.Format(format, TimeSpan.FromSeconds(GetLength()).ToString("mm:ss"));
return album_resource.uri;
}
public String GetAlbum()
public String GetTrackURI()
{
return track_resource.uri;
}
public String GetArtistURI()
{
return artist_resource.uri;
}
public String GetAlbumName()
{
return album_resource.name;
}
public String GetArtist()
public String GetArtistName()
{
return artist_resource.name;
}
public String GetAlbumArtURL(SizeEnum size)
public String GetAlbumArtURL(AlbumArtSize size)
{
if (album_resource.uri.Contains("local"))
return "";
int albumsize = 0;
switch (size)
{
case SizeEnum.SIZE_160:
case AlbumArtSize.SIZE_160:
albumsize = 160;
break;
case SizeEnum.SIZE_320:
case AlbumArtSize.SIZE_320:
albumsize = 320;
break;
case SizeEnum.SIZE_640:
case AlbumArtSize.SIZE_640:
albumsize = 640;
break;
}
@ -71,41 +80,41 @@ namespace SpotifyAPIv1
}
return "";
}
public Bitmap GetAlbumArt(SizeEnum size)
public async Task<Bitmap> GetAlbumArtAsync(AlbumArtSize size)
{
int albumsize = 0;
switch (size)
using (WebClient wc = new WebClient())
{
case SizeEnum.SIZE_160:
albumsize = 160;
break;
case SizeEnum.SIZE_320:
albumsize = 320;
break;
case SizeEnum.SIZE_640:
albumsize = 640;
break;
wc.Proxy = null;
String url = GetAlbumArtURL(size);
if (url == "")
return new Bitmap(640, 640);
byte[] stream = null;
try
{
stream = await wc.DownloadDataTaskAsync(url);
}
catch(WebException e)
{
stream = wc.DownloadData(@"http://www.51allout.co.uk/wp-content/uploads/2012/02/Image-not-found.gif");
}
using (MemoryStream ms = new MemoryStream(stream))
{
return (Bitmap)Image.FromStream(ms);
}
}
String raw = "";
}
public Bitmap GetAlbumArt(AlbumArtSize size)
{
using(WebClient wc = new WebClient())
{
wc.Proxy = null;
raw = wc.DownloadString("http://open.spotify.com/album/" + album_resource.uri.Split(new string[] { ":" }, StringSplitOptions.None)[2]);
raw = raw.Replace("\t", ""); ;
string[] lines = raw.Split(new string[] { "\n" }, StringSplitOptions.None);
foreach (string line in lines)
String url = GetAlbumArtURL(size);
if (url == "")
return new Bitmap(640,640);
using (MemoryStream ms = new MemoryStream(wc.DownloadData(url)))
{
if (line.StartsWith("<meta property=\"og:image\""))
{
string[] l = line.Split(new string[] { "/" }, StringSplitOptions.None);
String url = "http://o.scdn.co/" + albumsize + @"/" + l[4].Replace("\"", "").Replace(">", "");
using (MemoryStream ms = new MemoryStream(wc.DownloadData(url)))
{
return (Bitmap)Image.FromStream(ms);
}
}
return (Bitmap)Image.FromStream(ms);
}
return null;
}
}
}

View File

@ -5,18 +5,18 @@ using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
namespace DebugExample
namespace SpotifyAPI_Example
{
public class API
{
[DllImport("API.dll",EntryPoint = "API_AddChatMessage",CallingConvention = CallingConvention.Cdecl)]
public static extern int API_AddChatMessage(UInt32 color,string text);
[DllImport("API.dll", EntryPoint = "API_AddChatMessage", CallingConvention = CallingConvention.Cdecl)]
public static extern int API_AddChatMessage(UInt32 color, string text);
[DllImport("API.dll", EntryPoint = "API_GetChatLine", CallingConvention = CallingConvention.Cdecl)]
public static extern int API_GetChatLine(int line, ref String text);
[DllImport("API.dll", EntryPoint = "API_BoxCreate", CallingConvention = CallingConvention.Cdecl)]
public static extern int API_BoxCreate(int x,int y,int width,int height,UInt32 color,Boolean show);
public static extern int API_BoxCreate(int x, int y, int width, int height, UInt32 color, Boolean show);
[DllImport("API.dll", EntryPoint = "API_BoxSetPos", CallingConvention = CallingConvention.Cdecl)]
public static extern int API_BoxSetPos(int id,int x,int y);
public static extern int API_BoxSetPos(int id, int x, int y);
[DllImport("API.dll", EntryPoint = "API_BoxSetWidth", CallingConvention = CallingConvention.Cdecl)]
public static extern int API_BoxSetWidth(int id, int width);
[DllImport("API.dll", EntryPoint = "API_BoxSetHeight", CallingConvention = CallingConvention.Cdecl)]
@ -30,8 +30,12 @@ namespace DebugExample
[DllImport("API.dll", EntryPoint = "API_BoxSetColor", CallingConvention = CallingConvention.Cdecl)]
public static extern int API_BoxSetColor(int id, UInt32 color);
[DllImport("API.dll", EntryPoint = "API_TextCreate", CallingConvention = CallingConvention.Cdecl)]
public static extern int API_TextCreate(String Font,int size,Boolean italic,Boolean bold,int x,int y,UInt32 color,String text,Boolean show);
public static extern int API_TextCreate(String Font, int size, Boolean italic, Boolean bold, int x, int y, UInt32 color, String text, Boolean show);
[DllImport("API.dll", EntryPoint = "API_TextSetString", CallingConvention = CallingConvention.Cdecl)]
public static extern int API_TextSetString(int id, String text);
[DllImport("API.dll", EntryPoint = "API_TextSetColor", CallingConvention = CallingConvention.Cdecl)]
public static extern int API_TextSetColor(int id, UInt32 color);
[DllImport("API.dll", EntryPoint = "API_TextSetShown", CallingConvention = CallingConvention.Cdecl)]
public static extern int API_TextSetShown(int id, Boolean show);
}
}

379
SpotifyAPI_Example/Form1.Designer.cs generated Normal file
View File

@ -0,0 +1,379 @@
namespace SpotifyAPI_Example
{
partial class Form1
{
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Verwendete Ressourcen bereinigen.
/// </summary>
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Vom Windows Form-Designer generierter Code
/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/// </summary>
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.currentName = new System.Windows.Forms.Label();
this.currentAlbumValue = new System.Windows.Forms.Label();
this.currentAlbum = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label6 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.button5 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.button4 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.label11 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.progressBar1);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.currentName);
this.groupBox1.Controls.Add(this.currentAlbumValue);
this.groupBox1.Controls.Add(this.currentAlbum);
this.groupBox1.Controls.Add(this.pictureBox1);
this.groupBox1.Location = new System.Drawing.Point(12, 209);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(279, 313);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Current Track";
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(10, 280);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(256, 23);
this.progressBar1.TabIndex = 9;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(149, 264);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(13, 13);
this.label4.TabIndex = 8;
this.label4.Text = "0";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(104, 264);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(33, 13);
this.label5.TabIndex = 7;
this.label5.Text = "Time:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(50, 205);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(41, 13);
this.label2.TabIndex = 6;
this.label2.Text = "Name: ";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(3, 205);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(36, 13);
this.label3.TabIndex = 5;
this.label3.Text = "Artist: ";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(50, 182);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(41, 13);
this.label1.TabIndex = 4;
this.label1.Text = "Name: ";
//
// currentName
//
this.currentName.AutoSize = true;
this.currentName.Location = new System.Drawing.Point(3, 182);
this.currentName.Name = "currentName";
this.currentName.Size = new System.Drawing.Size(41, 13);
this.currentName.TabIndex = 3;
this.currentName.Text = "Name: ";
//
// currentAlbumValue
//
this.currentAlbumValue.AutoSize = true;
this.currentAlbumValue.Location = new System.Drawing.Point(48, 228);
this.currentAlbumValue.Name = "currentAlbumValue";
this.currentAlbumValue.Size = new System.Drawing.Size(62, 13);
this.currentAlbumValue.TabIndex = 2;
this.currentAlbumValue.Text = "albumValue";
//
// currentAlbum
//
this.currentAlbum.AutoSize = true;
this.currentAlbum.Location = new System.Drawing.Point(3, 228);
this.currentAlbum.Name = "currentAlbum";
this.currentAlbum.Size = new System.Drawing.Size(39, 13);
this.currentAlbum.TabIndex = 1;
this.currentAlbum.Text = "Album:";
//
// pictureBox1
//
this.pictureBox1.Location = new System.Drawing.Point(6, 19);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(160, 160);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(18, 76);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(54, 13);
this.label6.TabIndex = 9;
this.label6.Text = "Werbung:";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(78, 76);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(13, 13);
this.label7.TabIndex = 10;
this.label7.Text = "0";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.button5);
this.groupBox2.Controls.Add(this.textBox1);
this.groupBox2.Controls.Add(this.label7);
this.groupBox2.Controls.Add(this.checkBox1);
this.groupBox2.Controls.Add(this.label6);
this.groupBox2.Controls.Add(this.button4);
this.groupBox2.Controls.Add(this.button3);
this.groupBox2.Controls.Add(this.button2);
this.groupBox2.Controls.Add(this.button1);
this.groupBox2.Controls.Add(this.label11);
this.groupBox2.Controls.Add(this.label10);
this.groupBox2.Controls.Add(this.label9);
this.groupBox2.Controls.Add(this.label8);
this.groupBox2.Location = new System.Drawing.Point(12, 12);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(338, 191);
this.groupBox2.TabIndex = 11;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Spotify";
//
// button5
//
this.button5.Location = new System.Drawing.Point(249, 136);
this.button5.MaximumSize = new System.Drawing.Size(75, 23);
this.button5.MinimumSize = new System.Drawing.Size(75, 23);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(75, 23);
this.button5.TabIndex = 14;
this.button5.Text = "PlayURL";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(6, 136);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(237, 20);
this.textBox1.TabIndex = 13;
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(276, 108);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(56, 17);
this.checkBox1.TabIndex = 12;
this.checkBox1.Text = "Muted";
this.checkBox1.UseVisualStyleBackColor = true;
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
//
// button4
//
this.button4.Location = new System.Drawing.Point(249, 162);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(75, 23);
this.button4.TabIndex = 11;
this.button4.Text = "Skip";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(168, 162);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 10;
this.button3.Text = "Previous";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(87, 162);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 9;
this.button2.Text = "Pause";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(6, 162);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 8;
this.button1.Text = "Play";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(79, 53);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(55, 13);
this.label11.TabIndex = 7;
this.label11.Text = "IsPlaying: ";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(18, 53);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(45, 13);
this.label10.TabIndex = 6;
this.label10.Text = "Volume:";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(79, 30);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(55, 13);
this.label9.TabIndex = 5;
this.label9.Text = "IsPlaying: ";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(18, 30);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(55, 13);
this.label8.TabIndex = 4;
this.label8.Text = "IsPlaying: ";
//
// pictureBox2
//
this.pictureBox2.Location = new System.Drawing.Point(350, 12);
this.pictureBox2.MaximumSize = new System.Drawing.Size(640, 640);
this.pictureBox2.MinimumSize = new System.Drawing.Size(640, 640);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(640, 640);
this.pictureBox2.TabIndex = 12;
this.pictureBox2.TabStop = false;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1002, 664);
this.Controls.Add(this.pictureBox2);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.MaximumSize = new System.Drawing.Size(1018, 702);
this.MinimumSize = new System.Drawing.Size(1018, 702);
this.Name = "Form1";
this.Text = "SpotifyAPI Example";
this.Load += new System.EventHandler(this.Form1_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label currentAlbumValue;
private System.Windows.Forms.Label currentAlbum;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label currentName;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.ProgressBar progressBar1;
}
}

121
SpotifyAPI_Example/Form1.cs Normal file
View File

@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using SpotifyAPIv1;
using SpotifyEventHandler = SpotifyAPIv1.SpotifyEventHandler;
namespace SpotifyAPI_Example
{
public partial class Form1 : Form
{
SpotifyAPI spotify;
SpotifyMusicHandler mh;
SpotifyEventHandler eh;
public Form1()
{
InitializeComponent();
spotify = new SpotifyAPI();
if(!SpotifyAPI.IsSpotifyRunning())
spotify.RunSpotify();
if (!SpotifyAPI.IsSpotifyWebHelperRunning())
spotify.RunSpotifyWebHelper();
spotify.Connect();
mh = spotify.GetMusicHandler();
eh = spotify.GetEventHandler();
}
private async void Form1_Load(object sender, EventArgs e)
{
spotify.Update();
progressBar1.Maximum = (int)mh.GetCurrentTrack().GetLength() * 100;
pictureBox1.Image = await spotify.GetMusicHandler().GetCurrentTrack().GetAlbumArtAsync(AlbumArtSize.SIZE_160);
pictureBox2.Image = await spotify.GetMusicHandler().GetCurrentTrack().GetAlbumArtAsync(AlbumArtSize.SIZE_640);
label1.Text = mh.GetCurrentTrack().GetTrackName();
label2.Text = mh.GetCurrentTrack().GetArtistName();
currentAlbumValue.Text = mh.GetCurrentTrack().GetAlbumName();
label9.Text = mh.IsPlaying().ToString();
label11.Text = ((int)(mh.GetVolume() * 100)).ToString();
label7.Text = mh.IsAdRunning().ToString();
eh.OnTrackChange += new SpotifyEventHandler.TrackChangeEventHandler(trackchange);
eh.OnTrackTimeChange += new SpotifyEventHandler.TrackTimeChangeEventHandler(timechange);
eh.OnPlayStateChange += new SpotifyEventHandler.PlayStateEventHandler(playstatechange);
eh.OnVolumeChange += new SpotifyEventHandler.VolumeChangeEventHandler(volumechange);
eh.SetSynchronizingObject(this);
eh.ListenForEvents(true);
}
private void volumechange(VolumeChangeEventArgs e)
{
label11.Text = ((int)(mh.GetVolume() * 100)).ToString();
}
private void playstatechange(PlayStateEventArgs e)
{
label9.Text = e.playing.ToString();
}
private async void trackchange(TrackChangeEventArgs e)
{
progressBar1.Maximum = (int)mh.GetCurrentTrack().GetLength()*100;
label1.Text = e.new_track.GetTrackName();
label2.Text = e.new_track.GetArtistName();
currentAlbumValue.Text = e.new_track.GetAlbumName();
pictureBox1.Image = await e.new_track.GetAlbumArtAsync(AlbumArtSize.SIZE_160);
pictureBox2.Image = await e.new_track.GetAlbumArtAsync(AlbumArtSize.SIZE_640);
label7.Text = mh.IsAdRunning().ToString();
}
private void timechange(TrackTimeChangeEventArgs e)
{
label4.Text = formatTime(e.track_time) + "/" + formatTime(mh.GetCurrentTrack().GetLength());
progressBar1.Value = (int)e.track_time*100;
}
private String formatTime(double sec)
{
TimeSpan span = TimeSpan.FromSeconds(sec);
String secs = span.Seconds.ToString(), mins = span.Minutes.ToString();
if (secs.Length < 2)
secs = "0" + secs;
return mins + ":" + secs;
}
private void button1_Click(object sender, EventArgs e)
{
mh.Play();
}
private void button2_Click(object sender, EventArgs e)
{
mh.Pause();
}
private void button3_Click(object sender, EventArgs e)
{
mh.Previous();
}
private void button4_Click(object sender, EventArgs e)
{
mh.Skip();
}
private void button5_Click(object sender, EventArgs e)
{
if (spotify.IsValidSpotifyURL(textBox1.Text))
mh.PlayURL(textBox1.Text);
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked)
mh.Mute();
else
mh.UnMute();
}
}
}

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>

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SpotifyAPI_Example
{
static class Program
{
/// <summary>
/// Der Haupteinstiegspunkt für die Anwendung.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

View File

@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("DebugExample")]
[assembly: AssemblyTitle("SpotifyAPI_Example")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DebugExample")]
[assembly: AssemblyProduct("SpotifyAPI_Example")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@ -20,7 +20,7 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("9a361bab-2331-48d0-b06d-13255944de54")]
[assembly: Guid("8c170128-720b-4fc0-83ea-c4fdaf207403")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//

View File

@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.18408
//
// Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn
// der Code neu generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SpotifyAPI_Example.Properties
{
/// <summary>
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary>
// Diese Klasse wurde von der StronglyTypedResourceBuilder-Klasse
// über ein Tool wie ResGen oder Visual Studio automatisch generiert.
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
// mit der Option /str erneut aus, oder erstellen Sie Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SpotifyAPI_Example.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18408
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SpotifyAPI_Example.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -4,11 +4,11 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{41F89F0F-4D54-4551-B352-460BA6AB89BB}</ProjectGuid>
<OutputType>Exe</OutputType>
<ProjectGuid>{C12D46F9-BB35-46D6-B821-522B8F9C3CBE}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DebugExample</RootNamespace>
<AssemblyName>DebugExample</AssemblyName>
<RootNamespace>SpotifyAPI_Example</RootNamespace>
<AssemblyName>SpotifyAPI_Example</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
@ -31,35 +31,58 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>DebugExample.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SpotifyAPI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\SpotifyAPI.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="API.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SpotifyAPI\SpotifyAPI.csproj">
<Project>{ebbe35e2-7b91-4d7d-b8fc-3a0472f5119d}</Project>
<Name>SpotifyAPI</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

BIN
nircmd.dll Normal file

Binary file not shown.