From 5d47b500e9cb8dc41e2c3ca816b5035bdea90eae Mon Sep 17 00:00:00 2001 From: xxbiohazrdxx Date: Mon, 6 Dec 2021 10:04:48 -0500 Subject: [PATCH] Cleanup, convert ocntrol library to standard/core --- AmpAPI/AmpAPI.csproj | 9 +- AmpAPI/Hubs/AmpHub.cs | 14 + AmpAPI/Startup.cs | 14 +- AmpMonitor/AmpMonitor.csproj | 6 - AmpWeb/AmpWeb.csproj | 7 + AmpWeb/Controllers/SettingsController.cs | 57 +++ AmpWeb/Pages/Index.cshtml | 5 - AmpWeb/Services/AmplifierService.cs | 33 +- AmpWeb/Settings/ApplicationSettings.cs | 7 +- AmpWeb/Startup.cs | 2 + AmpWeb/appsettings.json | 156 ++++---- AmplifierTests/AmplifierTests.csproj | 6 - {MPRSGxZ => MPRSGxZ.backup}/AmplifierStack.cs | 0 MPRSGxZ.backup/AnalysisReport.sarif | 53 +++ .../Commands/BaseCommand.cs | 10 +- .../Commands/Command.cs | 0 MPRSGxZ.backup/Commands/CommandResponse.cs | 37 ++ .../Commands/CommandType.cs | 0 .../Commands/QueryCommand.cs | 0 .../Commands/SetCommand.cs | 0 .../Enumerators/AmplifierType.cs | 0 .../Enumerators/ZoneLinkMode.cs | 0 .../Events/QueueCommandEvent.cs | 0 .../Events/QueueCommandEventArgs.cs | 0 .../Events/ZoneChangedEvent.cs | 0 .../Events/ZoneChangedEventArgs.cs | 0 .../AmplifierCountOutOfRangeException.cs | 5 +- .../Exceptions/InvalidCommandException.cs | 0 .../Exceptions/ZoneAlreadyLinkedException.cs | 8 +- .../ZoneCountOutOfRangeException.cs | 5 +- .../Exceptions/ZoneNotEnabledException.cs | 8 +- .../Exceptions/ZoneNotLinkedException.cs | 11 + .../Hardware/Amplifier.cs | 0 .../Hardware/Source.cs | 0 {MPRSGxZ => MPRSGxZ.backup}/Hardware/Zone.cs | 11 +- {MPRSGxZ => MPRSGxZ.backup}/MPRSGxZ.csproj | 0 .../Ports/IPAmplifierPort.cs | 0 {MPRSGxZ => MPRSGxZ.backup}/Ports/IPort.cs | 0 .../Ports/SerialAmplifierPort.cs | 0 .../Ports/VirtualAmplifierPort.cs | 0 .../Properties/AssemblyInfo.cs | 0 MPRSGxZ.backup/upgrade.backup | 1 + MPRSGxZ.old/AmplifierStack.cs | 232 +++++++++++ MPRSGxZ.old/Commands/BaseCommand.cs | 32 ++ MPRSGxZ.old/Commands/Command.cs | 79 ++++ MPRSGxZ.old/Commands/CommandResponse.cs | 37 ++ MPRSGxZ.old/Commands/CommandType.cs | 8 + MPRSGxZ.old/Commands/QueryCommand.cs | 14 + MPRSGxZ.old/Commands/SetCommand.cs | 24 ++ MPRSGxZ.old/Enumerators/AmplifierType.cs | 8 + MPRSGxZ.old/Enumerators/ZoneLinkMode.cs | 9 + MPRSGxZ.old/Events/QueueCommandEvent.cs | 4 + MPRSGxZ.old/Events/QueueCommandEventArgs.cs | 15 + MPRSGxZ.old/Events/ZoneChangedEvent.cs | 4 + MPRSGxZ.old/Events/ZoneChangedEventArgs.cs | 16 + .../AmplifierCountOutOfRangeException.cs | 9 + .../Exceptions/InvalidCommandException.cs | 9 + .../Exceptions/ZoneAlreadyLinkedException.cs | 11 + .../ZoneCountOutOfRangeException.cs | 9 + .../Exceptions/ZoneNotEnabledException.cs | 11 + .../Exceptions/ZoneNotLinkedException.cs | 11 + MPRSGxZ.old/Hardware/Amplifier.cs | 48 +++ MPRSGxZ.old/Hardware/Source.cs | 16 + MPRSGxZ.old/Hardware/Zone.cs | 365 ++++++++++++++++++ MPRSGxZ.old/MPRSGxZ.csproj | 26 ++ MPRSGxZ.old/Ports/IPAmplifierPort.cs | 98 +++++ MPRSGxZ.old/Ports/IPort.cs | 11 + MPRSGxZ.old/Ports/SerialAmplifierPort.cs | 78 ++++ MPRSGxZ.old/Ports/VirtualAmplifierPort.cs | 74 ++++ MPRSGxZ.old/Properties/AssemblyInfo.cs | 11 + MPRSGxZ.sln | 18 +- MPRSGxZ/Commands/CommandResponse.cs | 37 -- MPRSGxZ/Exceptions/ZoneNotLinkedException.cs | 15 - NewLib/AmplifierStack.cs | 232 +++++++++++ NewLib/Commands/BaseCommand.cs | 32 ++ NewLib/Commands/Command.cs | 79 ++++ NewLib/Commands/CommandResponse.cs | 37 ++ NewLib/Commands/CommandType.cs | 8 + NewLib/Commands/QueryCommand.cs | 14 + NewLib/Commands/SetCommand.cs | 24 ++ NewLib/Enumerators/AmplifierType.cs | 8 + NewLib/Enumerators/ZoneLinkMode.cs | 9 + NewLib/Events/QueueCommandEvent.cs | 4 + NewLib/Events/QueueCommandEventArgs.cs | 15 + NewLib/Events/ZoneChangedEvent.cs | 4 + NewLib/Events/ZoneChangedEventArgs.cs | 16 + .../AmplifierCountOutOfRangeException.cs | 9 + NewLib/Exceptions/InvalidCommandException.cs | 9 + .../Exceptions/ZoneAlreadyLinkedException.cs | 11 + .../ZoneCountOutOfRangeException.cs | 9 + NewLib/Exceptions/ZoneNotEnabledException.cs | 11 + NewLib/Exceptions/ZoneNotLinkedException.cs | 11 + NewLib/Hardware/Amplifier.cs | 48 +++ NewLib/Hardware/Source.cs | 16 + NewLib/Hardware/Zone.cs | 365 ++++++++++++++++++ NewLib/MPRSGxZ.csproj | 11 + NewLib/Ports/IPAmplifierPort.cs | 98 +++++ NewLib/Ports/IPort.cs | 11 + NewLib/Ports/SerialAmplifierPort.cs | 78 ++++ NewLib/Ports/VirtualAmplifierPort.cs | 74 ++++ SimAmp/Class1.cs | 12 + SimAmp/Properties/AssemblyInfo.cs | 36 ++ SimAmp/SimAmp.csproj | 54 +++ 103 files changed, 2946 insertions(+), 203 deletions(-) create mode 100644 AmpAPI/Hubs/AmpHub.cs create mode 100644 AmpWeb/Controllers/SettingsController.cs rename {MPRSGxZ => MPRSGxZ.backup}/AmplifierStack.cs (100%) create mode 100644 MPRSGxZ.backup/AnalysisReport.sarif rename {MPRSGxZ => MPRSGxZ.backup}/Commands/BaseCommand.cs (82%) rename {MPRSGxZ => MPRSGxZ.backup}/Commands/Command.cs (100%) create mode 100644 MPRSGxZ.backup/Commands/CommandResponse.cs rename {MPRSGxZ => MPRSGxZ.backup}/Commands/CommandType.cs (100%) rename {MPRSGxZ => MPRSGxZ.backup}/Commands/QueryCommand.cs (100%) rename {MPRSGxZ => MPRSGxZ.backup}/Commands/SetCommand.cs (100%) rename {MPRSGxZ => MPRSGxZ.backup}/Enumerators/AmplifierType.cs (100%) rename {MPRSGxZ => MPRSGxZ.backup}/Enumerators/ZoneLinkMode.cs (100%) rename {MPRSGxZ => MPRSGxZ.backup}/Events/QueueCommandEvent.cs (100%) rename {MPRSGxZ => MPRSGxZ.backup}/Events/QueueCommandEventArgs.cs (100%) rename {MPRSGxZ => MPRSGxZ.backup}/Events/ZoneChangedEvent.cs (100%) rename {MPRSGxZ => MPRSGxZ.backup}/Events/ZoneChangedEventArgs.cs (100%) rename {MPRSGxZ => MPRSGxZ.backup}/Exceptions/AmplifierCountOutOfRangeException.cs (63%) rename {MPRSGxZ => MPRSGxZ.backup}/Exceptions/InvalidCommandException.cs (100%) rename {MPRSGxZ => MPRSGxZ.backup}/Exceptions/ZoneAlreadyLinkedException.cs (72%) rename {MPRSGxZ => MPRSGxZ.backup}/Exceptions/ZoneCountOutOfRangeException.cs (64%) rename {MPRSGxZ => MPRSGxZ.backup}/Exceptions/ZoneNotEnabledException.cs (73%) create mode 100644 MPRSGxZ.backup/Exceptions/ZoneNotLinkedException.cs rename {MPRSGxZ => MPRSGxZ.backup}/Hardware/Amplifier.cs (100%) rename {MPRSGxZ => MPRSGxZ.backup}/Hardware/Source.cs (100%) rename {MPRSGxZ => MPRSGxZ.backup}/Hardware/Zone.cs (97%) rename {MPRSGxZ => MPRSGxZ.backup}/MPRSGxZ.csproj (100%) rename {MPRSGxZ => MPRSGxZ.backup}/Ports/IPAmplifierPort.cs (100%) rename {MPRSGxZ => MPRSGxZ.backup}/Ports/IPort.cs (100%) rename {MPRSGxZ => MPRSGxZ.backup}/Ports/SerialAmplifierPort.cs (100%) rename {MPRSGxZ => MPRSGxZ.backup}/Ports/VirtualAmplifierPort.cs (100%) rename {MPRSGxZ => MPRSGxZ.backup}/Properties/AssemblyInfo.cs (100%) create mode 100644 MPRSGxZ.backup/upgrade.backup create mode 100644 MPRSGxZ.old/AmplifierStack.cs create mode 100644 MPRSGxZ.old/Commands/BaseCommand.cs create mode 100644 MPRSGxZ.old/Commands/Command.cs create mode 100644 MPRSGxZ.old/Commands/CommandResponse.cs create mode 100644 MPRSGxZ.old/Commands/CommandType.cs create mode 100644 MPRSGxZ.old/Commands/QueryCommand.cs create mode 100644 MPRSGxZ.old/Commands/SetCommand.cs create mode 100644 MPRSGxZ.old/Enumerators/AmplifierType.cs create mode 100644 MPRSGxZ.old/Enumerators/ZoneLinkMode.cs create mode 100644 MPRSGxZ.old/Events/QueueCommandEvent.cs create mode 100644 MPRSGxZ.old/Events/QueueCommandEventArgs.cs create mode 100644 MPRSGxZ.old/Events/ZoneChangedEvent.cs create mode 100644 MPRSGxZ.old/Events/ZoneChangedEventArgs.cs create mode 100644 MPRSGxZ.old/Exceptions/AmplifierCountOutOfRangeException.cs create mode 100644 MPRSGxZ.old/Exceptions/InvalidCommandException.cs create mode 100644 MPRSGxZ.old/Exceptions/ZoneAlreadyLinkedException.cs create mode 100644 MPRSGxZ.old/Exceptions/ZoneCountOutOfRangeException.cs create mode 100644 MPRSGxZ.old/Exceptions/ZoneNotEnabledException.cs create mode 100644 MPRSGxZ.old/Exceptions/ZoneNotLinkedException.cs create mode 100644 MPRSGxZ.old/Hardware/Amplifier.cs create mode 100644 MPRSGxZ.old/Hardware/Source.cs create mode 100644 MPRSGxZ.old/Hardware/Zone.cs create mode 100644 MPRSGxZ.old/MPRSGxZ.csproj create mode 100644 MPRSGxZ.old/Ports/IPAmplifierPort.cs create mode 100644 MPRSGxZ.old/Ports/IPort.cs create mode 100644 MPRSGxZ.old/Ports/SerialAmplifierPort.cs create mode 100644 MPRSGxZ.old/Ports/VirtualAmplifierPort.cs create mode 100644 MPRSGxZ.old/Properties/AssemblyInfo.cs delete mode 100644 MPRSGxZ/Commands/CommandResponse.cs delete mode 100644 MPRSGxZ/Exceptions/ZoneNotLinkedException.cs create mode 100644 NewLib/AmplifierStack.cs create mode 100644 NewLib/Commands/BaseCommand.cs create mode 100644 NewLib/Commands/Command.cs create mode 100644 NewLib/Commands/CommandResponse.cs create mode 100644 NewLib/Commands/CommandType.cs create mode 100644 NewLib/Commands/QueryCommand.cs create mode 100644 NewLib/Commands/SetCommand.cs create mode 100644 NewLib/Enumerators/AmplifierType.cs create mode 100644 NewLib/Enumerators/ZoneLinkMode.cs create mode 100644 NewLib/Events/QueueCommandEvent.cs create mode 100644 NewLib/Events/QueueCommandEventArgs.cs create mode 100644 NewLib/Events/ZoneChangedEvent.cs create mode 100644 NewLib/Events/ZoneChangedEventArgs.cs create mode 100644 NewLib/Exceptions/AmplifierCountOutOfRangeException.cs create mode 100644 NewLib/Exceptions/InvalidCommandException.cs create mode 100644 NewLib/Exceptions/ZoneAlreadyLinkedException.cs create mode 100644 NewLib/Exceptions/ZoneCountOutOfRangeException.cs create mode 100644 NewLib/Exceptions/ZoneNotEnabledException.cs create mode 100644 NewLib/Exceptions/ZoneNotLinkedException.cs create mode 100644 NewLib/Hardware/Amplifier.cs create mode 100644 NewLib/Hardware/Source.cs create mode 100644 NewLib/Hardware/Zone.cs create mode 100644 NewLib/MPRSGxZ.csproj create mode 100644 NewLib/Ports/IPAmplifierPort.cs create mode 100644 NewLib/Ports/IPort.cs create mode 100644 NewLib/Ports/SerialAmplifierPort.cs create mode 100644 NewLib/Ports/VirtualAmplifierPort.cs create mode 100644 SimAmp/Class1.cs create mode 100644 SimAmp/Properties/AssemblyInfo.cs create mode 100644 SimAmp/SimAmp.csproj diff --git a/AmpAPI/AmpAPI.csproj b/AmpAPI/AmpAPI.csproj index 79617d7..f32566b 100644 --- a/AmpAPI/AmpAPI.csproj +++ b/AmpAPI/AmpAPI.csproj @@ -1,7 +1,8 @@  - netcoreapp2.1 + netcoreapp3.1 + 8.0 @@ -9,14 +10,12 @@ - - + - - + diff --git a/AmpAPI/Hubs/AmpHub.cs b/AmpAPI/Hubs/AmpHub.cs new file mode 100644 index 0000000..ba6ed4d --- /dev/null +++ b/AmpAPI/Hubs/AmpHub.cs @@ -0,0 +1,14 @@ +using Microsoft.AspNetCore.SignalR; +using System.Threading.Tasks; +using AmpAPI.Models; + +namespace AmpApi.Hubs +{ + public class AmpHub : Hub + { + public async Task SendZoneUpdate(ZoneModel Zone) + { + await Clients.All.SendAsync("ReceiveZoneUpdate", Zone); + } + } +} \ No newline at end of file diff --git a/AmpAPI/Startup.cs b/AmpAPI/Startup.cs index 365b787..32c1528 100644 --- a/AmpAPI/Startup.cs +++ b/AmpAPI/Startup.cs @@ -3,8 +3,10 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.SignalR; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; namespace AmpAPI { @@ -23,11 +25,12 @@ public void ConfigureServices(IServiceCollection services) services.Configure(Configuration.GetSection("AmplifierStackSettings")); services.AddSingleton(); //services.AddSingleton(Configuration); - services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); + services.AddRazorPages(); + //services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env) + public void Configure(IApplicationBuilder app, IHostEnvironment env) { if (env.IsDevelopment()) { @@ -39,7 +42,12 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) } app.UseHttpsRedirection(); - app.UseMvc(); + app.UseRouting(); + //app.UseAuthorization(); + app.UseEndpoints(endpoints => + { + endpoints.MapRazorPages(); + }); } } } diff --git a/AmpMonitor/AmpMonitor.csproj b/AmpMonitor/AmpMonitor.csproj index d31d36f..9912460 100644 --- a/AmpMonitor/AmpMonitor.csproj +++ b/AmpMonitor/AmpMonitor.csproj @@ -50,12 +50,6 @@ - - - {9f947c76-0ff2-4bbf-bd94-5afe9d0fa8a4} - MPRSGxZ - -