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... --- Software/Visual_Studio/Tango.UnitTesting/MachineService_TST.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Software/Visual_Studio/Tango.UnitTesting') 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", -- 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/Tango.UnitTesting') 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 From cc19ab7414f097370b14f8655f76721701e3f47b Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 19 Dec 2018 17:08:28 +0200 Subject: Improved DB speed for Azure data source !! --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 20578304 -> 20578304 bytes Software/Visual_Studio/Tango.Core/DataSource.cs | 29 +++++++++++---------- .../Visual_Studio/Tango.UnitTesting/DAL_TST.cs | 26 ++++++++---------- .../Visual_Studio/Tango.UnitTesting/Logging_TST.cs | 3 ++- .../Tango.UnitTesting/MachineService_TST.cs | 3 ++- .../Tango.UnitTesting/Tango.UnitTesting.csproj | 6 ++++- 7 files changed, 35 insertions(+), 32 deletions(-) (limited to 'Software/Visual_Studio/Tango.UnitTesting') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 260afa6c7..c5ed078e6 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 0c46ed4ec..9f4498621 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/Tango.Core/DataSource.cs b/Software/Visual_Studio/Tango.Core/DataSource.cs index 3803eea5d..c5c58cf09 100644 --- a/Software/Visual_Studio/Tango.Core/DataSource.cs +++ b/Software/Visual_Studio/Tango.Core/DataSource.cs @@ -100,20 +100,21 @@ namespace Tango.Core case DataSourceType.Azure: - SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(); - builder.DataSource = Address; - builder.InitialCatalog = Catalog; - builder.UserID = UserName; - builder.Password = Password; - builder.IntegratedSecurity = false; - builder.TrustServerCertificate = true; - builder.ConnectTimeout = 15; - builder.Pooling = false; - builder.Authentication = SqlAuthenticationMethod.ActiveDirectoryPassword; - - SqlConnection sqlConnection = new SqlConnection(builder.ConnectionString); - - return sqlConnection; + SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(); + builder.DataSource = Address; + builder.InitialCatalog = Catalog; + builder.UserID = UserName; + builder.Password = Password; + builder.IntegratedSecurity = false; + //builder.TrustServerCertificate = true; + builder.MultipleActiveResultSets = true; + builder.ApplicationName = "EntityFramework"; + //builder.ConnectTimeout = 15; + builder.Authentication = SqlAuthenticationMethod.ActiveDirectoryPassword; + + SqlConnection sqlConnection = new SqlConnection(builder.ConnectionString); + + return sqlConnection; default: diff --git a/Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs index 0ea7b59ef..02862350f 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs @@ -17,24 +17,20 @@ namespace Tango.UnitTesting { String guid = Guid.NewGuid().ToString(); - using (var db = new DAL.Remote.DB.RemoteDB(SettingsManager.Default.GetOrCreate().DataSource)) - { - var action = new DAL.Remote.DB.ACTION_TYPES(); - action.CODE = 1; - action.NAME = "Action 1"; - action.DESCRIPTION = "Description 1"; - action.GUID = guid; - action.LAST_UPDATED = DateTime.UtcNow; + DataSource s = new DataSource(); + s.Type = DataSourceType.SQLServer; + s.Address = "twine.database.windows.net"; + s.Catalog = "Tango"; + s.IntegratedSecurity = false; + s.UserName = "Roy"; + s.Password = "Aa123456"; - db.ACTION_TYPES.Add(action); - db.SaveChanges(); - } - using (var db = new DAL.Remote.DB.RemoteDB(SettingsManager.Default.GetOrCreate().DataSource)) + using (var db = new DAL.Remote.DB.RemoteDB(s)) { - var action = db.ACTION_TYPES.Single(x => x.GUID == guid); - db.ACTION_TYPES.Remove(action); - db.SaveChanges(); + var events = db.EVENT_TYPES.ToList(); + var motors = db.HARDWARE_MOTOR_TYPES.ToList(); + var monitors = db.TECH_MONITORS.ToList(); } } diff --git a/Software/Visual_Studio/Tango.UnitTesting/Logging_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/Logging_TST.cs index 6d95674ff..c4a697715 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Logging_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/Logging_TST.cs @@ -4,7 +4,8 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using Tango.MachineStudio.Logging.Parsing; +using Tango.Integration.Logging; +using Tango.Logging; namespace Tango.UnitTesting { diff --git a/Software/Visual_Studio/Tango.UnitTesting/MachineService_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/MachineService_TST.cs index 94d30df98..0edab542a 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/MachineService_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/MachineService_TST.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.PMR.Synchronization; +using Tango.PPC.Common.MachineUpdate; using Tango.Transport.Web; namespace Tango.UnitTesting @@ -17,7 +18,7 @@ namespace Tango.UnitTesting public void Check_For_Updates() { IWebTransportClient client = new WebTransportClient(); - var result = client.Post("http://localhost:51581/api/PPC/CheckForUpdate", new CheckForUpdateRequest() + var result = client.PostJson("http://localhost:51581/api/PPC/CheckForUpdate", new CheckForUpdateRequest() { SerialNumber = "0000", Version = "0.0.0.0", diff --git a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj index aa8b71dd1..6c547102c 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj +++ b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj @@ -128,6 +128,10 @@ {cb0b0aa2-bb24-4bca-a720-45e397684e12} Tango.MachineStudio.Common + + {0BE74EEE-22CB-4DBA-B896-793B9E1A3AC0} + Tango.PPC.Common + {f441feee-322a-4943-b566-110e12fd3b72} Tango.BL @@ -211,7 +215,7 @@ - + \ No newline at end of file -- cgit v1.3.1 From e0b0859f62924d38c8cd7ac9975303c4bfb08624 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 20 Dec 2018 14:24:19 +0200 Subject: Added environments support for users & roles !! --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 20578304 -> 20578304 bytes .../Build/Shortcuts/Machine Emulator.lnk | Bin 1471 -> 1445 bytes .../Build/Shortcuts/Proto Compiler GUI.lnk | Bin 1464 -> 1444 bytes .../Build/Shortcuts/Stubs Execution GUI.lnk | Bin 1547 -> 1462 bytes .../Build/Shortcuts/Transport Router.lnk | Bin 1578 -> 1493 bytes .../MachineSetup/MachineSetupManager.cs | 35 ++---- .../MachineSetup/MachineSetupResponse.cs | 6 +- .../MachineUpdate/DownloadUpdateResponse.cs | 5 +- .../MachineUpdate/MachineUpdateManager.cs | 47 +++---- .../MachineUpdate/UpdateDBResponse.cs | 5 +- .../Visual_Studio/Tango.BL/Entities/Machine.cs | 123 ++++++++++++++++++ Software/Visual_Studio/Tango.BL/Entities/Rml.cs | 90 +++++++++++++ .../Tango.BL/Enumerations/Permissions.cs | 30 ++++- .../Visual_Studio/Tango.BL/Enumerations/Roles.cs | 32 ++++- Software/Visual_Studio/Tango.Core/DB/DbManager.cs | 5 + Software/Visual_Studio/Tango.Core/DataSource.cs | 12 ++ .../Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs | 4 + Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs | 5 + .../Tango.DAL.Remote/DB/RemoteADO.edmx | 53 +++++++- .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 139 +++++++++++---------- .../ExaminerConfigurationBuilder.cs | 34 +++-- .../ExaminerSequenceConfigurationRunner.cs | 14 +-- .../Tango.UnitTesting/SQLExaminer_TST.cs | 66 ++++++---- .../ObservablesGenerator.cs | 3 +- .../Controllers/MachineStudioController.cs | 2 +- .../Controllers/PPCController.cs | 37 ++++-- 27 files changed, 551 insertions(+), 196 deletions(-) (limited to 'Software/Visual_Studio/Tango.UnitTesting') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 29c02c4ab..952f63196 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 1c5b90031..24819348d 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk index 612ccab34..7bbdf66b4 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/Proto Compiler GUI.lnk b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk index 6f203ca29..ab1bc5eed 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/Build/Shortcuts/Stubs Execution GUI.lnk b/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk index 26bdb7c64..5b8ad68a5 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk and b/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk b/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk index 355f4b364..febffabca 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk and b/Software/Visual_Studio/Build/Shortcuts/Transport Router.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 1f86e0953..b8638b158 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -207,22 +207,20 @@ namespace Tango.PPC.Common.MachineSetup //Synchronize database UpdateProgress("Updating Database", "Initializing..."); - String db_name = "Tango"; - String localAddress = SettingsManager.Default.GetOrCreate().DataSource.Address; - String remote_address = setup_response.DbAddress; + var localDataSource = SettingsManager.Default.GetOrCreate().DataSource; - LogManager.Log($"Synchronizing database '{remote_address}\\{db_name}' => '{localAddress}\\{db_name}'..."); + LogManager.Log($"Synchronizing database '{setup_response.DataSource.ToString()}' => '{localDataSource.ToString()}'..."); UpdateProgress("Updating Database", "Connecting to local database..."); - LogManager.Log($"Connecting to local database at {localAddress}..."); - DbManager db = DbManager.FromAddress(localAddress); + LogManager.Log($"Connecting to local database at {localDataSource}..."); + DbManager db = DbManager.FromAddress(localDataSource.Address); - LogManager.Log($"Ensuring {db_name} database exists on the local machine..."); - if (!db.Exists(db_name)) + LogManager.Log($"Ensuring {localDataSource.Catalog} database exists on the local machine..."); + if (!db.Exists(localDataSource.Catalog)) { UpdateProgress("Updating Database", "Creating new database..."); LogManager.Log("Database does not exist. Creating new database..."); - db.Create(db_name); + db.Create(localDataSource.Catalog); } else { @@ -232,7 +230,7 @@ namespace Tango.PPC.Common.MachineSetup db.Dispose(); LogManager.Log("Initializing database manager..."); - db = DbManager.FromAddressAndName(localAddress, db_name); + db = DbManager.FromDataSource(localDataSource); UpdateProgress("Updating Database", "Clearing current database..."); LogManager.Log("Clearing database..."); @@ -248,20 +246,9 @@ namespace Tango.PPC.Common.MachineSetup ExaminerSequenceConfigurationRunner runner = new ExaminerSequenceConfigurationRunner( Path.Combine(_newPackageTempFolder, "Provision Scripts", "config.xml"), Path.Combine(_newPackageTempFolder, "Provision Scripts"), - new ExaminerSequenceDataSource() - { - Address = remote_address, - DataBaseName = db_name, - IntegratedSecurity = false, - UserName = setup_response.DbUserName, - Password = setup_response.DbPassword, - }, - new ExaminerSequenceDataSource() - { - Address = localAddress, - DataBaseName = db_name, - IntegratedSecurity = true, - }, serialNumber); + setup_response.DataSource, + localDataSource, + serialNumber); runner.Log += (x, msg) => { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResponse.cs index 89450a1d1..5e8885af7 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResponse.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResponse.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Core; using Tango.Transport.Web; namespace Tango.PPC.Common.MachineSetup @@ -13,9 +14,7 @@ namespace Tango.PPC.Common.MachineSetup public String BlobAddress { get; set; } - public String DbAddress { get; set; } - public String DbUserName { get; set; } - public String DbPassword { get; set; } + public DataSource DataSource { get; set; } public String OSKey { get; set; } @@ -23,6 +22,7 @@ namespace Tango.PPC.Common.MachineSetup public bool SetupRemoteAssistance { get; set; } public bool SetupUWF { get; set; } public bool SetupFirmware { get; set; } + public bool SetupFPGA { get; set; } public bool IsDemo { 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 index c42c06f3b..de978ed66 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/DownloadUpdateResponse.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/DownloadUpdateResponse.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Core; using Tango.Transport.Web; namespace Tango.PPC.Common.MachineUpdate @@ -13,8 +14,6 @@ namespace Tango.PPC.Common.MachineUpdate public String BlobAddress { get; set; } - public String DbAddress { get; set; } - public String DbUserName { get; set; } - public String DbPassword { get; set; } + public DataSource DataSource { 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 6df7117d7..69df627fb 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs @@ -164,18 +164,16 @@ namespace Tango.PPC.Common.MachineUpdate //Synchronize database UpdateProgress("Updating Database", "Initializing..."); - String db_name = "Tango"; - String localAddress = SettingsManager.Default.GetOrCreate().DataSource.Address; - String remote_address = update_response.DbAddress; + var localDataSource = SettingsManager.Default.GetOrCreate().DataSource; - LogManager.Log($"Synchronizing database '{remote_address}\\{db_name}' => '{localAddress}\\{db_name}'..."); + LogManager.Log($"Synchronizing database '{update_response.DataSource.ToString()}' => '{localDataSource.ToString()}'..."); UpdateProgress("Updating Database", "Connecting to local database..."); LogManager.Log("Initializing database manager..."); - DbManager db = DbManager.FromAddressAndName(localAddress, db_name); + DbManager db = DbManager.FromDataSource(localDataSource); LogManager.Log("Checking Tango database exists on the local machine..."); - if (!db.Exists(db_name)) + if (!db.Exists(localDataSource.Catalog)) { throw new InvalidProgramException("Database tango does not exists."); } @@ -190,20 +188,9 @@ namespace Tango.PPC.Common.MachineUpdate ExaminerSequenceConfigurationRunner runner = new ExaminerSequenceConfigurationRunner( Path.Combine(_newPackageTempFolder, "Update Scripts", "config.xml"), Path.Combine(_newPackageTempFolder, "Update Scripts"), - new ExaminerSequenceDataSource() - { - Address = remote_address, - DataBaseName = db_name, - IntegratedSecurity = false, - UserName = update_response.DbUserName, - Password = update_response.DbPassword, - }, - new ExaminerSequenceDataSource() - { - Address = localAddress, - DataBaseName = db_name, - IntegratedSecurity = true, - }, serialNumber); + update_response.DataSource, + localDataSource, + serialNumber); runner.Log += (x, msg) => { @@ -331,15 +318,13 @@ namespace Tango.PPC.Common.MachineUpdate UpdateDBResponse update_response = dbCompareResult.UpdateDBResponse; - String db_name = "Tango"; - String localAddress = SettingsManager.Default.GetOrCreate().DataSource.Address; - String remote_address = update_response.DbAddress; + var localDataSource = SettingsManager.Default.GetOrCreate().DataSource; - LogManager.Log($"Overriding database static tables '{remote_address}\\{db_name}' => '{localAddress}\\{db_name}'..."); + LogManager.Log($"Overriding database static tables '{update_response.DataSource.ToString()}' => '{localDataSource.ToString()}'..."); ExaminerConfigurationBuilder builder = new ExaminerConfigurationBuilder(config_file); - builder.SetSourceServer(remote_address, db_name, false, update_response.DbUserName, update_response.DbPassword); - builder.SetTargetServer(localAddress, db_name, true); + builder.SetSource(update_response.DataSource); + builder.SetTarget(localDataSource); builder.Synchronize(); var config = builder.Build(); @@ -410,17 +395,15 @@ namespace Tango.PPC.Common.MachineUpdate LogManager.Log($"Update DB response received: {Environment.NewLine}{update_response.ToJsonString()}"); - String db_name = "Tango"; - String localAddress = SettingsManager.Default.GetOrCreate().DataSource.Address; - String remote_address = update_response.DbAddress; + var localDataSource = SettingsManager.Default.GetOrCreate().DataSource; - LogManager.Log($"Comparing database static tables '{remote_address}\\{db_name}' => '{localAddress}\\{db_name}'..."); + LogManager.Log($"Comparing database static tables '{update_response.DataSource.ToString()}' => '{localDataSource.ToString()}'..."); var report_file = TemporaryManager.CreateFile(".xml"); ExaminerConfigurationBuilder builder = new ExaminerConfigurationBuilder(config_file); - builder.SetSourceServer(remote_address, db_name, false, update_response.DbUserName, update_response.DbPassword); - builder.SetTargetServer(localAddress, db_name, true); + builder.SetSource(update_response.DataSource); + builder.SetTarget(localDataSource); builder.SetReportFile(report_file); var config = builder.Build(); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/UpdateDBResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/UpdateDBResponse.cs index 212cd02d2..36be14750 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/UpdateDBResponse.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/UpdateDBResponse.cs @@ -3,14 +3,13 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Core; 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; } + public DataSource DataSource { get; set; } } } diff --git a/Software/Visual_Studio/Tango.BL/Entities/Machine.cs b/Software/Visual_Studio/Tango.BL/Entities/Machine.cs index 383492905..92ed46850 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Machine.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Machine.cs @@ -21,6 +21,11 @@ using Tango.Core; namespace Tango.BL.Entities { + + /// + /// + /// + [Table("MACHINES")] public partial class Machine : ObservableEntity { @@ -51,8 +56,12 @@ namespace Tango.BL.Entities public event EventHandler SetupFirmwareChanged; + public event EventHandler SetupFpgaChanged; + public event EventHandler IsDemoChanged; + public event EventHandler EnvironmentChanged; + public event EventHandler> CatsChanged; public event EventHandler DefaultColorSpaceChanged; @@ -71,6 +80,8 @@ namespace Tango.BL.Entities public event EventHandler DefaultRmlChanged; + public event EventHandler LoadedRmlChanged; + public event EventHandler DefaultSpoolTypeChanged; protected String _serialnumber; @@ -261,6 +272,32 @@ namespace Tango.BL.Entities } } + protected String _loadedrmlguid; + + /// + /// Gets or sets the machine loaded rml guid. + /// + + [Column("LOADED_RML_GUID")] + [ForeignKey("LoadedRml")] + + public String LoadedRmlGuid + { + get + { + return _loadedrmlguid; + } + + set + { + if (_loadedrmlguid != value) + { + _loadedrmlguid = value; + RaisePropertyChanged(nameof(LoadedRmlGuid)); + } + } + } + protected String _targetjobtypes; /// @@ -593,6 +630,34 @@ namespace Tango.BL.Entities } } + protected Boolean _setupfpga; + + /// + /// Gets or sets the machine setup fpga. + /// + + [Column("SETUP_FPGA")] + + public Boolean SetupFpga + { + get + { + return _setupfpga; + } + + set + { + if (_setupfpga != value) + { + _setupfpga = value; + + SetupFpgaChanged?.Invoke(this, value); + + RaisePropertyChanged(nameof(SetupFpga)); + } + } + } + protected Boolean _isdemo; /// @@ -621,6 +686,36 @@ namespace Tango.BL.Entities } } + protected Int32 _environment; + + /// + /// 0 = DEV + /// 1 = TEST + /// 2 = PROD + /// + + [Column("ENVIRONMENT")] + + public Int32 Environment + { + get + { + return _environment; + } + + set + { + if (_environment != value) + { + _environment = value; + + EnvironmentChanged?.Invoke(this, value); + + RaisePropertyChanged(nameof(Environment)); + } + } + } + protected SynchronizedObservableCollection _cats; /// @@ -865,6 +960,34 @@ namespace Tango.BL.Entities } } + protected Rml _loadedrml; + + /// + /// Gets or sets the machine rml1. + /// + + [XmlIgnore] + [JsonIgnore] + public virtual Rml LoadedRml + { + get + { + return _loadedrml; + } + + set + { + if (_loadedrml != value) + { + _loadedrml = value; + + LoadedRmlChanged?.Invoke(this, value); + + RaisePropertyChanged(nameof(LoadedRml)); + } + } + } + protected SpoolType _defaultspooltype; /// diff --git a/Software/Visual_Studio/Tango.BL/Entities/Rml.cs b/Software/Visual_Studio/Tango.BL/Entities/Rml.cs index c7c3077d7..b79736ad4 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Rml.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Rml.cs @@ -51,6 +51,10 @@ namespace Tango.BL.Entities public event EventHandler EstimatedThreadDiameterChanged; + public event EventHandler RankChanged; + + public event EventHandler ThumbnailChanged; + public event EventHandler> CatsChanged; public event EventHandler> CctsChanged; @@ -67,6 +71,8 @@ namespace Tango.BL.Entities public event EventHandler> MachinesChanged; + public event EventHandler> Machines1Changed; + public event EventHandler MediaColorChanged; public event EventHandler MediaConditionChanged; @@ -623,6 +629,62 @@ namespace Tango.BL.Entities } } + protected Int32 _rank; + + /// + /// Gets or sets the rml rank. + /// + + [Column("RANK")] + + public Int32 Rank + { + get + { + return _rank; + } + + set + { + if (_rank != value) + { + _rank = value; + + RankChanged?.Invoke(this, value); + + RaisePropertyChanged(nameof(Rank)); + } + } + } + + protected Byte[] _thumbnail; + + /// + /// Gets or sets the rml thumbnail. + /// + + [Column("THUMBNAIL")] + + public Byte[] Thumbnail + { + get + { + return _thumbnail; + } + + set + { + if (_thumbnail != value) + { + _thumbnail = value; + + ThumbnailChanged?.Invoke(this, value); + + RaisePropertyChanged(nameof(Thumbnail)); + } + } + } + protected SynchronizedObservableCollection _cats; /// @@ -837,6 +899,32 @@ namespace Tango.BL.Entities } } + protected SynchronizedObservableCollection _machines1; + + /// + /// Gets or sets the rml machines1. + /// + + public virtual SynchronizedObservableCollection Machines1 + { + get + { + return _machines1; + } + + set + { + if (_machines1 != value) + { + _machines1 = value; + + Machines1Changed?.Invoke(this, value); + + RaisePropertyChanged(nameof(Machines1)); + } + } + } + protected MediaColor _mediacolor; /// @@ -991,6 +1079,8 @@ namespace Tango.BL.Entities Machines = new SynchronizedObservableCollection(); + Machines1 = new SynchronizedObservableCollection(); + ProcessParametersTablesGroups = new SynchronizedObservableCollection(); } diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/Permissions.cs b/Software/Visual_Studio/Tango.BL/Enumerations/Permissions.cs index 5e5c7390d..721057ad0 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/Permissions.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/Permissions.cs @@ -50,10 +50,10 @@ namespace Tango.BL.Enumerations RunMachineStudio = 6, /// - /// (Allows publishing of new Machine Studio release version to the Machine Studio Service.) + /// (Allows publishing of new Machine Studio versions.) /// - [Description("Allows publishing of new Machine Studio release version to the Machine Studio Service.")] - PublishMachineStudioVersion = 7, + [Description("Allows publishing of new Machine Studio versions.")] + PublishMachineStudioVersions = 7, /// /// (Allows loading the stubs module in machine studio) @@ -127,5 +127,29 @@ namespace Tango.BL.Enumerations [Description("Allows running the hardware versions module in Machine Studio.")] RunHardwareVersionsModule = 19, + /// + /// (Grants access to the development environment.) + /// + [Description("Grants access to the development environment.")] + AccessDevelopmentDataSource = 20, + + /// + /// (Grants access to the test environment.) + /// + [Description("Grants access to the test environment.")] + AccessTestDataSource = 21, + + /// + /// (Grants access to the production environment.) + /// + [Description("Grants access to the production environment.")] + AccessProductionDataSource = 22, + + /// + /// (Allows publishing of new PPC application versions.) + /// + [Description("Allows publishing of new PPC application versions.")] + PublishPPCVersions = 23, + } } diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/Roles.cs b/Software/Visual_Studio/Tango.BL/Enumerations/Roles.cs index 626dc8f40..0ee332c6a 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/Roles.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/Roles.cs @@ -38,9 +38,9 @@ namespace Tango.BL.Enumerations Technician = 2, /// - /// (Publish new Machine Studio Versions) + /// (Machine Studio versions publisher.) /// - [Description("Publish new Machine Studio Versions")] + [Description("Machine Studio versions publisher.")] MachineStudioPublisher = 4, /// @@ -56,9 +56,9 @@ namespace Tango.BL.Enumerations PPCUser = 9, /// - /// (Manage organizations users and roles) + /// (Manages organizations users and roles) /// - [Description("Manage organizations users and roles")] + [Description("Manages organizations users and roles")] UsersAndRolesManager = 7, /// @@ -79,5 +79,29 @@ namespace Tango.BL.Enumerations [Description("Twine Software Developer")] SoftwareDeveloper = 6, + /// + /// (Specifies that a user should work against a development environment data source.) + /// + [Description("Specifies that a user should work against a development environment data source.")] + DevelopmentEnvironmentUser = 10, + + /// + /// (Specifies that a user should work against a testing environment data source.) + /// + [Description("Specifies that a user should work against a testing environment data source.")] + TestEnvironmentUser = 11, + + /// + /// (Specifies that a user should work against a production environment data source.) + /// + [Description("Specifies that a user should work against a production environment data source.")] + ProductionEnvironmentUser = 12, + + /// + /// (PPC Application Publisher) + /// + [Description("PPC Application Publisher")] + PPCPublisher = 13, + } } diff --git a/Software/Visual_Studio/Tango.Core/DB/DbManager.cs b/Software/Visual_Studio/Tango.Core/DB/DbManager.cs index 0a9123164..1d90b30e8 100644 --- a/Software/Visual_Studio/Tango.Core/DB/DbManager.cs +++ b/Software/Visual_Studio/Tango.Core/DB/DbManager.cs @@ -41,6 +41,11 @@ namespace Tango.Core.DB return new DbManager(new SqlConnection(String.Format("Server={0};Integrated security=SSPI;Initial Catalog={1}", address, database))); } + public static DbManager FromDataSource(DataSource dataSource) + { + return new DbManager(dataSource.ToConnection() as SqlConnection); + } + public static DbManager FromCredentials(String address, String database, String userName, String password) { return new DbManager(new SqlConnection(String.Format("Server={0};Initial Catalog={1};User Id={2};Password={3}", address, database, userName, password))); diff --git a/Software/Visual_Studio/Tango.Core/DataSource.cs b/Software/Visual_Studio/Tango.Core/DataSource.cs index c5c58cf09..fd7d5e3ec 100644 --- a/Software/Visual_Studio/Tango.Core/DataSource.cs +++ b/Software/Visual_Studio/Tango.Core/DataSource.cs @@ -66,6 +66,7 @@ namespace Tango.Core /// public DbConnection ToConnection() { + switch (Type) { case DataSourceType.SQLite: @@ -121,5 +122,16 @@ namespace Tango.Core return null; } } + + /// + /// Returns a that represents this instance. + /// + /// + /// A that represents this instance. + /// + public override string ToString() + { + return $"{Address}\\{Catalog}"; + } } } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs index 341f2aa2a..54b7a6231 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs @@ -33,6 +33,7 @@ namespace Tango.DAL.Remote.DB public string MACHINE_VERSION_GUID { get; set; } public string CONFIGURATION_GUID { get; set; } public string DEFAULT_RML_GUID { get; set; } + public string LOADED_RML_GUID { get; set; } public string TARGET_JOB_TYPES { get; set; } public string DEFAULT_COLOR_SPACE_GUID { get; set; } public double DEFAULT_SEGMENT_LENGTH { get; set; } @@ -45,7 +46,9 @@ namespace Tango.DAL.Remote.DB public bool SETUP_REMOTE_ASSISTANCE { get; set; } public bool SETUP_UWF { get; set; } public bool SETUP_FIRMWARE { get; set; } + public bool SETUP_FPGA { get; set; } public bool IS_DEMO { get; set; } + public int ENVIRONMENT { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection CATS { get; set; } @@ -60,6 +63,7 @@ namespace Tango.DAL.Remote.DB public virtual ICollection MACHINES_EVENTS { get; set; } public virtual ORGANIZATION ORGANIZATION { get; set; } public virtual RML RML { get; set; } + public virtual RML RML1 { get; set; } public virtual SPOOL_TYPES SPOOL_TYPES { get; set; } } } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs index ab767508c..a7a5b1deb 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs @@ -22,6 +22,7 @@ namespace Tango.DAL.Remote.DB this.JOBS = new HashSet(); this.LIQUID_TYPES_RMLS = new HashSet(); this.MACHINES = new HashSet(); + this.MACHINES1 = new HashSet(); this.PROCESS_PARAMETERS_TABLES_GROUPS = new HashSet(); } @@ -48,6 +49,8 @@ namespace Tango.DAL.Remote.DB public double TENSILE_STRENGTH { get; set; } public double ELONGATION_AT_BREAK_PERCENTAGE { get; set; } public double ESTIMATED_THREAD_DIAMETER { get; set; } + public int RANK { get; set; } + public byte[] THUMBNAIL { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection CATS { get; set; } @@ -62,6 +65,8 @@ namespace Tango.DAL.Remote.DB public virtual ICollection LIQUID_TYPES_RMLS { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection MACHINES { get; set; } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] + public virtual ICollection MACHINES1 { get; set; } public virtual MEDIA_COLORS MEDIA_COLORS { get; set; } public virtual MEDIA_CONDITIONS MEDIA_CONDITIONS { get; set; } public virtual MEDIA_MATERIALS MEDIA_MATERIALS { 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 86cf4ed6a..ed932c954 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -700,6 +700,7 @@ + @@ -712,7 +713,9 @@ + + @@ -810,7 +813,7 @@ - + @@ -882,6 +885,8 @@ + + @@ -1876,6 +1881,18 @@ + + + + + + + + + + + + @@ -2483,6 +2500,10 @@ + + + + @@ -2929,6 +2950,10 @@ + + + + @@ -3792,6 +3817,7 @@ + @@ -3804,7 +3830,9 @@ + + @@ -3814,6 +3842,7 @@ + @@ -3927,7 +3956,7 @@ - + @@ -4003,6 +4032,8 @@ + + @@ -4011,6 +4042,7 @@ + @@ -5129,6 +5161,18 @@ + + + + + + + + + + + + @@ -6055,7 +6099,9 @@ + + @@ -6068,6 +6114,7 @@ + @@ -6236,6 +6283,8 @@ + + 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 cf9ff4f22..886074e80 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 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + - - - - - + + + + + @@ -149,6 +149,7 @@ + diff --git a/Software/Visual_Studio/Tango.SQLExaminer/ExaminerConfigurationBuilder.cs b/Software/Visual_Studio/Tango.SQLExaminer/ExaminerConfigurationBuilder.cs index 7123553a6..dbed95b77 100644 --- a/Software/Visual_Studio/Tango.SQLExaminer/ExaminerConfigurationBuilder.cs +++ b/Software/Visual_Studio/Tango.SQLExaminer/ExaminerConfigurationBuilder.cs @@ -30,7 +30,7 @@ namespace Tango.SQLExaminer _config.DataSources.Clear(); } - public ExaminerConfigurationBuilder SetSourceServer(String address, String databaseName, bool integratedSecurity = true, String userName = null, String password = null) + public ExaminerConfigurationBuilder SetSource(Core.DataSource dataSource) { DataSource d1 = _config.DataSources.SingleOrDefault(x => x.ID == 1); @@ -41,20 +41,25 @@ namespace Tango.SQLExaminer } d1.ID = 1; - d1.DataBase = databaseName; - d1.Server = address; - d1.UserName = userName; - d1.Password = password; + d1.DataBase = dataSource.Catalog; + d1.Server = dataSource.Address; + d1.UserName = dataSource.UserName; + d1.Password = dataSource.Password; - if (integratedSecurity) + if (dataSource.IntegratedSecurity) { d1.IntegratedSecurity = "True"; } + if (dataSource.Type == Core.DataSourceType.Azure) + { + d1.Type = "SqlAzure"; + } + return this; } - public ExaminerConfigurationBuilder SetTargetServer(String address, String databaseName, bool integratedSecurity = true, String userName = null, String password = null) + public ExaminerConfigurationBuilder SetTarget(Core.DataSource dataSource) { DataSource d2 = _config.DataSources.SingleOrDefault(x => x.ID == 2); @@ -65,17 +70,22 @@ namespace Tango.SQLExaminer } d2.ID = 2; - d2.DataBase = databaseName; - d2.Server = address; - d2.UserName = userName; - d2.Password = password; + d2.DataBase = dataSource.Catalog; + d2.Server = dataSource.Address; + d2.UserName = dataSource.UserName; + d2.Password = dataSource.Password; - if (integratedSecurity) + if (dataSource.IntegratedSecurity) { d2.IntegratedSecurity = "True"; } + if (dataSource.Type == Core.DataSourceType.Azure) + { + d2.Type = "SqlAzure"; + } + return this; } diff --git a/Software/Visual_Studio/Tango.SQLExaminer/ExaminerSequenceConfigurationRunner.cs b/Software/Visual_Studio/Tango.SQLExaminer/ExaminerSequenceConfigurationRunner.cs index b9ee986bc..de146ead3 100644 --- a/Software/Visual_Studio/Tango.SQLExaminer/ExaminerSequenceConfigurationRunner.cs +++ b/Software/Visual_Studio/Tango.SQLExaminer/ExaminerSequenceConfigurationRunner.cs @@ -14,9 +14,9 @@ namespace Tango.SQLExaminer public String SequenceFile { get; private set; } - public ExaminerSequenceDataSource Source { get; private set; } + public Core.DataSource Source { get; private set; } - public ExaminerSequenceDataSource Target { get; private set; } + public Core.DataSource Target { get; private set; } public String MachineSerialNumber { get; private set; } @@ -24,7 +24,7 @@ namespace Tango.SQLExaminer public ExaminerSequenceConfiguration Configuration { get; private set; } - public ExaminerSequenceConfigurationRunner(String sequenceFile, String scriptsFolder, ExaminerSequenceDataSource source, ExaminerSequenceDataSource target, String machineSerialNumber) + public ExaminerSequenceConfigurationRunner(String sequenceFile, String scriptsFolder, Core.DataSource source, Core.DataSource target, String machineSerialNumber) { SequenceFile = sequenceFile; ScriptsFolder = scriptsFolder; @@ -49,13 +49,13 @@ namespace Tango.SQLExaminer if (item.Direction == ExaminerSequenceItemDirection.SourceToTarget) { - builder.SetSourceServer(Source.Address, Source.DataBaseName, Source.IntegratedSecurity, Source.UserName, Source.Password); - builder.SetTargetServer(Target.Address, Target.DataBaseName, Target.IntegratedSecurity, Target.UserName, Target.Password); + builder.SetSource(Source); + builder.SetTarget(Target); } else { - builder.SetSourceServer(Target.Address, Target.DataBaseName, Target.IntegratedSecurity, Target.UserName, Target.Password); - builder.SetTargetServer(Source.Address, Source.DataBaseName, Source.IntegratedSecurity, Source.UserName, Source.Password); + builder.SetSource(Target); + builder.SetTarget(Source); } if (item.RequiresSerialNumber) diff --git a/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer_TST.cs index 5b7ce16ca..5863aca74 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer_TST.cs @@ -20,6 +20,28 @@ namespace Tango.UnitTesting [TestCategory("SQL Examiner")] public class SQLExaminer_TST { + private Core.DataSource GetSource(String catalog = "Tango") + { + return new Core.DataSource() + { + Type = DataSourceType.SQLServer, + Address = "localhost\\SQLEXPRESS", + Catalog = catalog, + IntegratedSecurity = true, + }; + } + + private Core.DataSource GetTarget(String catalog = "Test") + { + return new Core.DataSource() + { + Type = DataSourceType.SQLServer, + Address = "localhost\\SQLEXPRESS", + Catalog = catalog, + IntegratedSecurity = true, + }; + } + [TestMethod] public void Generate_Schema_Synchronization_Script() { @@ -28,8 +50,8 @@ namespace Tango.UnitTesting var temp_folder = Helper.GetTempFolderPath(); builder. - SetSourceServer("localhost\\SQLEXPRESS", "Tango", false, "Synchronizer", "Aa123456"). - SetTargetServer("twine01\\SQLTWINE", "Tango"). + SetSource(GetSource()). + SetTarget(GetTarget()). SetBackupFile(Path.Combine(temp_folder, "db.bak")). SetReportFile(Path.Combine(temp_folder, "report.xml")); @@ -50,8 +72,8 @@ namespace Tango.UnitTesting var temp_folder = Helper.GetTempFolderPath(); builder. - SetSourceServer("localhost\\SQLEXPRESS", "Tango", false, "Synchronizer", "Aa123456"). - SetTargetServer("twine01\\SQLTWINE", "Tango"). + SetSource(GetSource()). + SetTarget(GetTarget()). SetReportFile(Path.Combine(temp_folder, "report.xml")). SetMachineSerialNumber("1111"); @@ -72,8 +94,8 @@ namespace Tango.UnitTesting var temp_folder = Helper.GetTempFolderPath(); builder. - SetSourceServer("localhost\\SQLEXPRESS", "Tango", false, "Synchronizer", "Aa123456"). - SetTargetServer("twine01\\SQLTWINE", "Tango"). + SetSource(GetSource()). + SetTarget(GetTarget()). SetReportFile(Path.Combine(temp_folder, "report.xml")); var config = builder.Build(); @@ -101,8 +123,8 @@ namespace Tango.UnitTesting var temp_folder = Helper.GetTempFolderPath(); builder. - SetSourceServer("localhost\\SQLEXPRESS", "Tango"). - SetTargetServer("localhost\\SQLEXPRESS", "Test"). + SetSource(GetSource()). + SetTarget(GetTarget()). SetReportFile("C:\\Data\\Report.xml"); var config = builder.Build(); @@ -125,8 +147,8 @@ namespace Tango.UnitTesting var temp_folder = Helper.GetTempFolderPath(); builder. - SetSourceServer("localhost\\SQLEXPRESS", "Tango"). - SetTargetServer("localhost\\SQLEXPRESS", "Test"). + SetSource(GetSource()). + SetTarget(GetTarget()). SetReportFile("C:\\DATA\\report_data.xml"); var config = builder.Build(); @@ -153,8 +175,8 @@ namespace Tango.UnitTesting var temp_folder = Helper.GetTempFolderPath(); builder. - SetSourceServer("localhost\\SQLEXPRESS", "Tango"). - SetTargetServer("localhost\\SQLEXPRESS", "Test"). + SetSource(GetSource()). + SetTarget(GetTarget()). SetMachineSerialNumber("1111"); var config = builder.Build(); @@ -216,8 +238,8 @@ namespace Tango.UnitTesting ExaminerConfigurationBuilder builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.Schema); builder. - SetSourceServer("localhost\\SQLEXPRESS", source_db). - SetTargetServer("localhost\\SQLEXPRESS", target_db). + SetSource(GetSource(source_db)). + SetTarget(GetTarget(target_db)). Synchronize(). SetReportFile(report_file); @@ -236,8 +258,8 @@ namespace Tango.UnitTesting builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.OverrideData); builder. - SetSourceServer("localhost\\SQLEXPRESS", source_db). - SetTargetServer("localhost\\SQLEXPRESS", target_db). + SetSource(GetSource(source_db)). + SetTarget(GetTarget(target_db)). Synchronize(). SetReportFile(report_file); @@ -255,8 +277,8 @@ namespace Tango.UnitTesting builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.ProvisionMachine); builder. - SetSourceServer("localhost\\SQLEXPRESS", source_db). - SetTargetServer("localhost\\SQLEXPRESS", target_db). + SetSource(GetSource(source_db)). + SetTarget(GetTarget(target_db)). SetMachineSerialNumber(machine_serial_number). Synchronize(). SetReportFile(report_file); @@ -308,8 +330,8 @@ namespace Tango.UnitTesting builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.UpdateTwineDB); builder. - SetSourceServer("localhost\\SQLEXPRESS", target_db). - SetTargetServer("localhost\\SQLEXPRESS", source_db). + SetSource(GetTarget(target_db)). + SetTarget(GetSource(source_db)). Synchronize(). SetReportFile(report_file); @@ -341,8 +363,8 @@ namespace Tango.UnitTesting builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.UpdateMachine); builder. - SetSourceServer("localhost\\SQLEXPRESS", source_db). - SetTargetServer("localhost\\SQLEXPRESS", target_db). + SetSource(GetSource(source_db)). + SetTarget(GetTarget(target_db)). SetMachineSerialNumber(machine_serial_number). Synchronize(). SetReportFile(report_file); diff --git a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs index 876639b78..e45815046 100644 --- a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs +++ b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs @@ -103,11 +103,12 @@ namespace Tango.DBObservablesGenerator.CLI codeField.Name = codeField.Type; codeField.XmlIgnore = true; - var fk = foreignKeys.SingleOrDefault(x => x.Contains(codeField.Name)); + var fk = foreignKeys.FirstOrDefault(x => x.Contains(codeField.Name)); if (fk != null) { codeField.Name = fk; + foreignKeys.Remove(fk); } codeField.Complex = true; diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs index 245c18b9b..ed1a807be 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs @@ -100,7 +100,7 @@ namespace Tango.MachineService.Controllers var user = db.Users.SingleOrDefault(x => x.Email.ToLower() == request.Email.ToLower() && x.Password == request.Password); - if (user != null && user.HasPermission(Permissions.PublishMachineStudioVersion)) + if (user != null && user.HasPermission(Permissions.PublishMachineStudioVersions)) { var latestVersion = db.MachineStudioVersions.ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault(); Version currentVersion = Version.Parse(request.Version); diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index 9ce22bbb0..662883223 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -18,6 +18,7 @@ using Tango.BL; using Tango.BL.Builders; using Tango.BL.Entities; using Tango.BL.Enumerations; +using Tango.Core; using Tango.Core.DB; using Tango.Core.Helpers; using Tango.Core.IO; @@ -101,9 +102,15 @@ namespace Tango.MachineService.Controllers }); } - response.DbAddress = Config.DB_ADDRESS; - response.DbUserName = credentials.UserName; - response.DbPassword = credentials.Password; + response.DataSource = new DataSource() + { + Address = Config.DB_ADDRESS, + Catalog = Config.DB_CATALOG, + UserName = credentials.UserName, + Password = credentials.Password, + Type = DataSourceType.SQLServer, + }; + response.OSKey = machine.OsKey; response.SetupActivation = machine.SetupActivation; response.SetupRemoteAssistance = machine.SetupRemoteAssistance; @@ -160,9 +167,14 @@ namespace Tango.MachineService.Controllers }); } - response.DbAddress = Config.DB_ADDRESS; - response.DbUserName = credentials.UserName; - response.DbPassword = credentials.Password; + response.DataSource = new DataSource() + { + Address = Config.DB_ADDRESS, + Catalog = Config.DB_CATALOG, + UserName = credentials.UserName, + Password = credentials.Password, + Type = DataSourceType.SQLServer, + }; } return response; @@ -231,9 +243,14 @@ namespace Tango.MachineService.Controllers }); } - response.DbAddress = Config.DB_ADDRESS; - response.DbUserName = credentials.UserName; - response.DbPassword = credentials.Password; + response.DataSource = new DataSource() + { + Address = Config.DB_ADDRESS, + Catalog = Config.DB_CATALOG, + UserName = credentials.UserName, + Password = credentials.Password, + Type = DataSourceType.SQLServer, + }; } return response; @@ -290,7 +307,7 @@ namespace Tango.MachineService.Controllers var user = db.Users.SingleOrDefault(x => x.Email.ToLower() == request.Email.ToLower() && x.Password == request.Password); - if (user != null && user.HasPermission(Permissions.PublishMachineStudioVersion)) + if (user != null && user.HasPermission(Permissions.PublishPPCVersions)) { var versions = db.TangoVersions.ToList().Where(x => x.MachineVersionGuid == request.MachineVersionGuid).OrderByDescending(x => Version.Parse(x.Version)).ToList(); -- cgit v1.3.1 From 721e03d7e6926055111d4edbbdf5f700a11ed58a Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 30 Dec 2018 15:23:34 +0200 Subject: Working on new Machine Designer. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../Build/Shortcuts/Machine Emulator.lnk | Bin 1530 -> 1445 bytes .../Build/Shortcuts/Machine Studio.lnk | Bin 1581 -> 1516 bytes .../Build/Shortcuts/Proto Compiler GUI.lnk | Bin 1529 -> 1444 bytes .../Build/Shortcuts/Stubs Execution GUI.lnk | Bin 1547 -> 1462 bytes .../Build/Shortcuts/Transport Router.lnk | Bin 1578 -> 1493 bytes .../ViewModels/ConfigurationsViewVM.cs | 1 - .../Tango.MachineStudio.MachineDesigner.csproj | 9 +- .../ViewModels/MainViewVM.cs | 598 +++++++++------------ .../Views/ConfigurationView.xaml | 55 +- .../Views/MachineDetailsView.xaml | 43 +- .../Views/MachineSettingsView.xaml | 99 ++++ .../Views/MachineSettingsView.xaml.cs | 28 + .../Views/MachineView.xaml | 19 - .../Views/MachinesView.xaml | 7 +- .../Views/MainView.xaml | 3 +- .../Tango.MachineStudio.Common/DeploymentSlots.cs | 2 + .../PPC/Tango.PPC.Common/DeploymentSlots.cs | 2 + .../Tango.BL/Builders/ConfigurationBuilder.cs | 7 +- .../Tango.BL/Builders/MachineBuilder.cs | 12 +- .../Tango.BL/Entities/Configuration.cs | 76 --- .../Visual_Studio/Tango.BL/Entities/Machine.cs | 76 +-- Software/Visual_Studio/Tango.BL/Entities/Spool.cs | 140 +++++ .../Visual_Studio/Tango.BL/Entities/SpoolType.cs | 38 ++ .../Tango.BL/EntitiesExtensions/Configuration.cs | 2 - .../Tango.BL/ObservablesStaticCollections.cs | 10 + .../Tango.DAL.Remote/DB/CONFIGURATION.cs | 2 - .../Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs | 4 +- .../Tango.DAL.Remote/DB/RemoteADO.Designer.cs | 2 +- .../Tango.DAL.Remote/DB/RemoteADO.edmx | 87 ++- .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 154 +++--- .../Visual_Studio/Tango.DAL.Remote/DB/SPOOL.cs | 5 + .../Tango.DAL.Remote/DB/SPOOL_TYPES.cs | 3 + .../Tango.UnitTesting/SQLExaminer_TST.cs | 1 - .../Tango.UnitTesting/Synchronization_TST.cs | 17 +- Software/Visual_Studio/Tango.Web/DeploymentSlot.cs | 2 + 37 files changed, 875 insertions(+), 629 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml.cs (limited to 'Software/Visual_Studio/Tango.UnitTesting') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 967eddb23..c6a231daa 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 65b2bce77..d85206fe7 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk index fd3743ce5..9f377363e 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 a454f518f..9151c74ac 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 ff739ffcb..ac84d995e 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/Build/Shortcuts/Stubs Execution GUI.lnk b/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk index 4115fb2ac..db7f7c338 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk and b/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk b/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk index 9294fa274..6f0433af2 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk and b/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ConfigurationsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ConfigurationsViewVM.cs index 18c8c3daa..d5022c761 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ConfigurationsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ConfigurationsViewVM.cs @@ -18,7 +18,6 @@ namespace Tango.MachineStudio.DB.ViewModels protected override void InitializeEntity(Configuration entity) { base.InitializeEntity(entity); - entity.CreationDate = DateTime.UtcNow; } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj index 8ced2e510..a55d7e696 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj @@ -83,6 +83,9 @@ MachineDetailsView.xaml + + MachineSettingsView.xaml + MachinesView.xaml @@ -103,6 +106,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -254,7 +261,7 @@ - + \ 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 e2924a185..b0b97d7d4 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 @@ -26,30 +26,21 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels public class MainViewVM : StudioViewModel { private INotificationProvider _notification; - private ObservablesContext _dbContext; - private ObservablesContext _machineContext; - private ObservablesContext _configContext; #region Properties - private ObservableCollection _machines; - /// - /// Gets or sets the machines. - /// - public ObservableCollection Machines + private ObservablesStaticCollections _machinesAdapter; + public ObservablesStaticCollections MachinesAdapter { - get { return _machines; } - set { _machines = value; RaisePropertyChangedAuto(); } + get { return _machinesAdapter; } + set { _machinesAdapter = value; RaisePropertyChangedAuto(); } } - private ObservableCollection _dispensers; - /// - /// Gets or sets the dispensers. - /// - public ObservableCollection Dispensers + private ObservablesStaticCollections _activeMachineAdapter; + public ObservablesStaticCollections ActiveMachineAdapter { - get { return _dispensers; } - set { _dispensers = value; RaisePropertyChangedAuto(); } + get { return _activeMachineAdapter; } + set { _activeMachineAdapter = value; RaisePropertyChangedAuto(); } } private Machine _selectedMachine; @@ -80,17 +71,6 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels set { _activeMachine = value; RaisePropertyChangedAuto(); } } - - private Configuration _configuration; - /// - /// Gets or sets the editable machine configuration. - /// - public Configuration Configuration - { - get { return _configuration; } - set { _configuration = value; RaisePropertyChangedAuto(); } - } - private IdsPack _selectedIds; /// /// Gets or sets the selected ids pack. @@ -155,6 +135,11 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// public RelayCommand EditMachineCommand { get; set; } + /// + /// Gets or sets the back to machines command. + /// + public RelayCommand BackToMachinesCommand { get; set; } + #endregion #region Constructors @@ -169,32 +154,17 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// public MainViewVM(INotificationProvider notification) { - _dbContext = ObservablesContext.CreateDefault(); + MachinesAdapter = new ObservablesStaticCollections(ObservablesContext.CreateDefault()); _notification = notification; //SaveCommand = new RelayCommand(Save); - AddIdsCommand = new RelayCommand(AddIds, (x) => Configuration != null && Configuration.IdsPacks.Count < 8); + AddIdsCommand = new RelayCommand(AddIds, (x) => ActiveMachine != null && ActiveMachine.Configuration != null && ActiveMachine.Configuration.IdsPacks.Count < 8); RemoveIdsCommand = new RelayCommand(RemoveIds, (x) => SelectedIds != null); - EditMachineCommand = new RelayCommand(EditSelectedMachine, () => SelectedMachine != null); - } - - private async void EditSelectedMachine() - { - using (_notification.PushTaskItem("Loading machine details...")) - { - IsFree = false; - - if (_machineContext != null) - { - _machineContext.Dispose(); - } - - _machineContext = ObservablesContext.CreateDefault(); - ActiveMachine = (await new MachineBuilder(_machineContext).Set(SelectedMachine).WithOrganization().WithConfiguration().BuildAsync()); - View.NavigateTo(MachineDesignerNavigationView.MachineDetailsView); - - IsFree = true; - } + EditMachineCommand = new RelayCommand(() => LoadSelectedMachine(), () => SelectedMachine != null); + BackToMachinesCommand = new RelayCommand(() => View.NavigateTo(MachineDesignerNavigationView.MachinesView)); + SaveCommand = new RelayCommand(SaveMachine); + AddMachineCommand = new RelayCommand(AddNewMachine); + RemoveMachineCommand = new RelayCommand(RemoveSelectedMachine,() => SelectedMachine != null); } #endregion @@ -208,59 +178,16 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels #endregion - //private Task InitCollections() - //{ - // return Task.Factory.StartNew(() => - // { - // CanWork = false; - - // _dbContext = ObservablesContext.CreateDefault(); - - // Adapter = new ObservablesStaticCollections(); - // Adapter.ApplicationDisplayPanelVersions = _dbContext.ApplicationDisplayPanelVersions.ToObservableCollection(); - // Adapter.ApplicationFirmwareVersions = _dbContext.ApplicationFirmwareVersions.ToObservableCollection(); - // Adapter.ApplicationOsVersions = _dbContext.ApplicationOsVersions.ToObservableCollection(); - // Adapter.EmbeddedFirmwareVersions = _dbContext.EmbeddedFirmwareVersions.ToObservableCollection(); - // Adapter.DispenserTypes = _dbContext.DispenserTypes.ToObservableCollection(); - // Adapter.LiquidTypes = _dbContext.LiquidTypes.ToObservableCollection(); - // Adapter.MidTankTypes = _dbContext.MidTankTypes.ToObservableCollection(); - // Adapter.CartridgeTypes = _dbContext.CartridgeTypes.ToObservableCollection(); - // Adapter.IdsPackFormulas = _dbContext.IdsPackFormulas.ToObservableCollection(); - // Adapter.HardwareVersions = _dbContext.HardwareVersions.ToObservableCollection(); - // Adapter.MachineVersions = _dbContext.MachineVersions.ToObservableCollection(); - // Adapter.Organizations = _dbContext.Organizations.ToObservableCollection(); - - // Adapter.InitCollectionSources(); - - // CanWork = true; - // }); - //} - - private void Reset() - { - //using (_notification.PushTaskItem("Resetting designer...")) - //{ - // SelectedMachine = null; - // Machine = new Machine(); - // Configuration = new Configuration(); - // InitCollections(); - //} - } - private async void OnDispensersFilterChanged() { if (!String.IsNullOrWhiteSpace(DispensersFilter)) { IsFree = false; - Dispensers = (await _configContext.Dispensers.Where(x => x.SerialNumber.ToLower().StartsWith(DispensersFilter.ToLower())).ToListAsync()).ToObservableCollection(); + ActiveMachineAdapter.Dispensers = (await ActiveMachineAdapter.Context.Dispensers.Where(x => x.SerialNumber.ToLower().StartsWith(DispensersFilter.ToLower())).ToListAsync()).ToObservableCollection(); IsFree = true; } } - #region Virtual Methods - - #endregion - #region Drag Drop Handlers /// @@ -270,7 +197,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// The ids pack2. public void DropIdsPack(IdsPack idsPack1, IdsPack idsPack2) { - Configuration.IdsPacks.Swap(idsPack1, idsPack2); + ActiveMachine.Configuration.IdsPacks.Swap(idsPack1, idsPack2); } /// @@ -279,8 +206,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// The application display panel version. public void DropTouchPanel(ApplicationDisplayPanelVersion applicationDisplayPanelVersion) { - Configuration.ApplicationDisplayPanelVersion = applicationDisplayPanelVersion; - Configuration.ApplicationDisplayPanelVersionGuid = applicationDisplayPanelVersion.Guid; + ActiveMachine.Configuration.ApplicationDisplayPanelVersion = applicationDisplayPanelVersion; + ActiveMachine.Configuration.ApplicationDisplayPanelVersionGuid = applicationDisplayPanelVersion.Guid; } /// @@ -289,8 +216,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// The application firmware version. public void DropApplicationFirmwareVersion(ApplicationFirmwareVersion applicationFirmwareVersion) { - Configuration.ApplicationFirmwareVersion = applicationFirmwareVersion; - Configuration.ApplicationFirmwareVersionGuid = applicationFirmwareVersion.Guid; + ActiveMachine.Configuration.ApplicationFirmwareVersion = applicationFirmwareVersion; + ActiveMachine.Configuration.ApplicationFirmwareVersionGuid = applicationFirmwareVersion.Guid; } /// @@ -299,8 +226,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// The hardware version. public void DropHardwareVersion(HardwareVersion hardwareVersion) { - Configuration.HardwareVersion = hardwareVersion; - Configuration.HardwareVersionGuid = hardwareVersion.Guid; + ActiveMachine.Configuration.HardwareVersion = hardwareVersion; + ActiveMachine.Configuration.HardwareVersionGuid = hardwareVersion.Guid; } /// @@ -309,8 +236,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// The embedded firmware version. public void DropEmbeddedFirmware(EmbeddedFirmwareVersion embeddedFirmwareVersion) { - Configuration.EmbeddedFirmwareVersion = embeddedFirmwareVersion; - Configuration.EmbeddedFirmwareVersionGuid = embeddedFirmwareVersion.Guid; + ActiveMachine.Configuration.EmbeddedFirmwareVersion = embeddedFirmwareVersion; + ActiveMachine.Configuration.EmbeddedFirmwareVersionGuid = embeddedFirmwareVersion.Guid; } /// @@ -319,8 +246,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// The application os version. public void DropApplicationOsVersion(ApplicationOsVersion applicationOsVersion) { - Configuration.ApplicationOsVersion = applicationOsVersion; - Configuration.ApplicationOsVersionGuid = applicationOsVersion.Guid; + ActiveMachine.Configuration.ApplicationOsVersion = applicationOsVersion; + ActiveMachine.Configuration.ApplicationOsVersionGuid = applicationOsVersion.Guid; } /// @@ -388,7 +315,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// private void RemoveIds() { - _dbContext.IdsPacks.Remove(SelectedIds); + ActiveMachineAdapter.Context.IdsPacks.Remove(SelectedIds); SelectedIds = null; } @@ -397,249 +324,242 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// private void AddIds() { - _dbContext.IdsPacks.Add(new IdsPack() { Configuration = Configuration }); + ActiveMachineAdapter.Context.IdsPacks.Add(new IdsPack() { Configuration = ActiveMachine.Configuration }); InvalidateRelayCommands(); } - ///// - ///// Saves the current machine configuration. - ///// - //private async void Save() - //{ - // foreach (var ids in Configuration.IdsPacks) - // { - // ids.PackIndex = Configuration.IdsPacks.IndexOf(ids); - // ids.Configuration = Configuration; - // ids.ConfigurationGuid = Configuration.Guid; - // } - - // //Validate - - // List errors = new List(); - - // if (Machine.MachineVersion == null) - // { - // errors.Add("Machine version is required."); - // } - - // if (Machine.Name.IsNullOrWhiteSpace()) - // { - // errors.Add("Machine name is required."); - // } - - // if (Machine.Organization == null) - // { - // errors.Add("Machine organization is required."); - // } - - // if (Machine.SerialNumber.IsNullOrWhiteSpace()) - // { - // errors.Add("Machine serial number is required."); - // } - - // if (Configuration.Name.IsNullOrWhiteSpace()) - // { - // errors.Add("Configuration name is required."); - // } - - // if (Configuration.ApplicationDisplayPanelVersion == null) - // { - // errors.Add("Touch Panel is required."); - // } - - // if (Configuration.ApplicationFirmwareVersion == null) - // { - // errors.Add("Application firmware is required."); - // } - - // if (Configuration.ApplicationOsVersion == null) - // { - // errors.Add("Application operation system is required."); - // } - - // if (Configuration.EmbeddedFirmwareVersion == null) - // { - // errors.Add("Embedded firmware is required."); - // } - - // if (Configuration.HardwareVersion == null) - // { - // errors.Add("Hardware version is required."); - // } - - // foreach (var pack in Configuration.IdsPacks) - // { - // if (pack.LiquidType != null || pack.CartridgeType != null || pack.Dispenser != null || pack.IdsPackFormula != null || pack.MidTankType != null) - // { - // if (pack.CartridgeType == null) - // { - // errors.Add(String.Format("Cartridge type is required on IDS pack '{0}'.", pack.PackIndex)); - // } - // if (pack.Dispenser == null) - // { - // errors.Add(String.Format("Dispenser is required on IDS pack '{0}'.", pack.PackIndex)); - // } - // if (pack.LiquidType == null) - // { - // errors.Add(String.Format("Liquid type is required on IDS pack '{0}'.", pack.PackIndex)); - // } - // if (pack.MidTankType == null) - // { - // errors.Add(String.Format("Mid Tank type is required on IDS pack '{0}'.", pack.PackIndex)); - // } - // if (pack.IdsPackFormula == null) - // { - // errors.Add(String.Format("Formula type is required on IDS pack '{0}'.", pack.PackIndex)); - // } - - // pack.IsEmpty = false; - // } - // else - // { - // pack.IsEmpty = true; - // } - // } - - // if (errors.Count > 0) - // { - // String errorsString = "Please fix the following validation errors before trying to save." + Environment.NewLine + Environment.NewLine; - // errorsString += String.Join(Environment.NewLine, errors); - // _notification.ShowError(errorsString); - // return; - // } - - // //Validate - - // try - // { - // CanWork = false; - - // using (_notification.PushTaskItem("Saving Machine Configuration...")) - // { - // if (!_dbContext.Machines.Any(x => x.SerialNumber.ToLower() == Machine.SerialNumber.ToLower())) - // { - // if (!_notification.ShowQuestion("The specified machine serial number does not exist. Do you wish to create a new machine?")) - // { - // CanWork = true; - // return; - // } - // else - // { - // Machine.Configuration = Configuration; - // Configuration.CreationDate = DateTime.UtcNow; - // Machine.ProductionDate = DateTime.UtcNow; - - // _dbContext.Machines.Add(Machine); - // } - // } - - // await _dbContext.SaveChangesAsync(); - // OnSelectedMachineChanged(); - - // } - // } - // catch (Exception ex) - // { - // _notification.ShowError("An error occurred while trying to save the configuration" + Environment.NewLine + ex.Message); - // } - // finally - // { - // CanWork = true; - // InvalidateRelayCommands(); - // } - //} - - ///// - ///// Sets the current configuration to the selected machine version default configuration. - ///// - //private async void SetVersionConfiguration() - //{ - // if (Machine.MachineVersion != null) - // { - // using (_notification.PushTaskItem("Applying default configuration...")) - // { - // CanWork = false; - - // await Task.Factory.StartNew(() => - // { - // var version = _dbContext.MachineVersions.Where(x => x.Guid == Machine.MachineVersion.Guid).Include(x => x.DefaultConfiguration).FirstOrDefault(); - // var version_config = _dbContext.Adapter.GetConfiguration(x => x.Guid == version.DefaultConfiguration.Guid); - // Configuration = version_config.Clone(); - // Machine.Configuration = Configuration; - // }); - - // CanWork = true; - // } - // } - // else - // { - // _notification.ShowError("No machine version selected."); - // } - //} - - ///// - ///// Sets the current configuration as a default machine version configuration. - ///// - //private void SetAsDefaultConfiguration() - //{ - // _notification.ShowModalDialog(async (vm) => - // { - // CanWork = false; - - // try - // { - // using (_notification.PushTaskItem("Saving Default Configuration...")) - // { - // if (vm.SelectedVersion != null) - // { - // var version = _dbContext.MachineVersions.Where(x => x.Guid == vm.SelectedVersion.Guid).Include(x => x.DefaultConfiguration).SingleOrDefault(x => x.Guid == vm.SelectedVersion.Guid); - - // _dbContext.Configurations.Remove(version.DefaultConfiguration); - - // var cloned = Configuration.Clone(); - // _dbContext.Configurations.Add(cloned); - // version.DefaultConfiguration = cloned; - - // await _dbContext.SaveChangesAsync(); - // } - // else - // { - // MachineVersion newVersion = new MachineVersion(); - // newVersion.Version = vm.Version; - // newVersion.Name = vm.VersionName; - - // var cloned = Configuration.Clone(); - - // _dbContext.Configurations.Add(cloned); - // newVersion.DefaultConfiguration = cloned; - // _dbContext.MachineVersions.Add(newVersion); - // await _dbContext.SaveChangesAsync(); - // } - // } - // } - // catch (Exception ex) - // { - // _notification.ShowError(ex.Message); - // } - // finally - // { - // CanWork = true; - // } - - // }, () => - // { - - // }); - //} + private async void LoadSelectedMachine(bool newMachine = false) + { + using (_notification.PushTaskItem("Loading machine details...")) + { + try + { + IsFree = false; + + if (ActiveMachineAdapter != null) + { + ActiveMachineAdapter.Context.Dispose(); + } + + ActiveMachineAdapter = new ObservablesStaticCollections(ObservablesContext.CreateDefault()); + ActiveMachineAdapter.Organizations = (await ActiveMachineAdapter.Context.Organizations.ToListAsync()).ToObservableCollection(); + ActiveMachineAdapter.MachineVersions = (await ActiveMachineAdapter.Context.MachineVersions.ToListAsync()).ToObservableCollection(); + ActiveMachineAdapter.Rmls = (await ActiveMachineAdapter.Context.Rmls.ToListAsync()).ToObservableCollection(); + ActiveMachineAdapter.ColorSpaces = (await ActiveMachineAdapter.Context.ColorSpaces.ToListAsync()).ToObservableCollection(); + ActiveMachineAdapter.SpoolTypes = (await ActiveMachineAdapter.Context.SpoolTypes.ToListAsync()).ToObservableCollection(); + + ActiveMachineAdapter.ApplicationDisplayPanelVersions = (await ActiveMachineAdapter.Context.ApplicationDisplayPanelVersions.ToListAsync()).ToObservableCollection(); + ActiveMachineAdapter.ApplicationFirmwareVersions = (await ActiveMachineAdapter.Context.ApplicationFirmwareVersions.ToListAsync()).ToObservableCollection(); + ActiveMachineAdapter.ApplicationOsVersions = (await ActiveMachineAdapter.Context.ApplicationOsVersions.ToListAsync()).ToObservableCollection(); + ActiveMachineAdapter.EmbeddedFirmwareVersions = (await ActiveMachineAdapter.Context.EmbeddedFirmwareVersions.ToListAsync()).ToObservableCollection(); + ActiveMachineAdapter.DispenserTypes = (await ActiveMachineAdapter.Context.DispenserTypes.ToListAsync()).ToObservableCollection(); + ActiveMachineAdapter.LiquidTypes = (await ActiveMachineAdapter.Context.LiquidTypes.ToListAsync()).ToObservableCollection(); + ActiveMachineAdapter.MidTankTypes = (await ActiveMachineAdapter.Context.MidTankTypes.ToListAsync()).ToObservableCollection(); + ActiveMachineAdapter.CartridgeTypes = (await ActiveMachineAdapter.Context.CartridgeTypes.ToListAsync()).ToObservableCollection(); + ActiveMachineAdapter.IdsPackFormulas = (await ActiveMachineAdapter.Context.IdsPackFormulas.ToListAsync()).ToObservableCollection(); + ActiveMachineAdapter.HardwareVersions = (await ActiveMachineAdapter.Context.HardwareVersions.ToListAsync()).ToObservableCollection(); + ActiveMachineAdapter.MachineVersions = (await ActiveMachineAdapter.Context.MachineVersions.ToListAsync()).ToObservableCollection(); + ActiveMachineAdapter.Organizations = (await ActiveMachineAdapter.Context.Organizations.ToListAsync()).ToObservableCollection(); + + if (!newMachine) + { + ActiveMachine = (await new MachineBuilder(ActiveMachineAdapter.Context).Set(SelectedMachine.Guid).WithOrganization().WithConfiguration().WithSpools().BuildAsync()); + } + else + { + ActiveMachine = new Machine(); + ActiveMachine.Configuration = new Configuration(); + ActiveMachineAdapter.Context.Machines.Add(ActiveMachine); + } + + View.NavigateTo(MachineDesignerNavigationView.MachineDetailsView); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error loading machine details for serial number {SelectedMachine.SerialNumber}"); + _notification.ShowError($"An error occurred while trying to load the selected machine details.\n{ex.Message}"); + } + finally + { + IsFree = true; + InvalidateRelayCommands(); + } + } + } + + private async void SaveMachine() + { + foreach (var ids in ActiveMachine.Configuration.IdsPacks) + { + ids.PackIndex = ActiveMachine.Configuration.IdsPacks.IndexOf(ids); + ids.Configuration = ActiveMachine.Configuration; + ids.ConfigurationGuid = ActiveMachine.Configuration.Guid; + } + + List errors = new List(); + + if (ActiveMachine.MachineVersion == null) + { + errors.Add("Machine version is required."); + } + + if (ActiveMachine.Name.IsNullOrWhiteSpace()) + { + errors.Add("Machine name is required."); + } + + if (ActiveMachine.Organization == null) + { + errors.Add("Machine organization is required."); + } + + if (ActiveMachine.SerialNumber.IsNullOrWhiteSpace()) + { + errors.Add("Machine serial number is required."); + } + + if (ActiveMachine.Configuration.ApplicationDisplayPanelVersion == null) + { + errors.Add("Touch Panel is required."); + } + + if (ActiveMachine.Configuration.ApplicationFirmwareVersion == null) + { + errors.Add("Application firmware is required."); + } + + if (ActiveMachine.Configuration.ApplicationOsVersion == null) + { + errors.Add("Application operation system is required."); + } + + if (ActiveMachine.Configuration.EmbeddedFirmwareVersion == null) + { + errors.Add("Embedded firmware is required."); + } + + if (ActiveMachine.Configuration.HardwareVersion == null) + { + errors.Add("Hardware version is required."); + } + + foreach (var pack in ActiveMachine.Configuration.IdsPacks) + { + if (pack.LiquidType != null || pack.CartridgeType != null || pack.Dispenser != null || pack.IdsPackFormula != null || pack.MidTankType != null) + { + if (pack.CartridgeType == null) + { + errors.Add(String.Format("Cartridge type is required on IDS pack '{0}'.", pack.PackIndex)); + } + if (pack.Dispenser == null) + { + errors.Add(String.Format("Dispenser is required on IDS pack '{0}'.", pack.PackIndex)); + } + if (pack.LiquidType == null) + { + errors.Add(String.Format("Liquid type is required on IDS pack '{0}'.", pack.PackIndex)); + } + if (pack.MidTankType == null) + { + errors.Add(String.Format("Mid Tank type is required on IDS pack '{0}'.", pack.PackIndex)); + } + if (pack.IdsPackFormula == null) + { + errors.Add(String.Format("Formula type is required on IDS pack '{0}'.", pack.PackIndex)); + } + + pack.IsEmpty = false; + } + else + { + pack.IsEmpty = true; + } + } + + foreach (var pack in ActiveMachine.Configuration.IdsPacks.Where(x => x.Dispenser != null)) + { + if (ActiveMachine.Configuration.IdsPacks.Where(x => x.Dispenser == pack.Dispenser).Count() > 1) + { + errors.Add($"Dispenser '{pack.Dispenser.SerialNumber}' is installed on multiple IDS packs."); + } + + if (ActiveMachineAdapter.Context.IdsPacks.Count(x => x.ConfigurationGuid != pack.ConfigurationGuid && x.DispenserGuid == pack.DispenserGuid) > 0) + { + errors.Add($"Dispenser '{pack.Dispenser.SerialNumber}' is already installed on a different machine."); + } + } + + if (errors.Count > 0) + { + String errorsString = "Please fix the following validation errors before trying to save." + Environment.NewLine + Environment.NewLine; + errorsString += String.Join(Environment.NewLine, errors.Distinct()); + _notification.ShowError(errorsString); + return; + } + + try + { + IsFree = false; + + using (_notification.PushTaskItem("Saving Machine Details...")) + { + + ActiveMachine.ConfigurationGuid = ActiveMachine.Configuration.Guid; + ActiveMachine.LastUpdated = DateTime.UtcNow; + ActiveMachine.ProductionDate = DateTime.UtcNow; + await ActiveMachineAdapter.Context.SaveChangesAsync(); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error saving machine details."); + _notification.ShowError("An error occurred while trying to save the machine details" + Environment.NewLine + ex.Message); + } + finally + { + IsFree = true; + InvalidateRelayCommands(); + } + } + + private void AddNewMachine() + { + LoadSelectedMachine(true); + } + + private async void RemoveSelectedMachine() + { + if (_notification.ShowQuestion("Are you sure you want to delete the selected machine?")) + { + using (_notification.PushTaskItem("Removing machine...")) + { + try + { + IsFree = false; + await SelectedMachine.DeleteCascadeAsync(MachinesAdapter.Context); + MachinesAdapter.Context.Machines.Remove(SelectedMachine); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error removing machine {SelectedMachine.SerialNumber}."); + _notification.ShowError($"An error occurred while trying to delete the selected machine.\n{ex.Message}"); + } + finally + { + IsFree = true; + } + } + } + } #endregion private async void OnFilterChanged() { - if (!String.IsNullOrWhiteSpace(Filter)) + if (Filter != null) { IsFree = false; - Machines = (await _dbContext.Machines.Where(x => x.SerialNumber.StartsWith(Filter)).ToListAsync()).ToObservableCollection(); + MachinesAdapter.Machines = (await MachinesAdapter.Context.Machines.Where(x => x.SerialNumber.StartsWith(Filter)).Include(x => x.Organization).Include(x => x.MachineVersion).ToListAsync()).ToObservableCollection(); IsFree = true; } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml index a96cd4685..97eceaa7d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml @@ -102,8 +102,8 @@ - - + + @@ -145,7 +145,7 @@ 8 - + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml new file mode 100644 index 000000000..63d1d2305 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + Serial Number + + + Name + + + Machine Version + + + Organization + + + Default RML + + + Loaded RML + + + Default Color Space + + + Default Segment Length + + + Default Spool Type + + + OS Key + + + + + Auto Login + + + Auto Check For Updates + + + Setup Activation + + + Setup Remote Assistance + + + Setup UWF + + + Setup Firmware + + + Setup FPGA + + + Is Demo Machine + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml.cs new file mode 100644 index 000000000..29367c3c4 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.MachineDesigner.Views +{ + /// + /// Interaction logic for MachineDetailsView.xaml + /// + public partial class MachineSettingsView : UserControl + { + public MachineSettingsView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml index ded14930a..d6afd41bf 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml @@ -69,25 +69,6 @@ - Add IDS - - - - - - Remove IDS - - - - - - - - 1 2 diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachinesView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachinesView.xaml index 48ce34688..91eda3491 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachinesView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachinesView.xaml @@ -53,7 +53,7 @@ - +