just generally a lot of improvements. the thing now actually Plays Audio

This commit is contained in:
Maff 2019-10-28 22:48:51 +00:00
parent 518e37a16e
commit 693a78e5fd
21 changed files with 667 additions and 99 deletions

197
.editorconfig Normal file
View File

@ -0,0 +1,197 @@
# Remove the line below if you want to inherit .editorconfig settings from higher directories
root = true
# C# files
[*.cs]
#### Core EditorConfig Options ####
# Indentation and spacing
indent_size = 2
indent_style = tab
tab_width = 2
# New line preferences
end_of_line = crlf
insert_final_newline = false
#### .NET Coding Conventions ####
# Organize usings
dotnet_separate_import_directive_groups = true
dotnet_sort_system_directives_first = true
# this. and Me. preferences
dotnet_style_qualification_for_event = false:suggestion
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_style_predefined_type_for_member_access = true:silent
# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:warning
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:warning
# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
# Expression-level preferences
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_throw_expression = true:warning
dotnet_style_coalesce_expression = true:warning
dotnet_style_collection_initializer = true:warning
dotnet_style_explicit_tuple_names = true:warning
dotnet_style_null_propagation = true:warning
dotnet_style_object_initializer = true:warning
dotnet_style_prefer_auto_properties = true:suggestion
dotnet_style_prefer_compound_assignment = true:warning
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
# Field preferences
dotnet_style_readonly_field = false:suggestion
# Parameter preferences
dotnet_code_quality_unused_parameters = all:suggestion
#### C# Coding Conventions ####
# var preferences
csharp_style_var_elsewhere = false:warning
csharp_style_var_for_built_in_types = false:error
csharp_style_var_when_type_is_apparent = false:warning
# Expression-bodied members
csharp_style_expression_bodied_accessors = true:warning
csharp_style_expression_bodied_constructors = true:warning
csharp_style_expression_bodied_indexers = true:warning
csharp_style_expression_bodied_lambdas = true:warning
csharp_style_expression_bodied_local_functions = true:warning
csharp_style_expression_bodied_methods = true:warning
csharp_style_expression_bodied_operators = true:warning
csharp_style_expression_bodied_properties = true:warning
# Pattern matching preferences
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_prefer_switch_expression = true:warning
# Null-checking preferences
csharp_style_conditional_delegate_call = true:warning
# Modifier preferences
csharp_prefer_static_local_function = true:suggestion
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
# Code-block preferences
csharp_prefer_braces = when_multiline:suggestion
csharp_prefer_simple_using_statement = true:suggestion
# Expression-level preferences
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
csharp_style_prefer_index_operator = true:warning
csharp_style_prefer_range_operator = true:warning
csharp_style_unused_value_assignment_preference = discard_variable:error
csharp_style_unused_value_expression_statement_preference = discard_variable:warning
# 'using' directive preferences
csharp_using_directive_placement = outside_namespace:suggestion
#### C# Formatting Rules ####
# New line preferences
csharp_new_line_before_catch = false
csharp_new_line_before_else = false
csharp_new_line_before_finally = false
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_open_brace = none
csharp_new_line_between_query_expression_clauses = true
# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = false
csharp_indent_labels = one_less_than_current
csharp_indent_switch_labels = true
# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = false
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = ignore
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false
# Wrapping preferences
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = false
#### Naming styles ####
# Naming rules
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
# Symbol specifications
dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal
dotnet_naming_symbols.types.required_modifiers =
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal
dotnet_naming_symbols.non_field_members.required_modifiers =
# Naming styles
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

View File

@ -1,13 +1,13 @@
<Window x:Class="WinPlaza.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WinPlaza"
mc:Ignorable="d"
Title="MainWindow" Height="200" Width="480" Background="#FFF0F0F0" ResizeMode="CanMinimize">
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WinPlaza"
mc:Ignorable="d"
Title="Nightwave.Net" Height="200" Width="480" Background="#FFF0F0F0" ResizeMode="CanMinimize">
<Grid>
<Image x:Name="art" HorizontalAlignment="Left" Margin="10,10,0,36" Width="140"/>
<Image x:Name="art" HorizontalAlignment="Left" Margin="10,10,0,36" Width="140" />
<Label x:Name="lbTitle" Content="リサフランク420 / 現代のコンピュ" HorizontalAlignment="Left" Margin="155,10,0,0" VerticalAlignment="Top" FontSize="14" FontWeight="Bold"/>
<Label x:Name="lbArtist" Content="MACプラス Macintosh Plus" HorizontalAlignment="Left" Margin="155,36,0,0" VerticalAlignment="Top"/>
<Label x:Name="lbAlbum" Content="フローラルの専門店 Floral Shoppe" HorizontalAlignment="Left" Margin="155,62,0,0" VerticalAlignment="Top" FontStyle="Italic" FontSize="11"/>
@ -17,13 +17,23 @@
<DockPanel>
<StatusBar Margin="0,0,0,0" DockPanel.Dock="Bottom" VerticalAlignment="Bottom" BorderBrush="#FFDFDFDF" BorderThickness="1">
<StatusBarItem>
<TextBlock Name="sbListeners" />
<TextBlock Name="sbListeners" Text="420 listeners"/>
</StatusBarItem>
</StatusBar>
<Separator/>
<StatusBarItem>
<ToggleButton Name="btPlayPause" Content="⏯" VerticalContentAlignment="Center" Checked="BtPlayPause_Click" Unchecked="BtPlayPause_Click"/>
</StatusBarItem>
<StatusBarItem>
<TextBlock Name="sbStatus" Text="Idle.."/>
</StatusBarItem>
<StatusBarItem HorizontalAlignment="Right" HorizontalContentAlignment="Right">
<TextBlock Name="sbListeningTimers" Text="00:00 (00:00)" Visibility="Hidden"/>
</StatusBarItem>
</StatusBar>
</DockPanel>
<Label x:Name="lbLike" Content="❤" HorizontalAlignment="Right" Margin="0,36,18.6,0" VerticalAlignment="Top" FontSize="10"/>
<Label x:Name="lbLikeCt" Content="0" HorizontalAlignment="Right" Margin="0,34,2.6,0" VerticalAlignment="Top"/>
<Label x:Name="lbDislike" Content="❌" HorizontalAlignment="Right" Margin="0,60,18.6,0" VerticalAlignment="Top" FontSize="10"/>
<Label x:Name="lbDislikeCt" Content="0" HorizontalAlignment="Right" Margin="0,58,2.6,0" VerticalAlignment="Top"/>
<Label x:Name="lbLike" Content="❤" HorizontalAlignment="Right" Margin="0,36,10.667,0" VerticalAlignment="Top" FontSize="10"/>
<Label x:Name="lbLikeCt" Content="0" HorizontalAlignment="Right" Margin="0,35,2.667,0" VerticalAlignment="Top"/>
<Label x:Name="lbDislike" Content="❌" HorizontalAlignment="Right" Margin="0,60,10.667,0" VerticalAlignment="Top" FontSize="10"/>
<Label x:Name="lbDislikeCt" Content="0" HorizontalAlignment="Right" Margin="0,59,2.667,0" VerticalAlignment="Top"/>
</Grid>
</Window>

View File

@ -1,50 +1,153 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Timers;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using libplaza;
using ManagedBass;
namespace WinPlaza {
public partial class MainWindow : Window {
static readonly object BufferLock=new object();
private int BuffCh;
private int BufferReqs;
string LastArtwork="";
Nightwave plaza=new Nightwave();
System.Timers.Timer tRefresh;
Timer tRefresh;
Timer tAudio;
bool AudioInit=false;
public MainWindow() {
InitializeComponent();
tRefresh = new System.Timers.Timer(500) { AutoReset = true };
tRefresh = new Timer(300) { AutoReset = true };
tRefresh.Elapsed += evtRefresh;
tRefresh.Start();
if(!Bass.Init())
sbStatus.Text = "Unable to initialise audio subsystem";
else
AudioInit = true;
if(!AudioInit)
return;
tAudio = new Timer(50);
tAudio.Elapsed += evtAud;
Bass.NetPlaylist = 1;
Bass.NetPreBuffer = 0;
}
private void evtRefresh(object sender, System.Timers.ElapsedEventArgs e) =>
_ = Dispatcher.BeginInvoke(new dgtInvokeRefresh(dgtRefresh));
private delegate void dgtInvokeRefresh();
private async void dgtRefresh() {
Nightwave.Status s=await plaza.Broadcast();
lbArtist.Content = s.Artist;
lbTitle.Content = s.Title;
lbAlbum.Content = s.Album;
slDuration.Maximum = s.Duration;
private void evtAud(object sender, ElapsedEventArgs e) =>
_ = Dispatcher.BeginInvoke(new dgtNoParam(dgtAud));
~MainWindow() {
if(AudioInit)
_ = Bass.Free();
}
private void _Status(string s) => sbStatus.Text = s;
private void SetStatus(string msg) => Dispatcher.BeginInvoke(new dgtStr(_Status), msg);
private void _Title(string s) => Title = s;
private void SetTitle(string msg) => Dispatcher.BeginInvoke(new dgtStr(_Title), msg);
private void LoadUri(string uri) => Task.Factory.StartNew(() => {
int r;
lock(BufferLock)
r = ++BufferReqs;
tAudio.Stop();
_ = Bass.StreamFree(BuffCh);
SetStatus("Connecting stream..");
int stream = Bass.CreateStream(uri, 0, BassFlags.StreamDownloadBlocks | BassFlags.StreamStatus | BassFlags.AutoFree, StatusProc, new IntPtr(r));
lock(BufferLock) {
if(r != BufferReqs) {
if(stream != 0)
_ = Bass.StreamFree(stream);
}
BuffCh = stream;
}
if(BuffCh == 0)
SetStatus("Unable to connect to stream");
else
tAudio.Start();
});
private void StatusProc(IntPtr buf, int len, IntPtr usr) {
if(buf != IntPtr.Zero && len == 0 && usr.ToInt32() == BufferReqs)
SetStatus(Marshal.PtrToStringAnsi(buf));
}
private void EndSync(int hdl, int ch, int dat, IntPtr usr) {
SetStatus("Idle..");
SetTitle("Nightwave.Net");
}
private void MetaSync(int hdl, int ch, int dat, IntPtr usr) => Dispatcher.BeginInvoke(new dgtBool(dgtRefresh), true);
private void evtRefresh(object sender, ElapsedEventArgs e) =>
_ = Dispatcher.BeginInvoke(new dgtBool(dgtRefresh), false);
private delegate void dgtNoParam();
private delegate void dgtBool(bool b);
private delegate void dgtStr(string s);
private async void dgtRefresh(bool Force = false) {
Nightwave.Status s=await plaza.Broadcast(Force);
slDuration.Value = s.CalculatedElapsed;
sbListeners.Text = $"{s.Listeners} listeners";
lbLikeCt.Content = s.Likes;
lbDislikeCt.Content = s.Dislikes;
lbElapsed.Content = $"{(s.CalculatedElapsed / 60).ToString("D")}:{(s.CalculatedElapsed % 60).ToString("D2")}";
lbTime.Content = $"{(s.Duration / 60).ToString("D")}:{(s.Duration % 60).ToString("D2")}";
if(LastArtwork != s.ArtworkUri) {
lbArtist.Content = s.Artist;
lbTitle.Content = s.Title;
lbAlbum.Content = s.Album;
if(btPlayPause.IsChecked == true)
SetTitle($"▶ {s.Title} - {s.Artist}");
slDuration.Maximum = s.Duration;
lbTime.Content = $"{(s.Duration / 60).ToString("D")}:{(s.Duration % 60).ToString("D2")}";
art.Source = new BitmapImage(new Uri(s.ArtworkUri));
LastArtwork = s.ArtworkUri;
}
}
private void dgtAud() {
long progress = Bass.StreamGetFilePosition(BuffCh, FileStreamPosition.Buffer)
* 100 / Bass.StreamGetFilePosition(BuffCh, FileStreamPosition.End);
if(progress > 75 || Bass.StreamGetFilePosition(BuffCh, FileStreamPosition.Connected) == 0) {
tAudio.Stop();
sbStatus.Text = "Playing";
SetTitle($"▶ {lbTitle.Content} - {lbArtist.Content}");
/*
IntPtr icy = Bass.ChannelGetTags(BuffCh, TagType.ICY);
if(icy == IntPtr.Zero)
icy = Bass.ChannelGetTags(BuffCh, TagType.HTTP);
if(icy != IntPtr.Zero) {
foreach(string tag in Extensions.ExtractMultiStringAnsi(icy)) {
string icymeta = string.Empty;
if(tag.StartsWith("icy-name:"))
icymeta += $"ICY Name: {tag.Substring(9)}";
if(tag.StartsWith("icy-url:"))
icymeta += $"ICY Url: {tag.Substring(8)}";
//IcyMeta = icymeta;
}
}*/
_ = Bass.ChannelSetSync(BuffCh, SyncFlags.MetadataReceived, 0, MetaSync);
_ = Bass.ChannelSetSync(BuffCh, SyncFlags.OggChange, 0, MetaSync);
_ = Bass.ChannelSetSync(BuffCh, SyncFlags.End, 0, EndSync);
_ = Bass.ChannelPlay(BuffCh);
} else
sbStatus.Text = $"Buffering... {progress}%";
}
private void PlazaLoad() => LoadUri("https://radio.plaza.one/ogg");
private void PlazaStop() {
lock(BufferLock) {
_ = Bass.StreamFree(BufferReqs);
_ = Bass.StreamFree(BuffCh);
_ = Bass.ChannelStop(BufferReqs);
_ = Bass.ChannelStop(BuffCh);
tAudio.Stop();
SetStatus("Idle..");
SetTitle("Nightwave.Net");
}
}
private void BtPlayPause_Click(object sender, RoutedEventArgs e) {
if(!AudioInit)
return;
if(btPlayPause.IsChecked == true)
_ = Dispatcher.BeginInvoke(new dgtNoParam(PlazaLoad));
else
_ = Dispatcher.BeginInvoke(new dgtNoParam(PlazaStop));
}
}
}

View File

@ -7,12 +7,12 @@ 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("WinPlaza")]
[assembly: AssemblyTitle("Nightwave.Net")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WinPlaza")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyCompany("pup.cloud Software")]
[assembly: AssemblyProduct("Nightwave.Net")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@ -53,3 +53,5 @@ using System.Windows;
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguage("en-GB")]

View File

@ -9,54 +9,165 @@
//------------------------------------------------------------------------------
namespace WinPlaza.Properties {
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if((resourceMan == null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WinPlaza.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WinPlaza.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon conf_157 {
get {
object obj = ResourceManager.GetObject("conf_157", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon mmsys_101 {
get {
object obj = ResourceManager.GetObject("mmsys_101", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon mmsys_102 {
get {
object obj = ResourceManager.GetObject("mmsys_102", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon mmsys_109 {
get {
object obj = ResourceManager.GetObject("mmsys_109", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon mmsys_110 {
get {
object obj = ResourceManager.GetObject("mmsys_110", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon mmsys_112 {
get {
object obj = ResourceManager.GetObject("mmsys_112", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon mmsys_99 {
get {
object obj = ResourceManager.GetObject("mmsys_99", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon mplayer_10 {
get {
object obj = ResourceManager.GetObject("mplayer_10", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon shell32_40 {
get {
object obj = ResourceManager.GetObject("shell32_40", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon sndvol32_301 {
get {
object obj = ResourceManager.GetObject("sndvol32_301", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon sndvol32_302 {
get {
object obj = ResourceManager.GetObject("sndvol32_302", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
}
}

View File

@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@ -60,6 +60,7 @@
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
@ -68,9 +69,10 @@
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
@ -85,9 +87,10 @@
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
@ -109,9 +112,43 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="conf_157" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\conf_157.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="mmsys_101" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\mmsys_101.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="mmsys_102" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\mmsys_102.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="mmsys_109" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\mmsys_109.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="mmsys_110" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\mmsys_110.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="mmsys_112" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\mmsys_112.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="mmsys_99" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\mmsys_99.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="mplayer_10" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\mplayer_10.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="shell32_40" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\shell32_40.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="sndvol32_301" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\sndvol32_301.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="sndvol32_302" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\sndvol32_302.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@ -14,6 +14,29 @@
<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>4</ApplicationRevision>
<ApplicationVersion>1.0.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>
@ -30,16 +53,42 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>
</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Resources\mmsys_109.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>56AE8D286B533A344BB2F6F2F383B107F823DF22</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>WinPlaza_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<PropertyGroup>
<StartupObject>WinPlaza.App</StartupObject>
</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="ManagedBass.Opus, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ManagedBass.Opus.2.0.0\lib\netstandard1.4\ManagedBass.Opus.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" />
@ -94,6 +143,7 @@
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<None Include="WinPlaza_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
@ -104,5 +154,58 @@
<Name>libplaza</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Resources\mmsys_99.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\mmsys_101.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\mmsys_102.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\mmsys_109.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\mmsys_110.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\mmsys_112.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\mplayer_10.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\conf_157.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\shell32_40.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\sndvol32_301.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\sndvol32_302.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>
</ItemGroup>
<ItemGroup>
<Folder Include="bin\Debug\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

BIN
WinPlaza/bass.dll Normal file

Binary file not shown.

View File

@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ManagedBass" version="2.0.4" targetFramework="net472" />
<package id="ManagedBass.Opus" version="2.0.0" targetFramework="net472" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" />
</packages>

View File

@ -45,6 +45,7 @@ namespace libplaza {
public int Elapsed;
public int Duration;
public long Since;
public int ServerTimeOffset;
public int CalculatedElapsed;
public int Likes;
public int Dislikes;
@ -58,9 +59,9 @@ namespace libplaza {
_hcl.DefaultRequestHeaders.Accept.Add(
new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
}
public async Task<Status> Broadcast() {
_bc.CalculatedElapsed = (int)(DateTimeOffset.Now.ToUnixTimeSeconds() - _bc.Since) + _bc.Elapsed;
if(tsLastRefresh+MinRefreshTime >= DateTimeOffset.Now.ToUnixTimeSeconds() && _bc.CalculatedElapsed < _bc.Duration)
public async Task<Status> Broadcast(bool Force=false) {
_bc.CalculatedElapsed = (int)(DateTimeOffset.Now.ToUnixTimeSeconds() - _bc.ServerTimeOffset - _bc.Since) + _bc.Elapsed;
if(!Force && tsLastRefresh+MinRefreshTime >= DateTimeOffset.Now.ToUnixTimeSeconds() && _bc.CalculatedElapsed < _bc.Duration)
return _bc;
try {
Status _=await GetNightwaveAsync();
@ -106,8 +107,10 @@ namespace libplaza {
Likes = j.playback.likes,
Dislikes = j.playback.hates,
Listeners = j.listeners,
ServerTimeOffset = (int)(DateTimeOffset.Now.ToUnixTimeSeconds() - _r.Headers.Date.Value.ToUnixTimeSeconds()),
ArtworkUri = $"{PlazaApi.ArtworkBase}{j.playback.artwork}"
};
status.CalculatedElapsed = (int)(DateTimeOffset.Now.ToUnixTimeSeconds() - status.ServerTimeOffset - j.playback.updated) + j.playback.position;
return status;
}
}