diff --git a/DebugExample/Program.cs b/DebugExample/Program.cs deleted file mode 100644 index 22601266..00000000 --- a/DebugExample/Program.cs +++ /dev/null @@ -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); - } - } -} diff --git a/ILMerge/ILMerge.exe b/ILMerge/ILMerge.exe new file mode 100644 index 00000000..9667425b Binary files /dev/null and b/ILMerge/ILMerge.exe differ diff --git a/ILMerge/compile.bat b/ILMerge/compile.bat new file mode 100644 index 00000000..afc50773 --- /dev/null +++ b/ILMerge/compile.bat @@ -0,0 +1 @@ +ilmerge /targetplatform:"v4" /log:log.txt /out:SpotifyAPIMerged.dll "Newtonsoft.Json.dll" "SpotifyAPI.dll" /target:library \ No newline at end of file diff --git a/Newtonsoft.Json.dll b/Newtonsoft.Json.dll new file mode 100644 index 00000000..8ae038bd Binary files /dev/null and b/Newtonsoft.Json.dll differ diff --git a/SpotifyAPI.dll b/SpotifyAPI.dll new file mode 100644 index 00000000..fabeebbe Binary files /dev/null and b/SpotifyAPI.dll differ diff --git a/SpotifyAPI.dll.config b/SpotifyAPI.dll.config new file mode 100644 index 00000000..49cc43e1 --- /dev/null +++ b/SpotifyAPI.dll.config @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/SpotifyAPI.sln b/SpotifyAPI.sln index 86de71dd..357b15d2 100644 --- a/SpotifyAPI.sln +++ b/SpotifyAPI.sln @@ -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 diff --git a/SpotifyAPI/CFID.cs b/SpotifyAPI/CFID.cs index 6ca22b89..3a05342e 100644 --- a/SpotifyAPI/CFID.cs +++ b/SpotifyAPI/CFID.cs @@ -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; } } } diff --git a/SpotifyAPI/Enum.cs b/SpotifyAPI/Enum.cs index 7359de4f..bac4f820 100644 --- a/SpotifyAPI/Enum.cs +++ b/SpotifyAPI/Enum.cs @@ -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 } } diff --git a/SpotifyAPI/Events.cs b/SpotifyAPI/Events.cs index 77a63252..097c8888 100644 --- a/SpotifyAPI/Events.cs +++ b/SpotifyAPI/Events.cs @@ -6,10 +6,6 @@ using System.Threading.Tasks; namespace SpotifyAPIv1 { - class Events - { - - } public class TrackChangeEventArgs { public Track old_track { get; set; } diff --git a/SpotifyAPI/RemoteHandler.cs b/SpotifyAPI/RemoteHandler.cs index 21a43ed0..7f3ac59b 100644 --- a/SpotifyAPI/RemoteHandler.cs +++ b/SpotifyAPI/RemoteHandler.cs @@ -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 raw = (List)JsonConvert.DeserializeObject(response,typeof(List)); 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 d = (List)JsonConvert.DeserializeObject(a, typeof(List)); 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); } } } diff --git a/SpotifyAPI/SpotifyAPI.cs b/SpotifyAPI/SpotifyAPI.cs index cef6067a..99595416 100644 --- a/SpotifyAPI/SpotifyAPI.cs +++ b/SpotifyAPI/SpotifyAPI.cs @@ -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(); } } } diff --git a/SpotifyAPI/SpotifyAPI.csproj b/SpotifyAPI/SpotifyAPI.csproj index bfb8df5c..0f795160 100644 --- a/SpotifyAPI/SpotifyAPI.csproj +++ b/SpotifyAPI/SpotifyAPI.csproj @@ -16,7 +16,7 @@ true full false - ..\DebugExample\bin\Debug\ + ..\ DEBUG;TRACE prompt 4 @@ -32,7 +32,7 @@ False - ..\DebugExample\bin\Debug\Newtonsoft.Json.dll + ..\Newtonsoft.Json.dll @@ -47,9 +47,9 @@ - + - + diff --git a/SpotifyAPI/EventHandler.cs b/SpotifyAPI/SpotifyEventHandler.cs similarity index 84% rename from SpotifyAPI/EventHandler.cs rename to SpotifyAPI/SpotifyEventHandler.cs index 922cbae7..4b7293fa 100644 --- a/SpotifyAPI/EventHandler.cs +++ b/SpotifyAPI/SpotifyEventHandler.cs @@ -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() { diff --git a/SpotifyAPI/MusicHandler.cs b/SpotifyAPI/SpotifyMusicHandler.cs similarity index 68% rename from SpotifyAPI/MusicHandler.cs rename to SpotifyAPI/SpotifyMusicHandler.cs index b66f9338..542177d2 100644 --- a/SpotifyAPI/MusicHandler.cs +++ b/SpotifyAPI/SpotifyMusicHandler.cs @@ -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); diff --git a/SpotifyAPI/Track.cs b/SpotifyAPI/Track.cs index 12ea88f6..3a7aac14 100644 --- a/SpotifyAPI/Track.cs +++ b/SpotifyAPI/Track.cs @@ -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 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("", ""); - using (MemoryStream ms = new MemoryStream(wc.DownloadData(url))) - { - return (Bitmap)Image.FromStream(ms); - } - } + return (Bitmap)Image.FromStream(ms); } - return null; } } } diff --git a/DebugExample/API.cs b/SpotifyAPI_Example/API.cs similarity index 69% rename from DebugExample/API.cs rename to SpotifyAPI_Example/API.cs index 65566a00..7de275b2 100644 --- a/DebugExample/API.cs +++ b/SpotifyAPI_Example/API.cs @@ -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); } } diff --git a/DebugExample/App.config b/SpotifyAPI_Example/App.config similarity index 100% rename from DebugExample/App.config rename to SpotifyAPI_Example/App.config diff --git a/SpotifyAPI_Example/Form1.Designer.cs b/SpotifyAPI_Example/Form1.Designer.cs new file mode 100644 index 00000000..da4efc3e --- /dev/null +++ b/SpotifyAPI_Example/Form1.Designer.cs @@ -0,0 +1,379 @@ +namespace SpotifyAPI_Example +{ + partial class Form1 + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Windows Form-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + 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; + + } +} + diff --git a/SpotifyAPI_Example/Form1.cs b/SpotifyAPI_Example/Form1.cs new file mode 100644 index 00000000..dc37ac57 --- /dev/null +++ b/SpotifyAPI_Example/Form1.cs @@ -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(); + } + } +} diff --git a/SpotifyAPI_Example/Form1.resx b/SpotifyAPI_Example/Form1.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/SpotifyAPI_Example/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SpotifyAPI_Example/Program.cs b/SpotifyAPI_Example/Program.cs new file mode 100644 index 00000000..3b59122b --- /dev/null +++ b/SpotifyAPI_Example/Program.cs @@ -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 + { + /// + /// Der Haupteinstiegspunkt für die Anwendung. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/DebugExample/Properties/AssemblyInfo.cs b/SpotifyAPI_Example/Properties/AssemblyInfo.cs similarity index 89% rename from DebugExample/Properties/AssemblyInfo.cs rename to SpotifyAPI_Example/Properties/AssemblyInfo.cs index 64da5506..cbe4d14b 100644 --- a/DebugExample/Properties/AssemblyInfo.cs +++ b/SpotifyAPI_Example/Properties/AssemblyInfo.cs @@ -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: // diff --git a/SpotifyAPI_Example/Properties/Resources.Designer.cs b/SpotifyAPI_Example/Properties/Resources.Designer.cs new file mode 100644 index 00000000..85c37b26 --- /dev/null +++ b/SpotifyAPI_Example/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +namespace SpotifyAPI_Example.Properties +{ + + + /// + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// + // 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() + { + } + + /// + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// + [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; + } + } + + /// + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/SpotifyAPI_Example/Properties/Resources.resx b/SpotifyAPI_Example/Properties/Resources.resx new file mode 100644 index 00000000..af7dbebb --- /dev/null +++ b/SpotifyAPI_Example/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SpotifyAPI_Example/Properties/Settings.Designer.cs b/SpotifyAPI_Example/Properties/Settings.Designer.cs new file mode 100644 index 00000000..5501b3dd --- /dev/null +++ b/SpotifyAPI_Example/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +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; + } + } + } +} diff --git a/SpotifyAPI_Example/Properties/Settings.settings b/SpotifyAPI_Example/Properties/Settings.settings new file mode 100644 index 00000000..39645652 --- /dev/null +++ b/SpotifyAPI_Example/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/DebugExample/DebugExample.csproj b/SpotifyAPI_Example/SpotifyAPI_Example.csproj similarity index 59% rename from DebugExample/DebugExample.csproj rename to SpotifyAPI_Example/SpotifyAPI_Example.csproj index 2cb685bc..445465b4 100644 --- a/DebugExample/DebugExample.csproj +++ b/SpotifyAPI_Example/SpotifyAPI_Example.csproj @@ -4,11 +4,11 @@ Debug AnyCPU - {41F89F0F-4D54-4551-B352-460BA6AB89BB} - Exe + {C12D46F9-BB35-46D6-B821-522B8F9C3CBE} + WinExe Properties - DebugExample - DebugExample + SpotifyAPI_Example + SpotifyAPI_Example v4.5 512 @@ -31,35 +31,58 @@ prompt 4 - - DebugExample.Program - - - False - ..\Newtonsoft.Json.dll - - - False - bin\Debug\SpotifyAPI.dll - - + + + - + + Form + + + Form1.cs + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + {ebbe35e2-7b91-4d7d-b8fc-3a0472f5119d} + SpotifyAPI + +