From 956f9ea033553136ebf199fff30f288dc26fbeb0 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 21 Feb 2018 20:21:57 +0200 Subject: Working on machine studio update center.. --- .../MachineStudioUpdateService.svc | 1 + .../MachineStudioUpdateService.svc.cs | 62 +++++++++ .../Properties/AssemblyInfo.cs | 36 ++++++ .../Tango.MachineStudio.UpdateService.csproj | 142 +++++++++++++++++++++ .../Web.Debug.config | 30 +++++ .../Web.Release.config | 31 +++++ .../Tango.MachineStudio.UpdateService/Web.config | 55 ++++++++ .../packages.config | 4 + 8 files changed, 361 insertions(+) create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Properties/AssemblyInfo.cs create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Tango.MachineStudio.UpdateService.csproj create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Web.Debug.config create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Web.Release.config create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Web.config create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/packages.config (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc new file mode 100644 index 000000000..bad3e4fcd --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc @@ -0,0 +1 @@ +<%@ ServiceHost Language="C#" Debug="true" Service="Tango.MachineStudio.UpdateService.MachineStudioUpdateService" CodeBehind="MachineStudioUpdateService.svc.cs" %> \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs new file mode 100644 index 000000000..4cfea1b8a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Linq; +using System.Runtime.Serialization; +using System.ServiceModel; +using System.ServiceModel.Web; +using System.Text; +using Tango.Integration.Observables; +using Tango.Logging; +using Tango.MachineStudio.Common.Update; + +namespace Tango.MachineStudio.UpdateService +{ + public class MachineStudioUpdateService : IMachineStudioUpdateService + { + public CheckForUpdatesResponse CheckForUpdates(CheckForUpdatesRequest request) + { + LogManager.Log("Request received..."); + + try + { + CheckForUpdatesResponse response = new CheckForUpdatesResponse(); + + using (ObservablesContext db = ObservablesContext.CreateDefaultForWeb()) + { + db.Configuration.LazyLoadingEnabled = false; + + var user = db.Users.SingleOrDefault(x => x.Email.ToLower() == request.Email.ToLower() && x.Password == request.Password); + + if (user != null) + { + var latestVersion = db.MachineStudioVersions.FirstOrDefault(); + Version currentVersionNumber = Version.Parse(request.Version); + + if (latestVersion != null && Version.Parse(latestVersion.Version) > currentVersionNumber) + { + response.IsUpdateAvailable = true; + + response.FtpHost = ConfigurationManager.AppSettings["FtpHost"].ToString(); + response.UserName = ConfigurationManager.AppSettings["UserName"].ToString(); + response.Password = ConfigurationManager.AppSettings["Password"].ToString(); + response.FilePath = latestVersion.FtpFilePath; + response.Version = latestVersion.Version; + } + } + else + { + throw new FaultException("Invalid user credentials."); + } + } + + return response; + } + catch (Exception ex) + { + LogManager.Log(ex); + throw new FaultException(ex.ToString()); + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..6b9387721 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tango.MachineStudio.UpdateService")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Tango.MachineStudio.UpdateService")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("cc6d62e9-c300-42f3-b452-79966e902b10")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Tango.MachineStudio.UpdateService.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Tango.MachineStudio.UpdateService.csproj new file mode 100644 index 000000000..c9400b2d1 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Tango.MachineStudio.UpdateService.csproj @@ -0,0 +1,142 @@ + + + + Debug + AnyCPU + + + 2.0 + {CC6D62E9-C300-42F3-B452-79966E902B10} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + Tango.MachineStudio.UpdateService + Tango.MachineStudio.UpdateService + v4.6 + True + true + true + + + + + + + + true + full + false + ..\..\Build\Debug\Web\Machine Studio Update Service\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + ..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll + + + ..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + MachineStudioUpdateService.svc + + + + + + + + + + + Web.config + + + Web.config + + + + + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} + Tango.Core + + + {4206ac58-3b57-4699-8835-90bf6db01a61} + Tango.Integration + + + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} + Tango.Logging + + + {cb0b0aa2-bb24-4bca-a720-45e397684e12} + Tango.MachineStudio.Common + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + + True + True + 65206 + / + http://localhost:53044/ + False + False + + + False + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Web.Debug.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Web.Debug.config new file mode 100644 index 000000000..fae9cfefa --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Web.Debug.config @@ -0,0 +1,30 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Web.Release.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Web.Release.config new file mode 100644 index 000000000..da6e960b8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Web.Release.config @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Web.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Web.config new file mode 100644 index 000000000..b0d2452f0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/Web.config @@ -0,0 +1,55 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/packages.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/packages.config new file mode 100644 index 000000000..9256e1591 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file -- cgit v1.3.1