🦀 WinPlaza is gone 🦀
ported WInPlaza to .Net Core 3 which brings with it the tiniest amount of bugfixes.. also made the main window resizable. for now, i'm dropping ClickOnce deployment (don't think .Net Core supports it anyway)
|
@ -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
|
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
|
||||||
|
|
||||||
# Code-block preferences
|
# Code-block preferences
|
||||||
csharp_prefer_braces = when_multiline:suggestion
|
csharp_prefer_braces = false:suggestion
|
||||||
csharp_prefer_simple_using_statement = true:suggestion
|
csharp_prefer_simple_using_statement = true:suggestion
|
||||||
|
|
||||||
# Expression-level preferences
|
# Expression-level preferences
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<Application x:Class="NightwaveForWorkgroups.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:NightwaveForWorkgroups"
|
||||||
|
StartupUri="MainWindow.xaml">
|
||||||
|
</Application>
|
|
@ -6,7 +6,7 @@ using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
namespace WinPlaza {
|
namespace NightwaveForWorkgroups {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for App.xaml
|
/// Interaction logic for App.xaml
|
||||||
/// </summary>
|
/// </summary>
|
|
@ -1,16 +1,16 @@
|
||||||
<Window x:Class="WinPlaza.MainWindow"
|
<Window x:Class="NightwaveForWorkgroups.MainWindow"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:WinPlaza"
|
xmlns:local="clr-namespace:NightwaveForWorkgroups"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Nightwave.Net" Height="206" Width="480" Background="#FFF0F0F0" ResizeMode="CanMinimize" Deactivated="Window_Deactivated" Activated="Window_Activated" UseLayoutRounding="True" Closing="Window_Closing">
|
Title="Nightwave.Net" Height="210" Width="480" MinHeight="210" MinWidth="480" MaxHeight="{Binding ActualWidth, RelativeSource={RelativeSource Self}}" Background="#FFF0F0F0" Deactivated="Window_Deactivated" Activated="Window_Activated" UseLayoutRounding="True" Closing="Window_Closing">
|
||||||
<Window.TaskbarItemInfo>
|
<Window.TaskbarItemInfo>
|
||||||
<TaskbarItemInfo>
|
<TaskbarItemInfo>
|
||||||
<TaskbarItemInfo.ThumbButtonInfos>
|
<TaskbarItemInfo.ThumbButtonInfos>
|
||||||
<ThumbButtonInfo x:Name="tbPlayPause" Description="Play/Stop" Click="TbPlayPause_Click" ImageSource="{DynamicResource tbPlayStop}"/>
|
<ThumbButtonInfo x:Name="tbPlayPause" Description="Play/Stop" Click="TbPlayPause_Click" ImageSource="Resources/playstop.png"/>
|
||||||
<ThumbButtonInfo x:Name="tbMute" Description="Mute/Unmute" Click="TbMute_Click" ImageSource="{DynamicResource tbAudible}"/>
|
<ThumbButtonInfo x:Name="tbMute" Description="Mute/Unmute" Click="TbMute_Click" ImageSource="Resources/unmuted.png"/>
|
||||||
</TaskbarItemInfo.ThumbButtonInfos>
|
</TaskbarItemInfo.ThumbButtonInfos>
|
||||||
</TaskbarItemInfo>
|
</TaskbarItemInfo>
|
||||||
</Window.TaskbarItemInfo>
|
</Window.TaskbarItemInfo>
|
||||||
|
@ -20,12 +20,12 @@
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="148*"/>
|
<ColumnDefinition Width="{Binding Parent.Height, RelativeSource={RelativeSource Self}}" MinWidth="148"/>
|
||||||
<ColumnDefinition Width="163*"/>
|
<ColumnDefinition Width="163*"/>
|
||||||
<ColumnDefinition Width="163*"/>
|
<ColumnDefinition Width="163*"/>
|
||||||
<ColumnDefinition Width="0*"/>
|
<ColumnDefinition Width="0*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Image x:Name="art" Margin="0,0,0,0" Grid.Column="0" Stretch="UniformToFill"/>
|
<Image x:Name="art" Margin="0,0,0,0" Grid.Column="0" Stretch="Uniform"/>
|
||||||
<Label x:Name="lbTitle" Content="Track title" HorizontalAlignment="Left" Margin="2,6,0,0" VerticalAlignment="Top" FontSize="12" FontWeight="Bold" Grid.ColumnSpan="2" Grid.Column="1"/>
|
<Label x:Name="lbTitle" Content="Track title" HorizontalAlignment="Left" Margin="2,6,0,0" VerticalAlignment="Top" FontSize="12" FontWeight="Bold" Grid.ColumnSpan="2" Grid.Column="1"/>
|
||||||
<Label x:Name="lbArtist" Content="Track artist" HorizontalAlignment="Left" Margin="2,28,0,0" VerticalAlignment="Top" FontSize="11" Grid.Column="1"/>
|
<Label x:Name="lbArtist" Content="Track artist" HorizontalAlignment="Left" Margin="2,28,0,0" VerticalAlignment="Top" FontSize="11" Grid.Column="1"/>
|
||||||
<Label x:Name="lbAlbum" Content="Track album" HorizontalAlignment="Left" Margin="2,45,0,0" VerticalAlignment="Top" FontStyle="Italic" FontSize="10" Grid.Column="1" Grid.ColumnSpan="2"/>
|
<Label x:Name="lbAlbum" Content="Track album" HorizontalAlignment="Left" Margin="2,45,0,0" VerticalAlignment="Top" FontStyle="Italic" FontSize="10" Grid.Column="1" Grid.ColumnSpan="2"/>
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
<Button x:Name="btDislike" Content="💔" ToolTip="Dislike this track" IsEnabled="False" HorizontalAlignment="Right" Margin="0,64,2,0" Width="22" Height="20" VerticalAlignment="Top" FontSize="10" Grid.Column="2" Click="BtDislike_Click"/>
|
<Button x:Name="btDislike" Content="💔" ToolTip="Dislike this track" IsEnabled="False" HorizontalAlignment="Right" Margin="0,64,2,0" Width="22" Height="20" VerticalAlignment="Top" FontSize="10" Grid.Column="2" Click="BtDislike_Click"/>
|
||||||
<Label x:Name="lbLikeCt" Content="0" HorizontalAlignment="Right" Margin="0,36.5,22,0" VerticalAlignment="Top" Grid.Column="2" Grid.ColumnSpan="2"/>
|
<Label x:Name="lbLikeCt" Content="0" HorizontalAlignment="Right" Margin="0,36.5,22,0" VerticalAlignment="Top" Grid.Column="2" Grid.ColumnSpan="2"/>
|
||||||
<Label x:Name="lbDislikeCt" Content="0" HorizontalAlignment="Right" Margin="0,60.5,22,0" VerticalAlignment="Top" Grid.Column="2" Grid.ColumnSpan="2"/>
|
<Label x:Name="lbDislikeCt" Content="0" HorizontalAlignment="Right" Margin="0,60.5,22,0" VerticalAlignment="Top" Grid.Column="2" Grid.ColumnSpan="2"/>
|
||||||
<Image x:Name="imLogin" Source="{DynamicResource imUsr}" IsHitTestVisible="False" Panel.ZIndex="1" Width="18" Height="18" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,17,3,0" Grid.Column="2"/>
|
<Image x:Name="imLogin" IsHitTestVisible="False" Panel.ZIndex="1" Width="18" Height="18" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,17,3,0" Grid.Column="2" Source="Resources/usr.png" Stretch="UniformToFill"/>
|
||||||
<Button x:Name="btLogin" Content="" ToolTip="Log into Nightwave Plaza" HorizontalAlignment="Right" Margin="0,16,2,0" Width="22" Height="20" VerticalAlignment="Top" FontSize="9" Grid.Column="2" Click="BtLogin_Click"/>
|
<Button x:Name="btLogin" Content="" ToolTip="Log into Nightwave Plaza" HorizontalAlignment="Right" Margin="0,16,2,0" Width="22" Height="20" VerticalAlignment="Top" FontSize="9" Grid.Column="2" Click="BtLogin_Click"/>
|
||||||
<TextBlock ToolTip="Visit Nightwave Plaza! If you don't have an account, you can make one there!" FontSize="10" FontStyle="Italic" Grid.Column="2" Grid.Row="0" Margin="0,0,2,13" HorizontalAlignment="Right" VerticalAlignment="Bottom" Foreground="#FF5A5A5A">
|
<TextBlock ToolTip="Visit Nightwave Plaza! If you don't have an account, you can make one there!" FontSize="10" FontStyle="Italic" Grid.Column="2" Grid.Row="0" Margin="0,0,2,13" HorizontalAlignment="Right" VerticalAlignment="Bottom" Foreground="#FF5A5A5A">
|
||||||
<Hyperlink NavigateUri="https://plaza.one" RequestNavigate="Hyperlink_RequestNavigate" Foreground="{Binding Parent.Foreground, RelativeSource={RelativeSource Self}}" TextDecorations="{x:Null}" Cursor="ArrowCD" TargetName="Nightwave Plaza">plaza.one</Hyperlink>
|
<Hyperlink NavigateUri="https://plaza.one" RequestNavigate="Hyperlink_RequestNavigate" Foreground="{Binding Parent.Foreground, RelativeSource={RelativeSource Self}}" TextDecorations="{x:Null}" Cursor="ArrowCD" TargetName="Nightwave Plaza">plaza.one</Hyperlink>
|
|
@ -8,16 +8,16 @@ using libplaza;
|
||||||
using ManagedBass;
|
using ManagedBass;
|
||||||
using Meziantou.Framework.Win32;
|
using Meziantou.Framework.Win32;
|
||||||
|
|
||||||
namespace WinPlaza {
|
namespace NightwaveForWorkgroups {
|
||||||
public partial class MainWindow : Window {
|
public partial class MainWindow : Window {
|
||||||
#region StateVars
|
#region StateVars
|
||||||
static readonly object BufferLock=new object();
|
private static readonly object BufferLock=new object();
|
||||||
private int BuffCh;
|
private int BuffCh;
|
||||||
private int BufferReqs;
|
private int BufferReqs;
|
||||||
private int MuteVol=-1;
|
private int MuteVol=-1;
|
||||||
private int GfxWidthStep=-1;
|
private int GfxWidthStep=-1;
|
||||||
private string LastArtwork="";
|
private string LastArtwork="";
|
||||||
private Nightwave plaza=new Nightwave();
|
private readonly Nightwave NwP=new Nightwave();
|
||||||
private Timer tRefresh;
|
private Timer tRefresh;
|
||||||
private Timer tAudio;
|
private Timer tAudio;
|
||||||
private Timer tGfx;
|
private Timer tGfx;
|
||||||
|
@ -32,40 +32,49 @@ namespace WinPlaza {
|
||||||
#endregion
|
#endregion
|
||||||
#region CrossThreadCalls
|
#region CrossThreadCalls
|
||||||
private void Leveller() {
|
private void Leveller() {
|
||||||
if(GfxWidthStep<0)
|
if(GfxWidthStep < 0)
|
||||||
GfxWidthStep = 32768 / (int)chLeftCvs.ActualWidth;
|
GfxWidthStep = 32768 / (int)chLeftCvs.ActualWidth;
|
||||||
chLeft.Width = Bass.ChannelGetLevelLeft(BuffCh) / GfxWidthStep;
|
chLeft.Width = Bass.ChannelGetLevelLeft(BuffCh) / GfxWidthStep;
|
||||||
chRight.Width = Bass.ChannelGetLevelRight(BuffCh) / GfxWidthStep;
|
chRight.Width = Bass.ChannelGetLevelRight(BuffCh) / GfxWidthStep;
|
||||||
}
|
}
|
||||||
private void DgtToggleEnabled(System.Windows.Controls.Control c) =>
|
private void DgtToggleEnabled(System.Windows.Controls.Control c) =>
|
||||||
c.IsEnabled = !c.IsEnabled;
|
c.IsEnabled = !c.IsEnabled;
|
||||||
|
private void DgtStatus(string s) =>
|
||||||
|
sbStatus.Text = s;
|
||||||
|
private void DgtTitle(string s) =>
|
||||||
|
Title = s;
|
||||||
private void SetStatus(string msg) =>
|
private void SetStatus(string msg) =>
|
||||||
Dispatcher.BeginInvoke(new dgtStr(_Status), msg);
|
Dispatcher.BeginInvoke(new dgtStr(DgtStatus), msg);
|
||||||
private void SetTitle(string msg) =>
|
private void SetTitle(string msg) =>
|
||||||
Dispatcher.BeginInvoke(new dgtStr(_Title), msg);
|
Dispatcher.BeginInvoke(new dgtStr(DgtTitle), msg);
|
||||||
private async void DgtStartupLogon() {
|
private async void DgtStartupLogon() {
|
||||||
Credential c=CredentialManager.ReadCredential("Nightwave.NET");
|
Credential c=CredentialManager.ReadCredential("Nightwave.NET");
|
||||||
if(c is null)
|
if(c is null)
|
||||||
return;
|
return;
|
||||||
if(await plaza.Login(c.UserName, c.Password)!=true)
|
try {
|
||||||
|
if(await NwP.Login(c.UserName, c.Password) != true)
|
||||||
|
return;
|
||||||
|
} catch(Exception) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
btLogin.IsEnabled = false;
|
btLogin.IsEnabled = false;
|
||||||
btLogin.Visibility = Visibility.Hidden;
|
btLogin.Visibility = Visibility.Hidden;
|
||||||
imLogin.IsEnabled = false;
|
imLogin.IsEnabled = false;
|
||||||
imLogin.Visibility = Visibility.Hidden;
|
imLogin.Visibility = Visibility.Hidden;
|
||||||
btDislike.IsEnabled = true;
|
btDislike.IsEnabled = true;
|
||||||
btLike.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) {
|
private async void DgtRefresh(bool Force = false) {
|
||||||
|
GfxWidthStep = 32768 / (int)chLeftCvs.ActualWidth;
|
||||||
Status s;
|
Status s;
|
||||||
try {
|
try {
|
||||||
s=await plaza.Status(Force);
|
s = await NwP.Status(Force);
|
||||||
} catch (NullReferenceException) {
|
} catch(NullReferenceException) {
|
||||||
SetStatus("Ran into a problem while fetching now-playing.");
|
SetStatus("Ran into a problem while fetching now-playing.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(s.FaultOccurred||s.InMaintenance) {
|
if(s.FaultOccurred || s.InMaintenance) {
|
||||||
if(s.InMaintenance)
|
if(s.InMaintenance)
|
||||||
SetStatus("Nightwave Plaza is currently in maintenance mode.");
|
SetStatus("Nightwave Plaza is currently in maintenance mode.");
|
||||||
else
|
else
|
||||||
|
@ -79,7 +88,7 @@ namespace WinPlaza {
|
||||||
lbElapsed.Content = $"{(s.CalculatedElapsed / 60).ToString("D")}:{(s.CalculatedElapsed % 60).ToString("D2")}";
|
lbElapsed.Content = $"{(s.CalculatedElapsed / 60).ToString("D")}:{(s.CalculatedElapsed % 60).ToString("D2")}";
|
||||||
if(LastArtwork != s.ArtworkUri || Force) {
|
if(LastArtwork != s.ArtworkUri || Force) {
|
||||||
//TODO should probably break this part out into a separate function cause this feels real messy
|
//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) {
|
switch(v) {
|
||||||
case Vote.Dislike:
|
case Vote.Dislike:
|
||||||
sbVote.Text = "👎";
|
sbVote.Text = "👎";
|
||||||
|
@ -166,7 +175,8 @@ namespace WinPlaza {
|
||||||
else
|
else
|
||||||
tAudio.Start();
|
tAudio.Start();
|
||||||
});
|
});
|
||||||
private void PlazaLoad() => LoadUri("https://radio.plaza.one/ogg");
|
private void PlazaLoad() =>
|
||||||
|
LoadUri("https://radio.plaza.one/ogg");
|
||||||
private void PlazaStop() {
|
private void PlazaStop() {
|
||||||
tGfx.Stop();
|
tGfx.Stop();
|
||||||
lock(BufferLock) {
|
lock(BufferLock) {
|
||||||
|
@ -203,23 +213,22 @@ namespace WinPlaza {
|
||||||
if(!AudioInit)
|
if(!AudioInit)
|
||||||
return;
|
return;
|
||||||
_ = Dispatcher.BeginInvoke(new dgtCtrl(DgtToggleEnabled), btPlayPause);
|
_ = Dispatcher.BeginInvoke(new dgtCtrl(DgtToggleEnabled), btPlayPause);
|
||||||
if(btPlayPause.IsChecked == true)
|
_ = btPlayPause.IsChecked == true
|
||||||
_ = Dispatcher.BeginInvoke(new dgtNoParam(PlazaLoad));
|
? Dispatcher.BeginInvoke(new dgtNoParam(PlazaLoad))
|
||||||
else
|
: Dispatcher.BeginInvoke(new dgtNoParam(PlazaStop));
|
||||||
_ = Dispatcher.BeginInvoke(new dgtNoParam(PlazaStop));
|
|
||||||
_ = Dispatcher.BeginInvoke(new dgtCtrl(DgtToggleEnabled), btPlayPause);
|
_ = Dispatcher.BeginInvoke(new dgtCtrl(DgtToggleEnabled), btPlayPause);
|
||||||
}
|
}
|
||||||
private void SbMute_Click(object sender, RoutedEventArgs e) {
|
private void SbMute_Click(object sender, RoutedEventArgs e) {
|
||||||
if(MuteVol<0) {
|
if(MuteVol < 0) {
|
||||||
MuteVol = Bass.GlobalStreamVolume;
|
MuteVol = Bass.GlobalStreamVolume;
|
||||||
Bass.GlobalStreamVolume = 0;
|
Bass.GlobalStreamVolume = 0;
|
||||||
sbMute.Content = "🔇";
|
sbMute.Content = "🔇";
|
||||||
tbMute.ImageSource = (BitmapImage)FindResource("tbMuted");
|
tbMute.ImageSource = new BitmapImage(new Uri("pack://application:,,,/;component/Resources/muted.png"));
|
||||||
} else {
|
} else {
|
||||||
Bass.GlobalStreamVolume = MuteVol;
|
Bass.GlobalStreamVolume = MuteVol;
|
||||||
MuteVol = -1;
|
MuteVol = -1;
|
||||||
sbMute.Content = "🔊";
|
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) {
|
private void SbVol_MouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e) {
|
||||||
|
@ -227,21 +236,18 @@ namespace WinPlaza {
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
private void SbVol_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) {
|
private void SbVol_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) {
|
||||||
if(MuteVol >= 0)
|
if(MuteVol >= 0 && sbMute.IsChecked == true)
|
||||||
sbMute.IsChecked = false;
|
sbMute.IsChecked = false;
|
||||||
Bass.GlobalStreamVolume = (int)sbVol.Value * 100;
|
Bass.GlobalStreamVolume = (int)sbVol.Value * 100;
|
||||||
}
|
}
|
||||||
private async void BtLogin_Click(object sender, RoutedEventArgs e) {
|
private async void BtLogin_Click(object sender, RoutedEventArgs e) {
|
||||||
_ = Dispatcher.BeginInvoke(new dgtCtrl(DgtToggleEnabled), btLogin);
|
_ = 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)
|
if(_c is null)
|
||||||
return;
|
return;
|
||||||
//#if DEBUG
|
if(!await NwP.Login(_c.UserName, _c.Password)) {
|
||||||
// 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)) {
|
|
||||||
SetStatus("Login failed! Please try again.");
|
SetStatus("Login failed! Please try again.");
|
||||||
_ = Dispatcher.BeginInvoke(new dgtCtrl(DgtToggleEnabled), btLogin);
|
_ = Dispatcher.BeginInvoke(new dgtCtrl(DgtToggleEnabled), btLogin);
|
||||||
return;
|
return;
|
||||||
|
@ -256,7 +262,7 @@ namespace WinPlaza {
|
||||||
throw new Exception("what the fuck");
|
throw new Exception("what the fuck");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!await plaza.CheckSession()) {
|
if(!await NwP.CheckSession()) {
|
||||||
SetStatus("Something went wrong during login! Sorry.");
|
SetStatus("Something went wrong during login! Sorry.");
|
||||||
_ = Dispatcher.BeginInvoke(new dgtCtrl(DgtToggleEnabled), btLogin);
|
_ = Dispatcher.BeginInvoke(new dgtCtrl(DgtToggleEnabled), btLogin);
|
||||||
return;
|
return;
|
||||||
|
@ -268,18 +274,17 @@ namespace WinPlaza {
|
||||||
imLogin.Visibility = Visibility.Hidden;
|
imLogin.Visibility = Visibility.Hidden;
|
||||||
btDislike.IsEnabled = true;
|
btDislike.IsEnabled = true;
|
||||||
btLike.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) {
|
private async void BtLike_Click(object sender, RoutedEventArgs e) {
|
||||||
_ = Dispatcher.BeginInvoke(new dgtCtrl(DgtToggleEnabled), btLike);
|
_ = Dispatcher.BeginInvoke(new dgtCtrl(DgtToggleEnabled), btLike);
|
||||||
Vote v = await plaza.Vote() ?? Vote.Neutral;
|
Vote v = await NwP.Vote() ?? Vote.Neutral;
|
||||||
if(v == Vote.Like)
|
v = v switch {
|
||||||
v = Vote.Favourite;
|
Vote.Like => Vote.Favourite,
|
||||||
else if(v == Vote.Favourite)
|
Vote.Favourite => Vote.Neutral,
|
||||||
v = Vote.Neutral;
|
_ => Vote.Like,
|
||||||
else
|
};
|
||||||
v = Vote.Like;
|
if(await NwP.Vote(v)) {
|
||||||
if(await plaza.Vote(v)) {
|
|
||||||
SetStatus($"Submitted {v}!");
|
SetStatus($"Submitted {v}!");
|
||||||
} else
|
} else
|
||||||
SetStatus($"Something went weird while casting {v}");
|
SetStatus($"Something went weird while casting {v}");
|
||||||
|
@ -289,9 +294,9 @@ namespace WinPlaza {
|
||||||
private async void BtDislike_Click(object sender, RoutedEventArgs e) {
|
private async void BtDislike_Click(object sender, RoutedEventArgs e) {
|
||||||
_ = Dispatcher.BeginInvoke(new dgtCtrl(DgtToggleEnabled), btDislike);
|
_ = Dispatcher.BeginInvoke(new dgtCtrl(DgtToggleEnabled), btDislike);
|
||||||
Vote v = Vote.Dislike;
|
Vote v = Vote.Dislike;
|
||||||
if(await plaza.Vote() == Vote.Dislike)
|
if(await NwP.Vote() == Vote.Dislike)
|
||||||
v = Vote.Neutral;
|
v = Vote.Neutral;
|
||||||
if(await plaza.Vote(v))
|
if(await NwP.Vote(v))
|
||||||
SetStatus($"Submitted {v}!");
|
SetStatus($"Submitted {v}!");
|
||||||
else
|
else
|
||||||
SetStatus($"Something went weird while casting {v}");
|
SetStatus($"Something went weird while casting {v}");
|
||||||
|
@ -300,7 +305,7 @@ namespace WinPlaza {
|
||||||
}
|
}
|
||||||
private void SbOnTop_Click(object sender, RoutedEventArgs e) {
|
private void SbOnTop_Click(object sender, RoutedEventArgs e) {
|
||||||
Topmost = sbOnTop.IsChecked == true;
|
Topmost = sbOnTop.IsChecked == true;
|
||||||
if(tGfx.Enabled)
|
if(tGfx.Enabled && Topmost)
|
||||||
tGfx.Interval = 1000.0 / 60.0;
|
tGfx.Interval = 1000.0 / 60.0;
|
||||||
}
|
}
|
||||||
private void TbPlayPause_Click(object sender, EventArgs e) =>
|
private void TbPlayPause_Click(object sender, EventArgs e) =>
|
||||||
|
@ -350,13 +355,11 @@ namespace WinPlaza {
|
||||||
Bass.NetPlaylist = 1;
|
Bass.NetPlaylist = 1;
|
||||||
Bass.NetPreBuffer = 0;
|
Bass.NetPreBuffer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
~MainWindow() {
|
~MainWindow() {
|
||||||
|
NwP.Dispose();
|
||||||
if(AudioInit)
|
if(AudioInit)
|
||||||
_ = Bass.Free();
|
_ = Bass.Free();
|
||||||
}
|
}
|
||||||
private void _Status(string s) => sbStatus.Text = s;
|
|
||||||
private void _Title(string s) => Title = s;
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
<Product>Nightwave.NET for Workgroups</Product>
|
||||||
|
<Company>Softpup Aesthetics & Petting, p.r.p.l.</Company>
|
||||||
|
<Authors>Maff</Authors>
|
||||||
|
<AssemblyVersion>1.7.0.0</AssemblyVersion>
|
||||||
|
<FileVersion>1.7.0.0</FileVersion>
|
||||||
|
<NeutralLanguage>en-GB</NeutralLanguage>
|
||||||
|
<PackageProjectUrl>https://soft.pup.cloud/Nightwave.NET/</PackageProjectUrl>
|
||||||
|
<RepositoryUrl>https://git.maff.scot/maff/PlazaSharp</RepositoryUrl>
|
||||||
|
<RepositoryType>git</RepositoryType>
|
||||||
|
<PackageLicenseExpression>BSD-3-CLAUSE</PackageLicenseExpression>
|
||||||
|
<Version>1.7.0</Version>
|
||||||
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
|
<ApplicationIcon>Resources\app.ico</ApplicationIcon>
|
||||||
|
<StartupObject>NightwaveForWorkgroups.App</StartupObject>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||||
|
<DefineConstants />
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="bass.dll" />
|
||||||
|
<None Remove="Resources\app.ico" />
|
||||||
|
<None Remove="Resources\app.png" />
|
||||||
|
<None Remove="Resources\music.png" />
|
||||||
|
<None Remove="Resources\muted.png" />
|
||||||
|
<None Remove="Resources\nomusic.png" />
|
||||||
|
<None Remove="Resources\playstop.png" />
|
||||||
|
<None Remove="Resources\unmuted.png" />
|
||||||
|
<None Remove="Resources\usr.ico" />
|
||||||
|
<None Remove="Resources\usr.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="bass.dll">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Resources\app.ico" />
|
||||||
|
<EmbeddedResource Include="Resources\usr.ico" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="ManagedBass" Version="2.0.4" />
|
||||||
|
<PackageReference Include="Meziantou.Framework.Win32.CredentialManager" Version="1.3.4" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\libplaza\libplaza.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="Resources\app.png" />
|
||||||
|
<Resource Include="Resources\music.png" />
|
||||||
|
<Resource Include="Resources\muted.png" />
|
||||||
|
<Resource Include="Resources\nomusic.png" />
|
||||||
|
<Resource Include="Resources\playstop.png" />
|
||||||
|
<Resource Include="Resources\unmuted.png" />
|
||||||
|
<Resource Include="Resources\usr.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Properties\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 560 B After Width: | Height: | Size: 560 B |
Before Width: | Height: | Size: 147 B After Width: | Height: | Size: 147 B |
Before Width: | Height: | Size: 711 B After Width: | Height: | Size: 711 B |
Before Width: | Height: | Size: 162 B After Width: | Height: | Size: 162 B |
Before Width: | Height: | Size: 228 B After Width: | Height: | Size: 228 B |
Before Width: | Height: | Size: 527 B After Width: | Height: | Size: 527 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 396 B After Width: | Height: | Size: 396 B |
|
@ -0,0 +1,33 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<assemblyIdentity version="1.6.3.0" name="NightwaveDotNet.app" />
|
||||||
|
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||||
|
<security>
|
||||||
|
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||||
|
</requestedPrivileges>
|
||||||
|
<applicationRequestMinimum>
|
||||||
|
<PermissionSet Unrestricted="true" ID="Custom" SameSite="site" />
|
||||||
|
<defaultAssemblyRequest permissionSetReference="Custom" />
|
||||||
|
</applicationRequestMinimum>
|
||||||
|
</security>
|
||||||
|
</trustInfo>
|
||||||
|
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||||
|
<application>
|
||||||
|
<!-- Windows 7 -->
|
||||||
|
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
|
||||||
|
<!-- Windows 8 -->
|
||||||
|
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
|
||||||
|
<!-- Windows 8.1 -->
|
||||||
|
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
|
||||||
|
<!-- Windows 10 -->
|
||||||
|
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||||
|
</application>
|
||||||
|
</compatibility>
|
||||||
|
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<windowsSettings>
|
||||||
|
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2,PerMonitor</dpiAwareness>
|
||||||
|
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||||
|
</windowsSettings>
|
||||||
|
</application>
|
||||||
|
</assembly>
|
|
@ -3,24 +3,24 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 16
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 16.0.29306.81
|
VisualStudioVersion = 16.0.29306.81
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
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}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "libplaza", "libplaza\libplaza.csproj", "{B8CD29C0-4FAF-4A02-B00C-3180E60841D3}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NightwaveForWorkgroups", "NightwaveForWorkgroups\NightwaveForWorkgroups.csproj", "{65CB13F7-C784-49F9-9365-B227D8B9D4CA}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
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.ActiveCfg = Debug|Any CPU
|
||||||
{B8CD29C0-4FAF-4A02-B00C-3180E60841D3}.Debug|Any CPU.Build.0 = 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.ActiveCfg = Release|Any CPU
|
||||||
{B8CD29C0-4FAF-4A02-B00C-3180E60841D3}.Release|Any CPU.Build.0 = 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
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<configuration>
|
|
||||||
<startup>
|
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
|
||||||
</startup>
|
|
||||||
</configuration>
|
|
|
@ -1,14 +0,0 @@
|
||||||
<Application x:Class="WinPlaza.App"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:local="clr-namespace:WinPlaza"
|
|
||||||
StartupUri="MainWindow.xaml">
|
|
||||||
<Application.Resources>
|
|
||||||
<BitmapImage x:Key="tbPlaying" UriSource="/WinPlaza;component/Resources/music.png"/>
|
|
||||||
<BitmapImage x:Key="tbStopped" UriSource="/WinPlaza;component/Resources/nomusic.png"/>
|
|
||||||
<BitmapImage x:Key="tbPlayStop" UriSource="/WinPlaza;component/Resources/playstop.png"/>
|
|
||||||
<BitmapImage x:Key="tbMuted" UriSource="/WinPlaza;component/Resources/muted.png"/>
|
|
||||||
<BitmapImage x:Key="tbAudible" UriSource="/WinPlaza;component/Resources/unmuted.png"/>
|
|
||||||
<BitmapImage x:Key="imUsr" UriSource="/WinPlaza;component/Resources/usr.png"/>
|
|
||||||
</Application.Resources>
|
|
||||||
</Application>
|
|
|
@ -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
|
|
||||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
|
||||||
//inside a <PropertyGroup>. For example, if you are using US english
|
|
||||||
//in your source files, set the <UICulture> 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")]
|
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// This code was generated by a tool.
|
|
||||||
// Runtime Version:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version='1.0' encoding='utf-8'?>
|
|
||||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
|
||||||
<Profiles>
|
|
||||||
<Profile Name="(Default)" />
|
|
||||||
</Profiles>
|
|
||||||
<Settings />
|
|
||||||
</SettingsFile>
|
|
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 239 B |
Before Width: | Height: | Size: 1.1 KiB |
|
@ -1,197 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProjectGuid>{72EEB593-D74D-4775-875A-CD0078923EC3}</ProjectGuid>
|
|
||||||
<OutputType>WinExe</OutputType>
|
|
||||||
<RootNamespace>WinPlaza</RootNamespace>
|
|
||||||
<AssemblyName>WinPlaza</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
|
||||||
<Deterministic>true</Deterministic>
|
|
||||||
<IsWebBootstrapper>true</IsWebBootstrapper>
|
|
||||||
<PublishUrl>c:\swpub\plaza\</PublishUrl>
|
|
||||||
<Install>true</Install>
|
|
||||||
<InstallFrom>Web</InstallFrom>
|
|
||||||
<UpdateEnabled>true</UpdateEnabled>
|
|
||||||
<UpdateMode>Background</UpdateMode>
|
|
||||||
<UpdateInterval>7</UpdateInterval>
|
|
||||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
|
||||||
<UpdatePeriodically>false</UpdatePeriodically>
|
|
||||||
<UpdateRequired>false</UpdateRequired>
|
|
||||||
<MapFileExtensions>true</MapFileExtensions>
|
|
||||||
<InstallUrl>https://swdist.ext.maff.scot/nightwave.net/</InstallUrl>
|
|
||||||
<ProductName>Nightwave.Net</ProductName>
|
|
||||||
<PublisherName>Maff</PublisherName>
|
|
||||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
|
||||||
<WebPage>index.html</WebPage>
|
|
||||||
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
|
|
||||||
<ApplicationRevision>1</ApplicationRevision>
|
|
||||||
<ApplicationVersion>1.6.0.%2a</ApplicationVersion>
|
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
|
||||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
|
||||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
|
||||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>
|
|
||||||
</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
|
||||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<ApplicationIcon>Resources\app.ico</ApplicationIcon>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<ManifestCertificateThumbprint>56AE8D286B533A344BB2F6F2F383B107F823DF22</ManifestCertificateThumbprint>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<ManifestKeyFile>WinPlaza_TemporaryKey.pfx</ManifestKeyFile>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<GenerateManifests>true</GenerateManifests>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<SignManifests>false</SignManifests>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<StartupObject>WinPlaza.App</StartupObject>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<SignAssembly>false</SignAssembly>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<AssemblyOriginatorKeyFile>SNSigningKey.snk</AssemblyOriginatorKeyFile>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="ManagedBass, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\ManagedBass.2.0.4\lib\net45\ManagedBass.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Meziantou.Framework.Win32.CredentialManager, Version=1.3.4.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\Meziantou.Framework.Win32.CredentialManager.1.3.4\lib\net461\Meziantou.Framework.Win32.CredentialManager.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Drawing" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="System.Net.Http" />
|
|
||||||
<Reference Include="System.Xaml">
|
|
||||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="WindowsBase" />
|
|
||||||
<Reference Include="PresentationCore" />
|
|
||||||
<Reference Include="PresentationFramework" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ApplicationDefinition Include="App.xaml">
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</ApplicationDefinition>
|
|
||||||
<Page Include="MainWindow.xaml">
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</Page>
|
|
||||||
<Compile Include="App.xaml.cs">
|
|
||||||
<DependentUpon>App.xaml</DependentUpon>
|
|
||||||
<SubType>Code</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="MainWindow.xaml.cs">
|
|
||||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
|
||||||
<SubType>Code</SubType>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs">
|
|
||||||
<SubType>Code</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Properties\Settings.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Settings.settings</DependentUpon>
|
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
|
||||||
</Compile>
|
|
||||||
<None Include="app.manifest" />
|
|
||||||
<None Include="LICENSE.md" />
|
|
||||||
<None Include="packages.config" />
|
|
||||||
<None Include="Properties\Settings.settings">
|
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
|
||||||
</None>
|
|
||||||
<None Include="README.md" />
|
|
||||||
<None Include="SNSigningKey.snk" />
|
|
||||||
<None Include="WinPlaza_TemporaryKey.pfx" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="App.config" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\libplaza\libplaza.csproj">
|
|
||||||
<Project>{b8cd29c0-4faf-4a02-b00c-3180e60841d3}</Project>
|
|
||||||
<Name>libplaza</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedResource Include="Resources\app.ico" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedResource Include="Resources\usr.ico" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName>
|
|
||||||
<Install>true</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
|
||||||
<Install>false</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="bass.dll">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Resource Include="Resources\playstop.png" />
|
|
||||||
<Resource Include="Resources\music.png" />
|
|
||||||
<Resource Include="Resources\usr.png" />
|
|
||||||
<Resource Include="Resources\app.png" />
|
|
||||||
<Resource Include="Resources\muted.png" />
|
|
||||||
<Resource Include="Resources\nomusic.png" />
|
|
||||||
<Resource Include="Resources\unmuted.png" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="bin\Debug\" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
</Project>
|
|
|
@ -1,76 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
|
||||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
|
||||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
|
||||||
<security>
|
|
||||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
|
||||||
<!-- UAC Manifest Options
|
|
||||||
If you want to change the Windows User Account Control level replace the
|
|
||||||
requestedExecutionLevel node with one of the following.
|
|
||||||
|
|
||||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
|
||||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
|
||||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
|
||||||
|
|
||||||
Specifying requestedExecutionLevel element will disable file and registry virtualization.
|
|
||||||
Remove this element if your application requires this virtualization for backwards
|
|
||||||
compatibility.
|
|
||||||
-->
|
|
||||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
|
||||||
</requestedPrivileges>
|
|
||||||
</security>
|
|
||||||
</trustInfo>
|
|
||||||
|
|
||||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
|
||||||
<application>
|
|
||||||
<!-- A list of the Windows versions that this application has been tested on
|
|
||||||
and is designed to work with. Uncomment the appropriate elements
|
|
||||||
and Windows will automatically select the most compatible environment. -->
|
|
||||||
|
|
||||||
<!-- Windows Vista -->
|
|
||||||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
|
|
||||||
|
|
||||||
<!-- Windows 7 -->
|
|
||||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
|
|
||||||
|
|
||||||
<!-- Windows 8 -->
|
|
||||||
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
|
|
||||||
|
|
||||||
<!-- Windows 8.1 -->
|
|
||||||
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
|
|
||||||
|
|
||||||
<!-- Windows 10 -->
|
|
||||||
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
|
|
||||||
|
|
||||||
</application>
|
|
||||||
</compatibility>
|
|
||||||
|
|
||||||
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
|
|
||||||
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
|
|
||||||
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
|
|
||||||
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
|
|
||||||
|
|
||||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
|
||||||
<windowsSettings>
|
|
||||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2,PerMonitor</dpiAwareness>
|
|
||||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
|
||||||
</windowsSettings>
|
|
||||||
</application>
|
|
||||||
|
|
||||||
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
|
|
||||||
<!--
|
|
||||||
<dependency>
|
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity
|
|
||||||
type="win32"
|
|
||||||
name="Microsoft.Windows.Common-Controls"
|
|
||||||
version="6.0.0.0"
|
|
||||||
processorArchitecture="*"
|
|
||||||
publicKeyToken="6595b64144ccf1df"
|
|
||||||
language="*"
|
|
||||||
/>
|
|
||||||
</dependentAssembly>
|
|
||||||
</dependency>
|
|
||||||
-->
|
|
||||||
|
|
||||||
</assembly>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="ManagedBass" version="2.0.4" targetFramework="net472" />
|
|
||||||
<package id="Meziantou.Framework.Win32.CredentialManager" version="1.3.4" targetFramework="net472" />
|
|
||||||
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" />
|
|
||||||
</packages>
|
|
321
libplaza/Main.cs
|
@ -5,161 +5,357 @@ using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Classes and other definitions relating to the <c>Nightwave</c> Plaza API
|
/// Classes and other definitions relating to the <see cref="Nightwave"/> Plaza API
|
||||||
/// </summary>
|
/// </summary>
|
||||||
namespace libplaza {
|
namespace libplaza {
|
||||||
#region API models
|
#region API models
|
||||||
|
/// <summary>
|
||||||
|
/// A transitional class used internally by <see cref="JsonConvert.DeserializeObject{T}(string)"/>
|
||||||
|
/// </summary>
|
||||||
public class PlazaPlayback {
|
public class PlazaPlayback {
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public string artist;
|
public string artist;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public string title;
|
public string title;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public string album;
|
public string album;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public int length;
|
public int length;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public int position;
|
public int position;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public string artwork;
|
public string artwork;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public string artwork_s;
|
public string artwork_s;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public int likes;
|
public int likes;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public int hates;
|
public int hates;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A transitional class used internally by <see cref="JsonConvert.DeserializeObject{T}(string)"/>
|
||||||
|
/// </summary>
|
||||||
public class PlazaJson {
|
public class PlazaJson {
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public bool maintenance;
|
public bool maintenance;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public int listeners;
|
public int listeners;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public long updated_at;
|
public long updated_at;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
[JsonProperty]
|
[JsonProperty]
|
||||||
public PlazaPlayback playback;
|
public PlazaPlayback playback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A transitional class used internally by <see cref="JsonConvert.DeserializeObject{T}(string)"/>
|
||||||
|
/// </summary>
|
||||||
public class PlazaUser {
|
public class PlazaUser {
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public int id;
|
public int id;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public string username;
|
public string username;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public string email;
|
public string email;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public int role;
|
public int role;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public string created_at;
|
public string created_at;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A transitional class used internally by <see cref="JsonConvert.DeserializeObject{T}(string)"/>
|
||||||
|
/// </summary>
|
||||||
public class PlazaVote {
|
public class PlazaVote {
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public string status;
|
public string status;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public int[] ratings;
|
public int[] ratings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A transitional class used internally by <see cref="JsonConvert.DeserializeObject{T}(string)"/>
|
||||||
|
/// </summary>
|
||||||
public class PlazaGetVote {
|
public class PlazaGetVote {
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public int rate;
|
public int rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A transitional class used internally by <see cref="JsonConvert.DeserializeObject{T}(string)"/>
|
||||||
|
/// </summary>
|
||||||
public class PlazaLogoutResult {
|
public class PlazaLogoutResult {
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public string status;
|
public string status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A transitional class used internally by <see cref="JsonConvert.DeserializeObject{T}(string)"/>
|
||||||
|
/// </summary>
|
||||||
public class PlazaLogonResult {
|
public class PlazaLogonResult {
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public string status;
|
public string status;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public string username;
|
public string username;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public string email;
|
public string email;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A representation of a JSON object attribute, used transitionally while processing a deserialized JSON payload
|
||||||
|
/// </summary>
|
||||||
public string token;
|
public string token;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Exceptions
|
#region Exceptions
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An <see cref="Exception"/> object indicating that the <c>Nightwave</c> API is under maintenance
|
/// An <see cref="Exception"/> object indicating that the <see cref="Nightwave"/> API is under maintenance
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class PlazaInMaintenanceException : Exception { }
|
internal class PlazaInMaintenanceException : Exception { }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An <see cref="Exception"/> object indicating that an error or exception occurred when communicating with the <c>Nightwave</c> API.
|
/// An <see cref="Exception"/> object indicating that an error or exception occurred when communicating with the <see cref="Nightwave"/> API.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class PlazaUnavailableException : Exception { }
|
internal class PlazaUnavailableException : Exception { }
|
||||||
#endregion
|
#endregion
|
||||||
#region Type Definitions
|
#region Type Definitions
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A <c>Status</c> object represents the current broadcast information returned by a <c>Nightwave</c> API object.
|
///Represents the current broadcast information returned by a <see cref="Nightwave"/> API object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Status {
|
public class Status {
|
||||||
/// <summary><c>InMaintenance</c> indicates whether the <c>Nightwave</c> API is in maintenance mode</summary>
|
/// <summary>
|
||||||
|
/// Indicates whether the <see cref="Nightwave"/> API is in maintenance mode
|
||||||
|
/// </summary>
|
||||||
public bool InMaintenance;
|
public bool InMaintenance;
|
||||||
/// <summary><c>FaultOccurred</c> indicates whether an exception occurred while querying the <c>Nightwave</c> API</summary>
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether an exception occurred while querying the <see cref="Nightwave"/> API
|
||||||
|
/// </summary>
|
||||||
public bool FaultOccurred;
|
public bool FaultOccurred;
|
||||||
/// <summary><c>Title</c> contains the currently-playing track's title</summary>
|
|
||||||
|
/// <summary>
|
||||||
|
/// Contains the currently-playing track's title
|
||||||
|
/// </summary>
|
||||||
public string Title;
|
public string Title;
|
||||||
/// <summary><c>Artist</c> contains the currently-playing track's creating artist</summary>
|
|
||||||
|
/// <summary>
|
||||||
|
/// Contains the currently-playing track's creating artist
|
||||||
|
/// </summary>
|
||||||
public string Artist;
|
public string Artist;
|
||||||
/// <summary><c>Album</c> contains the currently-playing track's album, if any</summary>
|
|
||||||
|
/// <summary>
|
||||||
|
/// Contains the currently-playing track's album, if any
|
||||||
|
/// </summary>
|
||||||
public string Album;
|
public string Album;
|
||||||
/// <summary><c>ArtworkUri</c> contains a relative URI to the artwork for the currently-playing track</summary>
|
|
||||||
|
/// <summary>
|
||||||
|
/// Contains a relative URI to the artwork for the currently-playing track
|
||||||
|
/// </summary>
|
||||||
public string ArtworkUri;
|
public string ArtworkUri;
|
||||||
/// <summary><c>Elapsed</c> contains an integer value of the elapsed seconds for the current track</summary>
|
|
||||||
|
/// <summary>
|
||||||
|
/// Contains an integer value of the elapsed seconds for the current track
|
||||||
|
/// </summary>
|
||||||
public int Elapsed;
|
public int Elapsed;
|
||||||
/// <summary><c>Duration</c> contains an integer value of the duration in seconds of the current track</summary>
|
|
||||||
|
/// <summary>
|
||||||
|
/// Contains an integer value of the duration in seconds of the current track
|
||||||
|
/// </summary>
|
||||||
public int Duration;
|
public int Duration;
|
||||||
/// <summary><c>Since</c> contains a 64-bit integer value of the epoch timestamp when the broadcast information was updated</summary>
|
|
||||||
|
/// <summary>
|
||||||
|
/// Contains a 64-bit integer value of the epoch timestamp when the broadcast information was updated
|
||||||
|
/// </summary>
|
||||||
public long Since;
|
public long Since;
|
||||||
/// <summary><c>ServerTimeOffset</c> contains an integer value of the time difference between the local computer and the <c>Nightwave</c> API server</summary>
|
|
||||||
|
/// <summary>
|
||||||
|
/// Contains an integer value of the time difference between the local computer and the <see cref="Nightwave"/> API server
|
||||||
|
/// </summary>
|
||||||
public int ServerTimeOffset;
|
public int ServerTimeOffset;
|
||||||
/// <summary><c>CalculatedElapsed</c> returns a dynamically-generated integer value of the elapsed seconds, taking time offsets and time since <see cref="Since"/></summary>
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a dynamically-generated integer value of the elapsed seconds, taking time offsets and time since <see cref="Since"/>
|
||||||
|
/// </summary>
|
||||||
public int CalculatedElapsed =>
|
public int CalculatedElapsed =>
|
||||||
(int)(DateTimeOffset.Now.ToUnixTimeSeconds() - ServerTimeOffset - Since) + Elapsed;
|
(int)(DateTimeOffset.Now.ToUnixTimeSeconds() - ServerTimeOffset - Since) + Elapsed;
|
||||||
/// <summary><c>Likes</c> contains an integer value of the number of likes the currently-playing track has received</summary>
|
|
||||||
|
/// <summary>
|
||||||
|
/// Contains an integer value of the number of likes the currently-playing track has received
|
||||||
|
/// </summary>
|
||||||
public int Likes;
|
public int Likes;
|
||||||
/// <summary><c>Dislikes</c> contains an integer value of the number of dislikes the currently-playing track has received</summary>
|
|
||||||
|
/// <summary>
|
||||||
|
/// Contains an integer value of the number of dislikes the currently-playing track has received
|
||||||
|
/// </summary>
|
||||||
public int Dislikes;
|
public int Dislikes;
|
||||||
/// <summary><c>Listeners</c> contains an integer value of the number of people currently listening to the broadcast</summary>
|
|
||||||
|
/// <summary>
|
||||||
|
/// Contains an integer value of the number of people currently listening to the broadcast
|
||||||
|
/// </summary>
|
||||||
public int Listeners;
|
public int Listeners;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <c>Vote</c> represents the user's disposition towards the currently-playing track.
|
/// Represents the user's disposition towards the currently-playing track.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum Vote {
|
public enum Vote {
|
||||||
/// <summary>To <c>Dislike</c> 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.</summary>
|
/// <summary>
|
||||||
|
/// To <c>Dislike</c> 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.
|
||||||
|
/// </summary>
|
||||||
Dislike = -1,
|
Dislike = -1,
|
||||||
/// <summary>To be of <c>Neutral</c> 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</summary>
|
|
||||||
|
/// <summary>
|
||||||
|
/// To be of <c>Neutral</c> 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
|
||||||
|
/// </summary>
|
||||||
Neutral,
|
Neutral,
|
||||||
/// <summary>To <c>Like</c> 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.</summary>
|
|
||||||
|
/// <summary>
|
||||||
|
/// To <c>Like</c> 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.
|
||||||
|
/// </summary>
|
||||||
Like,
|
Like,
|
||||||
/// <summary>To <c>Favourite</c> is functionally equivalent to <see cref="Like"/>, with the additional effect of adding the track to the user's favourites list.</summary>
|
|
||||||
|
/// <summary>
|
||||||
|
/// To <c>Favourite</c> is functionally equivalent to <see cref="Like"/>, with the additional effect of
|
||||||
|
/// adding the track to the user's favourites list.
|
||||||
|
/// </summary>
|
||||||
Favourite
|
Favourite
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <c>Nightwave</c> is the primary class by which the Nightwave Plaza API can be used.
|
/// <see cref="Nightwave"/> is the primary class by which the Nightwave Plaza API can be used.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Nightwave {
|
public class Nightwave : IDisposable {
|
||||||
/// <summary><c>MinRefreshTime</c> represents the minimum number of seconds that must pass before the cached <c>Status</c> may be invalidated</summary>
|
/// <summary>
|
||||||
public int MinRefreshTime=10;
|
/// <see cref="MinRefreshTime"/> represents the minimum number of seconds that must pass before the cached <see cref="Status"/> may be invalidated
|
||||||
|
/// </summary>
|
||||||
|
public int MinRefreshTime;
|
||||||
private long tsLastRefresh=0;
|
private long tsLastRefresh=0;
|
||||||
private static HttpClient _hcl=new HttpClient();
|
private static HttpClient _hcl=new HttpClient();
|
||||||
private Status _bc;
|
private Status _bc;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new <c>Nightwave</c> instance.
|
/// Creates a new <see cref="Nightwave"/> instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="baseuri">Specify an alternate URI for the API - useful if testing a dev server.</param>
|
/// <param name="baseuri">Specify an alternate URI for the API - useful if testing a dev server.</param>
|
||||||
/// <example>
|
/// <example>
|
||||||
/// To create a <c>Nightwave</c> API object targeting the production Nightwave Plaza API:
|
/// To create a <see cref="Nightwave"/> API object targeting the production Nightwave Plaza API:
|
||||||
/// <code>
|
/// <code>
|
||||||
/// Nightwave nw = new Nightwave();
|
/// <see cref="Nightwave"/> nw = new <see cref="Nightwave"/>();
|
||||||
/// </code>
|
/// </code>
|
||||||
/// To create a <c>Nightwave</c> API object targeting a local server (eg., during development):
|
/// To create a <see cref="Nightwave"/> API object targeting a local server (eg., during development):
|
||||||
/// <code>Nightwave nwd = new Nightwave("http://localhost:8000");</code>
|
/// <code><see cref="Nightwave"/> nwd = new <see cref="Nightwave"/>("http://localhost:8000");</code>
|
||||||
/// </example>
|
/// </example>
|
||||||
public Nightwave(string baseuri = "https://api.plaza.one/") {
|
public Nightwave(string baseuri = "https://api.plaza.one/") {
|
||||||
|
MinRefreshTime = 10;
|
||||||
_hcl.BaseAddress = new Uri(baseuri);
|
_hcl.BaseAddress = new Uri(baseuri);
|
||||||
_hcl.Timeout = TimeSpan.FromSeconds(2);
|
_hcl.Timeout = TimeSpan.FromSeconds(2);
|
||||||
_hcl.DefaultRequestHeaders.Accept.Clear();
|
_hcl.DefaultRequestHeaders.Accept.Clear();
|
||||||
_hcl.DefaultRequestHeaders.Accept.Add(
|
_hcl.DefaultRequestHeaders.Accept.Add(
|
||||||
new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
|
new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// De-initialises the <c>Nightwave</c> API object.
|
/// <see cref="Nightwave"/> object deconstructor. Simply a wrapper to ensure that <see cref="Dispose"/> is called.
|
||||||
|
/// </summary>
|
||||||
|
~Nightwave() =>
|
||||||
|
Dispose();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// De-initialises the <see cref="Nightwave"/> API object.
|
||||||
/// <para>Currently, this is equivalent to synchronously logging out the current session.</para>
|
/// <para>Currently, this is equivalent to synchronously logging out the current session.</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
~Nightwave() {
|
public void Dispose() =>
|
||||||
_ = Task.Run(async () => await Logout());
|
Task.Run(async () => await Logout());
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves the current Nightwave Plaza radio broadcast information, if possible
|
/// Retrieves the current Nightwave Plaza radio broadcast information, if possible
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <example>
|
/// <example>
|
||||||
/// If Nightwave Plaza is broadcasting normally:
|
/// If Nightwave Plaza is broadcasting normally:
|
||||||
/// <code>
|
/// <code>
|
||||||
/// Nightwave n = new Nightwave();
|
/// <see cref="Nightwave"/> n = new Nightwave();
|
||||||
/// Status s = await n.Status();
|
/// <see cref="Status"/> s = await n.Status();
|
||||||
/// Console.WriteLine(s.Title);
|
/// Console.WriteLine(s.Title);
|
||||||
/// </code>
|
/// </code>
|
||||||
/// The Console output would show "リサフランク420 / 現代のコンピュー", if that track were playing.
|
/// 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
|
/// In the event that an HTTP request fails or Nightwave Plaza is in maintenance mode, the appropriate flag will be set
|
||||||
/// <code>
|
/// <code>
|
||||||
/// Nightwave n = new Nightwave();
|
/// <see cref="Nightwave"/> n = new Nightwave();
|
||||||
/// Status s = await n.Status();
|
/// <see cref="Status"/> s = await n.Status();
|
||||||
/// if (s.InMaintenance) {
|
/// if (s.InMaintenance) {
|
||||||
/// Console.WriteLine("In maintenance!");
|
/// Console.WriteLine("In maintenance!");
|
||||||
/// return;
|
/// return;
|
||||||
|
@ -172,13 +368,13 @@ namespace libplaza {
|
||||||
/// The Console output would show "In maintenance!" or "A fault occurred!", depending on the conditions.
|
/// The Console output would show "In maintenance!" or "A fault occurred!", depending on the conditions.
|
||||||
/// </example>
|
/// </example>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// This method has inherent caching, and thus will not necessarily result in the <c>Status</c> object returned being fully fresh.
|
/// This method has inherent caching, and thus will not necessarily result in the <see cref="Status"/> object returned being fully fresh.
|
||||||
/// The <c>Status</c> object being returned may be a cached object UNLESS the <paramref name="Force"/> parameter is true
|
/// The <see cref="Status"/> object being returned may be a cached object UNLESS the <paramref name="Force"/> parameter is true
|
||||||
/// OR the <c>Status</c> object is older than the number of seconds stored by <see cref="MinRefreshTime"/>
|
/// OR the <see cref="Status"/> object is older than the number of seconds stored by <see cref="MinRefreshTime"/>
|
||||||
/// OR <c>Status.CalculatedElapsed</c> is equal to or greater than <c>Status.Duration</c>.
|
/// OR <see cref="Status.CalculatedElapsed"/> is equal to or greater than <see cref="Status.Duration"/>.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="Force">If true, the API will always be queried, and no caching will be performed.</param>
|
/// <param name="Force">If true, the API will always be queried, and no caching will be performed.</param>
|
||||||
/// <returns>A populated <c>Status</c> object describing the current broadcast details.</returns>
|
/// <returns>A populated <see cref="Status"/> object describing the current broadcast details.</returns>
|
||||||
public async Task<Status> Status(bool Force = false) {
|
public async Task<Status> Status(bool Force = false) {
|
||||||
//An API call will ONLY be made if Force is set, if the cached data is "stale",
|
//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.
|
// or if the currently-playing track's elapsed time is more than the track duration.
|
||||||
|
@ -190,6 +386,7 @@ namespace libplaza {
|
||||||
}
|
}
|
||||||
return _bc;
|
return _bc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A basic wrapper around <see cref="GetNightwaveAsync"/> which provides basic error handling.
|
/// A basic wrapper around <see cref="GetNightwaveAsync"/> which provides basic error handling.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -207,8 +404,9 @@ namespace libplaza {
|
||||||
_bc.FaultOccurred = true;
|
_bc.FaultOccurred = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Communicates with the <c>Nightwave</c> API to retrieve the current broadcast information.
|
/// Communicates with the <see cref="Nightwave"/> API to retrieve the current broadcast information.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Returns a <c>Status</c> object representing the current broadcast information.</returns>
|
/// <returns>Returns a <c>Status</c> object representing the current broadcast information.</returns>
|
||||||
/// <exception cref="PlazaUnavailableException">May be thrown in event of a non-success (HTTP/1.1 2XX) return code</exception>
|
/// <exception cref="PlazaUnavailableException">May be thrown in event of a non-success (HTTP/1.1 2XX) return code</exception>
|
||||||
|
@ -236,6 +434,7 @@ namespace libplaza {
|
||||||
};
|
};
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fetches the user's <see cref="Vote"/> for the currently-playing track.
|
/// Fetches the user's <see cref="Vote"/> for the currently-playing track.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -249,6 +448,7 @@ namespace libplaza {
|
||||||
PlazaGetVote r=JsonConvert.DeserializeObject<PlazaGetVote>(await _r.Content.ReadAsStringAsync());
|
PlazaGetVote r=JsonConvert.DeserializeObject<PlazaGetVote>(await _r.Content.ReadAsStringAsync());
|
||||||
return (Vote)r.rate;
|
return (Vote)r.rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Casts the given <see cref="Vote"/> specified in <paramref name="v"/> as the user's vote on the current track.
|
/// Casts the given <see cref="Vote"/> specified in <paramref name="v"/> as the user's vote on the current track.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -262,29 +462,27 @@ namespace libplaza {
|
||||||
if(!_r.IsSuccessStatusCode)
|
if(!_r.IsSuccessStatusCode)
|
||||||
return false;
|
return false;
|
||||||
PlazaVote r=JsonConvert.DeserializeObject<PlazaVote>(await _r.Content.ReadAsStringAsync());
|
PlazaVote r=JsonConvert.DeserializeObject<PlazaVote>(await _r.Content.ReadAsStringAsync());
|
||||||
if(r.status != "success")
|
return r.status == "success";
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An overload method to <see cref="CheckSession"/> to first set the <c>X-Access-Token</c> header to <paramref name="str"/>
|
/// An overload method to <see cref="CheckSession"/> to first set the <c>X-Access-Token</c> header to <paramref name="str"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="str">A valid session token for the <c>Nightwave</c> API</param>
|
/// <param name="str">A valid session token for the <see cref="Nightwave"/> API</param>
|
||||||
/// <returns>A <c>bool</c>ean value indicating whether the token given in <paramref name="str"/> was able to perform an authenticated API request</returns>
|
/// <returns>A <c>bool</c>ean value indicating whether the token given in <paramref name="str"/> was able to perform an authenticated API request</returns>
|
||||||
public async Task<bool> CheckSession(string str) {
|
public async Task<bool> CheckSession(string str) {
|
||||||
_ = _hcl.DefaultRequestHeaders.Remove("X-Access-Token");
|
_ = _hcl.DefaultRequestHeaders.Remove("X-Access-Token");
|
||||||
_hcl.DefaultRequestHeaders.Add("X-Access-Token", str);
|
_hcl.DefaultRequestHeaders.Add("X-Access-Token", str);
|
||||||
return await CheckSession();
|
return await CheckSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs a basic read-only API request to determine whether the session token, if present, is valid.
|
/// Performs a basic read-only API request to determine whether the session token, if present, is valid.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A <c>bool</c>ean value indicating whether the request succeeded</returns>
|
/// <returns>A <c>bool</c>ean value indicating whether the request succeeded</returns>
|
||||||
public async Task<bool> CheckSession() {
|
public async Task<bool> CheckSession() =>
|
||||||
if(await GetUser() != null)
|
await GetUser() != null;
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs a basic read-only API request to fetch the currently-authenticated user's profile details.
|
/// Performs a basic read-only API request to fetch the currently-authenticated user's profile details.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -294,12 +492,11 @@ namespace libplaza {
|
||||||
if(!_r.IsSuccessStatusCode)
|
if(!_r.IsSuccessStatusCode)
|
||||||
return null;
|
return null;
|
||||||
PlazaUser r=JsonConvert.DeserializeObject<PlazaUser>(await _r.Content.ReadAsStringAsync());
|
PlazaUser r=JsonConvert.DeserializeObject<PlazaUser>(await _r.Content.ReadAsStringAsync());
|
||||||
if(r.id <= 0)
|
return r.id <= 0 ? null : r.username;
|
||||||
return null;
|
|
||||||
return r.username;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs a login request to the <c>Nightwave</c> API with the given <paramref name="u">username</paramref> and <paramref name="p">password</paramref>.
|
/// Performs a login request to the <see cref="Nightwave"/> API with the given <paramref name="u">username</paramref> and <paramref name="p">password</paramref>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="u">A <c>string</c> containing the user's username</param>
|
/// <param name="u">A <c>string</c> containing the user's username</param>
|
||||||
/// <param name="p">A <c>string</c> containing the user's password</param>
|
/// <param name="p">A <c>string</c> containing the user's password</param>
|
||||||
|
@ -309,8 +506,9 @@ namespace libplaza {
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public async Task<bool> Login(string u, string p) =>
|
public async Task<bool> Login(string u, string p) =>
|
||||||
await Login(Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes($"{u}:{p}")));
|
await Login(Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes($"{u}:{p}")));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs a login request to the <c>Nightwave</c> API with the given HTTP Basic authentication <paramref name="str">string</paramref>.
|
/// Performs a login request to the <see cref="Nightwave"/> API with the given HTTP Basic authentication <paramref name="str">string</paramref>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="str">A valid HTTP Basic authentication string (<c>md5(username:password)</c>)</param>
|
/// <param name="str">A valid HTTP Basic authentication string (<c>md5(username:password)</c>)</param>
|
||||||
/// <returns>A <c>bool</c>ean value indicating whether the login attempt succeeded</returns>
|
/// <returns>A <c>bool</c>ean value indicating whether the login attempt succeeded</returns>
|
||||||
|
@ -326,8 +524,9 @@ namespace libplaza {
|
||||||
_ = _hcl.DefaultRequestHeaders.Remove("Authorization");
|
_ = _hcl.DefaultRequestHeaders.Remove("Authorization");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs a logout request to the <c>Nightwave</c> API.
|
/// Performs a logout request to the <see cref="Nightwave"/> API.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>If called with <c>await</c>, returns nothing. Otherwise, returns a <c>Task</c> object representing the method call</returns>
|
/// <returns>If called with <c>await</c>, returns nothing. Otherwise, returns a <c>Task</c> object representing the method call</returns>
|
||||||
public async Task Logout() {
|
public async Task Logout() {
|
||||||
|
|
|
@ -1,11 +1,20 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard1.4</TargetFramework>
|
||||||
|
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
||||||
|
<NeutralLanguage>en-GB</NeutralLanguage>
|
||||||
|
<RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||||
|
<DefineConstants />
|
||||||
|
<DocumentationFile>C:\Users\MC185353\source\repos\PlazaSharp\libplaza\libplaza.xml</DocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||||
|
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||||
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
|
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,216 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<doc>
|
||||||
|
<assembly>
|
||||||
|
<name>libplaza</name>
|
||||||
|
</assembly>
|
||||||
|
<members>
|
||||||
|
<member name="T:libplaza.PlazaInMaintenanceException">
|
||||||
|
<summary>
|
||||||
|
An <see cref="T:System.Exception"/> object indicating that the <c>Nightwave</c> API is under maintenance
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:libplaza.PlazaUnavailableException">
|
||||||
|
<summary>
|
||||||
|
An <see cref="T:System.Exception"/> object indicating that an error or exception occurred when communicating with the <c>Nightwave</c> API.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:libplaza.Status">
|
||||||
|
<summary>
|
||||||
|
A <c>Status</c> object represents the current broadcast information returned by a <c>Nightwave</c> API object.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:libplaza.Status.InMaintenance">
|
||||||
|
<summary><c>InMaintenance</c> indicates whether the <c>Nightwave</c> API is in maintenance mode</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:libplaza.Status.FaultOccurred">
|
||||||
|
<summary><c>FaultOccurred</c> indicates whether an exception occurred while querying the <c>Nightwave</c> API</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:libplaza.Status.Title">
|
||||||
|
<summary><c>Title</c> contains the currently-playing track's title</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:libplaza.Status.Artist">
|
||||||
|
<summary><c>Artist</c> contains the currently-playing track's creating artist</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:libplaza.Status.Album">
|
||||||
|
<summary><c>Album</c> contains the currently-playing track's album, if any</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:libplaza.Status.ArtworkUri">
|
||||||
|
<summary><c>ArtworkUri</c> contains a relative URI to the artwork for the currently-playing track</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:libplaza.Status.Elapsed">
|
||||||
|
<summary><c>Elapsed</c> contains an integer value of the elapsed seconds for the current track</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:libplaza.Status.Duration">
|
||||||
|
<summary><c>Duration</c> contains an integer value of the duration in seconds of the current track</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:libplaza.Status.Since">
|
||||||
|
<summary><c>Since</c> contains a 64-bit integer value of the epoch timestamp when the broadcast information was updated</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:libplaza.Status.ServerTimeOffset">
|
||||||
|
<summary><c>ServerTimeOffset</c> contains an integer value of the time difference between the local computer and the <c>Nightwave</c> API server</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:libplaza.Status.CalculatedElapsed">
|
||||||
|
<summary><c>CalculatedElapsed</c> returns a dynamically-generated integer value of the elapsed seconds, taking time offsets and time since <see cref="F:libplaza.Status.Since"/></summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:libplaza.Status.Likes">
|
||||||
|
<summary><c>Likes</c> contains an integer value of the number of likes the currently-playing track has received</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:libplaza.Status.Dislikes">
|
||||||
|
<summary><c>Dislikes</c> contains an integer value of the number of dislikes the currently-playing track has received</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:libplaza.Status.Listeners">
|
||||||
|
<summary><c>Listeners</c> contains an integer value of the number of people currently listening to the broadcast</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:libplaza.Vote">
|
||||||
|
<summary>
|
||||||
|
<c>Vote</c> represents the user's disposition towards the currently-playing track.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:libplaza.Vote.Dislike">
|
||||||
|
<summary>To <c>Dislike</c> 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.</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:libplaza.Vote.Neutral">
|
||||||
|
<summary>To be of <c>Neutral</c> 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</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:libplaza.Vote.Like">
|
||||||
|
<summary>To <c>Like</c> 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.</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:libplaza.Vote.Favourite">
|
||||||
|
<summary>To <c>Favourite</c> is functionally equivalent to <see cref="F:libplaza.Vote.Like"/>, with the additional effect of adding the track to the user's favourites list.</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:libplaza.Nightwave">
|
||||||
|
<summary>
|
||||||
|
<c>Nightwave</c> is the primary class by which the Nightwave Plaza API can be used.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:libplaza.Nightwave.MinRefreshTime">
|
||||||
|
<summary><c>MinRefreshTime</c> represents the minimum number of seconds that must pass before the cached <c>Status</c> may be invalidated</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:libplaza.Nightwave.#ctor(System.String)">
|
||||||
|
<summary>
|
||||||
|
Creates a new <c>Nightwave</c> instance.
|
||||||
|
</summary>
|
||||||
|
<param name="baseuri">Specify an alternate URI for the API - useful if testing a dev server.</param>
|
||||||
|
<example>
|
||||||
|
To create a <c>Nightwave</c> API object targeting the production Nightwave Plaza API:
|
||||||
|
<code>
|
||||||
|
Nightwave nw = new Nightwave();
|
||||||
|
</code>
|
||||||
|
To create a <c>Nightwave</c> API object targeting a local server (eg., during development):
|
||||||
|
<code>Nightwave nwd = new Nightwave("http://localhost:8000");</code>
|
||||||
|
</example>
|
||||||
|
</member>
|
||||||
|
<member name="M:libplaza.Nightwave.Finalize">
|
||||||
|
<summary>
|
||||||
|
De-initialises the <c>Nightwave</c> API object.
|
||||||
|
<para>Currently, this is equivalent to synchronously logging out the current session.</para>
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:libplaza.Nightwave.Status(System.Boolean)">
|
||||||
|
<summary>
|
||||||
|
Retrieves the current Nightwave Plaza radio broadcast information, if possible
|
||||||
|
</summary>
|
||||||
|
<example>
|
||||||
|
If Nightwave Plaza is broadcasting normally:
|
||||||
|
<code>
|
||||||
|
Nightwave n = new Nightwave();
|
||||||
|
Status s = await n.Status();
|
||||||
|
Console.WriteLine(s.Title);
|
||||||
|
</code>
|
||||||
|
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
|
||||||
|
<code>
|
||||||
|
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);
|
||||||
|
</code>
|
||||||
|
The Console output would show "In maintenance!" or "A fault occurred!", depending on the conditions.
|
||||||
|
</example>
|
||||||
|
<remarks>
|
||||||
|
This method has inherent caching, and thus will not necessarily result in the <c>Status</c> object returned being fully fresh.
|
||||||
|
The <c>Status</c> object being returned may be a cached object UNLESS the <paramref name="Force"/> parameter is true
|
||||||
|
OR the <c>Status</c> object is older than the number of seconds stored by <see cref="F:libplaza.Nightwave.MinRefreshTime"/>
|
||||||
|
OR <c>Status.CalculatedElapsed</c> is equal to or greater than <c>Status.Duration</c>.
|
||||||
|
</remarks>
|
||||||
|
<param name="Force">If true, the API will always be queried, and no caching will be performed.</param>
|
||||||
|
<returns>A populated <c>Status</c> object describing the current broadcast details.</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:libplaza.Nightwave.Update">
|
||||||
|
<summary>
|
||||||
|
A basic wrapper around <see cref="M:libplaza.Nightwave.GetNightwaveAsync"/> which provides basic error handling.
|
||||||
|
</summary>
|
||||||
|
<returns>If called with <c>await</c>, returns nothing. If called without, returns a <c>Task</c> object for the method call</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:libplaza.Nightwave.GetNightwaveAsync">
|
||||||
|
<summary>
|
||||||
|
Communicates with the <c>Nightwave</c> API to retrieve the current broadcast information.
|
||||||
|
</summary>
|
||||||
|
<returns>Returns a <c>Status</c> object representing the current broadcast information.</returns>
|
||||||
|
<exception cref="T:libplaza.PlazaUnavailableException">May be thrown in event of a non-success (HTTP/1.1 2XX) return code</exception>
|
||||||
|
<exception cref="T:libplaza.PlazaInMaintenanceException">May be thrown in event that the API indicates it is in maintenance</exception>
|
||||||
|
</member>
|
||||||
|
<member name="M:libplaza.Nightwave.Vote">
|
||||||
|
<summary>
|
||||||
|
Fetches the user's <see cref="M:libplaza.Nightwave.Vote"/> for the currently-playing track.
|
||||||
|
</summary>
|
||||||
|
<returns>A <see cref="M:libplaza.Nightwave.Vote"/> object indicating the user's disposition towards the track. If the vote could not be returned, this will be <c>null</c></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:libplaza.Nightwave.Vote(libplaza.Vote)">
|
||||||
|
<summary>
|
||||||
|
Casts the given <see cref="M:libplaza.Nightwave.Vote"/> specified in <paramref name="v"/> as the user's vote on the current track.
|
||||||
|
</summary>
|
||||||
|
<param name="v">A <see cref="M:libplaza.Nightwave.Vote"/> object indicating the user's disposition towards the current track</param>
|
||||||
|
<returns>A <c>bool</c>ean value indicating the success of the vote operation</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:libplaza.Nightwave.CheckSession(System.String)">
|
||||||
|
<summary>
|
||||||
|
An overload method to <see cref="M:libplaza.Nightwave.CheckSession(System.String)"/> to first set the <c>X-Access-Token</c> header to <paramref name="str"/>
|
||||||
|
</summary>
|
||||||
|
<param name="str">A valid session token for the <c>Nightwave</c> API</param>
|
||||||
|
<returns>A <c>bool</c>ean value indicating whether the token given in <paramref name="str"/> was able to perform an authenticated API request</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:libplaza.Nightwave.CheckSession">
|
||||||
|
<summary>
|
||||||
|
Performs a basic read-only API request to determine whether the session token, if present, is valid.
|
||||||
|
</summary>
|
||||||
|
<returns>A <c>bool</c>ean value indicating whether the request succeeded</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:libplaza.Nightwave.GetUser">
|
||||||
|
<summary>
|
||||||
|
Performs a basic read-only API request to fetch the currently-authenticated user's profile details.
|
||||||
|
</summary>
|
||||||
|
<returns>If successful, returns a <c>string</c> containing the authenticated user's username. If unsuccessful, will return null.</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:libplaza.Nightwave.Login(System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
Performs a login request to the <c>Nightwave</c> API with the given <paramref name="u">username</paramref> and <paramref name="p">password</paramref>.
|
||||||
|
</summary>
|
||||||
|
<param name="u">A <c>string</c> containing the user's username</param>
|
||||||
|
<param name="p">A <c>string</c> containing the user's password</param>
|
||||||
|
<returns>A <c>bool</c>ean value indicating whether the login attempt succeeded</returns>
|
||||||
|
<remarks>
|
||||||
|
Functionally, this method is a wrapper for <see cref="M:libplaza.Nightwave.Login(System.String)"/>, performing the function of generating a Basic authentication string
|
||||||
|
</remarks>
|
||||||
|
</member>
|
||||||
|
<member name="M:libplaza.Nightwave.Login(System.String)">
|
||||||
|
<summary>
|
||||||
|
Performs a login request to the <c>Nightwave</c> API with the given HTTP Basic authentication <paramref name="str">string</paramref>.
|
||||||
|
</summary>
|
||||||
|
<param name="str">A valid HTTP Basic authentication string (<c>md5(username:password)</c>)</param>
|
||||||
|
<returns>A <c>bool</c>ean value indicating whether the login attempt succeeded</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:libplaza.Nightwave.Logout">
|
||||||
|
<summary>
|
||||||
|
Performs a logout request to the <c>Nightwave</c> API.
|
||||||
|
</summary>
|
||||||
|
<returns>If called with <c>await</c>, returns nothing. Otherwise, returns a <c>Task</c> object representing the method call</returns>
|
||||||
|
</member>
|
||||||
|
</members>
|
||||||
|
</doc>
|