diff --git a/.editorconfig b/.editorconfig
index 080e05d..68c5b98 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -93,7 +93,7 @@ csharp_prefer_static_local_function = true:suggestion
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
# Code-block preferences
-csharp_prefer_braces = when_multiline:suggestion
+csharp_prefer_braces = false:suggestion
csharp_prefer_simple_using_statement = true:suggestion
# Expression-level preferences
diff --git a/NightwaveForWorkgroups/App.xaml b/NightwaveForWorkgroups/App.xaml
new file mode 100644
index 0000000..338b81d
--- /dev/null
+++ b/NightwaveForWorkgroups/App.xaml
@@ -0,0 +1,6 @@
+
+
diff --git a/WinPlaza/App.xaml.cs b/NightwaveForWorkgroups/App.xaml.cs
similarity index 89%
rename from WinPlaza/App.xaml.cs
rename to NightwaveForWorkgroups/App.xaml.cs
index b8d9c58..28d4c2c 100644
--- a/WinPlaza/App.xaml.cs
+++ b/NightwaveForWorkgroups/App.xaml.cs
@@ -6,7 +6,7 @@ using System.Linq;
using System.Threading.Tasks;
using System.Windows;
-namespace WinPlaza {
+namespace NightwaveForWorkgroups {
///
/// Interaction logic for App.xaml
///
diff --git a/WinPlaza/LICENSE.md b/NightwaveForWorkgroups/LICENSE.md
similarity index 100%
rename from WinPlaza/LICENSE.md
rename to NightwaveForWorkgroups/LICENSE.md
diff --git a/WinPlaza/MainWindow.xaml b/NightwaveForWorkgroups/MainWindow.xaml
similarity index 83%
rename from WinPlaza/MainWindow.xaml
rename to NightwaveForWorkgroups/MainWindow.xaml
index e9d7422..b238074 100644
--- a/WinPlaza/MainWindow.xaml
+++ b/NightwaveForWorkgroups/MainWindow.xaml
@@ -1,16 +1,16 @@
-
+
-
-
+
+
@@ -20,12 +20,12 @@
-
+
-
+
@@ -36,7 +36,7 @@
-
+ plaza.one
diff --git a/WinPlaza/MainWindow.xaml.cs b/NightwaveForWorkgroups/MainWindow.xaml.cs
similarity index 85%
rename from WinPlaza/MainWindow.xaml.cs
rename to NightwaveForWorkgroups/MainWindow.xaml.cs
index fecc725..e3502af 100644
--- a/WinPlaza/MainWindow.xaml.cs
+++ b/NightwaveForWorkgroups/MainWindow.xaml.cs
@@ -8,16 +8,16 @@ using libplaza;
using ManagedBass;
using Meziantou.Framework.Win32;
-namespace WinPlaza {
+namespace NightwaveForWorkgroups {
public partial class MainWindow : Window {
#region StateVars
- static readonly object BufferLock=new object();
+ private static readonly object BufferLock=new object();
private int BuffCh;
private int BufferReqs;
private int MuteVol=-1;
private int GfxWidthStep=-1;
private string LastArtwork="";
- private Nightwave plaza=new Nightwave();
+ private readonly Nightwave NwP=new Nightwave();
private Timer tRefresh;
private Timer tAudio;
private Timer tGfx;
@@ -32,40 +32,49 @@ namespace WinPlaza {
#endregion
#region CrossThreadCalls
private void Leveller() {
- if(GfxWidthStep<0)
+ if(GfxWidthStep < 0)
GfxWidthStep = 32768 / (int)chLeftCvs.ActualWidth;
chLeft.Width = Bass.ChannelGetLevelLeft(BuffCh) / GfxWidthStep;
chRight.Width = Bass.ChannelGetLevelRight(BuffCh) / GfxWidthStep;
}
private void DgtToggleEnabled(System.Windows.Controls.Control c) =>
c.IsEnabled = !c.IsEnabled;
+ private void DgtStatus(string s) =>
+ sbStatus.Text = s;
+ private void DgtTitle(string s) =>
+ Title = s;
private void SetStatus(string msg) =>
- Dispatcher.BeginInvoke(new dgtStr(_Status), msg);
+ Dispatcher.BeginInvoke(new dgtStr(DgtStatus), msg);
private void SetTitle(string msg) =>
- Dispatcher.BeginInvoke(new dgtStr(_Title), msg);
+ Dispatcher.BeginInvoke(new dgtStr(DgtTitle), msg);
private async void DgtStartupLogon() {
Credential c=CredentialManager.ReadCredential("Nightwave.NET");
if(c is null)
return;
- if(await plaza.Login(c.UserName, c.Password)!=true)
+ try {
+ if(await NwP.Login(c.UserName, c.Password) != true)
+ return;
+ } catch(Exception) {
return;
+ }
btLogin.IsEnabled = false;
btLogin.Visibility = Visibility.Hidden;
imLogin.IsEnabled = false;
imLogin.Visibility = Visibility.Hidden;
btDislike.IsEnabled = true;
btLike.IsEnabled = true;
- SetStatus($"Logged in as {await plaza.GetUser()}");
+ SetStatus($"Logged in as {await NwP.GetUser()}");
}
private async void DgtRefresh(bool Force = false) {
+ GfxWidthStep = 32768 / (int)chLeftCvs.ActualWidth;
Status s;
try {
- s=await plaza.Status(Force);
- } catch (NullReferenceException) {
+ s = await NwP.Status(Force);
+ } catch(NullReferenceException) {
SetStatus("Ran into a problem while fetching now-playing.");
return;
}
- if(s.FaultOccurred||s.InMaintenance) {
+ if(s.FaultOccurred || s.InMaintenance) {
if(s.InMaintenance)
SetStatus("Nightwave Plaza is currently in maintenance mode.");
else
@@ -79,7 +88,7 @@ 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
- Vote v = await plaza.Vote() ?? Vote.Neutral;
+ Vote v = await NwP.Vote() ?? Vote.Neutral;
switch(v) {
case Vote.Dislike:
sbVote.Text = "👎";
@@ -166,7 +175,8 @@ namespace WinPlaza {
else
tAudio.Start();
});
- private void PlazaLoad() => LoadUri("https://radio.plaza.one/ogg");
+ private void PlazaLoad() =>
+ LoadUri("https://radio.plaza.one/ogg");
private void PlazaStop() {
tGfx.Stop();
lock(BufferLock) {
@@ -203,23 +213,22 @@ namespace WinPlaza {
if(!AudioInit)
return;
_ = Dispatcher.BeginInvoke(new dgtCtrl(DgtToggleEnabled), btPlayPause);
- if(btPlayPause.IsChecked == true)
- _ = Dispatcher.BeginInvoke(new dgtNoParam(PlazaLoad));
- else
- _ = Dispatcher.BeginInvoke(new dgtNoParam(PlazaStop));
+ _ = btPlayPause.IsChecked == true
+ ? Dispatcher.BeginInvoke(new dgtNoParam(PlazaLoad))
+ : Dispatcher.BeginInvoke(new dgtNoParam(PlazaStop));
_ = Dispatcher.BeginInvoke(new dgtCtrl(DgtToggleEnabled), btPlayPause);
}
private void SbMute_Click(object sender, RoutedEventArgs e) {
- if(MuteVol<0) {
+ if(MuteVol < 0) {
MuteVol = Bass.GlobalStreamVolume;
Bass.GlobalStreamVolume = 0;
sbMute.Content = "🔇";
- tbMute.ImageSource = (BitmapImage)FindResource("tbMuted");
+ tbMute.ImageSource = new BitmapImage(new Uri("pack://application:,,,/;component/Resources/muted.png"));
} else {
Bass.GlobalStreamVolume = MuteVol;
MuteVol = -1;
sbMute.Content = "🔊";
- tbMute.ImageSource = (BitmapImage)FindResource("tbAudible");
+ tbMute.ImageSource = new BitmapImage(new Uri("pack://application:,,,/;component/Resources/unmuted.png"));
}
}
private void SbVol_MouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e) {
@@ -227,21 +236,18 @@ namespace WinPlaza {
e.Handled = true;
}
private void SbVol_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) {
- if(MuteVol >= 0)
+ if(MuteVol >= 0 && sbMute.IsChecked == true)
sbMute.IsChecked = false;
Bass.GlobalStreamVolume = (int)sbVol.Value * 100;
}
private async void BtLogin_Click(object sender, RoutedEventArgs e) {
_ = Dispatcher.BeginInvoke(new dgtCtrl(DgtToggleEnabled), btLogin);
- CredentialResult _c=CredentialManager.PromptForCredentials(messageText:"Please log into your Nightwave Plaza account", captionText:"Log into plaza.one");
+ CredentialResult _c=CredentialManager.PromptForCredentials(
+ messageText:"Please log into your Nightwave Plaza account",
+ captionText:"Log into plaza.one");
if(_c is null)
return;
-//#if DEBUG
-// Console.WriteLine($"did login work? {await plaza.Login(c.UserName, c.Password)}");
-// Console.WriteLine($"can validate? {await plaza.CheckSession()}");
-// Console.WriteLine($"token is {plaza.GetAuthorizationToken()}");
-//#else
- if(!await plaza.Login(_c.UserName, _c.Password)) {
+ if(!await NwP.Login(_c.UserName, _c.Password)) {
SetStatus("Login failed! Please try again.");
_ = Dispatcher.BeginInvoke(new dgtCtrl(DgtToggleEnabled), btLogin);
return;
@@ -256,7 +262,7 @@ namespace WinPlaza {
throw new Exception("what the fuck");
}
}
- if(!await plaza.CheckSession()) {
+ if(!await NwP.CheckSession()) {
SetStatus("Something went wrong during login! Sorry.");
_ = Dispatcher.BeginInvoke(new dgtCtrl(DgtToggleEnabled), btLogin);
return;
@@ -268,18 +274,17 @@ namespace WinPlaza {
imLogin.Visibility = Visibility.Hidden;
btDislike.IsEnabled = true;
btLike.IsEnabled = true;
- SetStatus($"Logged in as {await plaza.GetUser()}");
+ SetStatus($"Logged in as {await NwP.GetUser()}");
}
private async void BtLike_Click(object sender, RoutedEventArgs e) {
_ = Dispatcher.BeginInvoke(new dgtCtrl(DgtToggleEnabled), btLike);
- Vote v = await plaza.Vote() ?? Vote.Neutral;
- if(v == Vote.Like)
- v = Vote.Favourite;
- else if(v == Vote.Favourite)
- v = Vote.Neutral;
- else
- v = Vote.Like;
- if(await plaza.Vote(v)) {
+ Vote v = await NwP.Vote() ?? Vote.Neutral;
+ v = v switch {
+ Vote.Like => Vote.Favourite,
+ Vote.Favourite => Vote.Neutral,
+ _ => Vote.Like,
+ };
+ if(await NwP.Vote(v)) {
SetStatus($"Submitted {v}!");
} else
SetStatus($"Something went weird while casting {v}");
@@ -289,9 +294,9 @@ namespace WinPlaza {
private async void BtDislike_Click(object sender, RoutedEventArgs e) {
_ = Dispatcher.BeginInvoke(new dgtCtrl(DgtToggleEnabled), btDislike);
Vote v = Vote.Dislike;
- if(await plaza.Vote() == Vote.Dislike)
+ if(await NwP.Vote() == Vote.Dislike)
v = Vote.Neutral;
- if(await plaza.Vote(v))
+ if(await NwP.Vote(v))
SetStatus($"Submitted {v}!");
else
SetStatus($"Something went weird while casting {v}");
@@ -300,7 +305,7 @@ namespace WinPlaza {
}
private void SbOnTop_Click(object sender, RoutedEventArgs e) {
Topmost = sbOnTop.IsChecked == true;
- if(tGfx.Enabled)
+ if(tGfx.Enabled && Topmost)
tGfx.Interval = 1000.0 / 60.0;
}
private void TbPlayPause_Click(object sender, EventArgs e) =>
@@ -350,13 +355,11 @@ namespace WinPlaza {
Bass.NetPlaylist = 1;
Bass.NetPreBuffer = 0;
}
-
~MainWindow() {
+ NwP.Dispose();
if(AudioInit)
_ = Bass.Free();
}
- private void _Status(string s) => sbStatus.Text = s;
- private void _Title(string s) => Title = s;
#endregion
}
}
diff --git a/NightwaveForWorkgroups/NightwaveForWorkgroups.csproj b/NightwaveForWorkgroups/NightwaveForWorkgroups.csproj
new file mode 100644
index 0000000..fa6e7d3
--- /dev/null
+++ b/NightwaveForWorkgroups/NightwaveForWorkgroups.csproj
@@ -0,0 +1,74 @@
+
+
+
+ WinExe
+ netcoreapp3.0
+ true
+ Nightwave.NET for Workgroups
+ Softpup Aesthetics & Petting, p.r.p.l.
+ Maff
+ 1.7.0.0
+ 1.7.0.0
+ en-GB
+ https://soft.pup.cloud/Nightwave.NET/
+ https://git.maff.scot/maff/PlazaSharp
+ git
+ BSD-3-CLAUSE
+ 1.7.0
+ app.manifest
+ Resources\app.ico
+ NightwaveForWorkgroups.App
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Always
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WinPlaza/README.md b/NightwaveForWorkgroups/README.md
similarity index 100%
rename from WinPlaza/README.md
rename to NightwaveForWorkgroups/README.md
diff --git a/WinPlaza/Resources/app.ico b/NightwaveForWorkgroups/Resources/app.ico
similarity index 100%
rename from WinPlaza/Resources/app.ico
rename to NightwaveForWorkgroups/Resources/app.ico
diff --git a/WinPlaza/Resources/app.png b/NightwaveForWorkgroups/Resources/app.png
similarity index 100%
rename from WinPlaza/Resources/app.png
rename to NightwaveForWorkgroups/Resources/app.png
diff --git a/WinPlaza/Resources/music.png b/NightwaveForWorkgroups/Resources/music.png
similarity index 100%
rename from WinPlaza/Resources/music.png
rename to NightwaveForWorkgroups/Resources/music.png
diff --git a/WinPlaza/Resources/muted.png b/NightwaveForWorkgroups/Resources/muted.png
similarity index 100%
rename from WinPlaza/Resources/muted.png
rename to NightwaveForWorkgroups/Resources/muted.png
diff --git a/WinPlaza/Resources/nomusic.png b/NightwaveForWorkgroups/Resources/nomusic.png
similarity index 100%
rename from WinPlaza/Resources/nomusic.png
rename to NightwaveForWorkgroups/Resources/nomusic.png
diff --git a/WinPlaza/Resources/playstop.png b/NightwaveForWorkgroups/Resources/playstop.png
similarity index 100%
rename from WinPlaza/Resources/playstop.png
rename to NightwaveForWorkgroups/Resources/playstop.png
diff --git a/WinPlaza/Resources/unmuted.png b/NightwaveForWorkgroups/Resources/unmuted.png
similarity index 100%
rename from WinPlaza/Resources/unmuted.png
rename to NightwaveForWorkgroups/Resources/unmuted.png
diff --git a/WinPlaza/Resources/usr.ico b/NightwaveForWorkgroups/Resources/usr.ico
similarity index 100%
rename from WinPlaza/Resources/usr.ico
rename to NightwaveForWorkgroups/Resources/usr.ico
diff --git a/WinPlaza/Resources/usr.png b/NightwaveForWorkgroups/Resources/usr.png
similarity index 100%
rename from WinPlaza/Resources/usr.png
rename to NightwaveForWorkgroups/Resources/usr.png
diff --git a/NightwaveForWorkgroups/app.manifest b/NightwaveForWorkgroups/app.manifest
new file mode 100644
index 0000000..254edde
--- /dev/null
+++ b/NightwaveForWorkgroups/app.manifest
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PerMonitorV2,PerMonitor
+ true
+
+
+
\ No newline at end of file
diff --git a/NightwaveForWorkgroups/bass.dll b/NightwaveForWorkgroups/bass.dll
new file mode 100644
index 0000000..e7b2326
Binary files /dev/null and b/NightwaveForWorkgroups/bass.dll differ
diff --git a/PlazaSharp.sln b/PlazaSharp.sln
index a37a53b..9e774aa 100644
--- a/PlazaSharp.sln
+++ b/PlazaSharp.sln
@@ -3,24 +3,24 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
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("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "libplaza", "libplaza\libplaza.csproj", "{B8CD29C0-4FAF-4A02-B00C-3180E60841D3}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NightwaveForWorkgroups", "NightwaveForWorkgroups\NightwaveForWorkgroups.csproj", "{65CB13F7-C784-49F9-9365-B227D8B9D4CA}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {72EEB593-D74D-4775-875A-CD0078923EC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {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
{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
{B8CD29C0-4FAF-4A02-B00C-3180E60841D3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {65CB13F7-C784-49F9-9365-B227D8B9D4CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {65CB13F7-C784-49F9-9365-B227D8B9D4CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {65CB13F7-C784-49F9-9365-B227D8B9D4CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {65CB13F7-C784-49F9-9365-B227D8B9D4CA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/WinPlaza/App.config b/WinPlaza/App.config
deleted file mode 100644
index 56efbc7..0000000
--- a/WinPlaza/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/WinPlaza/App.xaml b/WinPlaza/App.xaml
deleted file mode 100644
index 7ae2587..0000000
--- a/WinPlaza/App.xaml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/WinPlaza/Properties/AssemblyInfo.cs b/WinPlaza/Properties/AssemblyInfo.cs
deleted file mode 100644
index 9d6e60e..0000000
--- a/WinPlaza/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Windows;
-
-// 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("Nightwave.Net")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("pup.cloud Software")]
-[assembly: AssemblyProduct("Nightwave.Net")]
-[assembly: AssemblyCopyright("")]
-[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)]
-
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
-)]
-
-
-// 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.1.0.0")]
-[assembly: AssemblyFileVersion("1.1.0.0")]
-[assembly: NeutralResourcesLanguage("en-GB")]
-
diff --git a/WinPlaza/Properties/Settings.Designer.cs b/WinPlaza/Properties/Settings.Designer.cs
deleted file mode 100644
index a98fd4e..0000000
--- a/WinPlaza/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 WinPlaza.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/WinPlaza/Properties/Settings.settings b/WinPlaza/Properties/Settings.settings
deleted file mode 100644
index 033d7a5..0000000
--- a/WinPlaza/Properties/Settings.settings
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/WinPlaza/Resources/muted.ico b/WinPlaza/Resources/muted.ico
deleted file mode 100644
index 00a2c23..0000000
Binary files a/WinPlaza/Resources/muted.ico and /dev/null differ
diff --git a/WinPlaza/Resources/nomusic.ico b/WinPlaza/Resources/nomusic.ico
deleted file mode 100644
index 227c96d..0000000
Binary files a/WinPlaza/Resources/nomusic.ico and /dev/null differ
diff --git a/WinPlaza/Resources/nomusic1.png b/WinPlaza/Resources/nomusic1.png
deleted file mode 100644
index 469754b..0000000
Binary files a/WinPlaza/Resources/nomusic1.png and /dev/null differ
diff --git a/WinPlaza/Resources/unmuted.ico b/WinPlaza/Resources/unmuted.ico
deleted file mode 100644
index f63903f..0000000
Binary files a/WinPlaza/Resources/unmuted.ico and /dev/null differ
diff --git a/WinPlaza/SNSigningKey.snk b/WinPlaza/SNSigningKey.snk
deleted file mode 100644
index 84a38fb..0000000
Binary files a/WinPlaza/SNSigningKey.snk and /dev/null differ
diff --git a/WinPlaza/WinPlaza.csproj b/WinPlaza/WinPlaza.csproj
deleted file mode 100644
index 851c8d6..0000000
--- a/WinPlaza/WinPlaza.csproj
+++ /dev/null
@@ -1,197 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {72EEB593-D74D-4775-875A-CD0078923EC3}
- WinExe
- WinPlaza
- WinPlaza
- v4.7.2
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
- true
- true
- true
- c:\swpub\plaza\
- true
- Web
- true
- Background
- 7
- Days
- false
- false
- true
- https://swdist.ext.maff.scot/nightwave.net/
- Nightwave.Net
- Maff
- true
- index.html
- false
- 1
- 1.6.0.%2a
- false
- true
- true
- true
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
-
-
- prompt
- 4
- true
- false
-
-
- Resources\app.ico
-
-
- 56AE8D286B533A344BB2F6F2F383B107F823DF22
-
-
- WinPlaza_TemporaryKey.pfx
-
-
- true
-
-
- false
-
-
- WinPlaza.App
-
-
- app.manifest
-
-
- false
-
-
- SNSigningKey.snk
-
-
-
- ..\packages\ManagedBass.2.0.4\lib\net45\ManagedBass.dll
-
-
- ..\packages\Meziantou.Framework.Win32.CredentialManager.1.3.4\lib\net461\Meziantou.Framework.Win32.CredentialManager.dll
-
-
- ..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll
-
-
-
-
-
-
-
-
-
-
-
- 4.0
-
-
-
-
-
-
-
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
-
-
- App.xaml
- Code
-
-
- MainWindow.xaml
- Code
-
-
-
-
- Code
-
-
- True
- Settings.settings
- True
-
-
-
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
-
-
-
-
-
-
-
-
- {b8cd29c0-4faf-4a02-b00c-3180e60841d3}
- libplaza
-
-
-
-
-
-
-
-
-
-
- False
- Microsoft .NET Framework 4.7.2 %28x86 and x64%29
- true
-
-
- False
- .NET Framework 3.5 SP1
- false
-
-
-
-
- Always
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/WinPlaza/app.manifest b/WinPlaza/app.manifest
deleted file mode 100644
index 4256b0e..0000000
--- a/WinPlaza/app.manifest
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PerMonitorV2,PerMonitor
- true
-
-
-
-
-
-
-
diff --git a/WinPlaza/bass.dll b/WinPlaza/bass.dll
deleted file mode 100644
index c88ddc9..0000000
Binary files a/WinPlaza/bass.dll and /dev/null differ
diff --git a/WinPlaza/packages.config b/WinPlaza/packages.config
deleted file mode 100644
index 3748f5f..0000000
--- a/WinPlaza/packages.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libplaza/Main.cs b/libplaza/Main.cs
index cd27bbd..1127891 100644
--- a/libplaza/Main.cs
+++ b/libplaza/Main.cs
@@ -5,161 +5,357 @@ using System.Threading.Tasks;
using Newtonsoft.Json;
///
-/// Classes and other definitions relating to the Nightwave Plaza API
+/// Classes and other definitions relating to the Plaza API
///
namespace libplaza {
#region API models
+ ///
+ /// A transitional class used internally by
+ ///
public class PlazaPlayback {
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public string artist;
+
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public string title;
+
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public string album;
+
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public int length;
+
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public int position;
+
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public string artwork;
+
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public string artwork_s;
+
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public int likes;
+
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public int hates;
+
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
}
+
+ ///
+ /// A transitional class used internally by
+ ///
public class PlazaJson {
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public bool maintenance;
+
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public int listeners;
+
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public long updated_at;
+
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
[JsonProperty]
public PlazaPlayback playback;
}
+
+ ///
+ /// A transitional class used internally by
+ ///
public class PlazaUser {
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public int id;
+
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public string username;
+
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public string email;
+
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public int role;
+
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public string created_at;
}
+
+ ///
+ /// A transitional class used internally by
+ ///
public class PlazaVote {
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public string status;
+
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public int[] ratings;
}
+
+ ///
+ /// A transitional class used internally by
+ ///
public class PlazaGetVote {
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public int rate;
}
+
+ ///
+ /// A transitional class used internally by
+ ///
public class PlazaLogoutResult {
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public string status;
}
+
+ ///
+ /// A transitional class used internally by
+ ///
public class PlazaLogonResult {
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public string status;
+
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public string username;
+
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public string email;
+
+ ///
+ /// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
+ ///
public string token;
}
#endregion
#region Exceptions
///
- /// An object indicating that the Nightwave API is under maintenance
+ /// An object indicating that the API is under maintenance
///
internal class PlazaInMaintenanceException : Exception { }
+
///
- /// An object indicating that an error or exception occurred when communicating with the Nightwave API.
+ /// An object indicating that an error or exception occurred when communicating with the API.
///
internal class PlazaUnavailableException : Exception { }
#endregion
#region Type Definitions
///
- /// A Status object represents the current broadcast information returned by a Nightwave API object.
+ ///Represents the current broadcast information returned by a API object.
///
public class Status {
- /// InMaintenance indicates whether the Nightwave API is in maintenance mode
+ ///
+ /// Indicates whether the API is in maintenance mode
+ ///
public bool InMaintenance;
- /// FaultOccurred indicates whether an exception occurred while querying the Nightwave API
+
+ ///
+ /// Indicates whether an exception occurred while querying the API
+ ///
public bool FaultOccurred;
- /// Title contains the currently-playing track's title
+
+ ///
+ /// Contains the currently-playing track's title
+ ///
public string Title;
- /// Artist contains the currently-playing track's creating artist
+
+ ///
+ /// Contains the currently-playing track's creating artist
+ ///
public string Artist;
- /// Album contains the currently-playing track's album, if any
+
+ ///
+ /// 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
+
+ ///
+ /// 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
+
+ ///
+ /// 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
+
+ ///
+ /// 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
+
+ ///
+ /// 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
+
+ ///
+ /// Contains an integer value of the time difference between the local computer and the API server
+ ///
public int ServerTimeOffset;
- /// CalculatedElapsed returns a dynamically-generated integer value of the elapsed seconds, taking time offsets and time since
+
+ ///
+ /// 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
+
+ ///
+ /// 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
+
+ ///
+ /// 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
+
+ ///
+ /// 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.
+ /// 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.
+ ///
+ /// 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
+
+ ///
+ /// 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.
+
+ ///
+ /// 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.
+
+ ///
+ /// 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.
+ /// 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;
+ public class Nightwave : IDisposable {
+ ///
+ /// represents the minimum number of seconds that must pass before the cached may be invalidated
+ ///
+ public int MinRefreshTime;
private long tsLastRefresh=0;
private static HttpClient _hcl=new HttpClient();
private Status _bc;
+
///
- /// Creates a new Nightwave instance.
+ /// Creates a new 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:
+ /// To create a API object targeting the production Nightwave Plaza API:
///
- /// Nightwave nw = new Nightwave();
+ /// nw = new ();
///
- /// To create a Nightwave API object targeting a local server (eg., during development):
- /// Nightwave nwd = new Nightwave("http://localhost:8000");
+ /// To create a API object targeting a local server (eg., during development):
+ /// nwd = new ("http://localhost:8000");
///
public Nightwave(string baseuri = "https://api.plaza.one/") {
+ MinRefreshTime = 10;
_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"));
}
+
///
- /// De-initialises the Nightwave API object.
+ /// object deconstructor. Simply a wrapper to ensure that is called.
+ ///
+ ~Nightwave() =>
+ Dispose();
+
+ ///
+ /// De-initialises the API object.
/// Currently, this is equivalent to synchronously logging out the current session.
///
- ~Nightwave() {
- _ = Task.Run(async () => await Logout());
- }
+ public void Dispose() =>
+ 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();
+ /// n = new Nightwave();
+ /// 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();
+ /// n = new Nightwave();
+ /// s = await n.Status();
/// if (s.InMaintenance) {
/// Console.WriteLine("In maintenance!");
/// return;
@@ -172,13 +368,13 @@ namespace libplaza {
/// 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.
+ /// This method has inherent caching, and thus will not necessarily result in the object returned being fully fresh.
+ /// The object being returned may be a cached object UNLESS the parameter is true
+ /// OR the object is older than the number of seconds stored by
+ /// OR is equal to or greater than .
///
/// If true, the API will always be queried, and no caching will be performed.
- /// A populated Status object describing the current broadcast details.
+ /// A populated 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.
@@ -190,6 +386,7 @@ namespace libplaza {
}
return _bc;
}
+
///
/// A basic wrapper around which provides basic error handling.
///
@@ -207,8 +404,9 @@ namespace libplaza {
_bc.FaultOccurred = true;
}
}
+
///
- /// Communicates with the Nightwave API to retrieve the current broadcast information.
+ /// Communicates with the 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
@@ -236,6 +434,7 @@ namespace libplaza {
};
return status;
}
+
///
/// Fetches the user's for the currently-playing track.
///
@@ -249,6 +448,7 @@ namespace libplaza {
PlazaGetVote r=JsonConvert.DeserializeObject(await _r.Content.ReadAsStringAsync());
return (Vote)r.rate;
}
+
///
/// Casts the given specified in as the user's vote on the current track.
///
@@ -262,29 +462,27 @@ namespace libplaza {
if(!_r.IsSuccessStatusCode)
return false;
PlazaVote r=JsonConvert.DeserializeObject(await _r.Content.ReadAsStringAsync());
- if(r.status != "success")
- return false;
- return true;
+ return r.status == "success";
}
+
///
/// An overload method to to first set the X-Access-Token header to
///
- /// A valid session token for the Nightwave API
+ /// A valid session token for the 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.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;
- }
+ public async Task CheckSession() =>
+ await GetUser() != null;
+
///
/// Performs a basic read-only API request to fetch the currently-authenticated user's profile details.
///
@@ -294,12 +492,11 @@ namespace libplaza {
if(!_r.IsSuccessStatusCode)
return null;
PlazaUser r=JsonConvert.DeserializeObject(await _r.Content.ReadAsStringAsync());
- if(r.id <= 0)
- return null;
- return r.username;
+ return r.id <= 0 ? null : r.username;
}
+
///
- /// Performs a login request to the Nightwave API with the given username and password.
+ /// Performs a login request to the API with the given username and password.
///
/// A string containing the user's username
/// A string containing the user's password
@@ -309,8 +506,9 @@ namespace libplaza {
///
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.
+ /// Performs a login request to the 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
@@ -326,8 +524,9 @@ namespace libplaza {
_ = _hcl.DefaultRequestHeaders.Remove("Authorization");
return true;
}
+
///
- /// Performs a logout request to the Nightwave API.
+ /// Performs a logout request to the API.
///
/// If called with await, returns nothing. Otherwise, returns a Task object representing the method call
public async Task Logout() {
diff --git a/libplaza/libplaza.csproj b/libplaza/libplaza.csproj
index 6a41cc6..4b9d3ce 100644
--- a/libplaza/libplaza.csproj
+++ b/libplaza/libplaza.csproj
@@ -1,11 +1,20 @@
- netstandard2.0
+ netstandard1.4
+ false
+ en-GB
+ false
+
+
+
+
+ C:\Users\MC185353\source\repos\PlazaSharp\libplaza\libplaza.xml
+
diff --git a/libplaza/libplaza.xml b/libplaza/libplaza.xml
new file mode 100644
index 0000000..c0f59e4
--- /dev/null
+++ b/libplaza/libplaza.xml
@@ -0,0 +1,216 @@
+
+
+
+ libplaza
+
+
+
+
+ An object indicating that the Nightwave API is under maintenance
+
+
+
+
+ An object indicating that an error or exception occurred when communicating with the Nightwave API.
+
+
+
+
+ A Status object represents the current broadcast information returned by a Nightwave API object.
+
+
+
+ InMaintenance indicates whether the Nightwave API is in maintenance mode
+
+
+ FaultOccurred indicates whether an exception occurred while querying the Nightwave API
+
+
+ Title contains the currently-playing track's title
+
+
+ Artist contains the currently-playing track's creating artist
+
+
+ Album contains the currently-playing track's album, if any
+
+
+ ArtworkUri contains a relative URI to the artwork for the currently-playing track
+
+
+ Elapsed contains an integer value of the elapsed seconds for the current track
+
+
+ Duration contains an integer value of the duration in seconds of the current track
+
+
+ Since contains a 64-bit integer value of the epoch timestamp when the broadcast information was updated
+
+
+ ServerTimeOffset contains an integer value of the time difference between the local computer and the Nightwave API server
+
+
+ CalculatedElapsed returns a dynamically-generated integer value of the elapsed seconds, taking time offsets and time since
+
+
+ Likes contains an integer value of the number of likes the currently-playing track has received
+
+
+ Dislikes contains an integer value of the number of dislikes the currently-playing track has received
+
+
+ Listeners contains an integer value of the number of people currently listening to the broadcast
+
+
+
+ Vote represents the user's disposition towards the currently-playing track.
+
+
+
+ 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.
+
+
+ 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
+
+
+ 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.
+
+
+ To Favourite is functionally equivalent to , with the additional effect of adding the track to the user's favourites list.
+
+
+
+ Nightwave is the primary class by which the Nightwave Plaza API can be used.
+
+
+
+ MinRefreshTime represents the minimum number of seconds that must pass before the cached Status may be invalidated
+
+
+
+ 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");
+
+
+
+
+ De-initialises the Nightwave API object.
+ Currently, this is equivalent to synchronously logging out the current session.
+
+
+
+
+ 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.
+
+
+
+ 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
+
+
+
+ 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
+
+
+
+ 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
+
+
+
+ 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
+
+
+
+ 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
+
+
+
+ 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
+
+
+
+ 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.
+
+
+
+ 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
+
+
+
+
+ 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
+
+
+
+ Performs a logout request to the Nightwave API.
+
+ If called with await, returns nothing. Otherwise, returns a Task object representing the method call
+
+
+