From ae1cfd30f1efbd385eac04b3d02fa1ed161058a3 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 17 Dec 2018 16:43:40 +0200 Subject: Add AppButtons to PPC. Implemented Stop & Start job app buttons! --- .../PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs index ead508488..31e3290d8 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -136,7 +136,7 @@ namespace Tango.PPC.Common.MachineSetup LogManager.Log("Installing remote assistance..."); UpdateProgress("Installing remote assistance", "Installing..."); - await _remoteAssistance.InstallRemoteAssistance(); + //await _remoteAssistance.InstallRemoteAssistance(); //Create temporary folders for packages. var _newPackageTempFolder = TemporaryManager.CreateFolder(); -- cgit v1.3.1 From 79f12332efed3507c2316eef9698e5766be31ff8 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 17 Dec 2018 16:59:13 +0200 Subject: Done some work on remote assistance installation. --- .../MachineSetup/MachineSetupManager.cs | 2 +- .../DefaultRemoteAssistanceProvider.cs | 24 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs index 31e3290d8..971dde32e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -136,7 +136,7 @@ namespace Tango.PPC.Common.MachineSetup LogManager.Log("Installing remote assistance..."); UpdateProgress("Installing remote assistance", "Installing..."); - //await _remoteAssistance.InstallRemoteAssistance(); + await _remoteAssistance.InstallRemoteAssistance(serialNumber); //Create temporary folders for packages. var _newPackageTempFolder = TemporaryManager.CreateFolder(); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/DefaultRemoteAssistanceProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/DefaultRemoteAssistanceProvider.cs index 1a0eea2bd..25ae2dcf7 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/DefaultRemoteAssistanceProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/DefaultRemoteAssistanceProvider.cs @@ -110,6 +110,30 @@ namespace Tango.PPC.Common.RemoteAssistance CmdCommand command = new CmdCommand("msiexec.exe", $"/i \"{_installer_path}\" /qn CUSTOMCONFIGID=ke43ann APITOKEN=4765529-gon1LwO1N1TTrlLI21ji ASSIGNMENTOPTIONS=\" --reassign --alias {"TANGO-" + machineSerialNumber} --grant-easy-access\""); await command.Run(); + + bool exist = false; + + for (int i = 0; i < 6; i++) + { + await Task.Delay(1000); + command = new CmdCommand("sc.exe", "query TeamViewer"); + try + { + await command.Run(); + exist = true; + break; + } + catch { } + } + + if (exist) + { + await DisableRemoteAssistance(); + } + else + { + throw new ApplicationException("The remote assistance service was installed but could not be found."); + } } catch (Exception ex) { -- cgit v1.3.1 From 45ac8eaf0e03d87c2f9728b2b7c84922c6f6a37d Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 18 Dec 2018 13:29:22 +0200 Subject: Implemented OS activation + UWF. Added OSKey to MACHINES table and machine service. --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 20578304 -> 20578304 bytes Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 20578304 -> 20578304 bytes .../Synchronization/MachineSetupResponse.proto | 2 + .../MachineSetup/MachineSetupManager.cs | 25 +++- .../OS/DefaultWindowsActivationManager.cs | 90 +++++++++++++ .../OS/IWindowsActivationManager.cs | 33 +++++ .../PPC/Tango.PPC.Common/Tango.PPC.Common.csproj | 5 + .../UWF/DefaultUnifiedWriteFilterManager.cs | 80 +++++++++++ .../UWF/IUnifiedWriteFilterManager.cs | 34 +++++ .../PPC/Tango.PPC.UI/ViewModelLocator.cs | 6 + .../Visual_Studio/Tango.BL/Entities/Machine.cs | 30 +++++ .../Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs | 1 + .../Tango.DAL.Remote/DB/RemoteADO.edmx | 3 + .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 146 ++++++++++----------- .../Synchronization/MachineSetupResponse.cs | 39 +++++- .../Controllers/SynchronizationController.cs | 6 + 18 files changed, 418 insertions(+), 82 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultWindowsActivationManager.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/OS/IWindowsActivationManager.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/DefaultUnifiedWriteFilterManager.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/IUnifiedWriteFilterManager.cs (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index 1e2085c5e..d4024c9c0 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index ee1123fef..339755212 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 50b0e84fa..f47422306 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index bdd6b2503..e2f31b24d 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/PMR/Messages/Synchronization/MachineSetupResponse.proto b/Software/PMR/Messages/Synchronization/MachineSetupResponse.proto index d298c4527..781379a88 100644 --- a/Software/PMR/Messages/Synchronization/MachineSetupResponse.proto +++ b/Software/PMR/Messages/Synchronization/MachineSetupResponse.proto @@ -12,4 +12,6 @@ message MachineSetupResponse string DbAddress = 3; string DbUserName = 4; string DbPassword = 5; + + string OSKey = 6; } \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs index 971dde32e..145512562 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -19,7 +19,9 @@ using Tango.Integration.Operation; using Tango.PMR.Synchronization; using Tango.PPC.Common.Application; using Tango.PPC.Common.Connection; +using Tango.PPC.Common.OS; using Tango.PPC.Common.RemoteAssistance; +using Tango.PPC.Common.UWF; using Tango.Settings; using Tango.SharedUI.Helpers; using Tango.SQLExaminer; @@ -35,6 +37,8 @@ namespace Tango.PPC.Common.MachineSetup public class MachineSetupManager : ExtendedObject, IMachineSetupManager { private IRemoteAssistanceProvider _remoteAssistance; + private IUnifiedWriteFilterManager _uwf; + private IWindowsActivationManager _windows_activation_manager; #region Events @@ -67,9 +71,11 @@ namespace Tango.PPC.Common.MachineSetup /// Initializes a new instance of the class. /// /// The remote assistance. - public MachineSetupManager(IRemoteAssistanceProvider remoteAssistance) + public MachineSetupManager(IRemoteAssistanceProvider remoteAssistance, IUnifiedWriteFilterManager unifiedWriterFilterManager, IWindowsActivationManager windowsActivationManager) { _remoteAssistance = remoteAssistance; + _uwf = unifiedWriterFilterManager; + _windows_activation_manager = windowsActivationManager; } #endregion @@ -134,9 +140,20 @@ namespace Tango.PPC.Common.MachineSetup LogManager.Log($"Machine setup response received: {Environment.NewLine}{setup_response.ToJsonString()}"); - LogManager.Log("Installing remote assistance..."); - UpdateProgress("Installing remote assistance", "Installing..."); - await _remoteAssistance.InstallRemoteAssistance(serialNumber); + if (!demoMode) + { + LogManager.Log("Activating windows license..."); + UpdateProgress("Activating operation system license", "Activating..."); + await _windows_activation_manager.Activate(setup_response.OSKey); + + LogManager.Log("Installing remote assistance..."); + UpdateProgress("Installing remote assistance", "Installing..."); + await _remoteAssistance.InstallRemoteAssistance(serialNumber); + + LogManager.Log("Activating unified write filter..."); + UpdateProgress("Activating disk protection", "Activating..."); + await _uwf.Setup(); + } //Create temporary folders for packages. var _newPackageTempFolder = TemporaryManager.CreateFolder(); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultWindowsActivationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultWindowsActivationManager.cs new file mode 100644 index 000000000..2305e24ff --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultWindowsActivationManager.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common.Scripting; + +namespace Tango.PPC.Common.OS +{ + using SLID = Guid; //SLID id declaration as typedef GUID SLID; in slpublic.h + + /// + /// Represents the default windows activation manager. + /// + /// + public class DefaultWindowsActivationManager : IWindowsActivationManager + { + private enum SL_GENUINE_STATE + { + SL_GEN_STATE_IS_GENUINE = 0, + SL_GEN_STATE_INVALID_LICENSE = 1, + SL_GEN_STATE_TAMPERED = 2, + SL_GEN_STATE_OFFLINE = 3, + SL_GEN_STATE_LAST = 4 + } + + [DllImportAttribute("Slwga.dll", EntryPoint = "SLIsGenuineLocal", CharSet = CharSet.None, ExactSpelling = false, SetLastError = false, PreserveSig = true, CallingConvention = CallingConvention.Winapi, BestFitMapping = false, ThrowOnUnmappableChar = false)] + [PreserveSigAttribute()] + private static extern uint SLIsGenuineLocal(ref SLID slid, [In, Out] ref SL_GENUINE_STATE genuineState, IntPtr val3); + + /// + /// Determines whether the OS is activated. + /// + /// + public Task IsActivated() + { + return Task.Factory.StartNew(() => + { + Guid ApplicationID = new Guid("55c92734-d682-4d71-983e-d6ec3f16059f"); //Application ID GUID http://technet.microsoft.com/en-us/library/dd772270.aspx + SLID windowsSlid = (Guid)ApplicationID; + try + { + SL_GENUINE_STATE genuineState = SL_GENUINE_STATE.SL_GEN_STATE_LAST; + uint ResultInt = SLIsGenuineLocal(ref windowsSlid, ref genuineState, IntPtr.Zero); + if (ResultInt == 0) + { + return (genuineState == SL_GENUINE_STATE.SL_GEN_STATE_IS_GENUINE); + } + else + { + throw new InvalidOperationException("An error occurred while trying to get the OS activation status."); + } + + } + catch (Exception ex) + { + throw ex; + } + }); + } + + /// + /// Activates the OS using the specified activation key. + /// + /// The activation key. + /// + public async Task Activate(string activationKey) + { + CmdCommand command = new CmdCommand("slmgr", $"-ipk {activationKey}"); + await command.Run(); + + if (!await IsActivated()) + { + throw new ApplicationException("The activation was completed but activation status returned a false response."); + } + } + + /// + /// Deactivates the OS license. + /// + /// + /// + public Task Deactivate() + { + throw new NotImplementedException("Deactivating windows license is not supported."); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/IWindowsActivationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/IWindowsActivationManager.cs new file mode 100644 index 000000000..2fc79e5bb --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/IWindowsActivationManager.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Common.OS +{ + /// + /// Represents a windows license activation manager. + /// + public interface IWindowsActivationManager + { + /// + /// Determines whether the OS is activated. + /// + /// + Task IsActivated(); + + /// + /// Activates the OS using the specified activation key. + /// + /// The activation key. + /// + Task Activate(String activationKey); + + /// + /// Deactivates the OS license. + /// + /// + Task Deactivate(); + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj index faea5ed41..79c970e5a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj @@ -87,6 +87,7 @@ + @@ -158,6 +159,8 @@ MessageNotificationItemView.xaml + + @@ -175,6 +178,8 @@ + + MSBuild:Compile Designer diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/DefaultUnifiedWriteFilterManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/DefaultUnifiedWriteFilterManager.cs new file mode 100644 index 000000000..f673171a5 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/DefaultUnifiedWriteFilterManager.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common.Scripting; + +namespace Tango.PPC.Common.UWF +{ + /// + /// Represents the default unified writer filter manager. + /// + /// + public class DefaultUnifiedWriteFilterManager : IUnifiedWriteFilterManager + { + private const int UWF_CAPACITY_MB = 5000; + + private String[] _exclusions = + { + @"C:\Users\Tango\AppData\Roaming\Twine", + @"C:\Program Files\Microsoft SQL Server\MSSQL14.SQLEXPRESS\MSSQL\DATA", + @"C:\Program Files (x86)\Twine", + }; + + /// + /// Gets a value indicating whether UWF if currently enabled on the system. + /// + public bool IsEnabled { get; } + + /// + /// Installs and configures the service (requires restart). + /// + public async Task Setup() + { + CmdCommand command = null; + + command = new CmdCommand("uwfmgr.exe", "overlay twine-type disk"); + await command.Run(); + + command = new CmdCommand("uwfmgr.exe", $"overlay twine-size {UWF_CAPACITY_MB}"); + await command.Run(); + + command = new CmdCommand("uwfmgr.exe", $"overlay twine-warningthreshold {UWF_CAPACITY_MB}"); + await command.Run(); + + command = new CmdCommand("uwfmgr.exe", $"overlay twine-criticalthreshold {UWF_CAPACITY_MB}"); + await command.Run(); + + command = new CmdCommand("uwfmgr.exe", $"volume protect c:"); + await command.Run(); + + foreach (var exclusion in _exclusions) + { + command = new CmdCommand("uwfmgr.exe", $"file add-exclusion \"{exclusion}\""); + await command.Run(); + } + + command = new CmdCommand("uwfmgr.exe", $"filter enable"); + await command.Run(); + } + + /// + /// Enables the UWF service (requires restart). + /// + public async Task Enable() + { + CmdCommand command = new CmdCommand("uwfmgr.exe", $"filter enable"); + await command.Run(); + } + + /// + /// Disables the UWF service (requires restart). + /// + public async Task Disable() + { + CmdCommand command = new CmdCommand("uwfmgr.exe", $"filter disable"); + await command.Run(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/IUnifiedWriteFilterManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/IUnifiedWriteFilterManager.cs new file mode 100644 index 000000000..05fa1876a --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/IUnifiedWriteFilterManager.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Common.UWF +{ + /// + /// Represents a windows unified write filter manager for disk write protection. + /// + public interface IUnifiedWriteFilterManager + { + /// + /// Gets a value indicating whether UWF if currently enabled on the system. + /// + bool IsEnabled { get; } + + /// + /// Installs and configures the service (requires restart). + /// + Task Setup(); + + /// + /// Enables the UWF service (requires restart). + /// + Task Enable(); + + /// + /// Disables the UWF service (requires restart). + /// + Task Disable(); + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs index f8b7ce003..80154bc3f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs @@ -16,10 +16,12 @@ using Tango.PPC.Common.MachineUpdate; using Tango.PPC.Common.Modules; using Tango.PPC.Common.Navigation; using Tango.PPC.Common.Notifications; +using Tango.PPC.Common.OS; using Tango.PPC.Common.Printing; using Tango.PPC.Common.RemoteAssistance; using Tango.PPC.Common.Storage; using Tango.PPC.Common.Threading; +using Tango.PPC.Common.UWF; using Tango.PPC.UI.Authentication; using Tango.PPC.UI.Connectivity; using Tango.PPC.UI.Modules; @@ -65,6 +67,8 @@ namespace Tango.PPC.UI TangoIOC.Default.Unregister(); TangoIOC.Default.Unregister(); TangoIOC.Default.Unregister(); + TangoIOC.Default.Unregister(); + TangoIOC.Default.Unregister(); TangoIOC.Default.Register(new DefaultDispatcherProvider(Application.Current.Dispatcher)); TangoIOC.Default.Register(); @@ -84,6 +88,8 @@ namespace Tango.PPC.UI TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); + TangoIOC.Default.Register(); + TangoIOC.Default.Register(); //TangoIOC.Default.Register(new TeamFoundationServiceExtendedClient("https://twinetfs.visualstudio.com", String.Empty, "szzfokrceo4rhd4eqi5qpmxn3pa5iwl3q7tlqd36l2m7smz2ynoa")); diff --git a/Software/Visual_Studio/Tango.BL/Entities/Machine.cs b/Software/Visual_Studio/Tango.BL/Entities/Machine.cs index 438bf33b5..ba54d5a1e 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Machine.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Machine.cs @@ -37,6 +37,8 @@ namespace Tango.BL.Entities public event EventHandler SynchedChanged; + public event EventHandler OsKeyChanged; + public event EventHandler AutoLoginChanged; public event EventHandler AutoCheckForUpdatesChanged; @@ -385,6 +387,34 @@ namespace Tango.BL.Entities } } + protected String _oskey; + + /// + /// Gets or sets the machine os key. + /// + + [Column("OS_KEY")] + + public String OsKey + { + get + { + return _oskey; + } + + set + { + if (_oskey != value) + { + _oskey = value; + + OsKeyChanged?.Invoke(this, value); + + RaisePropertyChanged(nameof(OsKey)); + } + } + } + protected Boolean _autologin; /// diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs index bb1d92f52..b4c998ef1 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs @@ -38,6 +38,7 @@ namespace Tango.DAL.Remote.DB public double DEFAULT_SEGMENT_LENGTH { get; set; } public string DEFAULT_SPOOL_TYPE_GUID { get; set; } public bool SYNCHED { get; set; } + public string OS_KEY { get; set; } public bool AUTO_LOGIN { get; set; } public bool AUTO_CHECK_FOR_UPDATES { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx index e4de437f9..45af1f873 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -705,6 +705,7 @@ + @@ -3791,6 +3792,7 @@ + @@ -6045,6 +6047,7 @@ + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram index a1a2ab2cf..b0706a849 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,81 +5,81 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/Tango.PMR/Synchronization/MachineSetupResponse.cs b/Software/Visual_Studio/Tango.PMR/Synchronization/MachineSetupResponse.cs index b07f36594..53b31b77f 100644 --- a/Software/Visual_Studio/Tango.PMR/Synchronization/MachineSetupResponse.cs +++ b/Software/Visual_Studio/Tango.PMR/Synchronization/MachineSetupResponse.cs @@ -23,14 +23,15 @@ namespace Tango.PMR.Synchronization { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "ChpNYWNoaW5lU2V0dXBSZXNwb25zZS5wcm90bxIZVGFuZ28uUE1SLlN5bmNo", - "cm9uaXphdGlvbiJ3ChRNYWNoaW5lU2V0dXBSZXNwb25zZRIPCgdWZXJzaW9u", - "GAEgASgJEhMKC0Jsb2JBZGRyZXNzGAIgASgJEhEKCURiQWRkcmVzcxgDIAEo", - "CRISCgpEYlVzZXJOYW1lGAQgASgJEhIKCkRiUGFzc3dvcmQYBSABKAlCJQoj", - "Y29tLnR3aW5lLnRhbmdvLnBtci5zeW5jaHJvbml6YXRpb25iBnByb3RvMw==")); + "cm9uaXphdGlvbiKGAQoUTWFjaGluZVNldHVwUmVzcG9uc2USDwoHVmVyc2lv", + "bhgBIAEoCRITCgtCbG9iQWRkcmVzcxgCIAEoCRIRCglEYkFkZHJlc3MYAyAB", + "KAkSEgoKRGJVc2VyTmFtZRgEIAEoCRISCgpEYlBhc3N3b3JkGAUgASgJEg0K", + "BU9TS2V5GAYgASgJQiUKI2NvbS50d2luZS50YW5nby5wbXIuc3luY2hyb25p", + "emF0aW9uYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Synchronization.MachineSetupResponse), global::Tango.PMR.Synchronization.MachineSetupResponse.Parser, new[]{ "Version", "BlobAddress", "DbAddress", "DbUserName", "DbPassword" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Synchronization.MachineSetupResponse), global::Tango.PMR.Synchronization.MachineSetupResponse.Parser, new[]{ "Version", "BlobAddress", "DbAddress", "DbUserName", "DbPassword", "OSKey" }, null, null, null) })); } #endregion @@ -66,6 +67,7 @@ namespace Tango.PMR.Synchronization { dbAddress_ = other.dbAddress_; dbUserName_ = other.dbUserName_; dbPassword_ = other.dbPassword_; + oSKey_ = other.oSKey_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -128,6 +130,17 @@ namespace Tango.PMR.Synchronization { } } + /// Field number for the "OSKey" field. + public const int OSKeyFieldNumber = 6; + private string oSKey_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OSKey { + get { return oSKey_; } + set { + oSKey_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as MachineSetupResponse); @@ -146,6 +159,7 @@ namespace Tango.PMR.Synchronization { if (DbAddress != other.DbAddress) return false; if (DbUserName != other.DbUserName) return false; if (DbPassword != other.DbPassword) return false; + if (OSKey != other.OSKey) return false; return true; } @@ -157,6 +171,7 @@ namespace Tango.PMR.Synchronization { if (DbAddress.Length != 0) hash ^= DbAddress.GetHashCode(); if (DbUserName.Length != 0) hash ^= DbUserName.GetHashCode(); if (DbPassword.Length != 0) hash ^= DbPassword.GetHashCode(); + if (OSKey.Length != 0) hash ^= OSKey.GetHashCode(); return hash; } @@ -187,6 +202,10 @@ namespace Tango.PMR.Synchronization { output.WriteRawTag(42); output.WriteString(DbPassword); } + if (OSKey.Length != 0) { + output.WriteRawTag(50); + output.WriteString(OSKey); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -207,6 +226,9 @@ namespace Tango.PMR.Synchronization { if (DbPassword.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(DbPassword); } + if (OSKey.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OSKey); + } return size; } @@ -230,6 +252,9 @@ namespace Tango.PMR.Synchronization { if (other.DbPassword.Length != 0) { DbPassword = other.DbPassword; } + if (other.OSKey.Length != 0) { + OSKey = other.OSKey; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -260,6 +285,10 @@ namespace Tango.PMR.Synchronization { DbPassword = input.ReadString(); break; } + case 50: { + OSKey = input.ReadString(); + break; + } } } } diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/SynchronizationController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/SynchronizationController.cs index 304ea34f2..6126594c5 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/SynchronizationController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/SynchronizationController.cs @@ -98,6 +98,11 @@ namespace Tango.MachineService.Controllers throw new AuthenticationException("The specified serial number could not be found."); } + if (machine.OsKey == null) + { + throw new InvalidDataException("The specified machine is not associated with an OS activation key."); + } + var machine_version = db.MachineVersions.SingleOrDefault(x => x.Guid == machine.MachineVersionGuid); var latest_machine_version = db.TangoVersions.Where(x => x.MachineVersionGuid == machine_version.Guid).ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault(); @@ -128,6 +133,7 @@ namespace Tango.MachineService.Controllers response.DbAddress = Config.DB_ADDRESS; response.DbUserName = credentials.UserName; response.DbPassword = credentials.Password; + response.OSKey = machine.OsKey; } return response; -- cgit v1.3.1 From f131b2573bfb617998927ea1072eb946b800d5e7 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 18 Dec 2018 17:59:41 +0200 Subject: PPC working on tablet ! --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 20578304 -> 20578304 bytes .../SQLExaminer Projects/Override Tables.sdeproj | 16 +-- .../SQLExaminer Projects/Provision Machine.sdeproj | 133 ++++++++++++------ .../DB/SQLExaminer Projects/UpdateMachine.sdeproj | 36 ++--- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 20578304 -> 20578304 bytes .../Synchronization/MachineSetupResponse.proto | 6 + .../ViewModels/MainViewVM.cs | 9 +- .../Connection/DefaultMachineProvider.cs | 70 ++++------ .../MachineSetup/MachineSetupManager.cs | 41 +++--- .../OS/DefaultWindowsActivationManager.cs | 2 +- .../PPC/Tango.PPC.Common/PPCSettings.cs | 13 +- .../DefaultRemoteAssistanceProvider.cs | 2 +- .../PPC/Tango.PPC.Common/Scripting/CmdCommand.cs | 33 ++++- .../UWF/DefaultUnifiedWriteFilterManager.cs | 28 ++-- .../PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs | 2 +- .../PPC/Tango.PPC.UI/Views/MachineSetupView.xaml | 2 +- .../Visual_Studio/Tango.BL/Entities/Machine.cs | 150 +++++++++++++++++++++ .../Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs | 5 + .../Tango.DAL.Remote/DB/RemoteADO.edmx | 15 +++ .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 150 ++++++++++----------- .../Synchronization/MachineSetupResponse.cs | 150 ++++++++++++++++++++- .../SQLExaminer/Configurations/OverrideData.xml | Bin 79756 -> 79236 bytes .../Configurations/ProvisionMachine.xml | Bin 57496 -> 61232 bytes .../SQLExaminer/Configurations/UpdateMachine.xml | Bin 25530 -> 27128 bytes .../Controllers/SynchronizationController.cs | 10 +- 27 files changed, 629 insertions(+), 244 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index d4024c9c0..0652c7b97 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index 339755212..4897c62e5 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/SQLExaminer Projects/Override Tables.sdeproj b/Software/DB/SQLExaminer Projects/Override Tables.sdeproj index ae9528a15..932ea95fb 100644 --- a/Software/DB/SQLExaminer Projects/Override Tables.sdeproj +++ b/Software/DB/SQLExaminer Projects/Override Tables.sdeproj @@ -165,14 +165,6 @@ - - - - - - - - @@ -671,8 +663,6 @@ - - @@ -681,6 +671,12 @@ + + + + + + diff --git a/Software/DB/SQLExaminer Projects/Provision Machine.sdeproj b/Software/DB/SQLExaminer Projects/Provision Machine.sdeproj index 2fb056697..267cf1abb 100644 --- a/Software/DB/SQLExaminer Projects/Provision Machine.sdeproj +++ b/Software/DB/SQLExaminer Projects/Provision Machine.sdeproj @@ -90,24 +90,24 @@ + + + + + + + + - - - - - - - - @@ -165,14 +165,6 @@ - - - - - - - - @@ -324,8 +316,8 @@ - + @@ -671,16 +663,20 @@ - - + + + + + + @@ -781,6 +777,7 @@ + @@ -799,7 +796,6 @@ - @@ -944,6 +940,8 @@ + + @@ -953,8 +951,6 @@ - - @@ -1044,7 +1040,8 @@ LEFT JOIN USERS ON USERS.ORGANIZATION_GUID = ORGANIZATION_GUID LEFT JOIN MACHINES ON MACHINES.ORGANIZATION_GUID = ORGANIZATIONS.GUID LEFT JOIN ADDRESSES ON ADDRESSES.GUID = USERS.ADDRESS_GUID OR ADDRESSES.GUID = ORGANIZATIONS.ADDRESS_GUID -WHERE MACHINES.SERIAL_NUMBER = '@']]> +WHERE MACHINES.SERIAL_NUMBER = '@' +]]> @@ -1075,7 +1072,8 @@ LEFT JOIN USERS ON USERS.ORGANIZATION_GUID = ORGANIZATION_GUID LEFT JOIN MACHINES ON MACHINES.ORGANIZATION_GUID = ORGANIZATIONS.GUID LEFT JOIN ADDRESSES ON ADDRESSES.GUID = USERS.ADDRESS_GUID OR ADDRESSES.GUID = ORGANIZATIONS.ADDRESS_GUID -WHERE MACHINES.SERIAL_NUMBER = '@']]> +WHERE MACHINES.SERIAL_NUMBER = '@' +]]>
@@ -1118,7 +1116,8 @@ FROM CATS INNER JOIN MACHINES ON MACHINES.GUID = CATS.MACHINE_GUID -WHERE MACHINES.SERIAL_NUMBER = '@']]> +WHERE MACHINES.SERIAL_NUMBER = '@' +]]>
@@ -1144,7 +1143,8 @@ FROM CATS INNER JOIN MACHINES ON MACHINES.GUID = CATS.MACHINE_GUID -WHERE MACHINES.SERIAL_NUMBER = '@']]> +WHERE MACHINES.SERIAL_NUMBER = '@' +]]>
@@ -1183,7 +1183,8 @@ WHERE MACHINES.SERIAL_NUMBER = '@']]> +WHERE MACHINES.SERIAL_NUMBER = '@' +]]>
@@ -1208,7 +1209,8 @@ WHERE MACHINES.SERIAL_NUMBER = '@']]> +WHERE MACHINES.SERIAL_NUMBER = '@' +]]>
@@ -1254,7 +1256,8 @@ LEFT JOIN USERS ON USERS.ORGANIZATION_GUID = ORGANIZATION_GUID LEFT JOIN MACHINES ON MACHINES.ORGANIZATION_GUID = ORGANIZATIONS.GUID LEFT JOIN CONTACTS ON CONTACTS.GUID = USERS.CONTACT_GUID OR CONTACTS.GUID = ORGANIZATIONS.CONTACT_GUID -WHERE MACHINES.SERIAL_NUMBER = '@']]> +WHERE MACHINES.SERIAL_NUMBER = '@' +]]>
@@ -1284,7 +1287,8 @@ LEFT JOIN USERS ON USERS.ORGANIZATION_GUID = ORGANIZATION_GUID LEFT JOIN MACHINES ON MACHINES.ORGANIZATION_GUID = ORGANIZATIONS.GUID LEFT JOIN CONTACTS ON CONTACTS.GUID = USERS.CONTACT_GUID OR CONTACTS.GUID = ORGANIZATIONS.CONTACT_GUID -WHERE MACHINES.SERIAL_NUMBER = '@']]> +WHERE MACHINES.SERIAL_NUMBER = '@' +]]>
@@ -1331,7 +1335,29 @@ FROM MACHINES INNER JOIN IDS_PACKS ON CONFIGURATIONS.GUID = IDS_PACKS.CONFIGURATION_GUID WHERE MACHINES.SERIAL_NUMBER = '@' + ]]> + +
+ + + + + + + + + + + + + + + + + +
+
@@ -1377,16 +1404,20 @@ WHERE MACHINES.SERIAL_NUMBER = '@' - - + + + + + + @@ -1406,14 +1437,20 @@ WHERE MACHINES.SERIAL_NUMBER = '@' - - + + + + + + + +
@@ -1435,14 +1472,20 @@ WHERE MACHINES.SERIAL_NUMBER = '@' - - + + + + + + + + @@ -1466,7 +1509,8 @@ FROM ORGANIZATIONS INNER JOIN MACHINES ON MACHINES.ORGANIZATION_GUID = ORGANIZATIONS.GUID -WHERE MACHINES.SERIAL_NUMBER = '@']]> +WHERE MACHINES.SERIAL_NUMBER = '@' +]]> @@ -1490,7 +1534,8 @@ FROM ORGANIZATIONS INNER JOIN MACHINES ON MACHINES.ORGANIZATION_GUID = ORGANIZATIONS.GUID -WHERE MACHINES.SERIAL_NUMBER = '@']]> +WHERE MACHINES.SERIAL_NUMBER = '@' +]]>
@@ -1531,7 +1576,8 @@ FROM USERS INNER JOIN ORGANIZATIONS ON ORGANIZATIONS.GUID = USERS.ORGANIZATION_GUID INNER JOIN MACHINES ON MACHINES.ORGANIZATION_GUID = ORGANIZATIONS.GUID -WHERE MACHINES.SERIAL_NUMBER = '@']]> +WHERE MACHINES.SERIAL_NUMBER = '@' +]]>
@@ -1560,7 +1606,8 @@ FROM USERS INNER JOIN ORGANIZATIONS ON ORGANIZATIONS.GUID = USERS.ORGANIZATION_GUID INNER JOIN MACHINES ON MACHINES.ORGANIZATION_GUID = ORGANIZATIONS.GUID -WHERE MACHINES.SERIAL_NUMBER = '@']]> +WHERE MACHINES.SERIAL_NUMBER = '@' +]]>
@@ -1602,7 +1649,8 @@ LEFT JOIN USERS ON USERS.ORGANIZATION_GUID = ORGANIZATION_GUID LEFT JOIN MACHINES ON MACHINES.ORGANIZATION_GUID = ORGANIZATIONS.GUID LEFT JOIN USERS_ROLES ON USERS_ROLES.USER_GUID = USERS.GUID -WHERE MACHINES.SERIAL_NUMBER = '@']]> +WHERE MACHINES.SERIAL_NUMBER = '@' +]]>
@@ -1628,7 +1676,8 @@ LEFT JOIN USERS ON USERS.ORGANIZATION_GUID = ORGANIZATION_GUID LEFT JOIN MACHINES ON MACHINES.ORGANIZATION_GUID = ORGANIZATIONS.GUID LEFT JOIN USERS_ROLES ON USERS_ROLES.USER_GUID = USERS.GUID -WHERE MACHINES.SERIAL_NUMBER = '@']]> +WHERE MACHINES.SERIAL_NUMBER = '@' +]]>
diff --git a/Software/DB/SQLExaminer Projects/UpdateMachine.sdeproj b/Software/DB/SQLExaminer Projects/UpdateMachine.sdeproj index ae2bb1bed..fb395f586 100644 --- a/Software/DB/SQLExaminer Projects/UpdateMachine.sdeproj +++ b/Software/DB/SQLExaminer Projects/UpdateMachine.sdeproj @@ -165,14 +165,6 @@ - - - - - - - - @@ -671,8 +663,6 @@ - - @@ -681,6 +671,12 @@ + + + + + + @@ -1175,16 +1171,20 @@ WHERE MACHINES.SERIAL_NUMBER = '@']]> - - + + + + + + @@ -1204,8 +1204,6 @@ WHERE MACHINES.SERIAL_NUMBER = '@']]> - - @@ -1233,14 +1231,20 @@ WHERE MACHINES.SERIAL_NUMBER = '@']]> - - + + + + + + + +
diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index f47422306..81ed33c36 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index e2f31b24d..76a2f4509 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/PMR/Messages/Synchronization/MachineSetupResponse.proto b/Software/PMR/Messages/Synchronization/MachineSetupResponse.proto index 781379a88..cc0d675b9 100644 --- a/Software/PMR/Messages/Synchronization/MachineSetupResponse.proto +++ b/Software/PMR/Messages/Synchronization/MachineSetupResponse.proto @@ -14,4 +14,10 @@ message MachineSetupResponse string DbPassword = 5; string OSKey = 6; + + bool SetupActivation = 7; + bool SetupRemoteAssistance = 8; + bool SetupUWF = 9; + bool SetupFirmware = 10; + bool IsDemo = 11; } \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs index 5ae5c531c..5a5df0d0f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs @@ -196,7 +196,14 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels MachinesProvider = new SuggestionProvider((filter) => { - return _db.Machines.Where(x => x.SerialNumber.StartsWith(filter)).ToList(); + try + { + return _db.Machines.Where(x => x.SerialNumber.StartsWith(filter)).ToList(); + } + catch + { + return new List(); + } }); } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs index 52d738220..340b64765 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs @@ -107,9 +107,7 @@ namespace Tango.PPC.Common.Connection var settings = SettingsManager.Default.GetOrCreate(); - var demo = settings.DemoMode; - - if (!demo) + if (!Machine.IsDemo) { if (String.IsNullOrWhiteSpace(settings.EmbeddedComPort)) { @@ -146,13 +144,15 @@ namespace Tango.PPC.Common.Connection { LogManager.Log("Application in demo mode!"); + var emulator_channel_name = "emulator-" + Guid.NewGuid().ToString(); + LogManager.Log("Starting embedded emulator..."); - MachineEmulator emulator = new MachineEmulator(new BasicTransporter(new MemoryTransportAdapter("emulator"))); + MachineEmulator emulator = new MachineEmulator(new BasicTransporter(new MemoryTransportAdapter(emulator_channel_name))); await emulator.Start(); LogManager.Log("Emulator started. Connecting to emulator..."); - MemoryTransportAdapter adapter = new MemoryTransportAdapter("emulator"); + MemoryTransportAdapter adapter = new MemoryTransportAdapter(emulator_channel_name); MachineOperator.Adapter = adapter; MachineOperator.JobHandlingMode = JobHandlerModes.SettingUp; LogManager.Log("Connecting machine operator..."); @@ -239,59 +239,35 @@ namespace Tango.PPC.Common.Connection var settings = SettingsManager.Default.GetOrCreate(); - var demo = settings.DemoMode; - - if (!demo) + if (String.IsNullOrWhiteSpace(settings.EmbeddedComPort)) { - if (String.IsNullOrWhiteSpace(settings.EmbeddedComPort)) - { - TimeSpan timeout = TimeSpan.FromSeconds(SettingsManager.Default.GetOrCreate().MachineScanningTimeoutSeconds); - - onProgress?.Invoke("Scanning for the machine..."); - LogManager.Default.Log("Scanning for machine on available serial ports..."); - Transport.Discovery.UsbCommunicationScanner scanner = new Transport.Discovery.UsbCommunicationScanner(UsbSerialBaudRates.BR_115200); - var response = await scanner.Scan(new ConnectRequest() { Password = "1234" }, timeout); + TimeSpan timeout = TimeSpan.FromSeconds(SettingsManager.Default.GetOrCreate().MachineScanningTimeoutSeconds); - onProgress?.Invoke("Machine discovered on port: " + response.Adapter.Address); - LogManager.Default.Log("Machine discovered on port: " + response.Adapter.Address); - LogManager.Default.Log("Device Information:"); - LogManager.Default.Log(response.Response.DeviceInformation.ToJsonString()); + onProgress?.Invoke("Scanning for the machine..."); + LogManager.Default.Log("Scanning for machine on available serial ports..."); + Transport.Discovery.UsbCommunicationScanner scanner = new Transport.Discovery.UsbCommunicationScanner(UsbSerialBaudRates.BR_115200); + var response = await scanner.Scan(new ConnectRequest() { Password = "1234" }, timeout); - machineOperator.Adapter = response.Adapter; - machineOperator.JobHandlingMode = JobHandlerModes.SettingUp; - LogManager.Default.Log("Connecting machine operator..."); + onProgress?.Invoke("Machine discovered on port: " + response.Adapter.Address); + LogManager.Default.Log("Machine discovered on port: " + response.Adapter.Address); + LogManager.Default.Log("Device Information:"); + LogManager.Default.Log(response.Response.DeviceInformation.ToJsonString()); - onProgress?.Invoke("Connecting machine operator..."); - await machineOperator.Connect(); - } - else - { - LogManager.Default.Log($"Connecting to machine on {settings.EmbeddedComPort}..."); + machineOperator.Adapter = response.Adapter; + machineOperator.JobHandlingMode = JobHandlerModes.SettingUp; + LogManager.Default.Log("Connecting machine operator..."); - onProgress?.Invoke($"Connecting to machine on {settings.EmbeddedComPort}..."); - UsbTransportAdapter adapter = new UsbTransportAdapter(settings.EmbeddedComPort, UsbSerialBaudRates.BR_115200); - machineOperator.Adapter = adapter; - machineOperator.JobHandlingMode = JobHandlerModes.SettingUp; - await machineOperator.Connect(); - } + onProgress?.Invoke("Connecting machine operator..."); + await machineOperator.Connect(); } else { - LogManager.Default.Log("Application in demo mode!"); - - onProgress?.Invoke("Application in demo mode, Starting embedded emulator..."); + LogManager.Default.Log($"Connecting to machine on {settings.EmbeddedComPort}..."); - LogManager.Default.Log("Starting embedded emulator..."); - MachineEmulator emulator = new MachineEmulator(new BasicTransporter(new MemoryTransportAdapter("emulator"))); - await emulator.Start(); - - LogManager.Default.Log("Emulator started. Connecting to emulator..."); - - MemoryTransportAdapter adapter = new MemoryTransportAdapter("emulator"); + onProgress?.Invoke($"Connecting to machine on {settings.EmbeddedComPort}..."); + UsbTransportAdapter adapter = new UsbTransportAdapter(settings.EmbeddedComPort, UsbSerialBaudRates.BR_115200); machineOperator.Adapter = adapter; machineOperator.JobHandlingMode = JobHandlerModes.SettingUp; - LogManager.Default.Log("Connecting machine operator..."); - onProgress?.Invoke("Connecting machine operator..."); await machineOperator.Connect(); } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs index 145512562..e1795d06a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -98,23 +98,7 @@ namespace Tango.PPC.Common.MachineSetup IMachineOperator op = null; - var demoMode = SettingsManager.Default.GetOrCreate().DemoMode; - - if (!demoMode) - { - //Connecting to machine... - LogManager.Log("Initiating machine connection..."); - - UpdateProgress("Connecting to machine", "Connecting..."); - op = await DefaultMachineProvider.CreateMinimalMachineOperator((msg) => - { - UpdateProgress("Connecting to machine", msg); - }); - } - else - { - LogManager.Log("Application in demo mode. Skipping machine connection..."); - } + var settings = SettingsManager.Default.GetOrCreate(); //Connect to machine service and get matching packages for this machine. UpdateProgress("Validating serial number", "Connecting to machine service..."); @@ -140,16 +124,34 @@ namespace Tango.PPC.Common.MachineSetup LogManager.Log($"Machine setup response received: {Environment.NewLine}{setup_response.ToJsonString()}"); - if (!demoMode) + if (setup_response.SetupFirmware) + { + //Connecting to machine... + LogManager.Log("Initiating machine connection..."); + + UpdateProgress("Connecting to machine", "Connecting..."); + op = await DefaultMachineProvider.CreateMinimalMachineOperator((msg) => + { + UpdateProgress("Connecting to machine", msg); + }); + } + + if (setup_response.SetupActivation) { LogManager.Log("Activating windows license..."); UpdateProgress("Activating operation system license", "Activating..."); await _windows_activation_manager.Activate(setup_response.OSKey); + } + if (setup_response.SetupRemoteAssistance) + { LogManager.Log("Installing remote assistance..."); UpdateProgress("Installing remote assistance", "Installing..."); await _remoteAssistance.InstallRemoteAssistance(serialNumber); + } + if (setup_response.SetupUWF) + { LogManager.Log("Activating unified write filter..."); UpdateProgress("Activating disk protection", "Activating..."); await _uwf.Setup(); @@ -286,7 +288,7 @@ namespace Tango.PPC.Common.MachineSetup throw LogManager.Log(ex, "Setup manager error while trying to synchronize database."); } - if (!demoMode) + if (setup_response.SetupFirmware) { //Updating firmware UpdateProgress("Updating Firmware", "Connecting to firmware device..."); @@ -324,7 +326,6 @@ namespace Tango.PPC.Common.MachineSetup } else { - LogManager.Log("Application in demo mode. Skipping firmware upgrade..."); result.SetResult(new MachineSetupResult() { UpdatePackagePath = _newPackageTempFolder, diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultWindowsActivationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultWindowsActivationManager.cs index 2305e24ff..610328bc2 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultWindowsActivationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultWindowsActivationManager.cs @@ -68,7 +68,7 @@ namespace Tango.PPC.Common.OS /// public async Task Activate(string activationKey) { - CmdCommand command = new CmdCommand("slmgr", $"-ipk {activationKey}"); + CmdCommand command = new CmdCommand("cscript", $"C:\\Windows\\System32\\slmgr.vbs -ipk {activationKey}"); await command.Run(); if (!await IsActivated()) diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index 142c3afe9..c33db4854 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -15,11 +15,6 @@ namespace Tango.PPC.Common /// public class PPCSettings : SettingsBase { - /// - /// Gets or sets the machine serial number. - /// - public String MachineSerialNumber { get; set; } - /// /// Gets or sets the logging categories. /// @@ -50,11 +45,6 @@ namespace Tango.PPC.Common ///
public String AutoConnectWiFiName { get; set; } - /// - /// Gets or sets a value indicating whether the application is in demo mode. - /// - public bool DemoMode { get; set; } - /// /// Gets or sets the embedded COM port if not specified will use auto scanning. /// @@ -92,9 +82,8 @@ namespace Tango.PPC.Common { MachineScanningTimeoutSeconds = 20; LoggingCategories = new List(); - MachineSerialNumber = "1111"; UpdateServiceAddress = "http://twine01/PPCUpdateService/PPCUpdateService.svc"; - MachineServiceAddress = "http://twine01/MachineService"; + MachineServiceAddress = "http://machineservice.twine-srv.com/"; EmbeddedComPort = null; ExternalBridgePassword = "Aa123456"; HotSpotPassword = "Aa123456"; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/DefaultRemoteAssistanceProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/DefaultRemoteAssistanceProvider.cs index 25ae2dcf7..040546b59 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/DefaultRemoteAssistanceProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/DefaultRemoteAssistanceProvider.cs @@ -18,7 +18,7 @@ namespace Tango.PPC.Common.RemoteAssistance public class DefaultRemoteAssistanceProvider : ExtendedObject, IRemoteAssistanceProvider { private IMachineProvider _machineProvider; - private String _installer_path = "C:\\Program Files(x86)\\TeamViewer\\TeamViewer_Host.msi"; + private String _installer_path = "C:\\Program Files (x86)\\TeamViewer\\TeamViewer_Host.msi"; private bool _isEnabled; /// diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Scripting/CmdCommand.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Scripting/CmdCommand.cs index abae98f06..5abbd49d1 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Scripting/CmdCommand.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Scripting/CmdCommand.cs @@ -11,12 +11,22 @@ namespace Tango.PPC.Common.Scripting { public class CmdCommand : ExtendedObject { + public enum OutEncoding + { + Default, + Unicode, + } + private Process _process; public String Arguments { get; set; } public TimeSpan Timeout { get; set; } + public String WorkingDir { get; set; } + + public OutEncoding OutputEncoding { get; set; } + public CmdCommand(String processName, String arguments) { Timeout = TimeSpan.FromSeconds(5); @@ -30,6 +40,12 @@ namespace Tango.PPC.Common.Scripting _process.StartInfo.RedirectStandardOutput = true; _process.StartInfo.Arguments = arguments; _process.StartInfo.Verb = "runas"; + + if (WorkingDir != null) + { + _process.StartInfo.WorkingDirectory = WorkingDir; + } + Arguments = arguments; } @@ -43,9 +59,22 @@ namespace Tango.PPC.Common.Scripting if (_process.HasExited) { + String output = _process.StandardOutput.ReadToEnd(); + String error = _process.StandardError.ReadToEnd(); + + if (OutputEncoding == OutEncoding.Unicode) + { + byte[] data = Encoding.Default.GetBytes(output); + output = Encoding.Unicode.GetString(data); + + data = Encoding.Default.GetBytes(error); + error = Encoding.Unicode.GetString(data); + } + LogManager.Log($"Process exited with exit code {_process.ExitCode}."); - LogManager.Log($"Process Standard Output:\n{_process.StandardOutput.ReadToEnd()}"); - LogManager.Log($"Process Standard Error:\n{_process.StandardError.ReadToEnd()}"); + LogManager.Log($"Process Standard Output:\n{output}"); + LogManager.Log($"Process Standard Error:\n{error}"); + if (_process.ExitCode != 0) { throw new IOException($"The process {_process.StartInfo.FileName} has exited with the code {_process.ExitCode}."); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/DefaultUnifiedWriteFilterManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/DefaultUnifiedWriteFilterManager.cs index f673171a5..1e7357b2f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/DefaultUnifiedWriteFilterManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/DefaultUnifiedWriteFilterManager.cs @@ -14,6 +14,7 @@ namespace Tango.PPC.Common.UWF public class DefaultUnifiedWriteFilterManager : IUnifiedWriteFilterManager { private const int UWF_CAPACITY_MB = 5000; + private const string UWF_PATH = "C:\\Windows\\Sysnative\\uwfmgr.exe"; private String[] _exclusions = { @@ -34,28 +35,35 @@ namespace Tango.PPC.Common.UWF { CmdCommand command = null; - command = new CmdCommand("uwfmgr.exe", "overlay twine-type disk"); + command = new CmdCommand(UWF_PATH, "overlay set-type disk"); + command.OutputEncoding = CmdCommand.OutEncoding.Unicode; await command.Run(); - command = new CmdCommand("uwfmgr.exe", $"overlay twine-size {UWF_CAPACITY_MB}"); + command = new CmdCommand(UWF_PATH, $"overlay set-size {UWF_CAPACITY_MB}"); + command.OutputEncoding = CmdCommand.OutEncoding.Unicode; await command.Run(); - command = new CmdCommand("uwfmgr.exe", $"overlay twine-warningthreshold {UWF_CAPACITY_MB}"); + command = new CmdCommand(UWF_PATH, $"overlay set-warningthreshold {UWF_CAPACITY_MB}"); + command.OutputEncoding = CmdCommand.OutEncoding.Unicode; await command.Run(); - command = new CmdCommand("uwfmgr.exe", $"overlay twine-criticalthreshold {UWF_CAPACITY_MB}"); + command = new CmdCommand(UWF_PATH, $"overlay set-criticalthreshold {UWF_CAPACITY_MB}"); + command.OutputEncoding = CmdCommand.OutEncoding.Unicode; await command.Run(); - command = new CmdCommand("uwfmgr.exe", $"volume protect c:"); + command = new CmdCommand(UWF_PATH, $"volume protect c:"); + command.OutputEncoding = CmdCommand.OutEncoding.Unicode; await command.Run(); foreach (var exclusion in _exclusions) { - command = new CmdCommand("uwfmgr.exe", $"file add-exclusion \"{exclusion}\""); + command = new CmdCommand(UWF_PATH, $"file add-exclusion \"{exclusion}\""); + command.OutputEncoding = CmdCommand.OutEncoding.Unicode; await command.Run(); } - command = new CmdCommand("uwfmgr.exe", $"filter enable"); + command = new CmdCommand(UWF_PATH, $"filter enable"); + command.OutputEncoding = CmdCommand.OutEncoding.Unicode; await command.Run(); } @@ -64,7 +72,8 @@ namespace Tango.PPC.Common.UWF /// public async Task Enable() { - CmdCommand command = new CmdCommand("uwfmgr.exe", $"filter enable"); + CmdCommand command = new CmdCommand(UWF_PATH, $"filter enable"); + command.OutputEncoding = CmdCommand.OutEncoding.Unicode; await command.Run(); } @@ -73,7 +82,8 @@ namespace Tango.PPC.Common.UWF /// public async Task Disable() { - CmdCommand command = new CmdCommand("uwfmgr.exe", $"filter disable"); + CmdCommand command = new CmdCommand(UWF_PATH, $"filter disable"); + command.OutputEncoding = CmdCommand.OutEncoding.Unicode; await command.Run(); } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs index 740b0d203..efd2a15b8 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango PPC Application")] -[assembly: AssemblyVersion("2.0.15.1608")] +[assembly: AssemblyVersion("2.0.17.1608")] diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml index 04e764c20..dc30cfa93 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml @@ -114,7 +114,7 @@ Setup Failed - + Tap 'RESTART' to restart the process RESTART diff --git a/Software/Visual_Studio/Tango.BL/Entities/Machine.cs b/Software/Visual_Studio/Tango.BL/Entities/Machine.cs index ba54d5a1e..383492905 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Machine.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Machine.cs @@ -43,6 +43,16 @@ namespace Tango.BL.Entities public event EventHandler AutoCheckForUpdatesChanged; + public event EventHandler SetupActivationChanged; + + public event EventHandler SetupRemoteAssistanceChanged; + + public event EventHandler SetupUwfChanged; + + public event EventHandler SetupFirmwareChanged; + + public event EventHandler IsDemoChanged; + public event EventHandler> CatsChanged; public event EventHandler DefaultColorSpaceChanged; @@ -471,6 +481,146 @@ namespace Tango.BL.Entities } } + protected Boolean _setupactivation; + + /// + /// Gets or sets the machine setup activation. + /// + + [Column("SETUP_ACTIVATION")] + + public Boolean SetupActivation + { + get + { + return _setupactivation; + } + + set + { + if (_setupactivation != value) + { + _setupactivation = value; + + SetupActivationChanged?.Invoke(this, value); + + RaisePropertyChanged(nameof(SetupActivation)); + } + } + } + + protected Boolean _setupremoteassistance; + + /// + /// Gets or sets the machine setup remote assistance. + /// + + [Column("SETUP_REMOTE_ASSISTANCE")] + + public Boolean SetupRemoteAssistance + { + get + { + return _setupremoteassistance; + } + + set + { + if (_setupremoteassistance != value) + { + _setupremoteassistance = value; + + SetupRemoteAssistanceChanged?.Invoke(this, value); + + RaisePropertyChanged(nameof(SetupRemoteAssistance)); + } + } + } + + protected Boolean _setupuwf; + + /// + /// Gets or sets the machine setup uwf. + /// + + [Column("SETUP_UWF")] + + public Boolean SetupUwf + { + get + { + return _setupuwf; + } + + set + { + if (_setupuwf != value) + { + _setupuwf = value; + + SetupUwfChanged?.Invoke(this, value); + + RaisePropertyChanged(nameof(SetupUwf)); + } + } + } + + protected Boolean _setupfirmware; + + /// + /// Gets or sets the machine setup firmware. + /// + + [Column("SETUP_FIRMWARE")] + + public Boolean SetupFirmware + { + get + { + return _setupfirmware; + } + + set + { + if (_setupfirmware != value) + { + _setupfirmware = value; + + SetupFirmwareChanged?.Invoke(this, value); + + RaisePropertyChanged(nameof(SetupFirmware)); + } + } + } + + protected Boolean _isdemo; + + /// + /// Gets or sets the machine is demo. + /// + + [Column("IS_DEMO")] + + public Boolean IsDemo + { + get + { + return _isdemo; + } + + set + { + if (_isdemo != value) + { + _isdemo = value; + + IsDemoChanged?.Invoke(this, value); + + RaisePropertyChanged(nameof(IsDemo)); + } + } + } + protected SynchronizedObservableCollection _cats; /// diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs index b4c998ef1..341f2aa2a 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs @@ -41,6 +41,11 @@ namespace Tango.DAL.Remote.DB public string OS_KEY { get; set; } public bool AUTO_LOGIN { get; set; } public bool AUTO_CHECK_FOR_UPDATES { get; set; } + public bool SETUP_ACTIVATION { get; set; } + public bool SETUP_REMOTE_ASSISTANCE { get; set; } + public bool SETUP_UWF { get; set; } + public bool SETUP_FIRMWARE { get; set; } + public bool IS_DEMO { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection CATS { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx index 45af1f873..7a01d5db8 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -708,6 +708,11 @@ + + + + + @@ -3795,6 +3800,11 @@ + + + + + @@ -6045,6 +6055,11 @@ + + + + + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram index b0706a849..c16e38955 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,81 +5,81 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/Tango.PMR/Synchronization/MachineSetupResponse.cs b/Software/Visual_Studio/Tango.PMR/Synchronization/MachineSetupResponse.cs index 53b31b77f..e2650cf2b 100644 --- a/Software/Visual_Studio/Tango.PMR/Synchronization/MachineSetupResponse.cs +++ b/Software/Visual_Studio/Tango.PMR/Synchronization/MachineSetupResponse.cs @@ -23,15 +23,17 @@ namespace Tango.PMR.Synchronization { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "ChpNYWNoaW5lU2V0dXBSZXNwb25zZS5wcm90bxIZVGFuZ28uUE1SLlN5bmNo", - "cm9uaXphdGlvbiKGAQoUTWFjaGluZVNldHVwUmVzcG9uc2USDwoHVmVyc2lv", + "cm9uaXphdGlvbiL3AQoUTWFjaGluZVNldHVwUmVzcG9uc2USDwoHVmVyc2lv", "bhgBIAEoCRITCgtCbG9iQWRkcmVzcxgCIAEoCRIRCglEYkFkZHJlc3MYAyAB", "KAkSEgoKRGJVc2VyTmFtZRgEIAEoCRISCgpEYlBhc3N3b3JkGAUgASgJEg0K", - "BU9TS2V5GAYgASgJQiUKI2NvbS50d2luZS50YW5nby5wbXIuc3luY2hyb25p", - "emF0aW9uYgZwcm90bzM=")); + "BU9TS2V5GAYgASgJEhcKD1NldHVwQWN0aXZhdGlvbhgHIAEoCBIdChVTZXR1", + "cFJlbW90ZUFzc2lzdGFuY2UYCCABKAgSEAoIU2V0dXBVV0YYCSABKAgSFQoN", + "U2V0dXBGaXJtd2FyZRgKIAEoCBIOCgZJc0RlbW8YCyABKAhCJQojY29tLnR3", + "aW5lLnRhbmdvLnBtci5zeW5jaHJvbml6YXRpb25iBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Synchronization.MachineSetupResponse), global::Tango.PMR.Synchronization.MachineSetupResponse.Parser, new[]{ "Version", "BlobAddress", "DbAddress", "DbUserName", "DbPassword", "OSKey" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Synchronization.MachineSetupResponse), global::Tango.PMR.Synchronization.MachineSetupResponse.Parser, new[]{ "Version", "BlobAddress", "DbAddress", "DbUserName", "DbPassword", "OSKey", "SetupActivation", "SetupRemoteAssistance", "SetupUWF", "SetupFirmware", "IsDemo" }, null, null, null) })); } #endregion @@ -68,6 +70,11 @@ namespace Tango.PMR.Synchronization { dbUserName_ = other.dbUserName_; dbPassword_ = other.dbPassword_; oSKey_ = other.oSKey_; + setupActivation_ = other.setupActivation_; + setupRemoteAssistance_ = other.setupRemoteAssistance_; + setupUWF_ = other.setupUWF_; + setupFirmware_ = other.setupFirmware_; + isDemo_ = other.isDemo_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -141,6 +148,61 @@ namespace Tango.PMR.Synchronization { } } + /// Field number for the "SetupActivation" field. + public const int SetupActivationFieldNumber = 7; + private bool setupActivation_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool SetupActivation { + get { return setupActivation_; } + set { + setupActivation_ = value; + } + } + + /// Field number for the "SetupRemoteAssistance" field. + public const int SetupRemoteAssistanceFieldNumber = 8; + private bool setupRemoteAssistance_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool SetupRemoteAssistance { + get { return setupRemoteAssistance_; } + set { + setupRemoteAssistance_ = value; + } + } + + /// Field number for the "SetupUWF" field. + public const int SetupUWFFieldNumber = 9; + private bool setupUWF_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool SetupUWF { + get { return setupUWF_; } + set { + setupUWF_ = value; + } + } + + /// Field number for the "SetupFirmware" field. + public const int SetupFirmwareFieldNumber = 10; + private bool setupFirmware_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool SetupFirmware { + get { return setupFirmware_; } + set { + setupFirmware_ = value; + } + } + + /// Field number for the "IsDemo" field. + public const int IsDemoFieldNumber = 11; + private bool isDemo_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool IsDemo { + get { return isDemo_; } + set { + isDemo_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as MachineSetupResponse); @@ -160,6 +222,11 @@ namespace Tango.PMR.Synchronization { if (DbUserName != other.DbUserName) return false; if (DbPassword != other.DbPassword) return false; if (OSKey != other.OSKey) return false; + if (SetupActivation != other.SetupActivation) return false; + if (SetupRemoteAssistance != other.SetupRemoteAssistance) return false; + if (SetupUWF != other.SetupUWF) return false; + if (SetupFirmware != other.SetupFirmware) return false; + if (IsDemo != other.IsDemo) return false; return true; } @@ -172,6 +239,11 @@ namespace Tango.PMR.Synchronization { if (DbUserName.Length != 0) hash ^= DbUserName.GetHashCode(); if (DbPassword.Length != 0) hash ^= DbPassword.GetHashCode(); if (OSKey.Length != 0) hash ^= OSKey.GetHashCode(); + if (SetupActivation != false) hash ^= SetupActivation.GetHashCode(); + if (SetupRemoteAssistance != false) hash ^= SetupRemoteAssistance.GetHashCode(); + if (SetupUWF != false) hash ^= SetupUWF.GetHashCode(); + if (SetupFirmware != false) hash ^= SetupFirmware.GetHashCode(); + if (IsDemo != false) hash ^= IsDemo.GetHashCode(); return hash; } @@ -206,6 +278,26 @@ namespace Tango.PMR.Synchronization { output.WriteRawTag(50); output.WriteString(OSKey); } + if (SetupActivation != false) { + output.WriteRawTag(56); + output.WriteBool(SetupActivation); + } + if (SetupRemoteAssistance != false) { + output.WriteRawTag(64); + output.WriteBool(SetupRemoteAssistance); + } + if (SetupUWF != false) { + output.WriteRawTag(72); + output.WriteBool(SetupUWF); + } + if (SetupFirmware != false) { + output.WriteRawTag(80); + output.WriteBool(SetupFirmware); + } + if (IsDemo != false) { + output.WriteRawTag(88); + output.WriteBool(IsDemo); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -229,6 +321,21 @@ namespace Tango.PMR.Synchronization { if (OSKey.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(OSKey); } + if (SetupActivation != false) { + size += 1 + 1; + } + if (SetupRemoteAssistance != false) { + size += 1 + 1; + } + if (SetupUWF != false) { + size += 1 + 1; + } + if (SetupFirmware != false) { + size += 1 + 1; + } + if (IsDemo != false) { + size += 1 + 1; + } return size; } @@ -255,6 +362,21 @@ namespace Tango.PMR.Synchronization { if (other.OSKey.Length != 0) { OSKey = other.OSKey; } + if (other.SetupActivation != false) { + SetupActivation = other.SetupActivation; + } + if (other.SetupRemoteAssistance != false) { + SetupRemoteAssistance = other.SetupRemoteAssistance; + } + if (other.SetupUWF != false) { + SetupUWF = other.SetupUWF; + } + if (other.SetupFirmware != false) { + SetupFirmware = other.SetupFirmware; + } + if (other.IsDemo != false) { + IsDemo = other.IsDemo; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -289,6 +411,26 @@ namespace Tango.PMR.Synchronization { OSKey = input.ReadString(); break; } + case 56: { + SetupActivation = input.ReadBool(); + break; + } + case 64: { + SetupRemoteAssistance = input.ReadBool(); + break; + } + case 72: { + SetupUWF = input.ReadBool(); + break; + } + case 80: { + SetupFirmware = input.ReadBool(); + break; + } + case 88: { + IsDemo = input.ReadBool(); + break; + } } } } diff --git a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/OverrideData.xml b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/OverrideData.xml index 6c9e5b267..61ca6aedb 100644 Binary files a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/OverrideData.xml and b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/OverrideData.xml differ diff --git a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml index c6f4e5825..003d76bde 100644 Binary files a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml and b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml differ diff --git a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml index f2671bee8..ca0b7f8f1 100644 Binary files a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml and b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml differ diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/SynchronizationController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/SynchronizationController.cs index 6126594c5..d675a348f 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/SynchronizationController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/SynchronizationController.cs @@ -98,9 +98,9 @@ namespace Tango.MachineService.Controllers throw new AuthenticationException("The specified serial number could not be found."); } - if (machine.OsKey == null) + if (machine.SetupActivation && machine.OsKey == null) { - throw new InvalidDataException("The specified machine is not associated with an OS activation key."); + throw new InvalidDataException("The specified machine is configured to perform an OS activation but is not associated with an OS activation key."); } var machine_version = db.MachineVersions.SingleOrDefault(x => x.Guid == machine.MachineVersionGuid); @@ -134,6 +134,12 @@ namespace Tango.MachineService.Controllers response.DbUserName = credentials.UserName; response.DbPassword = credentials.Password; response.OSKey = machine.OsKey; + response.SetupActivation = machine.SetupActivation; + response.SetupRemoteAssistance = machine.SetupRemoteAssistance; + response.SetupUWF = machine.SetupUwf; + response.SetupFirmware = machine.SetupFirmware; + response.IsDemo = machine.IsDemo; + } return response; -- cgit v1.3.1 From 0f5a0b13fc4408952d90d2450c642a7948b88879 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 19 Dec 2018 10:02:27 +0200 Subject: Starting working on improving web api's access... --- .../Properties/AssemblyInfo.cs | 2 +- .../MachineSetup/MachineSetupManager.cs | 2 +- .../MachineUpdate/MachineUpdateManager.cs | 6 +- .../Tango.PPC.UpdateService/PPCUpdateService.svc | 1 - .../PPCUpdateService.svc.cs | 193 -------------- .../Properties/AssemblyInfo.cs | 36 --- .../Publish PPC Update Service via FTP.pubxml | 21 -- .../Tango.PPC.UpdateService.csproj | 144 ----------- .../PPC/Tango.PPC.UpdateService/Web.Debug.config | 30 --- .../PPC/Tango.PPC.UpdateService/Web.Release.config | 31 --- .../PPC/Tango.PPC.UpdateService/Web.config | 114 --------- .../PPC/Tango.PPC.UpdateService/packages.config | 4 - .../Tango.UnitTesting/MachineService_TST.cs | 2 +- .../Controllers/PPCController.cs | 239 +++++++++++++++++ .../Controllers/SynchronizationController.cs | 285 --------------------- .../Tango.MachineService.csproj | 4 +- 16 files changed, 247 insertions(+), 867 deletions(-) delete mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UpdateService/PPCUpdateService.svc delete mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UpdateService/PPCUpdateService.svc.cs delete mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Properties/AssemblyInfo.cs delete mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Properties/PublishProfiles/Publish PPC Update Service via FTP.pubxml delete mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Tango.PPC.UpdateService.csproj delete mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Web.Debug.config delete mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Web.Release.config delete mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Web.config delete mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UpdateService/packages.config create mode 100644 Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs delete mode 100644 Software/Visual_Studio/Web/Tango.MachineService/Controllers/SynchronizationController.cs (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index c311df44b..2b58baa21 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("3.5.79.18305")] +[assembly: AssemblyVersion("3.5.80.18305")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs index e1795d06a..eb47ae231 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -114,7 +114,7 @@ namespace Tango.PPC.Common.MachineSetup { using (var http = new ProtoWebClient()) { - setup_response = await http.Post(machineServiceAddress + "/api/Synchronization/MachineSetup", request); + setup_response = await http.Post(machineServiceAddress + "/api/PPC/MachineSetup", request); } } catch (Exception ex) diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs index 9ae77df6f..ce45258f5 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs @@ -113,7 +113,7 @@ namespace Tango.PPC.Common.MachineUpdate using (var http = new ProtoWebClient()) { - update_response = await http.Post(machineServiceAddress + "/api/Synchronization/MachineUpdate", request); + update_response = await http.Post(machineServiceAddress + "/api/PPC/MachineUpdate", request); } LogManager.Log($"Machine update response received: {Environment.NewLine}{update_response.ToJsonString()}"); @@ -294,7 +294,7 @@ namespace Tango.PPC.Common.MachineUpdate using (var http = new ProtoWebClient()) { - update_response = http.Post(machineServiceAddress + "/api/Synchronization/CheckForUpdate", request).Result; + update_response = http.Post(machineServiceAddress + "/api/PPC/CheckForUpdate", request).Result; } LogManager.Log($"Check for update response received: {Environment.NewLine}{update_response.ToJsonString()}"); @@ -405,7 +405,7 @@ namespace Tango.PPC.Common.MachineUpdate using (var http = new ProtoWebClient()) { - update_response = http.Post(machineServiceAddress + "/api/Synchronization/UpdateDB", request).Result; + update_response = http.Post(machineServiceAddress + "/api/PPC/UpdateDB", request).Result; } LogManager.Log($"Update DB response received: {Environment.NewLine}{update_response.ToJsonString()}"); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/PPCUpdateService.svc b/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/PPCUpdateService.svc deleted file mode 100644 index ea2b9c582..000000000 --- a/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/PPCUpdateService.svc +++ /dev/null @@ -1 +0,0 @@ -<%@ ServiceHost Language="C#" Debug="true" Service="Tango.PPC.UpdateService.PPCUpdateService" CodeBehind="PPCUpdateService.svc.cs" %> \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/PPCUpdateService.svc.cs b/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/PPCUpdateService.svc.cs deleted file mode 100644 index 2474e310c..000000000 --- a/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/PPCUpdateService.svc.cs +++ /dev/null @@ -1,193 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Configuration; -using System.IO; -using System.Linq; -using System.Runtime.Serialization; -using System.ServiceModel; -using System.ServiceModel.Web; -using System.Text; -using Tango.BL; -using Tango.BL.Entities; -using Tango.BL.Enumerations; -using Tango.Logging; -using Tango.PPC.Common.Update; - -namespace Tango.PPC.UpdateService -{ - public class PPCUpdateService : IPPCUpdateService - { - private LogManager LogManager = LogManager.Default; - - private class PendingUpload - { - public String Token { get; set; } - - public String Version { get; set; } - - public String UserGuid { get; set; } - - public String Comments { get; set; } - - public String MachineVersionGuid { get; set; } - - public String FilePath { get; set; } - } - - private static List _pendingUploads; - - static PPCUpdateService() - { - _pendingUploads = new List(); - } - - public UploadVersionResponse UploadVersion(UploadVersionRequest request) - { - try - { - UploadVersionResponse response = new UploadVersionResponse(); - - using (ObservablesContext db = ObservablesContext.CreateDefault(GetServerAddress())) - { - db.Configuration.LazyLoadingEnabled = false; - - //Load relation first... - db.Roles.ToList(); - db.Permissions.ToList(); - db.UsersRoles.ToList(); - db.RolesPermissions.ToList(); - - var user = db.Users.SingleOrDefault(x => x.Email.ToLower() == request.Email.ToLower() && x.Password == request.Password); - - if (user != null && user.HasPermission(Permissions.PublishMachineStudioVersion)) - { - var versions = db.TangoVersions.ToList().Where(x => x.MachineVersionGuid == request.MachineVersionGuid).OrderByDescending(x => Version.Parse(x.Version)).ToList(); - - TangoVersion latestVersion = new TangoVersion(); - latestVersion.Version = "0.0.0.0"; - - if (versions.Count > 0) - { - latestVersion = versions.FirstOrDefault(); - } - - Version currentVersion = Version.Parse(request.Version); - - String newVersionFileName = Path.GetRandomFileName() + "_" + currentVersion.ToString() + ".zip"; - - String newVersionFilePath = "/Tango Versions/" + newVersionFileName; - - if (currentVersion > Version.Parse(latestVersion.Version)) - { - response.FtpHost = ConfigurationManager.AppSettings["FtpHost"].ToString(); - response.UserName = ConfigurationManager.AppSettings["UserName"].ToString(); - response.Password = ConfigurationManager.AppSettings["Password"].ToString(); - response.FileName = newVersionFileName; - response.FilePath = newVersionFilePath; - response.Token = Guid.NewGuid().ToString(); - - _pendingUploads.Add(new PendingUpload() - { - UserGuid = user.Guid, - Comments = request.Comments, - Token = response.Token, - Version = request.Version, - FilePath = response.FilePath, - MachineVersionGuid = request.MachineVersionGuid, - }); - } - else - { - throw new FaultException("New version must be greater than latest version."); - } - } - else - { - throw new FaultException("Invalid user credentials."); - } - } - - return response; - } - catch (Exception ex) - { - LogManager.Log(ex); - throw new FaultException(ex.ToString()); - } - } - - public void NotifyUploadCompleted(UploadCompletedRequest request) - { - try - { - PendingUpload upload = _pendingUploads.FirstOrDefault(x => x.Token == request.Token); - - if (upload != null) - { - _pendingUploads.RemoveAll(x => x.Token == upload.Token); - - using (ObservablesContext db = ObservablesContext.CreateDefault(GetServerAddress())) - { - db.Configuration.LazyLoadingEnabled = false; - - db.TangoVersions.Add(new TangoVersion() - { - Comments = upload.Comments, - FtpFilePath = upload.FilePath, - UserGuid = upload.UserGuid, - Version = upload.Version, - MachineVersionGuid = upload.MachineVersionGuid - }); - - db.SaveChanges(); - } - } - else - { - throw new FaultException("Invalid Token."); - } - } - catch (Exception ex) - { - LogManager.Log(ex); - throw new FaultException(ex.ToString()); - } - } - - public LatestVersionResponse GetLatestVersion(String machineVersionGuid) - { - try - { - LatestVersionResponse response = new LatestVersionResponse(); - - using (ObservablesContext db = ObservablesContext.CreateDefault(GetServerAddress())) - { - var versions = db.TangoVersions.Where(x => x.MachineVersionGuid == machineVersionGuid).ToList(); - - if (versions.Count > 0) - { - response.Version = db.TangoVersions.Where(x => x.MachineVersionGuid == machineVersionGuid).ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault().Version; - } - else - { - return new LatestVersionResponse() - { - Version = "0.0.0.0" - }; - } - } - - return response; - } - catch (Exception ex) - { - throw new FaultException(ex.ToString()); - } - } - - private String GetServerAddress() - { - return ConfigurationManager.AppSettings["ServerAddress"].ToString(); - } - } -} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Properties/AssemblyInfo.cs deleted file mode 100644 index 7cf1e50d3..000000000 --- a/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// 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("Tango.PPC.UpdateService")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Tango.PPC.UpdateService")] -[assembly: AssemblyCopyright("Copyright © 2018")] -[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)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("01c3ef89-6a17-4d70-a71f-0395a212f2f8")] - -// 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 Revision and Build Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Properties/PublishProfiles/Publish PPC Update Service via FTP.pubxml b/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Properties/PublishProfiles/Publish PPC Update Service via FTP.pubxml deleted file mode 100644 index c2c570917..000000000 --- a/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Properties/PublishProfiles/Publish PPC Update Service via FTP.pubxml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - FTP - Release - Any CPU - - True - False - twine01 - False - True - - PPCUpdateService|Roy - <_SavePWD>True - - \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Tango.PPC.UpdateService.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Tango.PPC.UpdateService.csproj deleted file mode 100644 index 900e41529..000000000 --- a/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Tango.PPC.UpdateService.csproj +++ /dev/null @@ -1,144 +0,0 @@ - - - - Debug - AnyCPU - - - 2.0 - {01C3EF89-6A17-4D70-A71F-0395A212F2F8} - {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - Tango.PPC.UpdateService - Tango.PPC.UpdateService - v4.6.1 - True - true - true - - - - - - - - - true - full - false - bin\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\ - TRACE - prompt - 4 - - - - ..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll - - - ..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - PPCUpdateService.svc - - - - - - - - - - - Web.config - - - Web.config - - - - - {F441FEEE-322A-4943-B566-110E12FD3B72} - Tango.BL - - - {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} - Tango.Core - - - {BC932DBD-7CDB-488C-99E4-F02CF441F55E} - Tango.Logging - - - {0be74eee-22cb-4dba-b896-793b9e1a3ac0} - Tango.PPC.Common - - - - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - - - - - True - True - 52137 - / - http://localhost:52137/ - False - False - - - False - - - - - - - \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Web.Debug.config b/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Web.Debug.config deleted file mode 100644 index fae9cfefa..000000000 --- a/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Web.Debug.config +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Web.Release.config b/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Web.Release.config deleted file mode 100644 index da6e960b8..000000000 --- a/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Web.Release.config +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Web.config b/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Web.config deleted file mode 100644 index d73fd1425..000000000 --- a/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/Web.config +++ /dev/null @@ -1,114 +0,0 @@ - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/packages.config b/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/packages.config deleted file mode 100644 index 9256e1591..000000000 --- a/Software/Visual_Studio/PPC/Tango.PPC.UpdateService/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.UnitTesting/MachineService_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/MachineService_TST.cs index 4afa31edf..954d53da8 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/MachineService_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/MachineService_TST.cs @@ -17,7 +17,7 @@ namespace Tango.UnitTesting public void Check_For_Updates() { ITransportWebClient client = new ProtoWebClient(); - var result = client.Post("http://localhost:51581/api/Synchronization/CheckForUpdate", new CheckForUpdateRequest() + var result = client.Post("http://localhost:51581/api/PPC/CheckForUpdate", new CheckForUpdateRequest() { SerialNumber = "0000", Version = "0.0.0.0", diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs new file mode 100644 index 000000000..c5e85f819 --- /dev/null +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -0,0 +1,239 @@ +using Google.Protobuf; +using Microsoft.Azure; +using Microsoft.Azure.Management.Sql; +using Microsoft.SqlServer.Management.Smo; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Configuration; +using System.IO; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Security.Authentication; +using System.Threading.Tasks; +using System.Web.Hosting; +using System.Web.Http; +using Tango.BL; +using Tango.BL.Builders; +using Tango.BL.Entities; +using Tango.Core.DB; +using Tango.Core.Helpers; +using Tango.Core.IO; +using Tango.Logging; +using Tango.MachineService.Helpers; +using Tango.MachineService.Models; +using Tango.MachineService.SMO; +using Tango.PMR.Stubs; +using Tango.PMR.Synchronization; +using Tango.Synchronization.Local; +using Tango.Synchronization.Remote; + +namespace Tango.MachineService.Controllers +{ + public class PPCController : ProtoController + { + [HttpPost] + public MachineSetupResponse MachineSetup(MachineSetupRequest request) + { + MachineSetupResponse response = new MachineSetupResponse(); + + LogManager.Log("Setup request received: " + request.ToString()); + + using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + { + db.Configuration.LazyLoadingEnabled = false; + String serial_number = request.SerialNumber; + + var machine = db.Machines.SingleOrDefault(x => x.SerialNumber == serial_number); + + if (machine == null) + { + throw new AuthenticationException("The specified serial number could not be found."); + } + + if (machine.SetupActivation && machine.OsKey == null) + { + throw new InvalidDataException("The specified machine is configured to perform an OS activation but is not associated with an OS activation key."); + } + + var machine_version = db.MachineVersions.SingleOrDefault(x => x.Guid == machine.MachineVersionGuid); + + var latest_machine_version = db.TangoVersions.Where(x => x.MachineVersionGuid == machine_version.Guid).ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault(); + + response.Version = latest_machine_version.Version; + + var client = StorageHelper.GetStorageBlobClient(); + var container = StorageHelper.GetTangoVersionsContainer(client); + var blob = container.GetBlockBlobReference(latest_machine_version.BlobName); + + response.BlobAddress = StorageHelper.GenerateBlobReadSignature(blob, TimeSpan.FromMinutes(60)); + + DbCredentials credentials = new DbCredentials(); + + using (SmoManager manager = new SmoManager()) + { + credentials = manager.CreateRandomLoginAndUser(); + + Task.Delay(TimeSpan.FromMinutes(10)).ContinueWith((x) => + { + using (SmoManager m = new SmoManager()) + { + m.DeleteLoginAndUser(credentials.UserName); + } + }); + } + + response.DbAddress = Config.DB_ADDRESS; + response.DbUserName = credentials.UserName; + response.DbPassword = credentials.Password; + response.OSKey = machine.OsKey; + response.SetupActivation = machine.SetupActivation; + response.SetupRemoteAssistance = machine.SetupRemoteAssistance; + response.SetupUWF = machine.SetupUwf; + response.SetupFirmware = machine.SetupFirmware; + response.IsDemo = machine.IsDemo; + + } + + return response; + } + + [HttpPost] + public DownloadUpdateResponse MachineUpdate(DownloadUpdateRequest request) + { + DownloadUpdateResponse response = new DownloadUpdateResponse(); + + using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + { + db.Configuration.LazyLoadingEnabled = false; + String serial_number = request.SerialNumber; + + var machine = db.Machines.SingleOrDefault(x => x.SerialNumber == serial_number); + + if (machine == null) + { + throw new AuthenticationException("The specified serial number could not be found."); + } + + var machine_version = db.MachineVersions.SingleOrDefault(x => x.Guid == machine.MachineVersionGuid); + + var latest_machine_version = db.TangoVersions.Where(x => x.MachineVersionGuid == machine_version.Guid).ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault(); + + response.Version = latest_machine_version.Version; + + var client = StorageHelper.GetStorageBlobClient(); + var container = StorageHelper.GetTangoVersionsContainer(client); + var blob = container.GetBlockBlobReference(latest_machine_version.BlobName); + + response.BlobAddress = StorageHelper.GenerateBlobReadSignature(blob, TimeSpan.FromMinutes(60)); + + DbCredentials credentials = new DbCredentials(); + + using (SmoManager manager = new SmoManager()) + { + credentials = manager.CreateRandomLoginAndUser(); + + Task.Delay(TimeSpan.FromMinutes(10)).ContinueWith((x) => + { + using (SmoManager m = new SmoManager()) + { + m.DeleteLoginAndUser(credentials.UserName); + } + }); + } + + response.DbAddress = Config.DB_ADDRESS; + response.DbUserName = credentials.UserName; + response.DbPassword = credentials.Password; + } + + return response; + } + + [HttpPost] + public CheckForUpdateResponse CheckForUpdate(CheckForUpdateRequest request) + { + CheckForUpdateResponse response = new CheckForUpdateResponse(); + + using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + { + db.Configuration.LazyLoadingEnabled = false; + + var machine = db.Machines.SingleOrDefault(x => x.SerialNumber == request.SerialNumber); + + if (machine == null) + { + throw new AuthenticationException("The specified serial number could not be found."); + } + + var machine_version = db.MachineVersions.SingleOrDefault(x => x.Guid == machine.MachineVersionGuid); + + var latest_machine_version = db.TangoVersions.Where(x => x.MachineVersionGuid == machine_version.Guid).ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault(); + + if (Version.Parse(latest_machine_version.Version) > Version.Parse(request.Version)) + { + response.IsUpdateAvailable = true; + } + + response.Version = latest_machine_version.Version; + } + + return response; + } + + [HttpPost] + public UpdateDBResponse UpdateDB(UpdateDBRequest request) + { + UpdateDBResponse response = new UpdateDBResponse(); + + using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + { + db.Configuration.LazyLoadingEnabled = false; + String serial_number = request.SerialNumber; + + var machine = db.Machines.SingleOrDefault(x => x.SerialNumber == serial_number); + + if (machine == null) + { + throw new AuthenticationException("The specified serial number could not be found."); + } + + DbCredentials credentials = new DbCredentials(); + + using (SmoManager manager = new SmoManager()) + { + credentials = manager.CreateRandomLoginAndUser(); + + Task.Delay(TimeSpan.FromMinutes(10)).ContinueWith((x) => + { + using (SmoManager m = new SmoManager()) + { + m.DeleteLoginAndUser(credentials.UserName); + } + }); + } + + response.DbAddress = Config.DB_ADDRESS; + response.DbUserName = credentials.UserName; + response.DbPassword = credentials.Password; + } + + return response; + } + + [HttpPost] + public Machine PersonTest(Person p) + { + using (var db = ObservablesContextHelper.CreateContext()) + { + var machine = new MachineBuilder(db) + .Set(x => x.SerialNumber == "1111") + .WithOrganization() + .WithConfiguration().Build(); + + return machine; + } + } + } +} diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/SynchronizationController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/SynchronizationController.cs deleted file mode 100644 index d675a348f..000000000 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/SynchronizationController.cs +++ /dev/null @@ -1,285 +0,0 @@ -using Google.Protobuf; -using Microsoft.Azure; -using Microsoft.Azure.Management.Sql; -using Microsoft.SqlServer.Management.Smo; -using Newtonsoft.Json.Linq; -using System; -using System.Collections.Generic; -using System.Configuration; -using System.IO; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Security.Authentication; -using System.Threading.Tasks; -using System.Web.Hosting; -using System.Web.Http; -using Tango.BL; -using Tango.BL.Builders; -using Tango.BL.Entities; -using Tango.Core.DB; -using Tango.Core.Helpers; -using Tango.Core.IO; -using Tango.Logging; -using Tango.MachineService.Helpers; -using Tango.MachineService.Models; -using Tango.MachineService.SMO; -using Tango.PMR.Stubs; -using Tango.PMR.Synchronization; -using Tango.Synchronization.Local; -using Tango.Synchronization.Remote; - -namespace Tango.MachineService.Controllers -{ - public class SynchronizationController : ProtoController - { - ///// - ///// Expects a DB synchronization request from a remote machine and returns the synchronized version of the machine database. - ///// - ///// The request. - ///// - //[HttpPost] - //public SynchronizeDBResponse Synchronize(SynchronizeDBRequest request) - //{ - // var tempFolder = TemporaryManager.Default.CreateFolder(); - - // try - // { - // //File path for the reflected remote data base SQLite. - // String masterSQLiteFile = Path.Combine(tempFolder, "Remote.db"); - // //File path for the received machine SQLite db. - // String slaveSQLiteFile = Path.Combine(tempFolder, "Local.db"); - - // //Save the machine db to file. - // File.WriteAllBytes(slaveSQLiteFile, request.LocalDB.ToByteArray()); - - // //Copy an SQLite db template. - // File.Copy(HostingEnvironment.MapPath(@"~/App_Data/Tango.db"), masterSQLiteFile); - - // //Synchronize the SQL Server db with the new SQLite template. (Overwrite basically) - // RemoteDBSynchronizer.Synchronize(masterSQLiteFile, request.SerialNumber, true); - - // //Synchronize the received machine db with the filled template. - // LocalDBSynchronizer.Synchronize(masterSQLiteFile, slaveSQLiteFile); - - // //Send the synchronized machine db to the machine to the machine. - // SynchronizeDBResponse response = new SynchronizeDBResponse(); - // response.RemoteDB = ByteString.CopyFrom(File.ReadAllBytes(slaveSQLiteFile)); - - // return response; - // } - // catch (Exception) - // { - // throw; - // } - // finally - // { - // //Remove all temporary files and folder. - // tempFolder.Delete(); - // } - //} - - [HttpPost] - public MachineSetupResponse MachineSetup(MachineSetupRequest request) - { - MachineSetupResponse response = new MachineSetupResponse(); - - LogManager.Log("Setup request received: " + request.ToString()); - - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) - { - db.Configuration.LazyLoadingEnabled = false; - String serial_number = request.SerialNumber; - - var machine = db.Machines.SingleOrDefault(x => x.SerialNumber == serial_number); - - if (machine == null) - { - throw new AuthenticationException("The specified serial number could not be found."); - } - - if (machine.SetupActivation && machine.OsKey == null) - { - throw new InvalidDataException("The specified machine is configured to perform an OS activation but is not associated with an OS activation key."); - } - - var machine_version = db.MachineVersions.SingleOrDefault(x => x.Guid == machine.MachineVersionGuid); - - var latest_machine_version = db.TangoVersions.Where(x => x.MachineVersionGuid == machine_version.Guid).ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault(); - - response.Version = latest_machine_version.Version; - - var client = StorageHelper.GetStorageBlobClient(); - var container = StorageHelper.GetTangoVersionsContainer(client); - var blob = container.GetBlockBlobReference(latest_machine_version.BlobName); - - response.BlobAddress = StorageHelper.GenerateBlobReadSignature(blob, TimeSpan.FromMinutes(60)); - - DbCredentials credentials = new DbCredentials(); - - using (SmoManager manager = new SmoManager()) - { - credentials = manager.CreateRandomLoginAndUser(); - - Task.Delay(TimeSpan.FromMinutes(10)).ContinueWith((x) => - { - using (SmoManager m = new SmoManager()) - { - m.DeleteLoginAndUser(credentials.UserName); - } - }); - } - - response.DbAddress = Config.DB_ADDRESS; - response.DbUserName = credentials.UserName; - response.DbPassword = credentials.Password; - response.OSKey = machine.OsKey; - response.SetupActivation = machine.SetupActivation; - response.SetupRemoteAssistance = machine.SetupRemoteAssistance; - response.SetupUWF = machine.SetupUwf; - response.SetupFirmware = machine.SetupFirmware; - response.IsDemo = machine.IsDemo; - - } - - return response; - } - - [HttpPost] - public DownloadUpdateResponse MachineUpdate(DownloadUpdateRequest request) - { - DownloadUpdateResponse response = new DownloadUpdateResponse(); - - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) - { - db.Configuration.LazyLoadingEnabled = false; - String serial_number = request.SerialNumber; - - var machine = db.Machines.SingleOrDefault(x => x.SerialNumber == serial_number); - - if (machine == null) - { - throw new AuthenticationException("The specified serial number could not be found."); - } - - var machine_version = db.MachineVersions.SingleOrDefault(x => x.Guid == machine.MachineVersionGuid); - - var latest_machine_version = db.TangoVersions.Where(x => x.MachineVersionGuid == machine_version.Guid).ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault(); - - response.Version = latest_machine_version.Version; - - var client = StorageHelper.GetStorageBlobClient(); - var container = StorageHelper.GetTangoVersionsContainer(client); - var blob = container.GetBlockBlobReference(latest_machine_version.BlobName); - - response.BlobAddress = StorageHelper.GenerateBlobReadSignature(blob, TimeSpan.FromMinutes(60)); - - DbCredentials credentials = new DbCredentials(); - - using (SmoManager manager = new SmoManager()) - { - credentials = manager.CreateRandomLoginAndUser(); - - Task.Delay(TimeSpan.FromMinutes(10)).ContinueWith((x) => - { - using (SmoManager m = new SmoManager()) - { - m.DeleteLoginAndUser(credentials.UserName); - } - }); - } - - response.DbAddress = Config.DB_ADDRESS; - response.DbUserName = credentials.UserName; - response.DbPassword = credentials.Password; - } - - return response; - } - - [HttpPost] - public CheckForUpdateResponse CheckForUpdate(CheckForUpdateRequest request) - { - CheckForUpdateResponse response = new CheckForUpdateResponse(); - - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) - { - db.Configuration.LazyLoadingEnabled = false; - - var machine = db.Machines.SingleOrDefault(x => x.SerialNumber == request.SerialNumber); - - if (machine == null) - { - throw new AuthenticationException("The specified serial number could not be found."); - } - - var machine_version = db.MachineVersions.SingleOrDefault(x => x.Guid == machine.MachineVersionGuid); - - var latest_machine_version = db.TangoVersions.Where(x => x.MachineVersionGuid == machine_version.Guid).ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault(); - - if (Version.Parse(latest_machine_version.Version) > Version.Parse(request.Version)) - { - response.IsUpdateAvailable = true; - } - - response.Version = latest_machine_version.Version; - } - - return response; - } - - [HttpPost] - public UpdateDBResponse UpdateDB(UpdateDBRequest request) - { - UpdateDBResponse response = new UpdateDBResponse(); - - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) - { - db.Configuration.LazyLoadingEnabled = false; - String serial_number = request.SerialNumber; - - var machine = db.Machines.SingleOrDefault(x => x.SerialNumber == serial_number); - - if (machine == null) - { - throw new AuthenticationException("The specified serial number could not be found."); - } - - DbCredentials credentials = new DbCredentials(); - - using (SmoManager manager = new SmoManager()) - { - credentials = manager.CreateRandomLoginAndUser(); - - Task.Delay(TimeSpan.FromMinutes(10)).ContinueWith((x) => - { - using (SmoManager m = new SmoManager()) - { - m.DeleteLoginAndUser(credentials.UserName); - } - }); - } - - response.DbAddress = Config.DB_ADDRESS; - response.DbUserName = credentials.UserName; - response.DbPassword = credentials.Password; - } - - return response; - } - - [HttpPost] - public Machine PersonTest(Person p) - { - using (var db = ObservablesContextHelper.CreateContext()) - { - var machine = new MachineBuilder(db) - .Set(x => x.SerialNumber == "1111") - .WithOrganization() - .WithConfiguration().Build(); - - return machine; - } - } - } -} diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj b/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj index 9f0b2cba2..c7fdab45c 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj +++ b/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj @@ -279,7 +279,7 @@ - + Global.asax @@ -365,7 +365,7 @@ False - + -- cgit v1.3.1 From de762e7e5b346af5a12eff04cbaa0696eec15b8c Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 19 Dec 2018 12:57:04 +0200 Subject: Moved all web transport to json :/ --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 20578304 -> 20578304 bytes .../Synchronization/CheckForUpdateRequest.proto | 10 - .../Synchronization/CheckForUpdateResponse.proto | 10 - .../Synchronization/DownloadUpdateRequest.proto | 9 - .../Synchronization/DownloadUpdateResponse.proto | 15 - .../Synchronization/MachineSetupRequest.proto | 9 - .../Synchronization/MachineSetupResponse.proto | 23 -- .../Synchronization/SynchronizeDBRequest.proto | 10 - .../Synchronization/SynchronizeDBResponse.proto | 9 - .../Messages/Synchronization/UpdateDBRequest.proto | 9 - .../Synchronization/UpdateDBResponse.proto | 11 - .../Build/Shortcuts/Machine Emulator.lnk | Bin 1530 -> 1471 bytes .../Build/Shortcuts/Machine Studio.lnk | Bin 1516 -> 1532 bytes .../Build/Shortcuts/Proto Compiler GUI.lnk | Bin 1529 -> 1464 bytes .../MachineSetup/MachineSetupManager.cs | 4 +- .../MachineSetup/MachineSetupRequest.cs | 14 + .../MachineSetup/MachineSetupResponse.cs | 28 ++ .../MachineUpdate/CheckForUpdateRequest.cs | 15 + .../MachineUpdate/CheckForUpdateResponse.cs | 15 + .../MachineUpdate/DownloadUpdateRequest.cs | 14 + .../MachineUpdate/DownloadUpdateResponse.cs | 20 + .../MachineUpdate/MachineUpdateManager.cs | 12 +- .../MachineUpdate/UpdateDBRequest.cs | 14 + .../MachineUpdate/UpdateDBResponse.cs | 16 + .../PPC/Tango.PPC.Common/PPCSettings.cs | 6 - .../PPC/Tango.PPC.Common/Tango.PPC.Common.csproj | 8 + .../Update/LatestVersionRequest.cs | 5 +- .../Update/LatestVersionResponse.cs | 5 +- .../Tango.PPC.Common/Update/PPCUpdateService.cs | 8 +- .../Update/UploadCompletedRequest.cs | 5 +- .../Update/UploadCompletedResponse.cs | 4 +- .../Update/UploadVersionRequest.cs | 9 +- .../Update/UploadVersionResponse.cs | 6 +- .../Visual_Studio/Tango.Core/Tango.Core.csproj | 2 +- .../Synchronization/CheckForUpdateRequest.cs | 188 --------- .../Synchronization/CheckForUpdateResponse.cs | 188 --------- .../Synchronization/DownloadUpdateRequest.cs | 160 -------- .../Synchronization/DownloadUpdateResponse.cs | 274 ------------- .../Synchronization/MachineSetupRequest.cs | 160 -------- .../Synchronization/MachineSetupResponse.cs | 444 --------------------- .../Synchronization/SynchronizeDBRequest.cs | 188 --------- .../Synchronization/SynchronizeDBResponse.cs | 160 -------- .../Tango.PMR/Synchronization/UpdateDBRequest.cs | 160 -------- .../Tango.PMR/Synchronization/UpdateDBResponse.cs | 216 ---------- Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj | 12 +- .../Tango.Transport/Tango.Transport.csproj | 13 +- .../Tango.Transport/TransporterBase.cs | 1 + .../Tango.Transport/Web/ITransportWebClient.cs | 14 - .../Tango.Transport/Web/IWebRequestMessage.cs | 12 + .../Tango.Transport/Web/IWebResponseMessage.cs | 12 + .../Tango.Transport/Web/IWebTransportClient.cs | 15 + .../Tango.Transport/Web/IWebTransportMessage.cs | 12 + .../Tango.Transport/Web/JsonWebClient.cs | 69 ---- .../Tango.Transport/Web/ProtoWebClient.cs | 51 --- .../Tango.Transport/Web/WebRequestMessage.cs | 12 + .../Tango.Transport/Web/WebResponseMessage.cs | 12 + .../Tango.Transport/Web/WebTransportClient.cs | 84 ++++ .../Tango.Transport/Web/WebTransportMessage.cs | 12 + .../Tango.UnitTesting/MachineService_TST.cs | 2 +- .../Controllers/HomeController.cs | 16 - .../Controllers/PPCController.cs | 152 ++++++- .../Controllers/ValuesController.cs | 45 --- .../Controllers/VersionUpdateController.cs | 168 -------- .../Tango.MachineService/Models/PendingUpload.cs | 22 + .../Tango.MachineService.csproj | 8 +- 66 files changed, 531 insertions(+), 2676 deletions(-) delete mode 100644 Software/PMR/Messages/Synchronization/CheckForUpdateRequest.proto delete mode 100644 Software/PMR/Messages/Synchronization/CheckForUpdateResponse.proto delete mode 100644 Software/PMR/Messages/Synchronization/DownloadUpdateRequest.proto delete mode 100644 Software/PMR/Messages/Synchronization/DownloadUpdateResponse.proto delete mode 100644 Software/PMR/Messages/Synchronization/MachineSetupRequest.proto delete mode 100644 Software/PMR/Messages/Synchronization/MachineSetupResponse.proto delete mode 100644 Software/PMR/Messages/Synchronization/SynchronizeDBRequest.proto delete mode 100644 Software/PMR/Messages/Synchronization/SynchronizeDBResponse.proto delete mode 100644 Software/PMR/Messages/Synchronization/UpdateDBRequest.proto delete mode 100644 Software/PMR/Messages/Synchronization/UpdateDBResponse.proto create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupRequest.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResponse.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/CheckForUpdateRequest.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/CheckForUpdateResponse.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/DownloadUpdateRequest.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/DownloadUpdateResponse.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/UpdateDBRequest.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/UpdateDBResponse.cs delete mode 100644 Software/Visual_Studio/Tango.PMR/Synchronization/CheckForUpdateRequest.cs delete mode 100644 Software/Visual_Studio/Tango.PMR/Synchronization/CheckForUpdateResponse.cs delete mode 100644 Software/Visual_Studio/Tango.PMR/Synchronization/DownloadUpdateRequest.cs delete mode 100644 Software/Visual_Studio/Tango.PMR/Synchronization/DownloadUpdateResponse.cs delete mode 100644 Software/Visual_Studio/Tango.PMR/Synchronization/MachineSetupRequest.cs delete mode 100644 Software/Visual_Studio/Tango.PMR/Synchronization/MachineSetupResponse.cs delete mode 100644 Software/Visual_Studio/Tango.PMR/Synchronization/SynchronizeDBRequest.cs delete mode 100644 Software/Visual_Studio/Tango.PMR/Synchronization/SynchronizeDBResponse.cs delete mode 100644 Software/Visual_Studio/Tango.PMR/Synchronization/UpdateDBRequest.cs delete mode 100644 Software/Visual_Studio/Tango.PMR/Synchronization/UpdateDBResponse.cs delete mode 100644 Software/Visual_Studio/Tango.Transport/Web/ITransportWebClient.cs create mode 100644 Software/Visual_Studio/Tango.Transport/Web/IWebRequestMessage.cs create mode 100644 Software/Visual_Studio/Tango.Transport/Web/IWebResponseMessage.cs create mode 100644 Software/Visual_Studio/Tango.Transport/Web/IWebTransportClient.cs create mode 100644 Software/Visual_Studio/Tango.Transport/Web/IWebTransportMessage.cs delete mode 100644 Software/Visual_Studio/Tango.Transport/Web/JsonWebClient.cs delete mode 100644 Software/Visual_Studio/Tango.Transport/Web/ProtoWebClient.cs create mode 100644 Software/Visual_Studio/Tango.Transport/Web/WebRequestMessage.cs create mode 100644 Software/Visual_Studio/Tango.Transport/Web/WebResponseMessage.cs create mode 100644 Software/Visual_Studio/Tango.Transport/Web/WebTransportClient.cs create mode 100644 Software/Visual_Studio/Tango.Transport/Web/WebTransportMessage.cs delete mode 100644 Software/Visual_Studio/Web/Tango.MachineService/Controllers/HomeController.cs delete mode 100644 Software/Visual_Studio/Web/Tango.MachineService/Controllers/ValuesController.cs delete mode 100644 Software/Visual_Studio/Web/Tango.MachineService/Controllers/VersionUpdateController.cs create mode 100644 Software/Visual_Studio/Web/Tango.MachineService/Models/PendingUpload.cs (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 81ed33c36..5b346239d 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 76a2f4509..1801b28f7 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/PMR/Messages/Synchronization/CheckForUpdateRequest.proto b/Software/PMR/Messages/Synchronization/CheckForUpdateRequest.proto deleted file mode 100644 index 4b1da8764..000000000 --- a/Software/PMR/Messages/Synchronization/CheckForUpdateRequest.proto +++ /dev/null @@ -1,10 +0,0 @@ -syntax = "proto3"; - -package Tango.PMR.Synchronization; -option java_package = "com.twine.tango.pmr.synchronization"; - -message CheckForUpdateRequest -{ - string SerialNumber = 1; - string Version = 2; -} \ No newline at end of file diff --git a/Software/PMR/Messages/Synchronization/CheckForUpdateResponse.proto b/Software/PMR/Messages/Synchronization/CheckForUpdateResponse.proto deleted file mode 100644 index 30e2b6fbb..000000000 --- a/Software/PMR/Messages/Synchronization/CheckForUpdateResponse.proto +++ /dev/null @@ -1,10 +0,0 @@ -syntax = "proto3"; - -package Tango.PMR.Synchronization; -option java_package = "com.twine.tango.pmr.synchronization"; - -message CheckForUpdateResponse -{ - bool IsUpdateAvailable = 1; - string Version = 2; -} \ No newline at end of file diff --git a/Software/PMR/Messages/Synchronization/DownloadUpdateRequest.proto b/Software/PMR/Messages/Synchronization/DownloadUpdateRequest.proto deleted file mode 100644 index 98b302f85..000000000 --- a/Software/PMR/Messages/Synchronization/DownloadUpdateRequest.proto +++ /dev/null @@ -1,9 +0,0 @@ -syntax = "proto3"; - -package Tango.PMR.Synchronization; -option java_package = "com.twine.tango.pmr.synchronization"; - -message DownloadUpdateRequest -{ - string SerialNumber = 1; -} \ No newline at end of file diff --git a/Software/PMR/Messages/Synchronization/DownloadUpdateResponse.proto b/Software/PMR/Messages/Synchronization/DownloadUpdateResponse.proto deleted file mode 100644 index d48639398..000000000 --- a/Software/PMR/Messages/Synchronization/DownloadUpdateResponse.proto +++ /dev/null @@ -1,15 +0,0 @@ -syntax = "proto3"; - -package Tango.PMR.Synchronization; -option java_package = "com.twine.tango.pmr.synchronization"; - -message DownloadUpdateResponse -{ - string Version = 1; - - string BlobAddress = 2; - - string DbAddress = 3; - string DbUserName = 4; - string DbPassword = 5; -} \ No newline at end of file diff --git a/Software/PMR/Messages/Synchronization/MachineSetupRequest.proto b/Software/PMR/Messages/Synchronization/MachineSetupRequest.proto deleted file mode 100644 index 578e3a194..000000000 --- a/Software/PMR/Messages/Synchronization/MachineSetupRequest.proto +++ /dev/null @@ -1,9 +0,0 @@ -syntax = "proto3"; - -package Tango.PMR.Synchronization; -option java_package = "com.twine.tango.pmr.synchronization"; - -message MachineSetupRequest -{ - string SerialNumber = 1; -} \ No newline at end of file diff --git a/Software/PMR/Messages/Synchronization/MachineSetupResponse.proto b/Software/PMR/Messages/Synchronization/MachineSetupResponse.proto deleted file mode 100644 index cc0d675b9..000000000 --- a/Software/PMR/Messages/Synchronization/MachineSetupResponse.proto +++ /dev/null @@ -1,23 +0,0 @@ -syntax = "proto3"; - -package Tango.PMR.Synchronization; -option java_package = "com.twine.tango.pmr.synchronization"; - -message MachineSetupResponse -{ - string Version = 1; - - string BlobAddress = 2; - - string DbAddress = 3; - string DbUserName = 4; - string DbPassword = 5; - - string OSKey = 6; - - bool SetupActivation = 7; - bool SetupRemoteAssistance = 8; - bool SetupUWF = 9; - bool SetupFirmware = 10; - bool IsDemo = 11; -} \ No newline at end of file diff --git a/Software/PMR/Messages/Synchronization/SynchronizeDBRequest.proto b/Software/PMR/Messages/Synchronization/SynchronizeDBRequest.proto deleted file mode 100644 index b3b6d542f..000000000 --- a/Software/PMR/Messages/Synchronization/SynchronizeDBRequest.proto +++ /dev/null @@ -1,10 +0,0 @@ -syntax = "proto3"; - -package Tango.PMR.Synchronization; -option java_package = "com.twine.tango.pmr.synchronization"; - -message SynchronizeDBRequest -{ - string SerialNumber = 1; - bytes LocalDB = 2; -} \ No newline at end of file diff --git a/Software/PMR/Messages/Synchronization/SynchronizeDBResponse.proto b/Software/PMR/Messages/Synchronization/SynchronizeDBResponse.proto deleted file mode 100644 index 091934027..000000000 --- a/Software/PMR/Messages/Synchronization/SynchronizeDBResponse.proto +++ /dev/null @@ -1,9 +0,0 @@ -syntax = "proto3"; - -package Tango.PMR.Synchronization; -option java_package = "com.twine.tango.pmr.synchronization"; - -message SynchronizeDBResponse -{ - bytes RemoteDB = 1; -} \ No newline at end of file diff --git a/Software/PMR/Messages/Synchronization/UpdateDBRequest.proto b/Software/PMR/Messages/Synchronization/UpdateDBRequest.proto deleted file mode 100644 index da3fe74c5..000000000 --- a/Software/PMR/Messages/Synchronization/UpdateDBRequest.proto +++ /dev/null @@ -1,9 +0,0 @@ -syntax = "proto3"; - -package Tango.PMR.Synchronization; -option java_package = "com.twine.tango.pmr.synchronization"; - -message UpdateDBRequest -{ - string SerialNumber = 1; -} \ No newline at end of file diff --git a/Software/PMR/Messages/Synchronization/UpdateDBResponse.proto b/Software/PMR/Messages/Synchronization/UpdateDBResponse.proto deleted file mode 100644 index fbc8e1ec3..000000000 --- a/Software/PMR/Messages/Synchronization/UpdateDBResponse.proto +++ /dev/null @@ -1,11 +0,0 @@ -syntax = "proto3"; - -package Tango.PMR.Synchronization; -option java_package = "com.twine.tango.pmr.synchronization"; - -message UpdateDBResponse -{ - string DbAddress = 1; - string DbUserName = 2; - string DbPassword = 3; -} \ No newline at end of file diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk index 391bb5fd2..612ccab34 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk and b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk index 8f85b4556..09ae17244 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk and b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk index 98e7572e8..6f203ca29 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk and b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs index eb47ae231..1f86e0953 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -112,9 +112,9 @@ namespace Tango.PPC.Common.MachineSetup try { - using (var http = new ProtoWebClient()) + using (var http = new WebTransportClient()) { - setup_response = await http.Post(machineServiceAddress + "/api/PPC/MachineSetup", request); + setup_response = await http.PostJson(machineServiceAddress + "/api/PPC/MachineSetup", request); } } catch (Exception ex) diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupRequest.cs new file mode 100644 index 000000000..4c8039544 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupRequest.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Transport.Web; + +namespace Tango.PPC.Common.MachineSetup +{ + public class MachineSetupRequest : WebRequestMessage + { + public String SerialNumber { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResponse.cs new file mode 100644 index 000000000..89450a1d1 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResponse.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Transport.Web; + +namespace Tango.PPC.Common.MachineSetup +{ + public class MachineSetupResponse : WebResponseMessage + { + public String Version { get; set; } + + public String BlobAddress { get; set; } + + public String DbAddress { get; set; } + public String DbUserName { get; set; } + public String DbPassword { get; set; } + + public String OSKey { get; set; } + + public bool SetupActivation { get; set; } + public bool SetupRemoteAssistance { get; set; } + public bool SetupUWF { get; set; } + public bool SetupFirmware { get; set; } + public bool IsDemo { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/CheckForUpdateRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/CheckForUpdateRequest.cs new file mode 100644 index 000000000..cd5789393 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/CheckForUpdateRequest.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Transport.Web; + +namespace Tango.PPC.Common.MachineUpdate +{ + public class CheckForUpdateRequest : WebRequestMessage + { + public String SerialNumber { get; set; } + public String Version { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/CheckForUpdateResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/CheckForUpdateResponse.cs new file mode 100644 index 000000000..cbf6c8c64 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/CheckForUpdateResponse.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Transport.Web; + +namespace Tango.PPC.Common.MachineUpdate +{ + public class CheckForUpdateResponse : WebResponseMessage + { + public bool IsUpdateAvailable { get; set; } + public String Version { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/DownloadUpdateRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/DownloadUpdateRequest.cs new file mode 100644 index 000000000..9369a2a94 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/DownloadUpdateRequest.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Transport.Web; + +namespace Tango.PPC.Common.MachineUpdate +{ + public class DownloadUpdateRequest : WebRequestMessage + { + public String SerialNumber { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/DownloadUpdateResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/DownloadUpdateResponse.cs new file mode 100644 index 000000000..c42c06f3b --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/DownloadUpdateResponse.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Transport.Web; + +namespace Tango.PPC.Common.MachineUpdate +{ + public class DownloadUpdateResponse : WebResponseMessage + { + public String Version { get; set; } + + public String BlobAddress { get; set; } + + public String DbAddress { get; set; } + public String DbUserName { get; set; } + public String DbPassword { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs index ce45258f5..6df7117d7 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs @@ -111,9 +111,9 @@ namespace Tango.PPC.Common.MachineUpdate DownloadUpdateResponse update_response = null; - using (var http = new ProtoWebClient()) + using (var http = new WebTransportClient()) { - update_response = await http.Post(machineServiceAddress + "/api/PPC/MachineUpdate", request); + update_response = await http.PostJson(machineServiceAddress + "/api/PPC/MachineUpdate", request); } LogManager.Log($"Machine update response received: {Environment.NewLine}{update_response.ToJsonString()}"); @@ -292,9 +292,9 @@ namespace Tango.PPC.Common.MachineUpdate CheckForUpdateResponse update_response = null; - using (var http = new ProtoWebClient()) + using (var http = new WebTransportClient()) { - update_response = http.Post(machineServiceAddress + "/api/PPC/CheckForUpdate", request).Result; + update_response = http.PostJson(machineServiceAddress + "/api/PPC/CheckForUpdate", request).Result; } LogManager.Log($"Check for update response received: {Environment.NewLine}{update_response.ToJsonString()}"); @@ -403,9 +403,9 @@ namespace Tango.PPC.Common.MachineUpdate UpdateDBResponse update_response = null; - using (var http = new ProtoWebClient()) + using (var http = new WebTransportClient()) { - update_response = http.Post(machineServiceAddress + "/api/PPC/UpdateDB", request).Result; + update_response = http.PostJson(machineServiceAddress + "/api/PPC/UpdateDB", request).Result; } LogManager.Log($"Update DB response received: {Environment.NewLine}{update_response.ToJsonString()}"); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/UpdateDBRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/UpdateDBRequest.cs new file mode 100644 index 000000000..1d0caa5a9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/UpdateDBRequest.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Transport.Web; + +namespace Tango.PPC.Common.MachineUpdate +{ + public class UpdateDBRequest : WebRequestMessage + { + public String SerialNumber { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/UpdateDBResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/UpdateDBResponse.cs new file mode 100644 index 000000000..212cd02d2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/UpdateDBResponse.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Transport.Web; + +namespace Tango.PPC.Common.MachineUpdate +{ + public class UpdateDBResponse : WebResponseMessage + { + public String DbAddress { get; set; } + public String DbUserName { get; set; } + public String DbPassword { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index c33db4854..d6fa39af0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -25,11 +25,6 @@ namespace Tango.PPC.Common ///
public ApplicationStates ApplicationState { get; set; } - /// - /// Gets the update service address. - /// - public String UpdateServiceAddress { get; internal set; } - /// /// Gets or sets the machine service address. /// @@ -82,7 +77,6 @@ namespace Tango.PPC.Common { MachineScanningTimeoutSeconds = 20; LoggingCategories = new List(); - UpdateServiceAddress = "http://twine01/PPCUpdateService/PPCUpdateService.svc"; MachineServiceAddress = "http://machineservice.twine-srv.com/"; EmbeddedComPort = null; ExternalBridgePassword = "Aa123456"; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj index 79c970e5a..790f69ff8 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj @@ -136,11 +136,19 @@ + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/LatestVersionRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/LatestVersionRequest.cs index caa857abc..6a6dab1b4 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/LatestVersionRequest.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/LatestVersionRequest.cs @@ -4,13 +4,12 @@ using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; +using Tango.Transport.Web; namespace Tango.PPC.Common.Update { - [DataContract] - public class LatestVersionRequest + public class LatestVersionRequest : WebRequestMessage { - [DataMember] public String MachineVersionGuid { get; set; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/LatestVersionResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/LatestVersionResponse.cs index aa753fb18..8e97a8177 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/LatestVersionResponse.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/LatestVersionResponse.cs @@ -4,13 +4,12 @@ using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; +using Tango.Transport.Web; namespace Tango.PPC.Common.Update { - [DataContract] - public class LatestVersionResponse + public class LatestVersionResponse : WebResponseMessage { - [DataMember] public String Version { get; set; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/PPCUpdateService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/PPCUpdateService.cs index 282e4d627..b6654ef59 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/PPCUpdateService.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/PPCUpdateService.cs @@ -3,18 +3,20 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Settings; using Tango.Transport.Web; namespace Tango.PPC.Common.Update { public class PPCUpdateService : IPPCUpdateService { - private string address = "http://localhost:51581/api/VersionUpdate/"; - private JsonWebClient _client; + private string address; + private WebTransportClient _client; public PPCUpdateService() { - _client = new JsonWebClient(); + address = SettingsManager.Default.GetOrCreate().MachineServiceAddress + "/api/PPC/"; + _client = new WebTransportClient(); } public Task UploadVersion(UploadVersionRequest request) diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/UploadCompletedRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/UploadCompletedRequest.cs index ce30a9d7c..55e733e04 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/UploadCompletedRequest.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/UploadCompletedRequest.cs @@ -4,13 +4,12 @@ using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; +using Tango.Transport.Web; namespace Tango.PPC.Common.Update { - [DataContract] - public class UploadCompletedRequest + public class UploadCompletedRequest : WebRequestMessage { - [DataMember] public String Token { get; set; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/UploadCompletedResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/UploadCompletedResponse.cs index 171c92172..1cce32e7d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/UploadCompletedResponse.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/UploadCompletedResponse.cs @@ -4,11 +4,11 @@ using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; +using Tango.Transport.Web; namespace Tango.PPC.Common.Update { - [DataContract] - public class UploadCompletedResponse + public class UploadCompletedResponse : WebResponseMessage { } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/UploadVersionRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/UploadVersionRequest.cs index 5672e8fd9..0b496d7be 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/UploadVersionRequest.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/UploadVersionRequest.cs @@ -4,25 +4,20 @@ using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; +using Tango.Transport.Web; namespace Tango.PPC.Common.Update { - [DataContract] - public class UploadVersionRequest + public class UploadVersionRequest : WebRequestMessage { - [DataMember] public String Email { get; set; } - [DataMember] public String Password { get; set; } - [DataMember] public String Version { get; set; } - [DataMember] public String MachineVersionGuid { get; set; } - [DataMember] public String Comments { get; set; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/UploadVersionResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/UploadVersionResponse.cs index ca40617f1..4543261e7 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/UploadVersionResponse.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/UploadVersionResponse.cs @@ -4,16 +4,14 @@ using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; +using Tango.Transport.Web; namespace Tango.PPC.Common.Update { - [DataContract] - public class UploadVersionResponse + public class UploadVersionResponse : WebResponseMessage { - [DataMember] public String Token { get; set; } - [DataMember] public String BlobAddress { get; set; } } } diff --git a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj index 469a17cd9..1fe53252f 100644 --- a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj +++ b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj @@ -192,7 +192,7 @@ - + diff --git a/Software/Visual_Studio/Tango.PMR/Synchronization/CheckForUpdateRequest.cs b/Software/Visual_Studio/Tango.PMR/Synchronization/CheckForUpdateRequest.cs deleted file mode 100644 index c873c62a5..000000000 --- a/Software/Visual_Studio/Tango.PMR/Synchronization/CheckForUpdateRequest.cs +++ /dev/null @@ -1,188 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: CheckForUpdateRequest.proto -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Tango.PMR.Synchronization { - - /// Holder for reflection information generated from CheckForUpdateRequest.proto - public static partial class CheckForUpdateRequestReflection { - - #region Descriptor - /// File descriptor for CheckForUpdateRequest.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static CheckForUpdateRequestReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChtDaGVja0ZvclVwZGF0ZVJlcXVlc3QucHJvdG8SGVRhbmdvLlBNUi5TeW5j", - "aHJvbml6YXRpb24iPgoVQ2hlY2tGb3JVcGRhdGVSZXF1ZXN0EhQKDFNlcmlh", - "bE51bWJlchgBIAEoCRIPCgdWZXJzaW9uGAIgASgJQiUKI2NvbS50d2luZS50", - "YW5nby5wbXIuc3luY2hyb25pemF0aW9uYgZwcm90bzM=")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Synchronization.CheckForUpdateRequest), global::Tango.PMR.Synchronization.CheckForUpdateRequest.Parser, new[]{ "SerialNumber", "Version" }, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class CheckForUpdateRequest : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CheckForUpdateRequest()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Tango.PMR.Synchronization.CheckForUpdateRequestReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CheckForUpdateRequest() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CheckForUpdateRequest(CheckForUpdateRequest other) : this() { - serialNumber_ = other.serialNumber_; - version_ = other.version_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CheckForUpdateRequest Clone() { - return new CheckForUpdateRequest(this); - } - - /// Field number for the "SerialNumber" field. - public const int SerialNumberFieldNumber = 1; - private string serialNumber_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string SerialNumber { - get { return serialNumber_; } - set { - serialNumber_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "Version" field. - public const int VersionFieldNumber = 2; - private string version_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Version { - get { return version_; } - set { - version_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as CheckForUpdateRequest); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(CheckForUpdateRequest other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (SerialNumber != other.SerialNumber) return false; - if (Version != other.Version) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (SerialNumber.Length != 0) hash ^= SerialNumber.GetHashCode(); - if (Version.Length != 0) hash ^= Version.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (SerialNumber.Length != 0) { - output.WriteRawTag(10); - output.WriteString(SerialNumber); - } - if (Version.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Version); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (SerialNumber.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(SerialNumber); - } - if (Version.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Version); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(CheckForUpdateRequest other) { - if (other == null) { - return; - } - if (other.SerialNumber.Length != 0) { - SerialNumber = other.SerialNumber; - } - if (other.Version.Length != 0) { - Version = other.Version; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - SerialNumber = input.ReadString(); - break; - } - case 18: { - Version = input.ReadString(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Synchronization/CheckForUpdateResponse.cs b/Software/Visual_Studio/Tango.PMR/Synchronization/CheckForUpdateResponse.cs deleted file mode 100644 index 736c653e5..000000000 --- a/Software/Visual_Studio/Tango.PMR/Synchronization/CheckForUpdateResponse.cs +++ /dev/null @@ -1,188 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: CheckForUpdateResponse.proto -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Tango.PMR.Synchronization { - - /// Holder for reflection information generated from CheckForUpdateResponse.proto - public static partial class CheckForUpdateResponseReflection { - - #region Descriptor - /// File descriptor for CheckForUpdateResponse.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static CheckForUpdateResponseReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChxDaGVja0ZvclVwZGF0ZVJlc3BvbnNlLnByb3RvEhlUYW5nby5QTVIuU3lu", - "Y2hyb25pemF0aW9uIkQKFkNoZWNrRm9yVXBkYXRlUmVzcG9uc2USGQoRSXNV", - "cGRhdGVBdmFpbGFibGUYASABKAgSDwoHVmVyc2lvbhgCIAEoCUIlCiNjb20u", - "dHdpbmUudGFuZ28ucG1yLnN5bmNocm9uaXphdGlvbmIGcHJvdG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Synchronization.CheckForUpdateResponse), global::Tango.PMR.Synchronization.CheckForUpdateResponse.Parser, new[]{ "IsUpdateAvailable", "Version" }, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class CheckForUpdateResponse : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CheckForUpdateResponse()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Tango.PMR.Synchronization.CheckForUpdateResponseReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CheckForUpdateResponse() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CheckForUpdateResponse(CheckForUpdateResponse other) : this() { - isUpdateAvailable_ = other.isUpdateAvailable_; - version_ = other.version_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CheckForUpdateResponse Clone() { - return new CheckForUpdateResponse(this); - } - - /// Field number for the "IsUpdateAvailable" field. - public const int IsUpdateAvailableFieldNumber = 1; - private bool isUpdateAvailable_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsUpdateAvailable { - get { return isUpdateAvailable_; } - set { - isUpdateAvailable_ = value; - } - } - - /// Field number for the "Version" field. - public const int VersionFieldNumber = 2; - private string version_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Version { - get { return version_; } - set { - version_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as CheckForUpdateResponse); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(CheckForUpdateResponse other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (IsUpdateAvailable != other.IsUpdateAvailable) return false; - if (Version != other.Version) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (IsUpdateAvailable != false) hash ^= IsUpdateAvailable.GetHashCode(); - if (Version.Length != 0) hash ^= Version.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (IsUpdateAvailable != false) { - output.WriteRawTag(8); - output.WriteBool(IsUpdateAvailable); - } - if (Version.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Version); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (IsUpdateAvailable != false) { - size += 1 + 1; - } - if (Version.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Version); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(CheckForUpdateResponse other) { - if (other == null) { - return; - } - if (other.IsUpdateAvailable != false) { - IsUpdateAvailable = other.IsUpdateAvailable; - } - if (other.Version.Length != 0) { - Version = other.Version; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 8: { - IsUpdateAvailable = input.ReadBool(); - break; - } - case 18: { - Version = input.ReadString(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Synchronization/DownloadUpdateRequest.cs b/Software/Visual_Studio/Tango.PMR/Synchronization/DownloadUpdateRequest.cs deleted file mode 100644 index 26a0eb8ff..000000000 --- a/Software/Visual_Studio/Tango.PMR/Synchronization/DownloadUpdateRequest.cs +++ /dev/null @@ -1,160 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: DownloadUpdateRequest.proto -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Tango.PMR.Synchronization { - - /// Holder for reflection information generated from DownloadUpdateRequest.proto - public static partial class DownloadUpdateRequestReflection { - - #region Descriptor - /// File descriptor for DownloadUpdateRequest.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static DownloadUpdateRequestReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChtEb3dubG9hZFVwZGF0ZVJlcXVlc3QucHJvdG8SGVRhbmdvLlBNUi5TeW5j", - "aHJvbml6YXRpb24iLQoVRG93bmxvYWRVcGRhdGVSZXF1ZXN0EhQKDFNlcmlh", - "bE51bWJlchgBIAEoCUIlCiNjb20udHdpbmUudGFuZ28ucG1yLnN5bmNocm9u", - "aXphdGlvbmIGcHJvdG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Synchronization.DownloadUpdateRequest), global::Tango.PMR.Synchronization.DownloadUpdateRequest.Parser, new[]{ "SerialNumber" }, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class DownloadUpdateRequest : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DownloadUpdateRequest()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Tango.PMR.Synchronization.DownloadUpdateRequestReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DownloadUpdateRequest() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DownloadUpdateRequest(DownloadUpdateRequest other) : this() { - serialNumber_ = other.serialNumber_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DownloadUpdateRequest Clone() { - return new DownloadUpdateRequest(this); - } - - /// Field number for the "SerialNumber" field. - public const int SerialNumberFieldNumber = 1; - private string serialNumber_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string SerialNumber { - get { return serialNumber_; } - set { - serialNumber_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as DownloadUpdateRequest); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DownloadUpdateRequest other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (SerialNumber != other.SerialNumber) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (SerialNumber.Length != 0) hash ^= SerialNumber.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (SerialNumber.Length != 0) { - output.WriteRawTag(10); - output.WriteString(SerialNumber); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (SerialNumber.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(SerialNumber); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DownloadUpdateRequest other) { - if (other == null) { - return; - } - if (other.SerialNumber.Length != 0) { - SerialNumber = other.SerialNumber; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - SerialNumber = input.ReadString(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Synchronization/DownloadUpdateResponse.cs b/Software/Visual_Studio/Tango.PMR/Synchronization/DownloadUpdateResponse.cs deleted file mode 100644 index ef91448ff..000000000 --- a/Software/Visual_Studio/Tango.PMR/Synchronization/DownloadUpdateResponse.cs +++ /dev/null @@ -1,274 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: DownloadUpdateResponse.proto -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Tango.PMR.Synchronization { - - /// Holder for reflection information generated from DownloadUpdateResponse.proto - public static partial class DownloadUpdateResponseReflection { - - #region Descriptor - /// File descriptor for DownloadUpdateResponse.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static DownloadUpdateResponseReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChxEb3dubG9hZFVwZGF0ZVJlc3BvbnNlLnByb3RvEhlUYW5nby5QTVIuU3lu", - "Y2hyb25pemF0aW9uInkKFkRvd25sb2FkVXBkYXRlUmVzcG9uc2USDwoHVmVy", - "c2lvbhgBIAEoCRITCgtCbG9iQWRkcmVzcxgCIAEoCRIRCglEYkFkZHJlc3MY", - "AyABKAkSEgoKRGJVc2VyTmFtZRgEIAEoCRISCgpEYlBhc3N3b3JkGAUgASgJ", - "QiUKI2NvbS50d2luZS50YW5nby5wbXIuc3luY2hyb25pemF0aW9uYgZwcm90", - "bzM=")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Synchronization.DownloadUpdateResponse), global::Tango.PMR.Synchronization.DownloadUpdateResponse.Parser, new[]{ "Version", "BlobAddress", "DbAddress", "DbUserName", "DbPassword" }, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class DownloadUpdateResponse : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DownloadUpdateResponse()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Tango.PMR.Synchronization.DownloadUpdateResponseReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DownloadUpdateResponse() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DownloadUpdateResponse(DownloadUpdateResponse other) : this() { - version_ = other.version_; - blobAddress_ = other.blobAddress_; - dbAddress_ = other.dbAddress_; - dbUserName_ = other.dbUserName_; - dbPassword_ = other.dbPassword_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DownloadUpdateResponse Clone() { - return new DownloadUpdateResponse(this); - } - - /// Field number for the "Version" field. - public const int VersionFieldNumber = 1; - private string version_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Version { - get { return version_; } - set { - version_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "BlobAddress" field. - public const int BlobAddressFieldNumber = 2; - private string blobAddress_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string BlobAddress { - get { return blobAddress_; } - set { - blobAddress_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "DbAddress" field. - public const int DbAddressFieldNumber = 3; - private string dbAddress_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DbAddress { - get { return dbAddress_; } - set { - dbAddress_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "DbUserName" field. - public const int DbUserNameFieldNumber = 4; - private string dbUserName_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DbUserName { - get { return dbUserName_; } - set { - dbUserName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "DbPassword" field. - public const int DbPasswordFieldNumber = 5; - private string dbPassword_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DbPassword { - get { return dbPassword_; } - set { - dbPassword_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as DownloadUpdateResponse); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DownloadUpdateResponse other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Version != other.Version) return false; - if (BlobAddress != other.BlobAddress) return false; - if (DbAddress != other.DbAddress) return false; - if (DbUserName != other.DbUserName) return false; - if (DbPassword != other.DbPassword) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Version.Length != 0) hash ^= Version.GetHashCode(); - if (BlobAddress.Length != 0) hash ^= BlobAddress.GetHashCode(); - if (DbAddress.Length != 0) hash ^= DbAddress.GetHashCode(); - if (DbUserName.Length != 0) hash ^= DbUserName.GetHashCode(); - if (DbPassword.Length != 0) hash ^= DbPassword.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Version.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Version); - } - if (BlobAddress.Length != 0) { - output.WriteRawTag(18); - output.WriteString(BlobAddress); - } - if (DbAddress.Length != 0) { - output.WriteRawTag(26); - output.WriteString(DbAddress); - } - if (DbUserName.Length != 0) { - output.WriteRawTag(34); - output.WriteString(DbUserName); - } - if (DbPassword.Length != 0) { - output.WriteRawTag(42); - output.WriteString(DbPassword); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Version.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Version); - } - if (BlobAddress.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(BlobAddress); - } - if (DbAddress.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DbAddress); - } - if (DbUserName.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DbUserName); - } - if (DbPassword.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DbPassword); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DownloadUpdateResponse other) { - if (other == null) { - return; - } - if (other.Version.Length != 0) { - Version = other.Version; - } - if (other.BlobAddress.Length != 0) { - BlobAddress = other.BlobAddress; - } - if (other.DbAddress.Length != 0) { - DbAddress = other.DbAddress; - } - if (other.DbUserName.Length != 0) { - DbUserName = other.DbUserName; - } - if (other.DbPassword.Length != 0) { - DbPassword = other.DbPassword; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - Version = input.ReadString(); - break; - } - case 18: { - BlobAddress = input.ReadString(); - break; - } - case 26: { - DbAddress = input.ReadString(); - break; - } - case 34: { - DbUserName = input.ReadString(); - break; - } - case 42: { - DbPassword = input.ReadString(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Synchronization/MachineSetupRequest.cs b/Software/Visual_Studio/Tango.PMR/Synchronization/MachineSetupRequest.cs deleted file mode 100644 index d332f5bf8..000000000 --- a/Software/Visual_Studio/Tango.PMR/Synchronization/MachineSetupRequest.cs +++ /dev/null @@ -1,160 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: MachineSetupRequest.proto -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Tango.PMR.Synchronization { - - /// Holder for reflection information generated from MachineSetupRequest.proto - public static partial class MachineSetupRequestReflection { - - #region Descriptor - /// File descriptor for MachineSetupRequest.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static MachineSetupRequestReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChlNYWNoaW5lU2V0dXBSZXF1ZXN0LnByb3RvEhlUYW5nby5QTVIuU3luY2hy", - "b25pemF0aW9uIisKE01hY2hpbmVTZXR1cFJlcXVlc3QSFAoMU2VyaWFsTnVt", - "YmVyGAEgASgJQiUKI2NvbS50d2luZS50YW5nby5wbXIuc3luY2hyb25pemF0", - "aW9uYgZwcm90bzM=")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Synchronization.MachineSetupRequest), global::Tango.PMR.Synchronization.MachineSetupRequest.Parser, new[]{ "SerialNumber" }, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class MachineSetupRequest : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MachineSetupRequest()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Tango.PMR.Synchronization.MachineSetupRequestReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MachineSetupRequest() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MachineSetupRequest(MachineSetupRequest other) : this() { - serialNumber_ = other.serialNumber_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MachineSetupRequest Clone() { - return new MachineSetupRequest(this); - } - - /// Field number for the "SerialNumber" field. - public const int SerialNumberFieldNumber = 1; - private string serialNumber_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string SerialNumber { - get { return serialNumber_; } - set { - serialNumber_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as MachineSetupRequest); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(MachineSetupRequest other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (SerialNumber != other.SerialNumber) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (SerialNumber.Length != 0) hash ^= SerialNumber.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (SerialNumber.Length != 0) { - output.WriteRawTag(10); - output.WriteString(SerialNumber); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (SerialNumber.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(SerialNumber); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(MachineSetupRequest other) { - if (other == null) { - return; - } - if (other.SerialNumber.Length != 0) { - SerialNumber = other.SerialNumber; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - SerialNumber = input.ReadString(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Synchronization/MachineSetupResponse.cs b/Software/Visual_Studio/Tango.PMR/Synchronization/MachineSetupResponse.cs deleted file mode 100644 index e2650cf2b..000000000 --- a/Software/Visual_Studio/Tango.PMR/Synchronization/MachineSetupResponse.cs +++ /dev/null @@ -1,444 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: MachineSetupResponse.proto -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Tango.PMR.Synchronization { - - /// Holder for reflection information generated from MachineSetupResponse.proto - public static partial class MachineSetupResponseReflection { - - #region Descriptor - /// File descriptor for MachineSetupResponse.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static MachineSetupResponseReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChpNYWNoaW5lU2V0dXBSZXNwb25zZS5wcm90bxIZVGFuZ28uUE1SLlN5bmNo", - "cm9uaXphdGlvbiL3AQoUTWFjaGluZVNldHVwUmVzcG9uc2USDwoHVmVyc2lv", - "bhgBIAEoCRITCgtCbG9iQWRkcmVzcxgCIAEoCRIRCglEYkFkZHJlc3MYAyAB", - "KAkSEgoKRGJVc2VyTmFtZRgEIAEoCRISCgpEYlBhc3N3b3JkGAUgASgJEg0K", - "BU9TS2V5GAYgASgJEhcKD1NldHVwQWN0aXZhdGlvbhgHIAEoCBIdChVTZXR1", - "cFJlbW90ZUFzc2lzdGFuY2UYCCABKAgSEAoIU2V0dXBVV0YYCSABKAgSFQoN", - "U2V0dXBGaXJtd2FyZRgKIAEoCBIOCgZJc0RlbW8YCyABKAhCJQojY29tLnR3", - "aW5lLnRhbmdvLnBtci5zeW5jaHJvbml6YXRpb25iBnByb3RvMw==")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Synchronization.MachineSetupResponse), global::Tango.PMR.Synchronization.MachineSetupResponse.Parser, new[]{ "Version", "BlobAddress", "DbAddress", "DbUserName", "DbPassword", "OSKey", "SetupActivation", "SetupRemoteAssistance", "SetupUWF", "SetupFirmware", "IsDemo" }, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class MachineSetupResponse : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MachineSetupResponse()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Tango.PMR.Synchronization.MachineSetupResponseReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MachineSetupResponse() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MachineSetupResponse(MachineSetupResponse other) : this() { - version_ = other.version_; - blobAddress_ = other.blobAddress_; - dbAddress_ = other.dbAddress_; - dbUserName_ = other.dbUserName_; - dbPassword_ = other.dbPassword_; - oSKey_ = other.oSKey_; - setupActivation_ = other.setupActivation_; - setupRemoteAssistance_ = other.setupRemoteAssistance_; - setupUWF_ = other.setupUWF_; - setupFirmware_ = other.setupFirmware_; - isDemo_ = other.isDemo_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MachineSetupResponse Clone() { - return new MachineSetupResponse(this); - } - - /// Field number for the "Version" field. - public const int VersionFieldNumber = 1; - private string version_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Version { - get { return version_; } - set { - version_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "BlobAddress" field. - public const int BlobAddressFieldNumber = 2; - private string blobAddress_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string BlobAddress { - get { return blobAddress_; } - set { - blobAddress_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "DbAddress" field. - public const int DbAddressFieldNumber = 3; - private string dbAddress_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DbAddress { - get { return dbAddress_; } - set { - dbAddress_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "DbUserName" field. - public const int DbUserNameFieldNumber = 4; - private string dbUserName_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DbUserName { - get { return dbUserName_; } - set { - dbUserName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "DbPassword" field. - public const int DbPasswordFieldNumber = 5; - private string dbPassword_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DbPassword { - get { return dbPassword_; } - set { - dbPassword_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "OSKey" field. - public const int OSKeyFieldNumber = 6; - private string oSKey_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string OSKey { - get { return oSKey_; } - set { - oSKey_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "SetupActivation" field. - public const int SetupActivationFieldNumber = 7; - private bool setupActivation_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool SetupActivation { - get { return setupActivation_; } - set { - setupActivation_ = value; - } - } - - /// Field number for the "SetupRemoteAssistance" field. - public const int SetupRemoteAssistanceFieldNumber = 8; - private bool setupRemoteAssistance_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool SetupRemoteAssistance { - get { return setupRemoteAssistance_; } - set { - setupRemoteAssistance_ = value; - } - } - - /// Field number for the "SetupUWF" field. - public const int SetupUWFFieldNumber = 9; - private bool setupUWF_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool SetupUWF { - get { return setupUWF_; } - set { - setupUWF_ = value; - } - } - - /// Field number for the "SetupFirmware" field. - public const int SetupFirmwareFieldNumber = 10; - private bool setupFirmware_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool SetupFirmware { - get { return setupFirmware_; } - set { - setupFirmware_ = value; - } - } - - /// Field number for the "IsDemo" field. - public const int IsDemoFieldNumber = 11; - private bool isDemo_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsDemo { - get { return isDemo_; } - set { - isDemo_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as MachineSetupResponse); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(MachineSetupResponse other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Version != other.Version) return false; - if (BlobAddress != other.BlobAddress) return false; - if (DbAddress != other.DbAddress) return false; - if (DbUserName != other.DbUserName) return false; - if (DbPassword != other.DbPassword) return false; - if (OSKey != other.OSKey) return false; - if (SetupActivation != other.SetupActivation) return false; - if (SetupRemoteAssistance != other.SetupRemoteAssistance) return false; - if (SetupUWF != other.SetupUWF) return false; - if (SetupFirmware != other.SetupFirmware) return false; - if (IsDemo != other.IsDemo) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Version.Length != 0) hash ^= Version.GetHashCode(); - if (BlobAddress.Length != 0) hash ^= BlobAddress.GetHashCode(); - if (DbAddress.Length != 0) hash ^= DbAddress.GetHashCode(); - if (DbUserName.Length != 0) hash ^= DbUserName.GetHashCode(); - if (DbPassword.Length != 0) hash ^= DbPassword.GetHashCode(); - if (OSKey.Length != 0) hash ^= OSKey.GetHashCode(); - if (SetupActivation != false) hash ^= SetupActivation.GetHashCode(); - if (SetupRemoteAssistance != false) hash ^= SetupRemoteAssistance.GetHashCode(); - if (SetupUWF != false) hash ^= SetupUWF.GetHashCode(); - if (SetupFirmware != false) hash ^= SetupFirmware.GetHashCode(); - if (IsDemo != false) hash ^= IsDemo.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Version.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Version); - } - if (BlobAddress.Length != 0) { - output.WriteRawTag(18); - output.WriteString(BlobAddress); - } - if (DbAddress.Length != 0) { - output.WriteRawTag(26); - output.WriteString(DbAddress); - } - if (DbUserName.Length != 0) { - output.WriteRawTag(34); - output.WriteString(DbUserName); - } - if (DbPassword.Length != 0) { - output.WriteRawTag(42); - output.WriteString(DbPassword); - } - if (OSKey.Length != 0) { - output.WriteRawTag(50); - output.WriteString(OSKey); - } - if (SetupActivation != false) { - output.WriteRawTag(56); - output.WriteBool(SetupActivation); - } - if (SetupRemoteAssistance != false) { - output.WriteRawTag(64); - output.WriteBool(SetupRemoteAssistance); - } - if (SetupUWF != false) { - output.WriteRawTag(72); - output.WriteBool(SetupUWF); - } - if (SetupFirmware != false) { - output.WriteRawTag(80); - output.WriteBool(SetupFirmware); - } - if (IsDemo != false) { - output.WriteRawTag(88); - output.WriteBool(IsDemo); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Version.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Version); - } - if (BlobAddress.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(BlobAddress); - } - if (DbAddress.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DbAddress); - } - if (DbUserName.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DbUserName); - } - if (DbPassword.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DbPassword); - } - if (OSKey.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(OSKey); - } - if (SetupActivation != false) { - size += 1 + 1; - } - if (SetupRemoteAssistance != false) { - size += 1 + 1; - } - if (SetupUWF != false) { - size += 1 + 1; - } - if (SetupFirmware != false) { - size += 1 + 1; - } - if (IsDemo != false) { - size += 1 + 1; - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(MachineSetupResponse other) { - if (other == null) { - return; - } - if (other.Version.Length != 0) { - Version = other.Version; - } - if (other.BlobAddress.Length != 0) { - BlobAddress = other.BlobAddress; - } - if (other.DbAddress.Length != 0) { - DbAddress = other.DbAddress; - } - if (other.DbUserName.Length != 0) { - DbUserName = other.DbUserName; - } - if (other.DbPassword.Length != 0) { - DbPassword = other.DbPassword; - } - if (other.OSKey.Length != 0) { - OSKey = other.OSKey; - } - if (other.SetupActivation != false) { - SetupActivation = other.SetupActivation; - } - if (other.SetupRemoteAssistance != false) { - SetupRemoteAssistance = other.SetupRemoteAssistance; - } - if (other.SetupUWF != false) { - SetupUWF = other.SetupUWF; - } - if (other.SetupFirmware != false) { - SetupFirmware = other.SetupFirmware; - } - if (other.IsDemo != false) { - IsDemo = other.IsDemo; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - Version = input.ReadString(); - break; - } - case 18: { - BlobAddress = input.ReadString(); - break; - } - case 26: { - DbAddress = input.ReadString(); - break; - } - case 34: { - DbUserName = input.ReadString(); - break; - } - case 42: { - DbPassword = input.ReadString(); - break; - } - case 50: { - OSKey = input.ReadString(); - break; - } - case 56: { - SetupActivation = input.ReadBool(); - break; - } - case 64: { - SetupRemoteAssistance = input.ReadBool(); - break; - } - case 72: { - SetupUWF = input.ReadBool(); - break; - } - case 80: { - SetupFirmware = input.ReadBool(); - break; - } - case 88: { - IsDemo = input.ReadBool(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Synchronization/SynchronizeDBRequest.cs b/Software/Visual_Studio/Tango.PMR/Synchronization/SynchronizeDBRequest.cs deleted file mode 100644 index 54efa1062..000000000 --- a/Software/Visual_Studio/Tango.PMR/Synchronization/SynchronizeDBRequest.cs +++ /dev/null @@ -1,188 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: SynchronizeDBRequest.proto -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Tango.PMR.Synchronization { - - /// Holder for reflection information generated from SynchronizeDBRequest.proto - public static partial class SynchronizeDBRequestReflection { - - #region Descriptor - /// File descriptor for SynchronizeDBRequest.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static SynchronizeDBRequestReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChpTeW5jaHJvbml6ZURCUmVxdWVzdC5wcm90bxIZVGFuZ28uUE1SLlN5bmNo", - "cm9uaXphdGlvbiI9ChRTeW5jaHJvbml6ZURCUmVxdWVzdBIUCgxTZXJpYWxO", - "dW1iZXIYASABKAkSDwoHTG9jYWxEQhgCIAEoDEIlCiNjb20udHdpbmUudGFu", - "Z28ucG1yLnN5bmNocm9uaXphdGlvbmIGcHJvdG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Synchronization.SynchronizeDBRequest), global::Tango.PMR.Synchronization.SynchronizeDBRequest.Parser, new[]{ "SerialNumber", "LocalDB" }, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class SynchronizeDBRequest : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SynchronizeDBRequest()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Tango.PMR.Synchronization.SynchronizeDBRequestReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SynchronizeDBRequest() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SynchronizeDBRequest(SynchronizeDBRequest other) : this() { - serialNumber_ = other.serialNumber_; - localDB_ = other.localDB_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SynchronizeDBRequest Clone() { - return new SynchronizeDBRequest(this); - } - - /// Field number for the "SerialNumber" field. - public const int SerialNumberFieldNumber = 1; - private string serialNumber_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string SerialNumber { - get { return serialNumber_; } - set { - serialNumber_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "LocalDB" field. - public const int LocalDBFieldNumber = 2; - private pb::ByteString localDB_ = pb::ByteString.Empty; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString LocalDB { - get { return localDB_; } - set { - localDB_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SynchronizeDBRequest); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SynchronizeDBRequest other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (SerialNumber != other.SerialNumber) return false; - if (LocalDB != other.LocalDB) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (SerialNumber.Length != 0) hash ^= SerialNumber.GetHashCode(); - if (LocalDB.Length != 0) hash ^= LocalDB.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (SerialNumber.Length != 0) { - output.WriteRawTag(10); - output.WriteString(SerialNumber); - } - if (LocalDB.Length != 0) { - output.WriteRawTag(18); - output.WriteBytes(LocalDB); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (SerialNumber.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(SerialNumber); - } - if (LocalDB.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(LocalDB); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SynchronizeDBRequest other) { - if (other == null) { - return; - } - if (other.SerialNumber.Length != 0) { - SerialNumber = other.SerialNumber; - } - if (other.LocalDB.Length != 0) { - LocalDB = other.LocalDB; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - SerialNumber = input.ReadString(); - break; - } - case 18: { - LocalDB = input.ReadBytes(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Synchronization/SynchronizeDBResponse.cs b/Software/Visual_Studio/Tango.PMR/Synchronization/SynchronizeDBResponse.cs deleted file mode 100644 index e25a903b9..000000000 --- a/Software/Visual_Studio/Tango.PMR/Synchronization/SynchronizeDBResponse.cs +++ /dev/null @@ -1,160 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: SynchronizeDBResponse.proto -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Tango.PMR.Synchronization { - - /// Holder for reflection information generated from SynchronizeDBResponse.proto - public static partial class SynchronizeDBResponseReflection { - - #region Descriptor - /// File descriptor for SynchronizeDBResponse.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static SynchronizeDBResponseReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChtTeW5jaHJvbml6ZURCUmVzcG9uc2UucHJvdG8SGVRhbmdvLlBNUi5TeW5j", - "aHJvbml6YXRpb24iKQoVU3luY2hyb25pemVEQlJlc3BvbnNlEhAKCFJlbW90", - "ZURCGAEgASgMQiUKI2NvbS50d2luZS50YW5nby5wbXIuc3luY2hyb25pemF0", - "aW9uYgZwcm90bzM=")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Synchronization.SynchronizeDBResponse), global::Tango.PMR.Synchronization.SynchronizeDBResponse.Parser, new[]{ "RemoteDB" }, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class SynchronizeDBResponse : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SynchronizeDBResponse()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Tango.PMR.Synchronization.SynchronizeDBResponseReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SynchronizeDBResponse() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SynchronizeDBResponse(SynchronizeDBResponse other) : this() { - remoteDB_ = other.remoteDB_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SynchronizeDBResponse Clone() { - return new SynchronizeDBResponse(this); - } - - /// Field number for the "RemoteDB" field. - public const int RemoteDBFieldNumber = 1; - private pb::ByteString remoteDB_ = pb::ByteString.Empty; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString RemoteDB { - get { return remoteDB_; } - set { - remoteDB_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SynchronizeDBResponse); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SynchronizeDBResponse other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (RemoteDB != other.RemoteDB) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (RemoteDB.Length != 0) hash ^= RemoteDB.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (RemoteDB.Length != 0) { - output.WriteRawTag(10); - output.WriteBytes(RemoteDB); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (RemoteDB.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(RemoteDB); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SynchronizeDBResponse other) { - if (other == null) { - return; - } - if (other.RemoteDB.Length != 0) { - RemoteDB = other.RemoteDB; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - RemoteDB = input.ReadBytes(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Synchronization/UpdateDBRequest.cs b/Software/Visual_Studio/Tango.PMR/Synchronization/UpdateDBRequest.cs deleted file mode 100644 index b55b41571..000000000 --- a/Software/Visual_Studio/Tango.PMR/Synchronization/UpdateDBRequest.cs +++ /dev/null @@ -1,160 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: UpdateDBRequest.proto -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Tango.PMR.Synchronization { - - /// Holder for reflection information generated from UpdateDBRequest.proto - public static partial class UpdateDBRequestReflection { - - #region Descriptor - /// File descriptor for UpdateDBRequest.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static UpdateDBRequestReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChVVcGRhdGVEQlJlcXVlc3QucHJvdG8SGVRhbmdvLlBNUi5TeW5jaHJvbml6", - "YXRpb24iJwoPVXBkYXRlREJSZXF1ZXN0EhQKDFNlcmlhbE51bWJlchgBIAEo", - "CUIlCiNjb20udHdpbmUudGFuZ28ucG1yLnN5bmNocm9uaXphdGlvbmIGcHJv", - "dG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Synchronization.UpdateDBRequest), global::Tango.PMR.Synchronization.UpdateDBRequest.Parser, new[]{ "SerialNumber" }, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class UpdateDBRequest : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UpdateDBRequest()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Tango.PMR.Synchronization.UpdateDBRequestReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UpdateDBRequest() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UpdateDBRequest(UpdateDBRequest other) : this() { - serialNumber_ = other.serialNumber_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UpdateDBRequest Clone() { - return new UpdateDBRequest(this); - } - - /// Field number for the "SerialNumber" field. - public const int SerialNumberFieldNumber = 1; - private string serialNumber_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string SerialNumber { - get { return serialNumber_; } - set { - serialNumber_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as UpdateDBRequest); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(UpdateDBRequest other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (SerialNumber != other.SerialNumber) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (SerialNumber.Length != 0) hash ^= SerialNumber.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (SerialNumber.Length != 0) { - output.WriteRawTag(10); - output.WriteString(SerialNumber); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (SerialNumber.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(SerialNumber); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(UpdateDBRequest other) { - if (other == null) { - return; - } - if (other.SerialNumber.Length != 0) { - SerialNumber = other.SerialNumber; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - SerialNumber = input.ReadString(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Synchronization/UpdateDBResponse.cs b/Software/Visual_Studio/Tango.PMR/Synchronization/UpdateDBResponse.cs deleted file mode 100644 index 9ab596bc2..000000000 --- a/Software/Visual_Studio/Tango.PMR/Synchronization/UpdateDBResponse.cs +++ /dev/null @@ -1,216 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: UpdateDBResponse.proto -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Tango.PMR.Synchronization { - - /// Holder for reflection information generated from UpdateDBResponse.proto - public static partial class UpdateDBResponseReflection { - - #region Descriptor - /// File descriptor for UpdateDBResponse.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static UpdateDBResponseReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChZVcGRhdGVEQlJlc3BvbnNlLnByb3RvEhlUYW5nby5QTVIuU3luY2hyb25p", - "emF0aW9uIk0KEFVwZGF0ZURCUmVzcG9uc2USEQoJRGJBZGRyZXNzGAEgASgJ", - "EhIKCkRiVXNlck5hbWUYAiABKAkSEgoKRGJQYXNzd29yZBgDIAEoCUIlCiNj", - "b20udHdpbmUudGFuZ28ucG1yLnN5bmNocm9uaXphdGlvbmIGcHJvdG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Synchronization.UpdateDBResponse), global::Tango.PMR.Synchronization.UpdateDBResponse.Parser, new[]{ "DbAddress", "DbUserName", "DbPassword" }, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class UpdateDBResponse : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UpdateDBResponse()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Tango.PMR.Synchronization.UpdateDBResponseReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UpdateDBResponse() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UpdateDBResponse(UpdateDBResponse other) : this() { - dbAddress_ = other.dbAddress_; - dbUserName_ = other.dbUserName_; - dbPassword_ = other.dbPassword_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UpdateDBResponse Clone() { - return new UpdateDBResponse(this); - } - - /// Field number for the "DbAddress" field. - public const int DbAddressFieldNumber = 1; - private string dbAddress_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DbAddress { - get { return dbAddress_; } - set { - dbAddress_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "DbUserName" field. - public const int DbUserNameFieldNumber = 2; - private string dbUserName_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DbUserName { - get { return dbUserName_; } - set { - dbUserName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "DbPassword" field. - public const int DbPasswordFieldNumber = 3; - private string dbPassword_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DbPassword { - get { return dbPassword_; } - set { - dbPassword_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as UpdateDBResponse); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(UpdateDBResponse other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (DbAddress != other.DbAddress) return false; - if (DbUserName != other.DbUserName) return false; - if (DbPassword != other.DbPassword) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (DbAddress.Length != 0) hash ^= DbAddress.GetHashCode(); - if (DbUserName.Length != 0) hash ^= DbUserName.GetHashCode(); - if (DbPassword.Length != 0) hash ^= DbPassword.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (DbAddress.Length != 0) { - output.WriteRawTag(10); - output.WriteString(DbAddress); - } - if (DbUserName.Length != 0) { - output.WriteRawTag(18); - output.WriteString(DbUserName); - } - if (DbPassword.Length != 0) { - output.WriteRawTag(26); - output.WriteString(DbPassword); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (DbAddress.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DbAddress); - } - if (DbUserName.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DbUserName); - } - if (DbPassword.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DbPassword); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(UpdateDBResponse other) { - if (other == null) { - return; - } - if (other.DbAddress.Length != 0) { - DbAddress = other.DbAddress; - } - if (other.DbUserName.Length != 0) { - DbUserName = other.DbUserName; - } - if (other.DbPassword.Length != 0) { - DbPassword = other.DbPassword; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - DbAddress = input.ReadString(); - break; - } - case 18: { - DbUserName = input.ReadString(); - break; - } - case 26: { - DbPassword = input.ReadString(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj index 790d0e3e5..1d8d5e16c 100644 --- a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj +++ b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj @@ -228,21 +228,11 @@ - - - - - - - - - - @@ -260,7 +250,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj b/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj index 02457471d..02e5381ee 100644 --- a/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj +++ b/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj @@ -107,9 +107,14 @@ - - - + + + + + + + + @@ -136,7 +141,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs index 05a892b37..581e62cc7 100644 --- a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs +++ b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs @@ -880,6 +880,7 @@ namespace Tango.Transport continue; } + LogManager.Log("Sending message on adapter: " + Adapter.Address + "...", LogCategory.Debug, message.Message); Adapter.Write(message.Serialize()); LogManager.Log("Message sent on adapter: " + Adapter.Address + "...", LogCategory.Debug, message.Message); } diff --git a/Software/Visual_Studio/Tango.Transport/Web/ITransportWebClient.cs b/Software/Visual_Studio/Tango.Transport/Web/ITransportWebClient.cs deleted file mode 100644 index 81d443671..000000000 --- a/Software/Visual_Studio/Tango.Transport/Web/ITransportWebClient.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Google.Protobuf; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.Transport.Web -{ - public interface ITransportWebClient : IDisposable - { - Task Post(String url, Request request) where Request : class, IMessage where Response : class, IMessage; - } -} diff --git a/Software/Visual_Studio/Tango.Transport/Web/IWebRequestMessage.cs b/Software/Visual_Studio/Tango.Transport/Web/IWebRequestMessage.cs new file mode 100644 index 000000000..7a8f293f4 --- /dev/null +++ b/Software/Visual_Studio/Tango.Transport/Web/IWebRequestMessage.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Transport.Web +{ + public interface IWebRequestMessage : IWebTransportMessage + { + } +} diff --git a/Software/Visual_Studio/Tango.Transport/Web/IWebResponseMessage.cs b/Software/Visual_Studio/Tango.Transport/Web/IWebResponseMessage.cs new file mode 100644 index 000000000..eba39959f --- /dev/null +++ b/Software/Visual_Studio/Tango.Transport/Web/IWebResponseMessage.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Transport.Web +{ + public interface IWebResponseMessage : IWebTransportMessage + { + } +} diff --git a/Software/Visual_Studio/Tango.Transport/Web/IWebTransportClient.cs b/Software/Visual_Studio/Tango.Transport/Web/IWebTransportClient.cs new file mode 100644 index 000000000..8ab0f9305 --- /dev/null +++ b/Software/Visual_Studio/Tango.Transport/Web/IWebTransportClient.cs @@ -0,0 +1,15 @@ +using Google.Protobuf; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Transport.Web +{ + public interface IWebTransportClient : IDisposable + { + Task PostProto(String url, Request request) where Request : class, IMessage where Response : class, IMessage; + Task PostJson(String url, Request request) where Request : class, IWebRequestMessage where Response : class, IWebResponseMessage; + } +} diff --git a/Software/Visual_Studio/Tango.Transport/Web/IWebTransportMessage.cs b/Software/Visual_Studio/Tango.Transport/Web/IWebTransportMessage.cs new file mode 100644 index 000000000..48d9960d9 --- /dev/null +++ b/Software/Visual_Studio/Tango.Transport/Web/IWebTransportMessage.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Transport.Web +{ + public interface IWebTransportMessage + { + } +} diff --git a/Software/Visual_Studio/Tango.Transport/Web/JsonWebClient.cs b/Software/Visual_Studio/Tango.Transport/Web/JsonWebClient.cs deleted file mode 100644 index 8b654dd61..000000000 --- a/Software/Visual_Studio/Tango.Transport/Web/JsonWebClient.cs +++ /dev/null @@ -1,69 +0,0 @@ -using Google.Protobuf; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net.Http; -using System.Text; -using System.Threading.Tasks; -using System.Web; -using Tango.PMR.Synchronization; - -namespace Tango.Transport.Web -{ - public class JsonWebClient : ITransportWebClient - { - private HttpClient _httpClient; - - public JsonWebClient() - { - _httpClient = new HttpClient(); - } - - public void Dispose() - { - throw new NotImplementedException(); - } - - public Task Post(String url, Request request) where Request : class, IMessage where Response : class, IMessage - { - return Task.Factory.StartNew(() => - { - var req = new ByteArrayContent(Encoding.UTF8.GetBytes(request.ToString())); - req.Headers.Add("Content-Type", "application/json"); - - var response = _httpClient.PostAsync(url, req).Result; - - var data = response.Content.ReadAsStringAsync().Result; - - Response dummy = Activator.CreateInstance() as Response; - - return dummy.GetParser().ParseJson(data) as Response; - }); - } - - public Task PostJson(String url, Request request) where Request : class where Response : class - { - return Task.Factory.StartNew(() => - { - var req = new ByteArrayContent(Encoding.UTF8.GetBytes(request.ToJsonString())); - req.Headers.Add("Content-Type", "application/json"); - - var response = _httpClient.PostAsync(url, req).Result; - var data = response.Content.ReadAsStringAsync().Result; - - try - { - response.EnsureSuccessStatusCode(); - } - catch (HttpRequestException ex) - { - throw new HttpRequestException(ex.Message + " " + JObject.Parse(data).GetValue("Message")); - } - - return JsonConvert.DeserializeObject(data); - }); - } - } -} diff --git a/Software/Visual_Studio/Tango.Transport/Web/ProtoWebClient.cs b/Software/Visual_Studio/Tango.Transport/Web/ProtoWebClient.cs deleted file mode 100644 index 7f8beef04..000000000 --- a/Software/Visual_Studio/Tango.Transport/Web/ProtoWebClient.cs +++ /dev/null @@ -1,51 +0,0 @@ -using Google.Protobuf; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net.Http; -using System.Text; -using System.Threading.Tasks; -using System.Web; -using Tango.PMR.Synchronization; - -namespace Tango.Transport.Web -{ - public class ProtoWebClient : ITransportWebClient - { - private HttpClient _httpClient; - - public ProtoWebClient() - { - _httpClient = new HttpClient(); - } - - public Task Post(String url, Request request) where Request : class, IMessage where Response : class, IMessage - { - return Task.Factory.StartNew(() => - { - - var req = new ByteArrayContent(request.ToByteArray()); - req.Headers.Add("Content-Type", "application/x-protobuf"); - - var response = _httpClient.PostAsync(url, req).Result; - - var data = response.Content.ReadAsByteArrayAsync().Result; - - if (response.StatusCode != System.Net.HttpStatusCode.OK) - { - HttpProtoException exception = HttpProtoException.Parser.ParseFrom(data); - throw new HttpException(exception.StatusCode, exception.Message); - } - - Response dummy = Activator.CreateInstance() as Response; - - return dummy.GetParser().ParseFrom(data) as Response; - }); - } - - public void Dispose() - { - _httpClient.Dispose(); - } - } -} diff --git a/Software/Visual_Studio/Tango.Transport/Web/WebRequestMessage.cs b/Software/Visual_Studio/Tango.Transport/Web/WebRequestMessage.cs new file mode 100644 index 000000000..a7bdd87ad --- /dev/null +++ b/Software/Visual_Studio/Tango.Transport/Web/WebRequestMessage.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Transport.Web +{ + public abstract class WebRequestMessage : WebTransportMessage, IWebRequestMessage + { + } +} diff --git a/Software/Visual_Studio/Tango.Transport/Web/WebResponseMessage.cs b/Software/Visual_Studio/Tango.Transport/Web/WebResponseMessage.cs new file mode 100644 index 000000000..adaf3b0eb --- /dev/null +++ b/Software/Visual_Studio/Tango.Transport/Web/WebResponseMessage.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Transport.Web +{ + public abstract class WebResponseMessage : WebTransportMessage, IWebResponseMessage + { + } +} diff --git a/Software/Visual_Studio/Tango.Transport/Web/WebTransportClient.cs b/Software/Visual_Studio/Tango.Transport/Web/WebTransportClient.cs new file mode 100644 index 000000000..227ecefa3 --- /dev/null +++ b/Software/Visual_Studio/Tango.Transport/Web/WebTransportClient.cs @@ -0,0 +1,84 @@ +using Google.Protobuf; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; +using System.Web; +using Tango.PMR.Synchronization; + +namespace Tango.Transport.Web +{ + public class WebTransportClient : IWebTransportClient + { + private HttpClient _httpClient; + private static JsonSerializerSettings _settings; + + static WebTransportClient() + { + _settings = new JsonSerializerSettings() + { + + }; + } + + public WebTransportClient() + { + _httpClient = new HttpClient(); + } + + public Task PostProto(String url, Request request) where Request : class, IMessage where Response : class, IMessage + { + return Task.Factory.StartNew(() => + { + + var req = new ByteArrayContent(request.ToByteArray()); + req.Headers.Add("Content-Type", "application/x-protobuf"); + + var response = _httpClient.PostAsync(url, req).Result; + + var data = response.Content.ReadAsByteArrayAsync().Result; + + if (response.StatusCode != System.Net.HttpStatusCode.OK) + { + HttpProtoException exception = HttpProtoException.Parser.ParseFrom(data); + throw new HttpException(exception.StatusCode, exception.Message); + } + + Response dummy = Activator.CreateInstance() as Response; + + return dummy.GetParser().ParseFrom(data) as Response; + }); + } + + public Task PostJson(string url, Request request) where Request : class, IWebRequestMessage where Response : class, IWebResponseMessage + { + return Task.Factory.StartNew(() => + { + var req = new ByteArrayContent(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(request, _settings))); + req.Headers.Add("Content-Type", "application/json"); + var response = _httpClient.PostAsync(url, req).Result; + var data = response.Content.ReadAsStringAsync().Result; + + try + { + response.EnsureSuccessStatusCode(); + } + catch (HttpRequestException ex) + { + throw new HttpRequestException(ex.Message + " " + JObject.Parse(data).GetValue("Message")); + } + + return JsonConvert.DeserializeObject(data); + }); + } + + public void Dispose() + { + _httpClient.Dispose(); + } + } +} diff --git a/Software/Visual_Studio/Tango.Transport/Web/WebTransportMessage.cs b/Software/Visual_Studio/Tango.Transport/Web/WebTransportMessage.cs new file mode 100644 index 000000000..3f886d9d2 --- /dev/null +++ b/Software/Visual_Studio/Tango.Transport/Web/WebTransportMessage.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Transport.Web +{ + public abstract class WebTransportMessage : IWebTransportMessage + { + } +} diff --git a/Software/Visual_Studio/Tango.UnitTesting/MachineService_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/MachineService_TST.cs index 954d53da8..94d30df98 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/MachineService_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/MachineService_TST.cs @@ -16,7 +16,7 @@ namespace Tango.UnitTesting [TestMethod] public void Check_For_Updates() { - ITransportWebClient client = new ProtoWebClient(); + IWebTransportClient client = new WebTransportClient(); var result = client.Post("http://localhost:51581/api/PPC/CheckForUpdate", new CheckForUpdateRequest() { SerialNumber = "0000", diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/HomeController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/HomeController.cs deleted file mode 100644 index a7c526f67..000000000 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/HomeController.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Mvc; - -namespace Tango.MachineService.Controllers -{ - public class HomeController : Controller - { - public String Index() - { - return "Machine Service Started!"; - } - } -} diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index c5e85f819..45396e47a 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -17,6 +17,7 @@ using System.Web.Http; using Tango.BL; using Tango.BL.Builders; using Tango.BL.Entities; +using Tango.BL.Enumerations; using Tango.Core.DB; using Tango.Core.Helpers; using Tango.Core.IO; @@ -26,13 +27,29 @@ using Tango.MachineService.Models; using Tango.MachineService.SMO; using Tango.PMR.Stubs; using Tango.PMR.Synchronization; +using Tango.PPC.Common.MachineSetup; +using Tango.PPC.Common.MachineUpdate; +using Tango.PPC.Common.Update; using Tango.Synchronization.Local; using Tango.Synchronization.Remote; namespace Tango.MachineService.Controllers { - public class PPCController : ProtoController + public class PPCController : JsonController { + private static List _pendingUploads; + + #region Constructors + + static PPCController() + { + _pendingUploads = new List(); + } + + #endregion + + #region Setup & Update + [HttpPost] public MachineSetupResponse MachineSetup(MachineSetupRequest request) { @@ -222,6 +239,139 @@ namespace Tango.MachineService.Controllers return response; } + #endregion + + #region Version Upload + + [HttpPost] + public LatestVersionResponse GetLatestVersion(LatestVersionRequest request) + { + LatestVersionResponse response = new LatestVersionResponse(); + + using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + { + var versions = db.TangoVersions.ToList(); + + if (versions.Count == 0) + { + return new LatestVersionResponse() + { + Version = "0.0.0.0", + }; + } + + var machine_versions = versions.Where(x => x.MachineVersionGuid == request.MachineVersionGuid).ToList(); + + if (machine_versions.Count > 0) + { + response.Version = db.TangoVersions.Where(x => x.MachineVersionGuid == request.MachineVersionGuid).ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault().Version; + } + else + { + throw new ArgumentException("The specified machine version was not found!"); + } + } + + return response; + } + + [HttpPost] + public UploadVersionResponse UploadVersion(UploadVersionRequest request) + { + UploadVersionResponse response = new UploadVersionResponse(); + + using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + { + //Load relations first... + db.Roles.ToList(); + db.Permissions.ToList(); + db.UsersRoles.ToList(); + db.RolesPermissions.ToList(); + + var user = db.Users.SingleOrDefault(x => x.Email.ToLower() == request.Email.ToLower() && x.Password == request.Password); + + if (user != null && user.HasPermission(Permissions.PublishMachineStudioVersion)) + { + var versions = db.TangoVersions.ToList().Where(x => x.MachineVersionGuid == request.MachineVersionGuid).OrderByDescending(x => Version.Parse(x.Version)).ToList(); + + TangoVersion latestVersion = new TangoVersion(); + latestVersion.Version = "0.0.0.0"; + + if (versions.Count > 0) + { + latestVersion = versions.FirstOrDefault(); + } + + Version currentVersion = Version.Parse(request.Version); + + if (currentVersion > Version.Parse(latestVersion.Version)) + { + String newVersionFileName = "Tango Version" + " " + currentVersion.ToString() + ".zip"; + + var client = StorageHelper.GetStorageBlobClient(); + var container = StorageHelper.GetTangoVersionsContainer(client); + var blob = StorageHelper.CreateEmptyBlob(container, newVersionFileName); + + response.Token = Guid.NewGuid().ToString(); + response.BlobAddress = StorageHelper.GenerateBlobWriteSignature(blob, TimeSpan.FromMinutes(30)); + + _pendingUploads.Add(new PendingUpload() + { + UserGuid = user.Guid, + Comments = request.Comments, + Token = response.Token, + Version = request.Version, + BlobName = blob.Name, + MachineVersionGuid = request.MachineVersionGuid, + }); + } + else + { + throw new ArgumentException("New version must be greater than latest version."); + } + } + else + { + throw new AuthenticationException("Invalid user credentials."); + } + } + + return response; + } + + [HttpPost] + public UploadCompletedResponse NotifyUploadCompleted(UploadCompletedRequest request) + { + PendingUpload upload = _pendingUploads.FirstOrDefault(x => x.Token == request.Token); + + if (upload != null) + { + _pendingUploads.RemoveAll(x => x.Token == upload.Token); + + using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + { + db.TangoVersions.Add(new TangoVersion() + { + Comments = upload.Comments, + BlobName = upload.BlobName, + UserGuid = upload.UserGuid, + Version = upload.Version, + MachineVersionGuid = upload.MachineVersionGuid + }); + + db.SaveChanges(); + } + + return new UploadCompletedResponse(); + } + else + { + throw new AuthenticationException("Invalid upload token."); + } + } + + #endregion + [HttpPost] public Machine PersonTest(Person p) { diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/ValuesController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/ValuesController.cs deleted file mode 100644 index f76d66836..000000000 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/ValuesController.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Web.Http; -using Tango.MachineService.Models; - -namespace Tango.MachineService.Controllers -{ - public class ValuesController : ApiController - { - private static List persons = new List(); - - // GET api/values - public IEnumerable Get() - { - return persons; - } - - // GET api/values/5 - public Person Get(int id) - { - return persons[id]; - } - - // POST api/values - public Person Post([FromBody]Person person) - { - persons.Add(person); - return person; - } - - // PUT api/values/5 - public void Put(Person person) - { - - } - - // DELETE api/values/5 - public void Delete(int id) - { - } - } -} diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/VersionUpdateController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/VersionUpdateController.cs deleted file mode 100644 index 2ad8bd735..000000000 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/VersionUpdateController.cs +++ /dev/null @@ -1,168 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Security.Authentication; -using System.Web.Http; -using Tango.BL; -using Tango.BL.Entities; -using Tango.BL.Enumerations; -using Tango.Logging; -using Tango.MachineService.Helpers; -using Tango.PPC.Common.Update; - -namespace Tango.MachineService.Controllers -{ - public class VersionUpdateController : JsonController - { - private class PendingUpload - { - public String Token { get; set; } - - public String Version { get; set; } - - public String UserGuid { get; set; } - - public String Comments { get; set; } - - public String MachineVersionGuid { get; set; } - - public String BlobName { get; set; } - } - - private static List _pendingUploads; - - static VersionUpdateController() - { - _pendingUploads = new List(); - } - - [HttpPost] - public LatestVersionResponse GetLatestVersion(LatestVersionRequest request) - { - LatestVersionResponse response = new LatestVersionResponse(); - - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) - { - var versions = db.TangoVersions.ToList(); - - if (versions.Count == 0) - { - return new LatestVersionResponse() - { - Version = "0.0.0.0", - }; - } - - var machine_versions = versions.Where(x => x.MachineVersionGuid == request.MachineVersionGuid).ToList(); - - if (machine_versions.Count > 0) - { - response.Version = db.TangoVersions.Where(x => x.MachineVersionGuid == request.MachineVersionGuid).ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault().Version; - } - else - { - throw new ArgumentException("The specified machine version was not found!"); - } - } - - return response; - } - - [HttpPost] - public UploadVersionResponse UploadVersion(UploadVersionRequest request) - { - UploadVersionResponse response = new UploadVersionResponse(); - - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) - { - //Load relations first... - db.Roles.ToList(); - db.Permissions.ToList(); - db.UsersRoles.ToList(); - db.RolesPermissions.ToList(); - - var user = db.Users.SingleOrDefault(x => x.Email.ToLower() == request.Email.ToLower() && x.Password == request.Password); - - if (user != null && user.HasPermission(Permissions.PublishMachineStudioVersion)) - { - var versions = db.TangoVersions.ToList().Where(x => x.MachineVersionGuid == request.MachineVersionGuid).OrderByDescending(x => Version.Parse(x.Version)).ToList(); - - TangoVersion latestVersion = new TangoVersion(); - latestVersion.Version = "0.0.0.0"; - - if (versions.Count > 0) - { - latestVersion = versions.FirstOrDefault(); - } - - Version currentVersion = Version.Parse(request.Version); - - if (currentVersion > Version.Parse(latestVersion.Version)) - { - String newVersionFileName = "Tango Version" + " " + currentVersion.ToString() + ".zip"; - - var client = StorageHelper.GetStorageBlobClient(); - var container = StorageHelper.GetTangoVersionsContainer(client); - var blob = StorageHelper.CreateEmptyBlob(container, newVersionFileName); - - response.Token = Guid.NewGuid().ToString(); - response.BlobAddress = StorageHelper.GenerateBlobWriteSignature(blob, TimeSpan.FromMinutes(30)); - - _pendingUploads.Add(new PendingUpload() - { - UserGuid = user.Guid, - Comments = request.Comments, - Token = response.Token, - Version = request.Version, - BlobName = blob.Name, - MachineVersionGuid = request.MachineVersionGuid, - }); - } - else - { - throw new ArgumentException("New version must be greater than latest version."); - } - } - else - { - throw new AuthenticationException("Invalid user credentials."); - } - } - - return response; - } - - [HttpPost] - public UploadCompletedResponse NotifyUploadCompleted(UploadCompletedRequest request) - { - PendingUpload upload = _pendingUploads.FirstOrDefault(x => x.Token == request.Token); - - if (upload != null) - { - _pendingUploads.RemoveAll(x => x.Token == upload.Token); - - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) - { - db.TangoVersions.Add(new TangoVersion() - { - Comments = upload.Comments, - BlobName = upload.BlobName, - UserGuid = upload.UserGuid, - Version = upload.Version, - MachineVersionGuid = upload.MachineVersionGuid - }); - - db.SaveChanges(); - } - - return new UploadCompletedResponse(); - } - else - { - throw new AuthenticationException("Invalid upload token."); - } - } - } -} diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Models/PendingUpload.cs b/Software/Visual_Studio/Web/Tango.MachineService/Models/PendingUpload.cs new file mode 100644 index 000000000..f18b3756a --- /dev/null +++ b/Software/Visual_Studio/Web/Tango.MachineService/Models/PendingUpload.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace Tango.MachineService.Models +{ + public class PendingUpload + { + public String Token { get; set; } + + public String Version { get; set; } + + public String UserGuid { get; set; } + + public String Comments { get; set; } + + public String MachineVersionGuid { get; set; } + + public String BlobName { get; set; } + } +} \ No newline at end of file diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj b/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj index c7fdab45c..acb4ad84e 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj +++ b/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj @@ -270,17 +270,15 @@ - + - - Global.asax @@ -331,6 +329,10 @@ {7ada4e86-cad7-4968-a210-3a8a9e5153ab} Tango.Synchronization + + {74e700b0-1156-4126-be40-ee450d3c3026} + Tango.Transport + -- cgit v1.3.1