diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..080e05d
--- /dev/null
+++ b/.editorconfig
@@ -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
diff --git a/WinPlaza/MainWindow.xaml b/WinPlaza/MainWindow.xaml
index 3b79129..4264337 100644
--- a/WinPlaza/MainWindow.xaml
+++ b/WinPlaza/MainWindow.xaml
@@ -1,13 +1,13 @@
+ 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">
-
+
@@ -17,13 +17,23 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
diff --git a/WinPlaza/MainWindow.xaml.cs b/WinPlaza/MainWindow.xaml.cs
index 6684779..b4256af 100644
--- a/WinPlaza/MainWindow.xaml.cs
+++ b/WinPlaza/MainWindow.xaml.cs
@@ -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));
+ }
}
}
diff --git a/WinPlaza/Properties/AssemblyInfo.cs b/WinPlaza/Properties/AssemblyInfo.cs
index f22ebe6..5da1f48 100644
--- a/WinPlaza/Properties/AssemblyInfo.cs
+++ b/WinPlaza/Properties/AssemblyInfo.cs
@@ -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")]
+
diff --git a/WinPlaza/Properties/Resources.Designer.cs b/WinPlaza/Properties/Resources.Designer.cs
index 6126935..6bebd9d 100644
--- a/WinPlaza/Properties/Resources.Designer.cs
+++ b/WinPlaza/Properties/Resources.Designer.cs
@@ -9,54 +9,165 @@
//------------------------------------------------------------------------------
namespace WinPlaza.Properties {
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if((resourceMan == null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WinPlaza.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
- }
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "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() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WinPlaza.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
+ ///
+ internal static System.Drawing.Icon conf_157 {
+ get {
+ object obj = ResourceManager.GetObject("conf_157", resourceCulture);
+ return ((System.Drawing.Icon)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
+ ///
+ internal static System.Drawing.Icon mmsys_101 {
+ get {
+ object obj = ResourceManager.GetObject("mmsys_101", resourceCulture);
+ return ((System.Drawing.Icon)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
+ ///
+ internal static System.Drawing.Icon mmsys_102 {
+ get {
+ object obj = ResourceManager.GetObject("mmsys_102", resourceCulture);
+ return ((System.Drawing.Icon)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
+ ///
+ internal static System.Drawing.Icon mmsys_109 {
+ get {
+ object obj = ResourceManager.GetObject("mmsys_109", resourceCulture);
+ return ((System.Drawing.Icon)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
+ ///
+ internal static System.Drawing.Icon mmsys_110 {
+ get {
+ object obj = ResourceManager.GetObject("mmsys_110", resourceCulture);
+ return ((System.Drawing.Icon)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
+ ///
+ internal static System.Drawing.Icon mmsys_112 {
+ get {
+ object obj = ResourceManager.GetObject("mmsys_112", resourceCulture);
+ return ((System.Drawing.Icon)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
+ ///
+ internal static System.Drawing.Icon mmsys_99 {
+ get {
+ object obj = ResourceManager.GetObject("mmsys_99", resourceCulture);
+ return ((System.Drawing.Icon)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
+ ///
+ internal static System.Drawing.Icon mplayer_10 {
+ get {
+ object obj = ResourceManager.GetObject("mplayer_10", resourceCulture);
+ return ((System.Drawing.Icon)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
+ ///
+ internal static System.Drawing.Icon shell32_40 {
+ get {
+ object obj = ResourceManager.GetObject("shell32_40", resourceCulture);
+ return ((System.Drawing.Icon)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
+ ///
+ internal static System.Drawing.Icon sndvol32_301 {
+ get {
+ object obj = ResourceManager.GetObject("sndvol32_301", resourceCulture);
+ return ((System.Drawing.Icon)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
+ ///
+ internal static System.Drawing.Icon sndvol32_302 {
+ get {
+ object obj = ResourceManager.GetObject("sndvol32_302", resourceCulture);
+ return ((System.Drawing.Icon)(obj));
+ }
+ }
+ }
}
diff --git a/WinPlaza/Properties/Resources.resx b/WinPlaza/Properties/Resources.resx
index af7dbeb..263531c 100644
--- a/WinPlaza/Properties/Resources.resx
+++ b/WinPlaza/Properties/Resources.resx
@@ -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.
-->
+
@@ -68,9 +69,10 @@
-
+
+
@@ -85,9 +87,10 @@
-
+
+
@@ -109,9 +112,43 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ ..\Resources\conf_157.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\mmsys_101.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\mmsys_102.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\mmsys_109.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\mmsys_110.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\mmsys_112.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\mmsys_99.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\mplayer_10.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\shell32_40.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\sndvol32_301.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\sndvol32_302.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
diff --git a/WinPlaza/Resources/conf_157.ico b/WinPlaza/Resources/conf_157.ico
new file mode 100644
index 0000000..c8cd5c0
Binary files /dev/null and b/WinPlaza/Resources/conf_157.ico differ
diff --git a/WinPlaza/Resources/mmsys_101.ico b/WinPlaza/Resources/mmsys_101.ico
new file mode 100644
index 0000000..6d910ff
Binary files /dev/null and b/WinPlaza/Resources/mmsys_101.ico differ
diff --git a/WinPlaza/Resources/mmsys_102.ico b/WinPlaza/Resources/mmsys_102.ico
new file mode 100644
index 0000000..1e4a979
Binary files /dev/null and b/WinPlaza/Resources/mmsys_102.ico differ
diff --git a/WinPlaza/Resources/mmsys_109.ico b/WinPlaza/Resources/mmsys_109.ico
new file mode 100644
index 0000000..e4c2d0f
Binary files /dev/null and b/WinPlaza/Resources/mmsys_109.ico differ
diff --git a/WinPlaza/Resources/mmsys_110.ico b/WinPlaza/Resources/mmsys_110.ico
new file mode 100644
index 0000000..5ad2433
Binary files /dev/null and b/WinPlaza/Resources/mmsys_110.ico differ
diff --git a/WinPlaza/Resources/mmsys_112.ico b/WinPlaza/Resources/mmsys_112.ico
new file mode 100644
index 0000000..b0c5b14
Binary files /dev/null and b/WinPlaza/Resources/mmsys_112.ico differ
diff --git a/WinPlaza/Resources/mmsys_99.ico b/WinPlaza/Resources/mmsys_99.ico
new file mode 100644
index 0000000..602fcae
Binary files /dev/null and b/WinPlaza/Resources/mmsys_99.ico differ
diff --git a/WinPlaza/Resources/mplayer_10.ico b/WinPlaza/Resources/mplayer_10.ico
new file mode 100644
index 0000000..95f86b0
Binary files /dev/null and b/WinPlaza/Resources/mplayer_10.ico differ
diff --git a/WinPlaza/Resources/shell32_40.ico b/WinPlaza/Resources/shell32_40.ico
new file mode 100644
index 0000000..2a95876
Binary files /dev/null and b/WinPlaza/Resources/shell32_40.ico differ
diff --git a/WinPlaza/Resources/sndvol32_301.ico b/WinPlaza/Resources/sndvol32_301.ico
new file mode 100644
index 0000000..00a2a05
Binary files /dev/null and b/WinPlaza/Resources/sndvol32_301.ico differ
diff --git a/WinPlaza/Resources/sndvol32_302.ico b/WinPlaza/Resources/sndvol32_302.ico
new file mode 100644
index 0000000..7a3d0a8
Binary files /dev/null and b/WinPlaza/Resources/sndvol32_302.ico differ
diff --git a/WinPlaza/WinPlaza.csproj b/WinPlaza/WinPlaza.csproj
index d42ca30..33d6fe8 100644
--- a/WinPlaza/WinPlaza.csproj
+++ b/WinPlaza/WinPlaza.csproj
@@ -14,6 +14,29 @@
4
true
true
+ true
+ c:\swpub\plaza\
+ true
+ Web
+ true
+ Background
+ 7
+ Days
+ false
+ false
+ true
+ https://swdist.ext.maff.scot/nightwave.net/
+ Nightwave.Net
+ Maff
+ true
+ index.html
+ false
+ 4
+ 1.0.0.%2a
+ false
+ true
+ true
+ true
AnyCPU
@@ -30,16 +53,42 @@
pdbonly
true
bin\Release\
- TRACE
+
+
prompt
4
+
+ Resources\mmsys_109.ico
+
+
+ 56AE8D286B533A344BB2F6F2F383B107F823DF22
+
+
+ WinPlaza_TemporaryKey.pfx
+
+
+ true
+
+
+ true
+
+
+ WinPlaza.App
+
+
+ ..\packages\ManagedBass.2.0.4\lib\net45\ManagedBass.dll
+
+
+ ..\packages\ManagedBass.Opus.2.0.0\lib\netstandard1.4\ManagedBass.Opus.dll
+
..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll
+
@@ -94,6 +143,7 @@
SettingsSingleFileGenerator
Settings.Designer.cs
+
@@ -104,5 +154,58 @@
libplaza
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ False
+ Microsoft .NET Framework 4.7.2 %28x86 and x64%29
+ true
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
+
+
+
+ Always
+
+
+
+
+
\ No newline at end of file
diff --git a/WinPlaza/bass.dll b/WinPlaza/bass.dll
new file mode 100644
index 0000000..c88ddc9
Binary files /dev/null and b/WinPlaza/bass.dll differ
diff --git a/WinPlaza/packages.config b/WinPlaza/packages.config
index a75532f..9c116c3 100644
--- a/WinPlaza/packages.config
+++ b/WinPlaza/packages.config
@@ -1,4 +1,6 @@
+
+
\ No newline at end of file
diff --git a/libplaza/Main.cs b/libplaza/Main.cs
index b03972a..b212c0b 100644
--- a/libplaza/Main.cs
+++ b/libplaza/Main.cs
@@ -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 Broadcast() {
- _bc.CalculatedElapsed = (int)(DateTimeOffset.Now.ToUnixTimeSeconds() - _bc.Since) + _bc.Elapsed;
- if(tsLastRefresh+MinRefreshTime >= DateTimeOffset.Now.ToUnixTimeSeconds() && _bc.CalculatedElapsed < _bc.Duration)
+ public async Task 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;
}
}