diff --git a/PlazaSharp.sln b/PlazaSharp.sln
index c2c33c5..a37a53b 100644
--- a/PlazaSharp.sln
+++ b/PlazaSharp.sln
@@ -5,12 +5,7 @@ VisualStudioVersion = 16.0.29306.81
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinPlaza", "WinPlaza\WinPlaza.csproj", "{72EEB593-D74D-4775-875A-CD0078923EC3}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testplaza", "testplaza\testplaza.csproj", "{DAB02D69-CD02-4C74-A110-7907E5B4A568}"
- ProjectSection(ProjectDependencies) = postProject
- {B8CD29C0-4FAF-4A02-B00C-3180E60841D3} = {B8CD29C0-4FAF-4A02-B00C-3180E60841D3}
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "libplaza", "libplaza\libplaza.csproj", "{B8CD29C0-4FAF-4A02-B00C-3180E60841D3}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "libplaza", "libplaza\libplaza.csproj", "{B8CD29C0-4FAF-4A02-B00C-3180E60841D3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -22,10 +17,6 @@ Global
{72EEB593-D74D-4775-875A-CD0078923EC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{72EEB593-D74D-4775-875A-CD0078923EC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{72EEB593-D74D-4775-875A-CD0078923EC3}.Release|Any CPU.Build.0 = Release|Any CPU
- {DAB02D69-CD02-4C74-A110-7907E5B4A568}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {DAB02D69-CD02-4C74-A110-7907E5B4A568}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {DAB02D69-CD02-4C74-A110-7907E5B4A568}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {DAB02D69-CD02-4C74-A110-7907E5B4A568}.Release|Any CPU.Build.0 = Release|Any CPU
{B8CD29C0-4FAF-4A02-B00C-3180E60841D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B8CD29C0-4FAF-4A02-B00C-3180E60841D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B8CD29C0-4FAF-4A02-B00C-3180E60841D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/WinPlaza/MainWindow.xaml.cs b/WinPlaza/MainWindow.xaml.cs
index 02fded4..fecc725 100644
--- a/WinPlaza/MainWindow.xaml.cs
+++ b/WinPlaza/MainWindow.xaml.cs
@@ -58,7 +58,13 @@ namespace WinPlaza {
SetStatus($"Logged in as {await plaza.GetUser()}");
}
private async void DgtRefresh(bool Force = false) {
- Status s=await plaza.Broadcast(Force);
+ Status s;
+ try {
+ s=await plaza.Status(Force);
+ } catch (NullReferenceException) {
+ SetStatus("Ran into a problem while fetching now-playing.");
+ return;
+ }
if(s.FaultOccurred||s.InMaintenance) {
if(s.InMaintenance)
SetStatus("Nightwave Plaza is currently in maintenance mode.");
@@ -66,10 +72,6 @@ namespace WinPlaza {
SetStatus("Ran into a problem while fetching now-playing.");
return;
}
- if(s.ArtworkUri == null || s.Duration == 0) {
- Console.WriteLine("why is async so hard");
- throw new Exception("Something went real weird, woah. Time to Crash!");
- }
slDuration.Value = s.CalculatedElapsed;
sbListeners.Text = $"{s.Listeners} listeners";
lbLikeCt.Content = s.Likes;
@@ -77,9 +79,9 @@ namespace WinPlaza {
lbElapsed.Content = $"{(s.CalculatedElapsed / 60).ToString("D")}:{(s.CalculatedElapsed % 60).ToString("D2")}";
if(LastArtwork != s.ArtworkUri || Force) {
//TODO should probably break this part out into a separate function cause this feels real messy
- Nightwave.Vote v = await plaza.GetVote() ?? Nightwave.Vote.Neutral;
+ Vote v = await plaza.Vote() ?? Vote.Neutral;
switch(v) {
- case Nightwave.Vote.Dislike:
+ case Vote.Dislike:
sbVote.Text = "👎";
sbVote.ToolTip = "You dislike this.";
btLike.Content = "👍";
@@ -87,7 +89,7 @@ namespace WinPlaza {
btDislike.Content = "🤷♀️";
btDislike.ToolTip = "Remove your vote for this track";
break;
- case Nightwave.Vote.Like:
+ case Vote.Like:
sbVote.Text = "👍";
sbVote.ToolTip = "You like this.";
btLike.Content = "💖";
@@ -95,7 +97,7 @@ namespace WinPlaza {
btDislike.Content = "👎";
btDislike.ToolTip = "Dislike this track";
break;
- case Nightwave.Vote.Favourite:
+ case Vote.Favourite:
sbVote.Text = "💖";
sbVote.ToolTip = "You have favourited this.";
btLike.Content = "🤷♀️";
@@ -270,14 +272,14 @@ namespace WinPlaza {
}
private async void BtLike_Click(object sender, RoutedEventArgs e) {
_ = Dispatcher.BeginInvoke(new dgtCtrl(DgtToggleEnabled), btLike);
- Nightwave.Vote v = await plaza.GetVote() ?? Nightwave.Vote.Neutral;
- if(v == Nightwave.Vote.Like)
- v = Nightwave.Vote.Favourite;
- else if(v == Nightwave.Vote.Favourite)
- v = Nightwave.Vote.Neutral;
+ Vote v = await plaza.Vote() ?? Vote.Neutral;
+ if(v == Vote.Like)
+ v = Vote.Favourite;
+ else if(v == Vote.Favourite)
+ v = Vote.Neutral;
else
- v = Nightwave.Vote.Like;
- if(await plaza.CastVote(v)) {
+ v = Vote.Like;
+ if(await plaza.Vote(v)) {
SetStatus($"Submitted {v}!");
} else
SetStatus($"Something went weird while casting {v}");
@@ -286,10 +288,10 @@ namespace WinPlaza {
}
private async void BtDislike_Click(object sender, RoutedEventArgs e) {
_ = Dispatcher.BeginInvoke(new dgtCtrl(DgtToggleEnabled), btDislike);
- Nightwave.Vote v = Nightwave.Vote.Dislike;
- if(await plaza.GetVote() == Nightwave.Vote.Dislike)
- v = Nightwave.Vote.Neutral;
- if(await plaza.CastVote(v))
+ Vote v = Vote.Dislike;
+ if(await plaza.Vote() == Vote.Dislike)
+ v = Vote.Neutral;
+ if(await plaza.Vote(v))
SetStatus($"Submitted {v}!");
else
SetStatus($"Something went weird while casting {v}");
diff --git a/libplaza/Main.cs b/libplaza/Main.cs
index fd87b6d..cd27bbd 100644
--- a/libplaza/Main.cs
+++ b/libplaza/Main.cs
@@ -4,12 +4,11 @@ using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json;
+///
+/// Classes and other definitions relating to the Nightwave Plaza API
+///
namespace libplaza {
- internal class PlazaApi {
- internal const string ApiBase="https://api.plaza.one/";
- internal const string ArtworkBase="https://plaza.one/";
- internal const string RadioBase="https://radio.plaza.one/";
- }
+ #region API models
public class PlazaPlayback {
public string artist;
public string title;
@@ -42,56 +41,159 @@ namespace libplaza {
public class PlazaGetVote {
public int rate;
}
+ public class PlazaLogoutResult {
+ public string status;
+ }
public class PlazaLogonResult {
public string status;
public string username;
public string email;
public string token;
}
+ #endregion
+ #region Exceptions
+ ///
+ /// An object indicating that the Nightwave API is under maintenance
+ ///
internal class PlazaInMaintenanceException : Exception { }
+ ///
+ /// An object indicating that an error or exception occurred when communicating with the Nightwave API.
+ ///
internal class PlazaUnavailableException : Exception { }
+ #endregion
+ #region Type Definitions
+ ///
+ /// A Status object represents the current broadcast information returned by a Nightwave API object.
+ ///
public class Status {
+ /// InMaintenance indicates whether the Nightwave API is in maintenance mode
public bool InMaintenance;
+ /// FaultOccurred indicates whether an exception occurred while querying the Nightwave API
public bool FaultOccurred;
+ /// Title contains the currently-playing track's title
public string Title;
+ /// Artist contains the currently-playing track's creating artist
public string Artist;
+ /// Album contains the currently-playing track's album, if any
public string Album;
+ /// ArtworkUri contains a relative URI to the artwork for the currently-playing track
public string ArtworkUri;
+ /// Elapsed contains an integer value of the elapsed seconds for the current track
public int Elapsed;
+ /// Duration contains an integer value of the duration in seconds of the current track
public int Duration;
+ /// Since contains a 64-bit integer value of the epoch timestamp when the broadcast information was updated
public long Since;
+ /// ServerTimeOffset contains an integer value of the time difference between the local computer and the Nightwave API server
public int ServerTimeOffset;
- public int CalculatedElapsed =>
+ /// CalculatedElapsed returns a dynamically-generated integer value of the elapsed seconds, taking time offsets and time since
+ public int CalculatedElapsed =>
(int)(DateTimeOffset.Now.ToUnixTimeSeconds() - ServerTimeOffset - Since) + Elapsed;
+ /// Likes contains an integer value of the number of likes the currently-playing track has received
public int Likes;
+ /// Dislikes contains an integer value of the number of dislikes the currently-playing track has received
public int Dislikes;
+ /// Listeners contains an integer value of the number of people currently listening to the broadcast
public int Listeners;
}
+ ///
+ /// Vote represents the user's disposition towards the currently-playing track.
+ ///
+ public enum Vote {
+ /// To Dislike is to indicate the user's disposition towards this track is one of displeasure; that the user does not appreciate hearing this track, perhaps even that the user wishes not to hear this track.
+ Dislike = -1,
+ /// To be of Neutral disposition is to indicate the user has no feelings towards this track, or that the user does have feelings, but not strong enough to be worth expressing
+ Neutral,
+ /// To Like is to indicate the user's disposition towards this track is one of enjoyment or pleasure; that the user appreciated this track and/or wishes to indicate such.
+ Like,
+ /// To Favourite is functionally equivalent to , with the additional effect of adding the track to the user's favourites list.
+ Favourite
+ }
+ #endregion
+ ///
+ /// Nightwave is the primary class by which the Nightwave Plaza API can be used.
+ ///
public class Nightwave {
+ /// MinRefreshTime represents the minimum number of seconds that must pass before the cached Status may be invalidated
public int MinRefreshTime=10;
private long tsLastRefresh=0;
private static HttpClient _hcl=new HttpClient();
- public enum Vote {
- Dislike=-1,
- Neutral,
- Like,
- Favourite
- }
private Status _bc;
- public Nightwave() {
- _hcl.BaseAddress = new Uri(PlazaApi.ApiBase);
+ ///
+ /// Creates a new Nightwave instance.
+ ///
+ /// Specify an alternate URI for the API - useful if testing a dev server.
+ ///
+ /// To create a Nightwave API object targeting the production Nightwave Plaza API:
+ ///
+ /// Nightwave nw = new Nightwave();
+ ///
+ /// To create a Nightwave API object targeting a local server (eg., during development):
+ /// Nightwave nwd = new Nightwave("http://localhost:8000");
+ ///
+ public Nightwave(string baseuri = "https://api.plaza.one/") {
+ _hcl.BaseAddress = new Uri(baseuri);
_hcl.Timeout = TimeSpan.FromSeconds(2);
_hcl.DefaultRequestHeaders.Accept.Clear();
_hcl.DefaultRequestHeaders.Accept.Add(
new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
}
- public async Task Broadcast(bool Force = false) {
- if(!Force && tsLastRefresh + MinRefreshTime >= DateTimeOffset.Now.ToUnixTimeSeconds() && _bc.CalculatedElapsed < _bc.Duration)
- return _bc;
- await Update();
- tsLastRefresh = DateTimeOffset.Now.ToUnixTimeSeconds();
+ ///
+ /// De-initialises the Nightwave API object.
+ /// Currently, this is equivalent to synchronously logging out the current session.
+ ///
+ ~Nightwave() {
+ _ = Task.Run(async () => await Logout());
+ }
+ ///
+ /// Retrieves the current Nightwave Plaza radio broadcast information, if possible
+ ///
+ ///
+ /// If Nightwave Plaza is broadcasting normally:
+ ///
+ /// Nightwave n = new Nightwave();
+ /// Status s = await n.Status();
+ /// Console.WriteLine(s.Title);
+ ///
+ /// The Console output would show "リサフランク420 / 現代のコンピュー", if that track were playing.
+ /// In the event that an HTTP request fails or Nightwave Plaza is in maintenance mode, the appropriate flag will be set
+ ///
+ /// Nightwave n = new Nightwave();
+ /// Status s = await n.Status();
+ /// if (s.InMaintenance) {
+ /// Console.WriteLine("In maintenance!");
+ /// return;
+ /// } else if (s.FaultOccurred) {
+ /// Console.WriteLine("A fault occurred!");
+ /// return;
+ /// }
+ /// Console.WriteLine(s.Title);
+ ///
+ /// The Console output would show "In maintenance!" or "A fault occurred!", depending on the conditions.
+ ///
+ ///
+ /// This method has inherent caching, and thus will not necessarily result in the Status object returned being fully fresh.
+ /// The Status object being returned may be a cached object UNLESS the parameter is true
+ /// OR the Status object is older than the number of seconds stored by
+ /// OR Status.CalculatedElapsed is equal to or greater than Status.Duration.
+ ///
+ /// If true, the API will always be queried, and no caching will be performed.
+ /// A populated Status object describing the current broadcast details.
+ public async Task Status(bool Force = false) {
+ //An API call will ONLY be made if Force is set, if the cached data is "stale",
+ // or if the currently-playing track's elapsed time is more than the track duration.
+ if(Force
+ || (tsLastRefresh + MinRefreshTime < DateTimeOffset.Now.ToUnixTimeSeconds())
+ || _bc.CalculatedElapsed < _bc.Duration) {
+ await Update();
+ tsLastRefresh = DateTimeOffset.Now.ToUnixTimeSeconds();
+ }
return _bc;
}
+ ///
+ /// A basic wrapper around which provides basic error handling.
+ ///
+ /// If called with await, returns nothing. If called without, returns a Task object for the method call
public async Task Update() {
try {
Status _=await GetNightwaveAsync();
@@ -105,12 +207,17 @@ namespace libplaza {
_bc.FaultOccurred = true;
}
}
+ ///
+ /// Communicates with the Nightwave API to retrieve the current broadcast information.
+ ///
+ /// Returns a Status object representing the current broadcast information.
+ /// May be thrown in event of a non-success (HTTP/1.1 2XX) return code
+ /// May be thrown in event that the API indicates it is in maintenance
public async Task GetNightwaveAsync() {
Status status;
HttpResponseMessage _r=await _hcl.GetAsync("/status");
if(!_r.IsSuccessStatusCode)
throw new PlazaUnavailableException();
- //string _=await _r.Content.ReadAsStringAsync();
PlazaJson j=JsonConvert.DeserializeObject(await _r.Content.ReadAsStringAsync());
if(j.maintenance)
throw new PlazaInMaintenanceException();
@@ -125,11 +232,15 @@ namespace libplaza {
Dislikes = j.playback.hates,
Listeners = j.listeners,
ServerTimeOffset = (int)(DateTimeOffset.Now.ToUnixTimeSeconds() - _r.Headers.Date.Value.ToUnixTimeSeconds()),
- ArtworkUri = $"{PlazaApi.ArtworkBase}{j.playback.artwork}"
+ ArtworkUri = $"https://plaza.one/{j.playback.artwork}"
};
return status;
}
- public async Task GetVote() {
+ ///
+ /// Fetches the user's for the currently-playing track.
+ ///
+ /// A object indicating the user's disposition towards the track. If the vote could not be returned, this will be null
+ public async Task Vote() {
if(!await CheckSession())
return null;
HttpResponseMessage _r=await _hcl.GetAsync("/vote");
@@ -138,7 +249,12 @@ namespace libplaza {
PlazaGetVote r=JsonConvert.DeserializeObject(await _r.Content.ReadAsStringAsync());
return (Vote)r.rate;
}
- public async Task CastVote(Vote v) {
+ ///
+ /// Casts the given specified in as the user's vote on the current track.
+ ///
+ /// A object indicating the user's disposition towards the current track
+ /// A boolean value indicating the success of the vote operation
+ public async Task Vote(Vote v) {
if(!await CheckSession())
return false;
HttpResponseMessage _r=await _hcl.PostAsync("/vote", new FormUrlEncodedContent(new[] {
@@ -150,16 +266,29 @@ namespace libplaza {
return false;
return true;
}
+ ///
+ /// An overload method to to first set the X-Access-Token header to
+ ///
+ /// A valid session token for the Nightwave API
+ /// A boolean value indicating whether the token given in was able to perform an authenticated API request
public async Task CheckSession(string str) {
- _=_hcl.DefaultRequestHeaders.Remove("X-Access-Token");
+ _ = _hcl.DefaultRequestHeaders.Remove("X-Access-Token");
_hcl.DefaultRequestHeaders.Add("X-Access-Token", str);
return await CheckSession();
}
+ ///
+ /// Performs a basic read-only API request to determine whether the session token, if present, is valid.
+ ///
+ /// A boolean value indicating whether the request succeeded
public async Task CheckSession() {
if(await GetUser() != null)
return true;
return false;
}
+ ///
+ /// Performs a basic read-only API request to fetch the currently-authenticated user's profile details.
+ ///
+ /// If successful, returns a string containing the authenticated user's username. If unsuccessful, will return null.
public async Task GetUser() {
HttpResponseMessage _r=await _hcl.GetAsync("/user");
if(!_r.IsSuccessStatusCode)
@@ -169,7 +298,22 @@ namespace libplaza {
return null;
return r.username;
}
- public async Task Login(string u, string p) => await Login(Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes($"{u}:{p}")));
+ ///
+ /// Performs a login request to the Nightwave API with the given username and password.
+ ///
+ /// A string containing the user's username
+ /// A string containing the user's password
+ /// A boolean value indicating whether the login attempt succeeded
+ ///
+ /// Functionally, this method is a wrapper for , performing the function of generating a Basic authentication string
+ ///
+ public async Task Login(string u, string p) =>
+ await Login(Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes($"{u}:{p}")));
+ ///
+ /// Performs a login request to the Nightwave API with the given HTTP Basic authentication string.
+ ///
+ /// A valid HTTP Basic authentication string (md5(username:password))
+ /// A boolean value indicating whether the login attempt succeeded
public async Task Login(string str) {
_hcl.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", str);
HttpResponseMessage _r=await _hcl.PostAsync("/user/login", null);
@@ -179,15 +323,20 @@ namespace libplaza {
if(r.status != "success")
return false;
_hcl.DefaultRequestHeaders.Add("X-Access-Token", r.token);
- _=_hcl.DefaultRequestHeaders.Remove("Authorization");
+ _ = _hcl.DefaultRequestHeaders.Remove("Authorization");
return true;
}
-#if DEBUG
- public string GetAuthorizationToken() {
- IEnumerator h=_hcl.DefaultRequestHeaders.GetValues("X-Access-Token").GetEnumerator();
- _ = h.MoveNext();
- return h.Current;
+ ///
+ /// Performs a logout request to the Nightwave API.
+ ///
+ /// If called with await, returns nothing. Otherwise, returns a Task object representing the method call
+ public async Task Logout() {
+ //Any API call errors are assumed to indicate an invalid session
+ // Since the goal of a logout function is to not have a valid session, this is a good thing.
+ if(await CheckSession())
+ _ = await _hcl.PostAsync("/user/logout", null);
+ _ = _hcl.DefaultRequestHeaders.Remove("Authorization");
+ _ = _hcl.DefaultRequestHeaders.Remove("X-Access-Token");
}
-#endif
}
}
diff --git a/testplaza/App.config b/testplaza/App.config
deleted file mode 100644
index 56efbc7..0000000
--- a/testplaza/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/testplaza/Form1.Designer.cs b/testplaza/Form1.Designer.cs
deleted file mode 100644
index 12d5e2a..0000000
--- a/testplaza/Form1.Designer.cs
+++ /dev/null
@@ -1,133 +0,0 @@
-namespace testplaza {
- partial class Form1 {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing) {
- if(disposing && (components != null)) {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent() {
- this.pbAlbumArt = new System.Windows.Forms.PictureBox();
- this.txInfo = new System.Windows.Forms.TextBox();
- this.btRefresh = new System.Windows.Forms.Button();
- this.btLike = new System.Windows.Forms.Button();
- this.btDislike = new System.Windows.Forms.Button();
- this.lbLikes = new System.Windows.Forms.Label();
- this.lbDislikes = new System.Windows.Forms.Label();
- ((System.ComponentModel.ISupportInitialize)(this.pbAlbumArt)).BeginInit();
- this.SuspendLayout();
- //
- // pbAlbumArt
- //
- this.pbAlbumArt.Location = new System.Drawing.Point(12, 12);
- this.pbAlbumArt.Name = "pbAlbumArt";
- this.pbAlbumArt.Size = new System.Drawing.Size(200, 200);
- this.pbAlbumArt.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
- this.pbAlbumArt.TabIndex = 0;
- this.pbAlbumArt.TabStop = false;
- //
- // txInfo
- //
- this.txInfo.Enabled = false;
- this.txInfo.Location = new System.Drawing.Point(218, 12);
- this.txInfo.Multiline = true;
- this.txInfo.Name = "txInfo";
- this.txInfo.Size = new System.Drawing.Size(570, 200);
- this.txInfo.TabIndex = 1;
- //
- // btRefresh
- //
- this.btRefresh.Location = new System.Drawing.Point(218, 218);
- this.btRefresh.Name = "btRefresh";
- this.btRefresh.Size = new System.Drawing.Size(570, 50);
- this.btRefresh.TabIndex = 2;
- this.btRefresh.Text = "Refresh";
- this.btRefresh.UseVisualStyleBackColor = true;
- this.btRefresh.Click += new System.EventHandler(this.BtRefresh_Click);
- //
- // btLike
- //
- this.btLike.Location = new System.Drawing.Point(12, 218);
- this.btLike.Name = "btLike";
- this.btLike.Size = new System.Drawing.Size(81, 50);
- this.btLike.TabIndex = 3;
- this.btLike.Text = "Like";
- this.btLike.UseVisualStyleBackColor = true;
- this.btLike.Click += new System.EventHandler(this.BtLike_Click);
- //
- // btDislike
- //
- this.btDislike.Location = new System.Drawing.Point(121, 218);
- this.btDislike.Name = "btDislike";
- this.btDislike.Size = new System.Drawing.Size(91, 50);
- this.btDislike.TabIndex = 4;
- this.btDislike.Text = "Dislike";
- this.btDislike.UseVisualStyleBackColor = true;
- this.btDislike.Click += new System.EventHandler(this.BtDislike_Click);
- //
- // lbLikes
- //
- this.lbLikes.AutoSize = true;
- this.lbLikes.Location = new System.Drawing.Point(99, 222);
- this.lbLikes.Name = "lbLikes";
- this.lbLikes.Size = new System.Drawing.Size(16, 17);
- this.lbLikes.TabIndex = 5;
- this.lbLikes.Text = "0";
- //
- // lbDislikes
- //
- this.lbDislikes.AutoSize = true;
- this.lbDislikes.Location = new System.Drawing.Point(99, 247);
- this.lbDislikes.Name = "lbDislikes";
- this.lbDislikes.Size = new System.Drawing.Size(16, 17);
- this.lbDislikes.TabIndex = 6;
- this.lbDislikes.Text = "0";
- //
- // Form1
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(800, 280);
- this.Controls.Add(this.lbDislikes);
- this.Controls.Add(this.lbLikes);
- this.Controls.Add(this.btDislike);
- this.Controls.Add(this.btLike);
- this.Controls.Add(this.btRefresh);
- this.Controls.Add(this.txInfo);
- this.Controls.Add(this.pbAlbumArt);
- this.Name = "Form1";
- this.Text = "libplaza validation app";
- ((System.ComponentModel.ISupportInitialize)(this.pbAlbumArt)).EndInit();
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private System.Windows.Forms.PictureBox pbAlbumArt;
- private System.Windows.Forms.TextBox txInfo;
- private System.Windows.Forms.Button btRefresh;
- private System.Windows.Forms.Button btLike;
- private System.Windows.Forms.Button btDislike;
- private System.Windows.Forms.Label lbLikes;
- private System.Windows.Forms.Label lbDislikes;
- }
-}
-
diff --git a/testplaza/Form1.cs b/testplaza/Form1.cs
deleted file mode 100644
index 576c276..0000000
--- a/testplaza/Form1.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System;
-using System.Windows.Forms;
-using libplaza;
-
-namespace testplaza {
- public partial class Form1 : Form {
- public Form1() => InitializeComponent();
- private Nightwave plaza=new Nightwave();
-
- private void BtLike_Click(object sender, EventArgs e) {
-
- }
-
- private void BtDislike_Click(object sender, EventArgs e) {
-
- }
-
- private async void BtRefresh_Click(object sender, EventArgs e) {
- Nightwave.Status now=await plaza.Broadcast();
- txInfo.ResetText();
- txInfo.AppendText($"Plaza is {plaza.Broadcasting}\n");
- if(plaza.Broadcasting == Nightwave.BroadcastStatus.OffAir)
- return;
- lbLikes.Text = now.Likes.ToString();
- lbDislikes.Text = now.Dislikes.ToString();
- txInfo.AppendText($"{now.Listeners} listeners\n");
- txInfo.AppendText($"Playing {now.Title}\n");
- txInfo.AppendText($"From album {now.Album}\n");
- txInfo.AppendText($"By {now.Artist}\n");
- txInfo.AppendText($"Song is {now.Duration}s long\n");
- txInfo.AppendText($"{now.Elapsed}s elapsed (calculated elapsed is {now.CalculatedElapsed}s)\n");
- pbAlbumArt.LoadAsync(now.ArtworkUri);
- txInfo.AppendText($"Album art is at:\n{now.ArtworkUri}\n");
- }
- }
-}
diff --git a/testplaza/Form1.resx b/testplaza/Form1.resx
deleted file mode 100644
index 1af7de1..0000000
--- a/testplaza/Form1.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 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/testplaza/Program.cs b/testplaza/Program.cs
deleted file mode 100644
index 80ab648..0000000
--- a/testplaza/Program.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace testplaza {
- static class Program {
- ///
- /// The main entry point for the application.
- ///
- [STAThread]
- static void Main() {
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new Form1());
- }
- }
-}
diff --git a/testplaza/Properties/AssemblyInfo.cs b/testplaza/Properties/AssemblyInfo.cs
deleted file mode 100644
index 00504dd..0000000
--- a/testplaza/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("testplaza")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("testplaza")]
-[assembly: AssemblyCopyright("Copyright © 2019")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("dab02d69-cd02-4c74-a110-7907e5b4a568")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/testplaza/Properties/Resources.Designer.cs b/testplaza/Properties/Resources.Designer.cs
deleted file mode 100644
index 5dd7e38..0000000
--- a/testplaza/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace testplaza.Properties {
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class 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() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [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("testplaza.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [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/testplaza/Properties/Resources.resx b/testplaza/Properties/Resources.resx
deleted file mode 100644
index af7dbeb..0000000
--- a/testplaza/Properties/Resources.resx
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 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/testplaza/Properties/Settings.Designer.cs b/testplaza/Properties/Settings.Designer.cs
deleted file mode 100644
index 4cd61f6..0000000
--- a/testplaza/Properties/Settings.Designer.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace testplaza.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/testplaza/Properties/Settings.settings b/testplaza/Properties/Settings.settings
deleted file mode 100644
index 3964565..0000000
--- a/testplaza/Properties/Settings.settings
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/testplaza/packages.config b/testplaza/packages.config
deleted file mode 100644
index a75532f..0000000
--- a/testplaza/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/testplaza/testplaza.csproj b/testplaza/testplaza.csproj
deleted file mode 100644
index d5a194c..0000000
--- a/testplaza/testplaza.csproj
+++ /dev/null
@@ -1,93 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {DAB02D69-CD02-4C74-A110-7907E5B4A568}
- WinExe
- testplaza
- testplaza
- v4.7.2
- 512
- true
- true
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- ..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Form
-
-
- Form1.cs
-
-
-
-
- Form1.cs
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
- Designer
-
-
- True
- Resources.resx
-
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
- True
- Settings.settings
- True
-
-
-
-
-
-
-
- {B8CD29C0-4FAF-4A02-B00C-3180E60841D3}
- libplaza
-
-
-
-
\ No newline at end of file