diff --git a/Client.Config/Config.cs b/Client.Config/Config.cs
index 4ba4f35d..5a00488e 100644
--- a/Client.Config/Config.cs
+++ b/Client.Config/Config.cs
@@ -1,21 +1,15 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Client.Config
+namespace Client.Config
{
-
+
public static class Config
{
- public static SubModels.Client ClientConfig;
- public static SubModels.Connection ConnectionConfig;
- public static SubModels.VendorHmi VendorHmiConfig;
+ public static SubModels.Client ClientConfig;
+ public static SubModels.Connection ConnectionConfig;
+ public static SubModels.VendorHmi VendorHmiConfig;
public static SubModels.ProdSoftware ProdSoftwareConfig { get; set; }
public static string TextEditorPath { get; set; }
- public static SubModels.Software[] ExtSoftwaresConfig { get; set; }
+ public static SubModels.Software[] ExtSoftwaresConfig { get; set; }
}
}
diff --git a/Client.Config/Config.xml b/Client.Config/Config.xml
index 233d4f8f..748c96c4 100644
--- a/Client.Config/Config.xml
+++ b/Client.Config/Config.xml
@@ -6,7 +6,7 @@
GPU
false
false
- false
+ true
localhost
diff --git a/Client.Config/ConfigController.cs b/Client.Config/ConfigController.cs
index 8ff7b68d..9c2bf1b1 100644
--- a/Client.Config/ConfigController.cs
+++ b/Client.Config/ConfigController.cs
@@ -1,280 +1,276 @@
-using Client.Utils;
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Drawing.Imaging;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-using System.Xml.Linq;
-using System.Xml.Schema;
-
-namespace Client.Config
-{
- public class ConfigController
- {
- const String ChromeScheme = "chrome";
-
- public static void ReadStartupConfig()
- {
- // Read validation file
- XmlSchemaSet readerSettings = new XmlSchemaSet();
-
- // Add Schema
- readerSettings.Add(null, Constants.STARTUP_CONFIG_SCHEMA_PATH);
- // Open file reader
- XDocument xmlConfigFile = XDocument.Load(Constants.STARTUP_CONFIG_PATH);
-
- // Validate file
- xmlConfigFile.Validate(readerSettings, ValidationHandler);
-
- // Read XML Config
- Config.ClientConfig = xmlConfigFile
- .Descendants(Constants.CLIENT_CONFIG_KEY)
- .Select(x => new SubModels.Client()
- {
- TranspColor = ValidateTranspColor(x.Element("TranspColor").Value),
- RenderingMethod = ValidateRendering(x.Element("RenderingMethod").Value),
- RunningOnSecondaryScreen = ValidateSecScreen(x.Element("RunningOnSecondaryScreen").Value),
- ShowVirtualKeyboard = ValidateVirtualKeyboard(x.Element("ShowVirtualKeyboard").Value),
- DeveloperMode = ValidateDeveloperMode(x.Element("DeveloperMode").Value),
- IsSCM = ValidateIsSCM(x.Element("IsSCM").Value)
- }).FirstOrDefault();
-
- Config.ConnectionConfig = xmlConfigFile
- .Descendants(Constants.CONNECTION_CONFIG_KEY)
- .Select(x => new SubModels.Connection()
- {
- ServerUrl = ValidateServerUrl(x.Element("ServerUrl").Value),
- ServerPort = ValidateServerPort(x.Element("ServerPort").Value),
- Id = ValidateClientID(x.Element("Id").Value),
- DeleteCahceFolderOnStartup = ValidateDelCache(x.Element("DeleteCahceFolderOnStartup").Value),
- }).FirstOrDefault();
-
- Config.VendorHmiConfig = xmlConfigFile
- .Descendants(Constants.VENDORHMI_CONFIG_KEY)
- .Select(x => new SubModels.VendorHmi()
- {
- FollowNcWindow = ValidateFollowNcWin(x.Element("FollowNcWindow").Value)
- }).FirstOrDefault();
-
- Config.ProdSoftwareConfig = new SubModels.ProdSoftware();
- Config.ExtSoftwaresConfig = new SubModels.Software[] { };
-
- //ReadConfig Url compositing
- Config.ConnectionConfig.ReadConfigUrl = "http://" + Config.ConnectionConfig.ServerUrl + ":" + Config.ConnectionConfig.ServerPort + "/" + Constants.ConfigPage;
- Config.ConnectionConfig.StartingUrl = "http://" + Config.ConnectionConfig.ServerUrl + ":" + Config.ConnectionConfig.ServerPort + "/" + Constants.StartingPage;
-
- //ErrorPage content
- if (File.Exists(Constants.errorPageFile))
- Config.ConnectionConfig.ErrorPage = File.ReadAllText(Constants.errorPageFile);
- else
- throw new Exception(@"File Error: """ + Constants.errorPageFile + @""" not found");
-
- }
-
- private static void ValidationHandler(object sender, ValidationEventArgs e)
- {
- throw new Exception(@"Configuration Error: " + e.Message);
- }
-
-
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- #region PROPERTIES_VALIDATOR
-
- private static String ValidateServerUrl(String value)
- {
- if (!String.IsNullOrWhiteSpace(value))
- return value;
- else
- throw new Exception(@"Configuration Error: ""Connection - ServerUrl"" is not a valid URL");
- }
-
-
- private static ushort ValidateServerPort(String value)
- {
- if (ushort.TryParse(value, out ushort Port))
- return Port;
- else
- throw new Exception(@"Configuration Error: ""Connection - ServerPort"" is not a valid Id of CMS-Client");
- }
-
-
- private static String ValidateArgumentUrl(String value)
- {
- Uri NewUrl;
- if (Uri.TryCreate(value, UriKind.Absolute, out NewUrl) && (NewUrl.Scheme == Uri.UriSchemeHttp || NewUrl.Scheme == Uri.UriSchemeHttps || NewUrl.Scheme == Uri.UriSchemeFile || NewUrl.Scheme == ChromeScheme))
- return value;
- else
- throw new Exception(@"Argument Url Error: is not a valid URL");
- }
-
-
-
- private static Color ValidateTranspColor(String value)
- {
- Color color;
- try
- {
- color = ColorTranslator.FromHtml(value);
- return color;
- }
- catch (Exception)
- {
- throw new Exception(@"Configuration Error: ""Client - TranspColor"" is not a valid Hex Color");
- }
- }
-
-
-
- private static Constants.Rendering ValidateRendering(string value)
- {
- if (value.ToUpper().Equals("CPU"))
- return Constants.Rendering.CPU;
- else if (value.ToUpper().Equals("GPU"))
- return Constants.Rendering.GPU;
- else
- throw new Exception(@"Configuration Error: ""Client - RenderingMethod"" is not a valid Rendering Method");
- }
-
-
-
- private static bool ValidateSecScreen(string value)
- {
- Boolean secScreen;
- if (Boolean.TryParse(value, out secScreen))
- return secScreen;
- else
- throw new Exception(@"Configuration Error: ""Client - RunningOnSecondaryScreen"" is not a valid Boolean Type");
-
- }
- private static bool ValidateIsSCM(string value)
- {
- Boolean IsSCM;
- if (Boolean.TryParse(value, out IsSCM))
- return IsSCM;
+using Client.Utils;
+using System;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.IO;
+using System.Linq;
+using System.Xml.Linq;
+using System.Xml.Schema;
+
+namespace Client.Config
+{
+ public class ConfigController
+ {
+ const String ChromeScheme = "chrome";
+
+ public static void ReadStartupConfig()
+ {
+ // Read validation file
+ XmlSchemaSet readerSettings = new XmlSchemaSet();
+
+ // Add Schema
+ readerSettings.Add(null, Constants.STARTUP_CONFIG_SCHEMA_PATH);
+ // Open file reader
+ XDocument xmlConfigFile = XDocument.Load(Constants.STARTUP_CONFIG_PATH);
+
+ // Validate file
+ xmlConfigFile.Validate(readerSettings, ValidationHandler);
+
+ // Read XML Config
+ Config.ClientConfig = xmlConfigFile
+ .Descendants(Constants.CLIENT_CONFIG_KEY)
+ .Select(x => new SubModels.Client()
+ {
+ TranspColor = ValidateTranspColor(x.Element("TranspColor").Value),
+ RenderingMethod = ValidateRendering(x.Element("RenderingMethod").Value),
+ RunningOnSecondaryScreen = ValidateSecScreen(x.Element("RunningOnSecondaryScreen").Value),
+ ShowVirtualKeyboard = ValidateVirtualKeyboard(x.Element("ShowVirtualKeyboard").Value),
+ DeveloperMode = ValidateDeveloperMode(x.Element("DeveloperMode").Value),
+ IsSCM = ValidateIsSCM(x.Element("IsSCM").Value)
+ }).FirstOrDefault();
+
+ Config.ConnectionConfig = xmlConfigFile
+ .Descendants(Constants.CONNECTION_CONFIG_KEY)
+ .Select(x => new SubModels.Connection()
+ {
+ ServerUrl = ValidateServerUrl(x.Element("ServerUrl").Value),
+ ServerPort = ValidateServerPort(x.Element("ServerPort").Value),
+ Id = ValidateClientID(x.Element("Id").Value),
+ DeleteCahceFolderOnStartup = ValidateDelCache(x.Element("DeleteCahceFolderOnStartup").Value),
+ }).FirstOrDefault();
+
+ Config.VendorHmiConfig = xmlConfigFile
+ .Descendants(Constants.VENDORHMI_CONFIG_KEY)
+ .Select(x => new SubModels.VendorHmi()
+ {
+ FollowNcWindow = ValidateFollowNcWin(x.Element("FollowNcWindow").Value)
+ }).FirstOrDefault();
+
+ Config.ProdSoftwareConfig = new SubModels.ProdSoftware();
+ Config.ExtSoftwaresConfig = new SubModels.Software[] { };
+
+ //ReadConfig Url compositing
+ Config.ConnectionConfig.ReadConfigUrl = "http://" + Config.ConnectionConfig.ServerUrl + ":" + Config.ConnectionConfig.ServerPort + "/" + Constants.ConfigPage;
+ Config.ConnectionConfig.StartingUrl = "http://" + Config.ConnectionConfig.ServerUrl + ":" + Config.ConnectionConfig.ServerPort + "/" + Constants.StartingPage;
+
+ //ErrorPage content
+ if (File.Exists(Constants.errorPageFile))
+ Config.ConnectionConfig.ErrorPage = File.ReadAllText(Constants.errorPageFile);
+ else
+ throw new Exception(@"File Error: """ + Constants.errorPageFile + @""" not found");
+
+ }
+
+ private static void ValidationHandler(object sender, ValidationEventArgs e)
+ {
+ throw new Exception(@"Configuration Error: " + e.Message);
+ }
+
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ #region PROPERTIES_VALIDATOR
+
+ private static String ValidateServerUrl(String value)
+ {
+ if (!String.IsNullOrWhiteSpace(value))
+ return value;
+ else
+ throw new Exception(@"Configuration Error: ""Connection - ServerUrl"" is not a valid URL");
+ }
+
+
+ private static ushort ValidateServerPort(String value)
+ {
+ if (ushort.TryParse(value, out ushort Port))
+ return Port;
+ else
+ throw new Exception(@"Configuration Error: ""Connection - ServerPort"" is not a valid Id of CMS-Client");
+ }
+
+
+ private static String ValidateArgumentUrl(String value)
+ {
+ Uri NewUrl;
+ if (Uri.TryCreate(value, UriKind.Absolute, out NewUrl) && (NewUrl.Scheme == Uri.UriSchemeHttp || NewUrl.Scheme == Uri.UriSchemeHttps || NewUrl.Scheme == Uri.UriSchemeFile || NewUrl.Scheme == ChromeScheme))
+ return value;
+ else
+ throw new Exception(@"Argument Url Error: is not a valid URL");
+ }
+
+
+
+ private static Color ValidateTranspColor(String value)
+ {
+ Color color;
+ try
+ {
+ color = ColorTranslator.FromHtml(value);
+ return color;
+ }
+ catch (Exception)
+ {
+ throw new Exception(@"Configuration Error: ""Client - TranspColor"" is not a valid Hex Color");
+ }
+ }
+
+
+
+ private static Constants.Rendering ValidateRendering(string value)
+ {
+ if (value.ToUpper().Equals("CPU"))
+ return Constants.Rendering.CPU;
+ else if (value.ToUpper().Equals("GPU"))
+ return Constants.Rendering.GPU;
+ else
+ throw new Exception(@"Configuration Error: ""Client - RenderingMethod"" is not a valid Rendering Method");
+ }
+
+
+
+ private static bool ValidateSecScreen(string value)
+ {
+ Boolean secScreen;
+ if (Boolean.TryParse(value, out secScreen))
+ return secScreen;
+ else
+ throw new Exception(@"Configuration Error: ""Client - RunningOnSecondaryScreen"" is not a valid Boolean Type");
+
+ }
+ private static bool ValidateIsSCM(string value)
+ {
+ Boolean IsSCM;
+ if (Boolean.TryParse(value, out IsSCM))
+ return IsSCM;
+ else
+ throw new Exception(@"Configuration Error: ""Client - IsSCM"" is not a valid Boolean Type");
+
+ }
+
+
+
+ private static bool ValidateVirtualKeyboard(string value)
+ {
+ Boolean keyboard;
+ if (Boolean.TryParse(value, out keyboard))
+ return keyboard;
+ else
+ throw new Exception(@"Configuration Error: ""Client - ShowVirtualKeyboard"" is not a valid Boolean Type");
+
+ }
+
+
+
+ private static bool ValidateDeveloperMode(string value)
+ {
+ Boolean DeveloperMode;
+ if (Boolean.TryParse(value, out DeveloperMode))
+ return DeveloperMode;
+ else
+ throw new Exception(@"Configuration Error: ""Client - DeveloperMode"" is not a valid Boolean Type");
+
+ }
+
+
+ private static Boolean ValidateFollowNcWin(String value)
+ {
+ Boolean FollowNc;
+ if (Boolean.TryParse(value, out FollowNc))
+ return FollowNc;
+ else
+ throw new Exception(@"Configuration Error: ""VendorHmi - FollowNcWindow"" is not a valid Boolean Type");
+ }
+
+
+ private static ushort ValidateClientID(String value)
+ {
+ ushort Client;
+ if (ushort.TryParse(value, out Client))
+ return Client;
+ else
+ throw new Exception(@"Configuration Error: ""Connection - Id"" is not a valid Id of CMS-Client");
+ }
+
+
+
+ private static Boolean ValidateDelCache(String value)
+ {
+ Boolean DelCache;
+ if (Boolean.TryParse(value, out DelCache))
+ return DelCache;
+ else
+ throw new Exception(@"Configuration Error: ""Connection - DeleteCahceFolderOnStartup"" is not a valid Boolean Type");
+
+ }
+
+
+ private static String ValidateSFTPath(String value)
+ {
+ if (File.Exists(value))
+ return value;
+ else
+ throw new Exception(@"Configuration Error: File """ + value + @""" not found");
+
+ }
+
+
+ private static String ValidateSFTSName(String value)
+ {
+ if (!String.IsNullOrEmpty(value))
+ {
+ if (value.Count() <= 3)
+ return value;
+ else
+ throw new Exception(@"Configuration Error: Short Name """ + value + @""" cannot be over 3 Letters");
+ }
else
- throw new Exception(@"Configuration Error: ""Client - IsSCM"" is not a valid Boolean Type");
-
- }
-
-
-
- private static bool ValidateVirtualKeyboard(string value)
- {
- Boolean keyboard;
- if (Boolean.TryParse(value, out keyboard))
- return keyboard;
- else
- throw new Exception(@"Configuration Error: ""Client - ShowVirtualKeyboard"" is not a valid Boolean Type");
-
- }
-
-
-
- private static bool ValidateDeveloperMode(string value)
- {
- Boolean DeveloperMode;
- if (Boolean.TryParse(value, out DeveloperMode))
- return DeveloperMode;
- else
- throw new Exception(@"Configuration Error: ""Client - DeveloperMode"" is not a valid Boolean Type");
-
- }
-
-
- private static Boolean ValidateFollowNcWin(String value)
- {
- Boolean FollowNc;
- if (Boolean.TryParse(value, out FollowNc))
- return FollowNc;
- else
- throw new Exception(@"Configuration Error: ""VendorHmi - FollowNcWindow"" is not a valid Boolean Type");
- }
-
-
- private static ushort ValidateClientID(String value)
- {
- ushort Client;
- if (ushort.TryParse(value, out Client))
- return Client;
- else
- throw new Exception(@"Configuration Error: ""Connection - Id"" is not a valid Id of CMS-Client");
- }
-
-
-
- private static Boolean ValidateDelCache(String value)
- {
- Boolean DelCache;
- if (Boolean.TryParse(value, out DelCache))
- return DelCache;
- else
- throw new Exception(@"Configuration Error: ""Connection - DeleteCahceFolderOnStartup"" is not a valid Boolean Type");
-
- }
-
-
- private static String ValidateSFTPath(String value)
- {
- if(File.Exists(value))
- return value;
- else
- throw new Exception(@"Configuration Error: File """+ value + @""" not found");
-
- }
-
-
- private static String ValidateSFTSName(String value)
- {
- if (!String.IsNullOrEmpty(value))
- {
- if (value.Count() <= 3)
- return value;
- else
- throw new Exception(@"Configuration Error: Short Name """ + value + @""" cannot be over 3 Letters");
- }
- else
throw new Exception(@"Configuration Error: Software Short Name Must be setted");
- }
-
-
- private static bool ValidateInMainMenuBar(String value)
- {
- if (!String.IsNullOrEmpty(value))
- {
- return Boolean.Parse(value);
- }
- else
+ }
+
+
+ private static bool ValidateInMainMenuBar(String value)
+ {
+ if (!String.IsNullOrEmpty(value))
+ {
+ return Boolean.Parse(value);
+ }
+ else
throw new Exception(@"Configuration Error: In-Main-Menu-Bar Must be setted");
- }
-
-
- private static String ValidateSFTLName(String value)
- {
- if (!String.IsNullOrEmpty(value))
- return value;
- else
- throw new Exception(@"Configuration Error: Software Long Name Must be setted");
-
- }
-
-
- private static String ExtractBase64Icon(String value)
- {
- Image im = Icon.ExtractAssociatedIcon(value).ToBitmap();
- MemoryStream m = new MemoryStream();
- im.Save(m, ImageFormat.Png);
- return "data:image/png;base64," + Convert.ToBase64String(m.ToArray());
- }
-
-
- #endregion
-
-
- }
+ }
+
+
+ private static String ValidateSFTLName(String value)
+ {
+ if (!String.IsNullOrEmpty(value))
+ return value;
+ else
+ throw new Exception(@"Configuration Error: Software Long Name Must be setted");
+
+ }
+
+
+ private static String ExtractBase64Icon(String value)
+ {
+ Image im = Icon.ExtractAssociatedIcon(value).ToBitmap();
+ MemoryStream m = new MemoryStream();
+ im.Save(m, ImageFormat.Png);
+ return "data:image/png;base64," + Convert.ToBase64String(m.ToArray());
+ }
+
+
+ #endregion
+
+
+ }
}
\ No newline at end of file
diff --git a/Client.Config/Properties/AssemblyInfo.cs b/Client.Config/Properties/AssemblyInfo.cs
index 6fd5c958..28082f0e 100644
--- a/Client.Config/Properties/AssemblyInfo.cs
+++ b/Client.Config/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Le informazioni generali relative a un assembly sono controllate dal seguente
diff --git a/Client.Config/SubModels/Client.cs b/Client.Config/SubModels/Client.cs
index 17ef4bcd..32fc0431 100644
--- a/Client.Config/SubModels/Client.cs
+++ b/Client.Config/SubModels/Client.cs
@@ -1,9 +1,5 @@
using System;
-using System.Collections.Generic;
using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using static Client.Utils.Constants;
namespace Client.Config.SubModels
diff --git a/Client.Config/SubModels/Connection.cs b/Client.Config/SubModels/Connection.cs
index f5d80f37..9d45f293 100644
--- a/Client.Config/SubModels/Connection.cs
+++ b/Client.Config/SubModels/Connection.cs
@@ -1,8 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Client.Config.SubModels
{
@@ -15,6 +11,6 @@ namespace Client.Config.SubModels
public string ReadConfigUrl { get; set; }
public Boolean DeleteCahceFolderOnStartup { get; set; }
public Boolean BypassReadConfiguration { get; set; }
- public string ErrorPage { get; set; }
+ public string ErrorPage { get; set; }
}
}
diff --git a/Client.Config/SubModels/ProdSoftware.cs b/Client.Config/SubModels/ProdSoftware.cs
index 7ebdb943..3beb0089 100644
--- a/Client.Config/SubModels/ProdSoftware.cs
+++ b/Client.Config/SubModels/ProdSoftware.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Client.Config.SubModels
+namespace Client.Config.SubModels
{
public class ProdSoftware
{
diff --git a/Client.Config/SubModels/ServerConfigModel.cs b/Client.Config/SubModels/ServerConfigModel.cs
index b95597e2..ac3c88c2 100644
--- a/Client.Config/SubModels/ServerConfigModel.cs
+++ b/Client.Config/SubModels/ServerConfigModel.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Collections.Generic;
namespace Client.Config.SubModels
{
@@ -15,8 +11,8 @@ namespace Client.Config.SubModels
public string ProdEnabled { get; set; }
public string ProdPath { get; set; }
public string Autorun { get; set; }
- public string EditorPath { get; set; }
-
+ public string EditorPath { get; set; }
+
public List ExtSoftwares { get; set; }
}
}
diff --git a/Client.Config/SubModels/Software.cs b/Client.Config/SubModels/Software.cs
index 65635890..7fe1d571 100644
--- a/Client.Config/SubModels/Software.cs
+++ b/Client.Config/SubModels/Software.cs
@@ -1,15 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.Serialization;
-using System.Text;
-using System.Threading.Tasks;
+using System.Runtime.Serialization;
namespace Client.Config.SubModels
{
[DataContract]
public class Software
- {
+ {
[DataMember]
public string id { get; set; }
[DataMember]
diff --git a/Client.Config/SubModels/VendorHmi.cs b/Client.Config/SubModels/VendorHmi.cs
index f59ebc89..3f2b87b5 100644
--- a/Client.Config/SubModels/VendorHmi.cs
+++ b/Client.Config/SubModels/VendorHmi.cs
@@ -1,8 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Client.Config.SubModels
{
diff --git a/Client.Utils/Constants.cs b/Client.Utils/Constants.cs
index fd3d4d0b..579d41ed 100644
--- a/Client.Utils/Constants.cs
+++ b/Client.Utils/Constants.cs
@@ -1,44 +1,39 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Client.Utils
+namespace Client.Utils
{
public static class Constants
{
//Folders
- public static string BASE_PATH = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\";
- public static string BROWSER_CACHE_FOLDER = BASE_PATH + "LocalStorage";
+ public static string BASE_PATH = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\";
+ //public static string BASE_PATH = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\";
+ public static string BROWSER_CACHE_FOLDER = BASE_PATH + "LocalStorage";
public static string STARTUP_CONFIG_SCHEMA_PATH = BASE_PATH + "ClientValidator.xsd";
- public static string STARTUP_CONFIG_PATH = BASE_PATH + "Config.xml";
- public static string CEF_PATH = BASE_PATH + "CEF";
- public static string CEF_X86_PATH = BASE_PATH + "CEF\\Release_X86";
- public static string CEF_X64_PATH = BASE_PATH + "CEF\\Release_X64";
- public static string CEF_LOCALES_PATH = BASE_PATH + "CEF\\Resources\\locales";
- public static string CEF_EXCEPTIONLOG_PATH = BASE_PATH + "ExceptionLog";
- public static string errorPageFile = BASE_PATH + "error.pg";
- public static string JOB_OPENING_PATH = "C:\\CMS\\ACTIVE\\TMP\\clientTmpJob\\";
- public static string PART_PRG_FOLDER = "C:\\PartPrg";
+ public static string STARTUP_CONFIG_PATH = BASE_PATH + "lib\\Config.xml";
+ public static string CEF_PATH = BASE_PATH + "CEF";
+ public static string CEF_X86_PATH = BASE_PATH + "CEF\\Release_X86";
+ public static string CEF_X64_PATH = BASE_PATH + "CEF\\Release_X64";
+ public static string CEF_LOCALES_PATH = BASE_PATH + "CEF\\Resources\\locales";
+ public static string CEF_EXCEPTIONLOG_PATH = BASE_PATH + "ExceptionLog";
+ public static string errorPageFile = BASE_PATH + "error.pg";
+ public static string JOB_OPENING_PATH = "C:\\CMS\\ThermoActive\\TMP\\clientTmpJob\\";
+ public static string PART_PRG_FOLDER = "C:\\PartPrg";
//Config Names
- public const string CONFIG_KEY = "Config";
- public const string CLIENT_CONFIG_KEY = "Client";
- public const string CONNECTION_CONFIG_KEY = "Connection";
- public const string VENDORHMI_CONFIG_KEY = "VendorHmi";
- public const string EXTSFT_CONFIG_KEY = "ExtSoftwares";
- public const string SFT_CONFIG_KEY = "Software";
- public const string JOB_MAIN_FILENAME = "main.cnc";
- public const string JOB_METADATA_FILENAME = "metadata.json";
- public enum Rendering {GPU = 0, CPU = 1 };
+ public const string CONFIG_KEY = "Config";
+ public const string CLIENT_CONFIG_KEY = "Client";
+ public const string CONNECTION_CONFIG_KEY = "Connection";
+ public const string VENDORHMI_CONFIG_KEY = "VendorHmi";
+ public const string EXTSFT_CONFIG_KEY = "ExtSoftwares";
+ public const string SFT_CONFIG_KEY = "Software";
+ public const string JOB_MAIN_FILENAME = "main.cnc";
+ public const string JOB_METADATA_FILENAME = "metadata.json";
+ public enum Rendering { GPU = 0, CPU = 1 };
//BROWSER OBJECT NAME -> The first letter must be Lower-Case (CEF Settings)
public const string BROWSER_JS_OBJ_NAME = "cmsClient";
-
+
//Nc States
public enum NcState { HIDE = 0, SHOW = 1, SHOWPROD = 2 };
@@ -68,13 +63,13 @@ namespace Client.Utils
//KEYBOARD Constants
public const int KEYB_HEIGHT = 377;
- public const int KEYB_WIDTH = 1134;
+ public const int KEYB_WIDTH = 1134;
public const int KEYB_Y_OFFSET = 15;
public const string KEYB_EXE_NAME = "OSK.EXE";
public const string KEYB_PROC_NAME = "OSK";
public const string StartingPage = "index.html";
- public const string UPLOAD_PAGE = "/api/file_manager/upload";
+ public const string UPLOAD_PAGE = "/api/file_manager/upload";
public const string UPLOAD_ADD_QUEUE = "/api/file_manager/queue/add";
public const string ConfigPage = "api/configuration/client";
public const string errorPageUrl = @"error://error/";
diff --git a/Client.Utils/Properties/AssemblyInfo.cs b/Client.Utils/Properties/AssemblyInfo.cs
index 1ccc9862..9d00d496 100644
--- a/Client.Utils/Properties/AssemblyInfo.cs
+++ b/Client.Utils/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Le informazioni generali relative a un assembly sono controllate dal seguente
diff --git a/Client/App.config b/Client/App.config
index c76c89bb..9eadbb98 100644
--- a/Client/App.config
+++ b/Client/App.config
@@ -1,6 +1,11 @@
-
+
-
+
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Client/Browser_Tools/BrowserJSObject.cs b/Client/Browser_Tools/BrowserJSObject.cs
index 93927564..b4e1421b 100644
--- a/Client/Browser_Tools/BrowserJSObject.cs
+++ b/Client/Browser_Tools/BrowserJSObject.cs
@@ -1,13 +1,13 @@
-using Chromium;
+using Active_Client.Browser_Tools.Models;
+using Active_Client.Browser_Tools.Models.Errors;
+using Active_Client.Browser_Tools.Models.Metadata;
+using Active_Client.View;
+using Chromium;
+using Chromium.Remote;
using Chromium.Remote.Event;
using Chromium.WebBrowser;
using Client.Config;
using Client.Config.SubModels;
-using Client.Utils;
-using Active_Client.Browser_Tools.Models;
-using Active_Client.Browser_Tools.Models.Errors;
-using Active_Client.Browser_Tools.Models.Metadata;
-using Active_Client.View;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
@@ -15,13 +15,12 @@ using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
+using System.Management;
using System.Net.Http;
+using System.Text;
using System.Threading;
using System.Windows.Forms;
using static Client.Utils.Constants;
-using System.Management;
-using Chromium.Remote;
-using System.Text;
namespace Active_Client.Browser_Tools
{
@@ -56,7 +55,7 @@ namespace Active_Client.Browser_Tools
{
mainForm = f;
- AddDynamicProperty("RECENT_FOLDER_KEY").PropertyGet += getProp;
+ AddDynamicProperty("RECENT_FOLDER_KEY").PropertyGet += getProp;
AddFunction("minimizeForm").Execute += minimizeForm;
AddFunction("maximizeForm").Execute += maximizeForm;
@@ -383,7 +382,7 @@ namespace Active_Client.Browser_Tools
Path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\",
Type = "SPFO"
});
-
+
try
{
// Network Folders
@@ -429,7 +428,7 @@ namespace Active_Client.Browser_Tools
try
{
- if(p == RECENT_FOLDER_KEY)
+ if (p == RECENT_FOLDER_KEY)
{
filelist = GetLastUploadedFiles();
}
@@ -556,9 +555,9 @@ namespace Active_Client.Browser_Tools
// }
//}
- foreach(FileModel file in files)
+ foreach (FileModel file in files)
{
- if(!file.IsMain)
+ if (!file.IsMain)
form.Add(new ByteArrayContent(File.ReadAllBytes(file.AbsolutePath)), "file", Path.GetFileName(file.AbsolutePath));
}
@@ -745,13 +744,13 @@ namespace Active_Client.Browser_Tools
func = e.Arguments[1],
file = p
};
-
+
Thread t = new Thread(startNewEditor);
t.Start();
}
public void startNewEditor()
- {
+ {
Process proc = new Process
{
StartInfo = new ProcessStartInfo()
@@ -769,7 +768,7 @@ namespace Active_Client.Browser_Tools
public void cleanFileWatcher(object sender, CfrV8HandlerExecuteEventArgs e)
{
- if(watcher != null)
+ if (watcher != null)
{
watcher.EnableRaisingEvents = false;
@@ -832,7 +831,7 @@ namespace Active_Client.Browser_Tools
else
isFirst = false;
- stringBuilder.Append(stringVal);
+ stringBuilder.Append(stringVal);
}
File.WriteAllLines(RECENT_FILE_PATH, stringBuilder.ToString()
@@ -865,7 +864,7 @@ namespace Active_Client.Browser_Tools
{
if (file.FileExist && !file.IsMain)
files.Add(file);
-
+
}
}
// Check if software need to upload all the files
@@ -881,7 +880,7 @@ namespace Active_Client.Browser_Tools
files.Add(new FileModel()
{
AbsolutePath = subfileName,
- FileExist = true,
+ FileExist = true,
IsDirectory = false,
IsMain = false,
Name = Path.GetFileName(subfileName),
@@ -969,7 +968,7 @@ namespace Active_Client.Browser_Tools
//Task to execute
var task = new CfrTask();
task.Execute += (s, e) =>
- {
+ {
context.Enter();
var args = new CfrV8Value[] { arguments };
functionIstance.ExecuteFunction(null, args); //execute callback, nothing happens here
@@ -1176,7 +1175,7 @@ namespace Active_Client.Browser_Tools
{
// Find metadata.json file
var file = zipArchive.Entries.Where(x => x.FullName == JOB_METADATA_FILENAME).FirstOrDefault();
- if(file == null)
+ if (file == null)
{
e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("error_corrupted_model")));
return;
@@ -1342,7 +1341,7 @@ namespace Active_Client.Browser_Tools
{
ZipFile.CreateFromDirectory(JOB_OPENING_PATH, jobPath);
}
- catch(Exception ex)
+ catch (Exception ex)
{
e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("error_save_file")));
return;
diff --git a/Client/Browser_Tools/Models/Drive.cs b/Client/Browser_Tools/Models/Drive.cs
index 3e00b831..e6606bad 100644
--- a/Client/Browser_Tools/Models/Drive.cs
+++ b/Client/Browser_Tools/Models/Drive.cs
@@ -1,8 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Active_Client.Browser_Tools.Models
{
diff --git a/Client/Browser_Tools/Models/Errors/ErrorContainer.cs b/Client/Browser_Tools/Models/Errors/ErrorContainer.cs
index 57a71a3b..0d761a5e 100644
--- a/Client/Browser_Tools/Models/Errors/ErrorContainer.cs
+++ b/Client/Browser_Tools/Models/Errors/ErrorContainer.cs
@@ -1,8 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Active_Client.Browser_Tools.Models.Errors
{
diff --git a/Client/Browser_Tools/Models/File.cs b/Client/Browser_Tools/Models/File.cs
index 82a16433..900123a8 100644
--- a/Client/Browser_Tools/Models/File.cs
+++ b/Client/Browser_Tools/Models/File.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Active_Client.Browser_Tools.Models
+namespace Active_Client.Browser_Tools.Models
{
public class FileModel
{
diff --git a/Client/Browser_Tools/Models/InfoFile.cs b/Client/Browser_Tools/Models/InfoFile.cs
index c1503813..00809189 100644
--- a/Client/Browser_Tools/Models/InfoFile.cs
+++ b/Client/Browser_Tools/Models/InfoFile.cs
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Active_Client.Browser_Tools.Models
{
diff --git a/Client/Browser_Tools/Models/JobToStep.cs b/Client/Browser_Tools/Models/JobToStep.cs
index f03988d3..6ab9ab9c 100644
--- a/Client/Browser_Tools/Models/JobToStep.cs
+++ b/Client/Browser_Tools/Models/JobToStep.cs
@@ -1,9 +1,6 @@
using Active_Client.Browser_Tools.Models.Metadata;
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Active_Client.Browser_Tools.Models
{
diff --git a/Client/Browser_Tools/Models/Metadata/CustomParam.cs b/Client/Browser_Tools/Models/Metadata/CustomParam.cs
index 5706e3e5..b2592804 100644
--- a/Client/Browser_Tools/Models/Metadata/CustomParam.cs
+++ b/Client/Browser_Tools/Models/Metadata/CustomParam.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Collections.Generic;
namespace Active_Client.Browser_Tools.Models.Metadata
{
diff --git a/Client/Browser_Tools/Models/Metadata/GenericsParam.cs b/Client/Browser_Tools/Models/Metadata/GenericsParam.cs
index aa2c5070..cad44c01 100644
--- a/Client/Browser_Tools/Models/Metadata/GenericsParam.cs
+++ b/Client/Browser_Tools/Models/Metadata/GenericsParam.cs
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Active_Client.Browser_Tools.Models.Metadata
{
diff --git a/Client/Browser_Tools/Models/Metadata/ImageParam.cs b/Client/Browser_Tools/Models/Metadata/ImageParam.cs
index df20fcbd..99a6d3de 100644
--- a/Client/Browser_Tools/Models/Metadata/ImageParam.cs
+++ b/Client/Browser_Tools/Models/Metadata/ImageParam.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Active_Client.Browser_Tools.Models.Metadata
+namespace Active_Client.Browser_Tools.Models.Metadata
{
public class ImageParam
{
diff --git a/Client/Browser_Tools/Models/Metadata/Metas.cs b/Client/Browser_Tools/Models/Metadata/Metas.cs
index d0e91668..515641dd 100644
--- a/Client/Browser_Tools/Models/Metadata/Metas.cs
+++ b/Client/Browser_Tools/Models/Metadata/Metas.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Collections.Generic;
namespace Active_Client.Browser_Tools.Models.Metadata
{
diff --git a/Client/Browser_Tools/Models/Metadata/PPContainer.cs b/Client/Browser_Tools/Models/Metadata/PPContainer.cs
index f11af4f2..c5c679a9 100644
--- a/Client/Browser_Tools/Models/Metadata/PPContainer.cs
+++ b/Client/Browser_Tools/Models/Metadata/PPContainer.cs
@@ -1,8 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Active_Client.Browser_Tools.Models.Metadata
{
diff --git a/Client/Browser_Tools/Models/MetadataToFile.cs b/Client/Browser_Tools/Models/MetadataToFile.cs
index 13e837cc..62d11940 100644
--- a/Client/Browser_Tools/Models/MetadataToFile.cs
+++ b/Client/Browser_Tools/Models/MetadataToFile.cs
@@ -1,9 +1,6 @@
using Active_Client.Browser_Tools.Models.Metadata;
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Active_Client.Browser_Tools.Models
{
diff --git a/Client/Client.csproj b/Client/Client.csproj
index f818321b..5176c192 100644
--- a/Client/Client.csproj
+++ b/Client/Client.csproj
@@ -288,4 +288,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Client/Program.cs b/Client/Program.cs
index 2357b91b..749e4c22 100644
--- a/Client/Program.cs
+++ b/Client/Program.cs
@@ -1,21 +1,17 @@
-using Chromium;
+using Active_Client.View;
+using Chromium;
using Chromium.Event;
using Chromium.WebBrowser;
using Chromium.WebBrowser.Event;
using Client.Config;
using Client.Utils;
-using Active_Client.View;
using Microsoft.Win32;
using System;
-using System.Collections.Generic;
-using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Management;
-using System.Reflection;
using System.Threading;
-using System.Threading.Tasks;
using System.Windows.Forms;
namespace Active_Client
@@ -37,8 +33,8 @@ namespace Active_Client
//Crate General Exception Handler
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(GeneralExMethod);
-
- //Read App Configuration
+
+ //Read App Configuration
readConfiguration();
//Initialize Chromium
@@ -66,9 +62,9 @@ namespace Active_Client
Application.SetCompatibleTextRenderingDefault(false);
//Check Graphic Card in Energy Saving mode
- checkGraphicCard();
-
- //Run the Loading Form
+ checkGraphicCard();
+
+ //Run the Loading Form
Application.Run(new OpeningForm());
//Run the Main-Browser Form
@@ -76,14 +72,14 @@ namespace Active_Client
//Force show Taskbar
NcWindow.ShowTaskBar();
- }
-
+ }
+
#endregion
-
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region CONFIG_METHODS
-
- //Sub-Method used to read the configuration
+
+ //Sub-Method used to read the configuration
static private void readConfiguration()
{
//Read the Config
@@ -107,7 +103,8 @@ namespace Active_Client
{
//Prepare List of Cards
String Cardlist = "";
- foreach (ManagementObject card in VideoCards){
+ foreach (ManagementObject card in VideoCards)
+ {
Cardlist = Cardlist + " - " + card["Name"] + "\n";
}
@@ -121,7 +118,7 @@ namespace Active_Client
{
//code if key Not Exist add it and restart
Registry.SetValue(keyName, valueName, "GpuPreference=1;");
- MessageBox.Show("Active has foundthis Graphic Cards:\n\n" + Cardlist +"\nThe graphic configuration has been setted. Press Ok to restart the Application",Application.ProductName);
+ MessageBox.Show("Active has foundthis Graphic Cards:\n\n" + Cardlist + "\nThe graphic configuration has been setted. Press Ok to restart the Application", Application.ProductName);
Application.Restart();
Environment.Exit(0);
}
@@ -143,10 +140,10 @@ namespace Active_Client
if (CfxRuntime.PlatformArch == CfxPlatformArch.x64)
CfxRuntime.LibCefDirPath = Constants.CEF_X64_PATH;
else
- CfxRuntime.LibCefDirPath = Constants.CEF_X86_PATH;
-
-
- //Add the event variables
+ CfxRuntime.LibCefDirPath = Constants.CEF_X86_PATH;
+
+
+ //Add the event variables
ChromiumWebBrowser.OnBeforeCfxInitialize += Chromium_OnBeforeCfxInitialize;
ChromiumWebBrowser.OnBeforeCommandLineProcessing += Chromium_OnBeforeCommandLineProcessing;
@@ -167,11 +164,11 @@ namespace Active_Client
static void Chromium_OnBeforeCommandLineProcessing(CfxOnBeforeCommandLineProcessingEventArgs e)
{
if (Config.ClientConfig.RenderingMethod == Constants.Rendering.CPU)
- e.CommandLine.AppendSwitch("--disable-gpu");
-
+ e.CommandLine.AppendSwitch("--disable-gpu");
+
e.CommandLine.AppendSwitch("--enable-transparent-visuals");
e.CommandLine.AppendSwitch("--disable-pinch");
- e.CommandLine.AppendSwitch("--enable-media-stream");
+ e.CommandLine.AppendSwitch("--enable-media-stream");
e.CommandLine.AppendSwitch("--enable-usermedia-screen-capture");
e.CommandLine.AppendSwitch("--no-proxy-server");
@@ -188,7 +185,7 @@ namespace Active_Client
e.Settings.CachePath = Constants.BROWSER_CACHE_FOLDER;
e.Settings.LocalesDirPath = Constants.CEF_LOCALES_PATH;
e.Settings.ResourcesDirPath = CfxRuntime.LibCefDirPath;
- e.Settings.Locale = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName ;
+ e.Settings.Locale = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName;
}
@@ -218,10 +215,10 @@ namespace Active_Client
MessageBoxDefaultButton.Button1
);
Environment.Exit(-1);
- }
-
-
-
+ }
+
+
+
private static void GeneralExMethod(object sender, UnhandledExceptionEventArgs args)
{
Exception e = (Exception)args.ExceptionObject;
diff --git a/Client/Properties/AssemblyInfo.cs b/Client/Properties/AssemblyInfo.cs
index d003df09..2a9e36b2 100644
--- a/Client/Properties/AssemblyInfo.cs
+++ b/Client/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Le informazioni generali relative a un assembly sono controllate dal seguente
diff --git a/Client/View/LoadingForm.cs b/Client/View/LoadingForm.cs
index 4bf191b9..d02101d9 100644
--- a/Client/View/LoadingForm.cs
+++ b/Client/View/LoadingForm.cs
@@ -1,26 +1,14 @@
-using Microsoft.WindowsAPICodePack.Taskbar;
-using Client.Config;
+using Client.Config;
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Configuration;
-using System.Data;
using System.Drawing;
-using System.Linq;
-using System.Net;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
using System.Windows.Forms;
-using Client.Utils;
-using System.IO;
namespace Active_Client.View
{
public partial class LoadingForm : MetroFramework.Forms.MetroForm
- {
-
- //Constructor
+ {
+
+ //Constructor
public LoadingForm()
{
InitializeComponent();
@@ -37,7 +25,7 @@ namespace Active_Client.View
}
//Set window Position
- this.Location = new Point((Screen.PrimaryScreen.Bounds.Width / 2) - (this.Width / 2), (Screen.PrimaryScreen.Bounds.Height / 2) - (this.Height / 2));
+ this.Location = new Point((Screen.PrimaryScreen.Bounds.Width / 2) - (this.Width / 2), (Screen.PrimaryScreen.Bounds.Height / 2) - (this.Height / 2));
}
diff --git a/Client/View/MainForm.cs b/Client/View/MainForm.cs
index 4cb3812f..7f044908 100644
--- a/Client/View/MainForm.cs
+++ b/Client/View/MainForm.cs
@@ -1,16 +1,15 @@
-using Chromium;
+using Active_Client.Browser_Tools;
+using Chromium;
using Chromium.Event;
using Chromium.Remote.Event;
using Chromium.WebBrowser;
using Client.Config;
using Client.Utils;
-using Active_Client.Browser_Tools;
using System;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using static Client.Utils.Constants;
-using System.Diagnostics;
namespace Active_Client.View
{
@@ -31,7 +30,7 @@ namespace Active_Client.View
private LoadingForm LdFrm;
private static IntPtr MainHandle;
private static IntPtr NcHandle;
- private static IntPtr ProdHandle;
+ private static IntPtr ProdHandle;
private int X = 0, Y = 0;
private string BrokenUrl;
private Boolean closeRight = false;
@@ -54,7 +53,7 @@ namespace Active_Client.View
//Setup the Icon
if (Config.ClientConfig.IsSCM)
this.Icon = Properties.Resources.MAESTRO_ACTIVE_ICON;
-
+
//Start Client Setting
InitializeClientSettings();
@@ -83,7 +82,7 @@ namespace Active_Client.View
{
var candidate = Screen.PrimaryScreen;
// If primary screen is not full HD find another screen
- if(candidate.WorkingArea.Width != 1920)
+ if (candidate.WorkingArea.Width != 1920)
{
foreach (var s in Screen.AllScreens)
{
@@ -125,7 +124,7 @@ namespace Active_Client.View
if (Config.VendorHmiConfig.Type == 3)
NcWindow.MinimizeNcWindow();
-
+
if (Config.VendorHmiConfig.Enabled)
NcFrm.Hide();
if (Config.ProdSoftwareConfig.Enabled)
@@ -148,7 +147,7 @@ namespace Active_Client.View
{
ShowNCWindow();
}
- else if(NcWindow.State == NcState.SHOWPROD)
+ else if (NcWindow.State == NcState.SHOWPROD)
{
ShowProdWindow();
}
@@ -172,7 +171,7 @@ namespace Active_Client.View
//Close the NC HMI && Stop Following Nc
if (Config.VendorHmiConfig.Enabled)
NcWindow.CloseNcWindow(false);
-
+
if (Config.ProdSoftwareConfig.Enabled)
NcWindow.CloseProdWindow(false);
@@ -186,7 +185,7 @@ namespace Active_Client.View
try
{
CfxRuntime.Shutdown();
-
+
}
catch (Exception)
{
@@ -197,7 +196,7 @@ namespace Active_Client.View
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
- if(!closeRight)
+ if (!closeRight)
e.Cancel = true;
}
@@ -272,7 +271,7 @@ namespace Active_Client.View
private void BeforeDownload(object sender, CfxOnBeforeDownloadEventArgs e)
{
- e.Callback.Continue("",true);
+ e.Callback.Continue("", true);
}
//On browser Load-Error. Event Handler called by Browser
@@ -478,7 +477,7 @@ namespace Active_Client.View
private void ShowWindow()
{
- if(Config.ClientConfig.DeveloperMode && Width < 1920 && Height < 1080)
+ if (Config.ClientConfig.DeveloperMode && Width < 1920 && Height < 1080)
{
double ratio = (((double)Width) / 1920.0) * 100.0;
//Funzione sperimentale presa da Forum CEF
@@ -513,7 +512,7 @@ namespace Active_Client.View
w = NcFrm.Width;
h = NcFrm.Height;
}
- else if(Config.ProdSoftwareConfig.Enabled)
+ else if (Config.ProdSoftwareConfig.Enabled)
{
w = ProdFrm.Width;
h = ProdFrm.Height;
@@ -560,8 +559,8 @@ namespace Active_Client.View
if (InvokeRequired)
Invoke((MethodInvoker)delegate ()
{
- //Set Message Status
- LdFrm.Show(Message);
+ //Set Message Status
+ LdFrm.Show(Message);
LdFrm.Focus();
});
else
@@ -705,7 +704,7 @@ namespace Active_Client.View
//Hide NC Method
public void HideAUXWindow()
{
- if ((!Config.VendorHmiConfig.Enabled && !Config.ProdSoftwareConfig.Enabled) || (NcFrm==null && ProdFrm == null))
+ if ((!Config.VendorHmiConfig.Enabled && !Config.ProdSoftwareConfig.Enabled) || (NcFrm == null && ProdFrm == null))
return;
//Invoke method if is needed or call the method in STD mode
@@ -728,7 +727,7 @@ namespace Active_Client.View
else
{
- if (NcFrm != null && NcFrm.Owner != null)
+ if (NcFrm != null && NcFrm.Owner != null)
NcFrm.Owner = null;
if (ProdFrm != null && ProdFrm.Owner != null)
ProdFrm.Owner = null;
@@ -770,7 +769,7 @@ namespace Active_Client.View
if (ss.Bounds.Width != 1920 && ss.Bounds.Height != 1080)
{
HideLoadingWindow();
- if(Config.VendorHmiConfig.Enabled)
+ if (Config.VendorHmiConfig.Enabled)
NcWindow.CloseNcWindow(false);
if (Config.ProdSoftwareConfig.Enabled)
NcWindow.CloseProdWindow(false);
@@ -778,8 +777,8 @@ namespace Active_Client.View
}
}
}
- else
- {
+ else
+ {
if (Config.ClientConfig.DeveloperMode)
{
//Set the Prymary screen Size
@@ -789,7 +788,7 @@ namespace Active_Client.View
this.Height = ps.Bounds.Height;
}
- }
+ }
else
{
if (ps.Bounds.Width != 1920 && ps.Bounds.Height != 1080)
diff --git a/Client/View/NcForm.cs b/Client/View/NcForm.cs
index b237f7bc..e49c2704 100644
--- a/Client/View/NcForm.cs
+++ b/Client/View/NcForm.cs
@@ -1,18 +1,11 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Drawing;
using System.Windows.Forms;
namespace Active_Client.View
{
public partial class NcForm : Form
{
- public NcForm(Color TranspColor,int PosX,int PosY)
+ public NcForm(Color TranspColor, int PosX, int PosY)
{
InitializeComponent();
@@ -37,7 +30,7 @@ namespace Active_Client.View
private void NcForm_FormClosing(object sender, FormClosingEventArgs e)
{
- if(e.CloseReason == CloseReason.UserClosing)
+ if (e.CloseReason == CloseReason.UserClosing)
e.Cancel = true;
}
}
diff --git a/Client/View/NcWindow.cs b/Client/View/NcWindow.cs
index 518bf019..b3753fde 100644
--- a/Client/View/NcWindow.cs
+++ b/Client/View/NcWindow.cs
@@ -1,9 +1,8 @@
-using Chromium.Remote;
+using Active_Client.Properties;
+using Chromium.Remote;
using Client.Config;
using Client.Utils;
-using Active_Client.Properties;
using System;
-using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
@@ -60,7 +59,7 @@ namespace Active_Client.View
private static int LastX, LastY;
private static int LastWidth = 1024, LastHeight = 768;
private static IntPtr hhook;
- private static IntPtr hhookWindow;
+ private static IntPtr hhookWindow;
private static IntPtr keybhook;
private static IntPtr MainViewHandle;
private static IntPtr TaskBarHandle;
@@ -70,7 +69,7 @@ namespace Active_Client.View
private static uint ProdProcessPID;
private static uint ActualPID;
private static WinEventDelegate procDelegate;
- private static WinEventDelegate procDelegateWindow;
+ private static WinEventDelegate procDelegateWindow;
private static keyboardHookProc keybDelegate;
private static uint LastdwmsEventTime;
private static uint LastHookedPID;
@@ -102,13 +101,13 @@ namespace Active_Client.View
private static int ActiveWindowNCWindowStyle;
private static int ActiveWindowNCWindowBorder;
private static uint ActiveWindowNCPopUp;
- private static uint ActiveNCWindowNCPopUp;
-
-
+ private static uint ActiveNCWindowNCPopUp;
+
+
public static MainForm mainFrm;
- private static string prodEXEname;
-
-
+ private static string prodEXEname;
+
+
public static NcState State { get { return state; } }
private static NcState state;
@@ -263,8 +262,8 @@ namespace Active_Client.View
//Maximize Window if is Osai
if (Config.VendorHmiConfig.Type == 3)
- ShowWindow(ncprocess.MainWindowHandle, SW_SHOWMAXIMIZED);
-
+ ShowWindow(ncprocess.MainWindowHandle, SW_SHOWMAXIMIZED);
+
return 0;
}
@@ -681,8 +680,8 @@ namespace Active_Client.View
//Stop following Nc Window (bring-to-font the main window) -> ONLY FOR OSAI System!
public static void StopNcFollowing()
- {
- //Detach the hook
+ {
+ //Detach the hook
if (hhook != IntPtr.Zero)
UnhookWinEvent(hhook);
@@ -984,9 +983,9 @@ namespace Active_Client.View
#region WINDOWS_EVENT_OVERRIDE
private static void WinEventProcWindow(IntPtr hWinEventHook, uint eventType, IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime)
- {
-
- //Read the actual ID of the Process
+ {
+
+ //Read the actual ID of the Process
GetWindowThreadProcessId(hwnd, out ActualWindowPID);
if (ActualWindowPID == NcProcessPID && NcProcessPID != 0 && hWinEventHook != ncprocess.MainWindowHandle)
{
@@ -998,7 +997,7 @@ namespace Active_Client.View
ActiveWindowNCPopUp = ((uint)ActiveWindowNCWindowStyle & WS_POPUP);
//if it has the border and a title execute focus
- if (ActiveWindowNCWindowStyle != 0 && (((ActiveWindowNCWindowBorder == WS_BORDER) && ReadWindowTitle(hwnd) != "") || (ActiveWindowNCPopUp == WS_POPUP) ))
+ if (ActiveWindowNCWindowStyle != 0 && (((ActiveWindowNCWindowBorder == WS_BORDER) && ReadWindowTitle(hwnd) != "") || (ActiveWindowNCPopUp == WS_POPUP)))
{
if (eventType == EVENT_OBJECT_CREATE)
{
@@ -1006,8 +1005,8 @@ namespace Active_Client.View
}
else if (eventType == EVENT_OBJECT_DESTROY)
SetWindowPos(MainViewHandle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_SHOWWINDOW);
- }
-
+ }
+
}
}
@@ -1036,13 +1035,13 @@ namespace Active_Client.View
//if it has the border and a title execute focus
if (ActiveNCWindowStyle != 0 && ((ActiveNCWindowBorder == WS_BORDER && ReadWindowTitle(hwnd) != "") || (ActiveNCWindowNCPopUp == WS_POPUP)) && hwnd != ncprocess.MainWindowHandle)
{
- Console.WriteLine("Handle: " + hwnd + " MainWindowHandle" + ncprocess.MainWindowHandle);
- SetWindowPos(ncprocess.MainWindowHandle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_SHOWWINDOW);
+ Console.WriteLine("Handle: " + hwnd + " MainWindowHandle" + ncprocess.MainWindowHandle);
+ SetWindowPos(ncprocess.MainWindowHandle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_SHOWWINDOW);
}
- }
-
-
- //If the PID is the STEP-HMI Process
+ }
+
+
+ //If the PID is the STEP-HMI Process
if (ActualPID == MainProcessPID)
{
if (!IsIconic(MainViewHandle))
@@ -1088,9 +1087,9 @@ namespace Active_Client.View
//Hook Keyboard Handle
private static void KeybEventProc(int nCode, IntPtr wParam, IntPtr lParam)
{
- int Key = Marshal.ReadInt32(lParam);
-
- //Elaborate Hotkey
+ int Key = Marshal.ReadInt32(lParam);
+
+ //Elaborate Hotkey
if (wParam == HWND_KEYDOWN || wParam == HWND_SYSKEYDOWN)
{
if (Key == 0xA4 || Key == 0xA5)
@@ -1120,7 +1119,7 @@ namespace Active_Client.View
if (wParam == HWND_SYSKEYDOWN || wParam == HWND_KEYDOWN)
mainFrm.keyPressedHandler(altPressed, ctrlPressed, shiftPressed, Key);
}
- if((wParam == HWND_SYSKEYDOWN || wParam == HWND_KEYDOWN) && !altPressed && (KeybPID == MainProcessPID || KeybPID == ProdProcessPID) && state == NcState.SHOW)
+ if ((wParam == HWND_SYSKEYDOWN || wParam == HWND_KEYDOWN) && !altPressed && (KeybPID == MainProcessPID || KeybPID == ProdProcessPID) && state == NcState.SHOW)
{
//IF Siemens
if (Config.VendorHmiConfig.Type == 2)
diff --git a/Client/View/OpeningForm.cs b/Client/View/OpeningForm.cs
index 8196fbc6..3adf5f06 100644
--- a/Client/View/OpeningForm.cs
+++ b/Client/View/OpeningForm.cs
@@ -1,22 +1,15 @@
-using Microsoft.WindowsAPICodePack.Taskbar;
-using Client.Config;
+using Client.Config;
+using Client.Config.SubModels;
+using Client.Utils;
+using Microsoft.WindowsAPICodePack.Taskbar;
+using Newtonsoft.Json;
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Configuration;
-using System.Data;
using System.Drawing;
-using System.Linq;
+using System.IO;
using System.Net;
-using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
-using Client.Utils;
-using System.IO;
-using MetroFramework;
-using Newtonsoft.Json;
-using Client.Config.SubModels;
namespace Active_Client.View
{
@@ -27,7 +20,7 @@ namespace Active_Client.View
private HttpWebResponse ConnTestResponse;
private String ConnTestError;
private Task ConnTask;
- private ushort WaitDot=1;
+ private ushort WaitDot = 1;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region WINDOW_START_&_BEHAVIOUR_METHOD
@@ -63,9 +56,9 @@ namespace Active_Client.View
private void LoadingForm_Load(object sender, EventArgs e)
{
//Force on Desktop 1
- this.DesktopLocation = new Point((Screen.PrimaryScreen.Bounds.Width / 2) - (this.Width / 2), (Screen.PrimaryScreen.Bounds.Height / 2) - (this.Height / 2));
-
- //Start Backgroud Task
+ this.DesktopLocation = new Point((Screen.PrimaryScreen.Bounds.Width / 2) - (this.Width / 2), (Screen.PrimaryScreen.Bounds.Height / 2) - (this.Height / 2));
+
+ //Start Backgroud Task
ConnTask = Task.Run(() => BagroundWorker());
}
@@ -126,28 +119,29 @@ namespace Active_Client.View
setOpacity(1);
//Show the loading state on the app ICON
- this.Invoke((MethodInvoker)delegate () {TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.Indeterminate, this.Handle); });
-
- //try to Request
- if(!Config.ConnectionConfig.BypassReadConfiguration)
+ this.Invoke((MethodInvoker)delegate () { TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.Indeterminate, this.Handle); });
+
+ //try to Request
+ if (!Config.ConnectionConfig.BypassReadConfiguration)
{
setStatus("Connecting to " + Config.ConnectionConfig.ServerUrl + ":" + Config.ConnectionConfig.ServerPort, "");
- Boolean error=false;
- do {
+ Boolean error = false;
+ do
+ {
if (error == true)
return;
- } while (!testConnection(new Uri(Config.ConnectionConfig.ReadConfigUrl),out error));
+ } while (!testConnection(new Uri(Config.ConnectionConfig.ReadConfigUrl), out error));
}
//Set App Opacity (Only Siemens)
- if(Config.VendorHmiConfig.Type == 2)
+ if (Config.VendorHmiConfig.Type == 2)
setOpacity(0.85);
//Open Nc Window
- setStatus("Opening NC Window... ", "");
-
+ setStatus("Opening NC Window... ", "");
+
if (Config.VendorHmiConfig.Enabled)
if (!OpenNcWindow())
return;
@@ -160,13 +154,13 @@ namespace Active_Client.View
var exename = Path.GetFileNameWithoutExtension(Config.ProdSoftwareConfig.Path);
if (!OpenProdWindow(Config.ProdSoftwareConfig.Path, exename))
return;
- }
-
- //Set App Opacity
+ }
+
+ //Set App Opacity
setOpacity(1);
//Close the Window
- closeWindow();
+ closeWindow();
}
@@ -195,7 +189,7 @@ namespace Active_Client.View
//Sub-Method used to test the connection
- private bool testConnection(Uri url,out Boolean error)
+ private bool testConnection(Uri url, out Boolean error)
{
Boolean Connected = false;
error = false;
@@ -224,8 +218,8 @@ namespace Active_Client.View
//Check if it's connected
if (Connected)
- {
- // var jsonDefinition = new { ncVendor = "", showHMI = "", ncIp = "", ncPort = "", prodEnabled = "", prodPath = "", extPrograms = "" };
+ {
+ // var jsonDefinition = new { ncVendor = "", showHMI = "", ncIp = "", ncPort = "", prodEnabled = "", prodPath = "", extPrograms = "" };
var jsonDefinition = new ServerConfigModel();
setStatus("Connected!", "");
@@ -237,20 +231,20 @@ namespace Active_Client.View
{
var ConfigResponse = JsonConvert.DeserializeAnonymousType(reader.ReadToEnd(), jsonDefinition);
- if(!String.IsNullOrWhiteSpace(ConfigResponse.NcVendor) && !String.IsNullOrWhiteSpace(ConfigResponse.ShowHMI))
+ if (!String.IsNullOrWhiteSpace(ConfigResponse.NcVendor) && !String.IsNullOrWhiteSpace(ConfigResponse.ShowHMI))
{
string ncVendorName = ConfigResponse.NcVendor.ToUpper();
string ncVendorHMI = ConfigResponse.ShowHMI.ToUpper();
- Config.VendorHmiConfig.IpAddress = ConfigResponse.NcIp.ToUpper();
- Config.VendorHmiConfig.Port = ConfigResponse.NcPort.ToUpper();
- string ProdEnabled = ConfigResponse.ProdEnabled.ToUpper();
+ Config.VendorHmiConfig.IpAddress = ConfigResponse.NcIp.ToUpper();
+ Config.VendorHmiConfig.Port = ConfigResponse.NcPort.ToUpper();
+ string ProdEnabled = ConfigResponse.ProdEnabled.ToUpper();
string ProdPath = ConfigResponse.ProdPath.ToUpper();
string Autorun = ConfigResponse.Autorun.ToUpper();
-
+
//Read the Server Type
if (ncVendorName.Equals("DEMO"))
- Config.VendorHmiConfig.Type = 0;
+ Config.VendorHmiConfig.Type = 0;
else if (ncVendorName.Equals("FANUC"))
Config.VendorHmiConfig.Type = 1;
else if (ncVendorName.Equals("SIEMENS"))
@@ -271,8 +265,8 @@ namespace Active_Client.View
Config.VendorHmiConfig.Enabled = true;
else
Config.VendorHmiConfig.Enabled = false;
-
- //Autorun
+
+ //Autorun
if (Autorun.ToUpper().Equals("TRUE"))
Config.ClientConfig.Autorun = true;
else
@@ -290,9 +284,9 @@ namespace Active_Client.View
Config.TextEditorPath = ConfigResponse.EditorPath;
if (ConfigResponse.ExtSoftwares != null)
- Config.ExtSoftwaresConfig = ConfigResponse.ExtSoftwares.ToArray();
-
- return true;
+ Config.ExtSoftwaresConfig = ConfigResponse.ExtSoftwares.ToArray();
+
+ return true;
}
}
@@ -303,8 +297,8 @@ namespace Active_Client.View
setStatus("Error!", "Error While loading the configuration");
return false;
- }
-
+ }
+
}
else
{
@@ -331,29 +325,30 @@ namespace Active_Client.View
//Sub-Method used to open the NC Window
private bool OpenNcWindow()
{
- switch(NcWindow.StartNcWindow())
+ switch (NcWindow.StartNcWindow())
{
case 0: return true;
- case 1: {
+ case 1:
+ {
setStatus("Close the application!", "NC Path not found: " + NcWindow.ProcessPath);
- return false;
- };
+ return false;
+ };
case 2:
{
setStatus("Close the application!", "Unable to start the NC application: ");
return false;
};
- }
-
+ }
+
return false;
}
//Sub-Method used to open the NC Window
- private bool OpenProdWindow(string ExePath,string ExeName)
+ private bool OpenProdWindow(string ExePath, string ExeName)
{
switch (NcWindow.StartProdWindow(ExePath, ExeName))
{
diff --git a/Client/View/ProdForm.cs b/Client/View/ProdForm.cs
index b79496d5..e8e2e633 100644
--- a/Client/View/ProdForm.cs
+++ b/Client/View/ProdForm.cs
@@ -1,11 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Drawing;
using System.Windows.Forms;
namespace Active_Client.View
diff --git a/Thermo.Active.CmsConnectGateway/Builders/GatewayNewtorkConfigurationBuilder.cs b/Thermo.Active.CmsConnectGateway/Builders/GatewayNewtorkConfigurationBuilder.cs
index 9726380a..c83fda89 100644
--- a/Thermo.Active.CmsConnectGateway/Builders/GatewayNewtorkConfigurationBuilder.cs
+++ b/Thermo.Active.CmsConnectGateway/Builders/GatewayNewtorkConfigurationBuilder.cs
@@ -1,10 +1,7 @@
-using Thermo.Active.CmsConnectGateway.Builders;
-using System;
+using System;
using System.Collections.Generic;
-using System.Linq;
using System.Net;
-using System.Text;
-using System.Threading.Tasks;
+using Thermo.Active.CmsConnectGateway.Builders;
namespace Thermo.Active.CmsConnectGateway
{
@@ -52,7 +49,7 @@ namespace Thermo.Active.CmsConnectGateway
config.dnsPrefixes = dnsPrefixes;
return this;
}
-
+
public GatewayNetworkConfiguration GenerateConfiguration()
{
@@ -93,7 +90,7 @@ namespace Thermo.Active.CmsConnectGateway
return config;
}
-
+
}
}
diff --git a/Thermo.Active.CmsConnectGateway/Builders/GatewayProxyConfigurationBuilder.cs b/Thermo.Active.CmsConnectGateway/Builders/GatewayProxyConfigurationBuilder.cs
index d9278f61..f59c16e9 100644
--- a/Thermo.Active.CmsConnectGateway/Builders/GatewayProxyConfigurationBuilder.cs
+++ b/Thermo.Active.CmsConnectGateway/Builders/GatewayProxyConfigurationBuilder.cs
@@ -1,10 +1,7 @@
-using Thermo.Active.CmsConnectGateway.Builders;
-using System;
+using System;
using System.Collections.Generic;
-using System.Linq;
using System.Net;
-using System.Text;
-using System.Threading.Tasks;
+using Thermo.Active.CmsConnectGateway.Builders;
namespace Thermo.Active.CmsConnectGateway
{
@@ -79,7 +76,7 @@ namespace Thermo.Active.CmsConnectGateway
//Controls empty spaces
CheckNoEmptySpaces(config.address, "Address");
- if(config.username != null)
+ if (config.username != null)
CheckNoEmptySpaces(config.username, "Username");
if (config.password != null)
CheckNoEmptySpaces(config.password, "Password");
diff --git a/Thermo.Active.CmsConnectGateway/Builders/iBuilder.cs b/Thermo.Active.CmsConnectGateway/Builders/iBuilder.cs
index 22989a76..f5004053 100644
--- a/Thermo.Active.CmsConnectGateway/Builders/iBuilder.cs
+++ b/Thermo.Active.CmsConnectGateway/Builders/iBuilder.cs
@@ -1,10 +1,6 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
using System.Net;
-using System.Text;
using System.Text.RegularExpressions;
-using System.Threading.Tasks;
namespace Thermo.Active.CmsConnectGateway.Builders
{
@@ -51,13 +47,13 @@ namespace Thermo.Active.CmsConnectGateway.Builders
}
- internal void CheckNoEmptySpaces(string strToCheck,string paramName)
+ internal void CheckNoEmptySpaces(string strToCheck, string paramName)
{
if (strToCheck.Contains(" "))
throw new FormatException("BAD FORMAT - param \"" + paramName + "\" must be without empty spaces");
}
-
+
private bool EvaluateIPV4(string stringValue, out IPAddress address)
{
diff --git a/Thermo.Active.CmsConnectGateway/Events/GatewayRebootEventHandlerArgs.cs b/Thermo.Active.CmsConnectGateway/Events/GatewayRebootEventHandlerArgs.cs
index 9fad985e..f17664eb 100644
--- a/Thermo.Active.CmsConnectGateway/Events/GatewayRebootEventHandlerArgs.cs
+++ b/Thermo.Active.CmsConnectGateway/Events/GatewayRebootEventHandlerArgs.cs
@@ -1,8 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Thermo.Active.CmsConnectGateway.Events
{
diff --git a/Thermo.Active.CmsConnectGateway/Exceptions/GatewayException.cs b/Thermo.Active.CmsConnectGateway/Exceptions/GatewayException.cs
index 2f557c90..6f92ad87 100644
--- a/Thermo.Active.CmsConnectGateway/Exceptions/GatewayException.cs
+++ b/Thermo.Active.CmsConnectGateway/Exceptions/GatewayException.cs
@@ -1,14 +1,10 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Thermo.Active.CmsConnectGateway.Exceptions
{
- public class GatewayException: Exception
+ public class GatewayException : Exception
{
- public GatewayException(string message): base(message)
+ public GatewayException(string message) : base(message)
{
}
}
diff --git a/Thermo.Active.CmsConnectGateway/GatewayAdapter.cs b/Thermo.Active.CmsConnectGateway/GatewayAdapter.cs
index e82649ed..d334aa8e 100644
--- a/Thermo.Active.CmsConnectGateway/GatewayAdapter.cs
+++ b/Thermo.Active.CmsConnectGateway/GatewayAdapter.cs
@@ -1,7 +1,5 @@
using Renci.SshNet;
using Renci.SshNet.Common;
-using Thermo.Active.CmsConnectGateway.Events;
-using Thermo.Active.CmsConnectGateway.Exceptions;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -11,6 +9,8 @@ using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
+using Thermo.Active.CmsConnectGateway.Events;
+using Thermo.Active.CmsConnectGateway.Exceptions;
namespace Thermo.Active.CmsConnectGateway
{
@@ -127,7 +127,7 @@ namespace Thermo.Active.CmsConnectGateway
///
public GatewayNetworkConfiguration ReadGatewayNetworkConfiguration()
{
- return ElaborateConfigFromSshNetworkCommand( SendSSHCommand(SSH_GET_NETWORK_COMMAND) );
+ return ElaborateConfigFromSshNetworkCommand(SendSSHCommand(SSH_GET_NETWORK_COMMAND));
}
@@ -184,9 +184,9 @@ namespace Thermo.Active.CmsConnectGateway
}
hand(this, ev);
};
-
+
// Create a task and not start it.
- Task t = new Task (() => action(delay, handler));
+ Task t = new Task(() => action(delay, handler));
t.Start();
}
@@ -217,7 +217,7 @@ namespace Thermo.Active.CmsConnectGateway
}
#endregion
-
+
//---------------------------------------------------------------------------------------------------
#region SSH_commands_preparations_sub_methods
@@ -255,7 +255,7 @@ namespace Thermo.Active.CmsConnectGateway
return command.ToString();
}
-
+
//SSH command generator for Network setting
private string GenerateSshNetworkCommand(GatewayNetworkConfiguration configuration)
@@ -272,7 +272,7 @@ namespace Thermo.Active.CmsConnectGateway
IPNetwork tempIpNetw = IPNetwork.Parse(configuration.ipAddress, configuration.netMaskAddress);
command.Append(configuration.ipAddress).Append("/").Append(tempIpNetw.Cidr).Append(" ");
- if(configuration.defaultGatewayAddress != null)
+ if (configuration.defaultGatewayAddress != null)
command.Append(configuration.defaultGatewayAddress);
}
@@ -298,7 +298,7 @@ namespace Thermo.Active.CmsConnectGateway
{
StringBuilder command = new StringBuilder(SSH_SET_DNSSUFFIX_COMMAND);
- if(configuration.dnsPrefixes != null)
+ if (configuration.dnsPrefixes != null)
command.Append(string.Join(",", configuration.dnsPrefixes));
return command.ToString();
@@ -368,7 +368,7 @@ namespace Thermo.Active.CmsConnectGateway
if (!stringValue.Contains('/'))
throw new GatewayException("Internal Gateway Error during read (bad format): " + IP_ADDR_LABEL + stringValue);
- string [] tempAddr = stringValue.Split('/');
+ string[] tempAddr = stringValue.Split('/');
//Check if has lenght == 2
if (tempAddr.Length != 2)
throw new GatewayException("Internal Gateway Error during read (bad format): " + IP_ADDR_LABEL + stringValue);
@@ -445,7 +445,7 @@ namespace Thermo.Active.CmsConnectGateway
if (tempStr.Length == 0)
configuration.dnsPrefixes = null;
else
- configuration.dnsPrefixes = tempStr.Where(X=> !String.IsNullOrEmpty(X)).ToList();
+ configuration.dnsPrefixes = tempStr.Where(X => !String.IsNullOrEmpty(X)).ToList();
}
}
@@ -473,7 +473,7 @@ namespace Thermo.Active.CmsConnectGateway
if (!stringValue.Contains(':'))
throw new GatewayException("Internal Gateway Error during read (bad format): " + PROXY_ADDR_LABEL + stringValue);
string[] tempAddr = stringValue.Split(':');
-
+
//Check if has lenght == 2
if (tempAddr.Length != 2)
throw new GatewayException("Internal Gateway Error during read (bad format): " + PROXY_ADDR_LABEL + stringValue);
@@ -510,7 +510,7 @@ namespace Thermo.Active.CmsConnectGateway
throw new GatewayException("Internal Gateway Error during read (bad format): " + PROXY_ADDR_LABEL + stringValue);
if (tempAddr.Length != 2)
throw new GatewayException("Internal Gateway Error during read (bad format): " + PROXY_ADDR_LABEL + stringValue);
-
+
//Set the username
configuration.username = tempLogin[0];
//Set the password
@@ -524,7 +524,7 @@ namespace Thermo.Active.CmsConnectGateway
throw new GatewayException("Internal Gateway Error during read (bad format): " + PROXY_ADDR_LABEL + stringValue);
configuration.port = tempPort;
}
-
+
}
}
@@ -538,7 +538,7 @@ namespace Thermo.Active.CmsConnectGateway
{
string[] tempStr = stringValue.Trim('"').Split(',');
- for (int i=0;i SendSSHCommand(string command)
{
- return SendSSHCommand(new List {command});
+ return SendSSHCommand(new List { command });
}
@@ -594,12 +594,12 @@ namespace Thermo.Active.CmsConnectGateway
List returnedValues = new List();
//Create the SSH Gateway
- SshClient _sshGateway = new SshClient(this.host, this.username, this.password);
+ SshClient _sshGateway = new SshClient(this.host, this.username, this.password);
try
{
//Connect
_sshGateway.Connect();
- foreach(string cmd in command)
+ foreach (string cmd in command)
{
//Run command
sshCmd = _sshGateway.RunCommand(cmd);
@@ -655,7 +655,7 @@ namespace Thermo.Active.CmsConnectGateway
private void SendSSHReboot(int seconds)
{
//Send SSH Command
- SendSSHCommand(SSH_GW_REBOOT_COMMAND + seconds);
+ SendSSHCommand(SSH_GW_REBOOT_COMMAND + seconds);
//Wait the time for reboot
Thread.Sleep((seconds + 5) * 1000);
@@ -708,7 +708,7 @@ namespace Thermo.Active.CmsConnectGateway
}
} while (!disconnected);
-
+
//Phase 2 Wait Re-connection Cycle
bool connected = false;
do
@@ -716,7 +716,7 @@ namespace Thermo.Active.CmsConnectGateway
try
{
//If TimeSpan > TOT MIN -> Exception
- if((DateTime.Now - nowAfterReboot) > TimeSpan.FromMinutes(REBOOT_MINUTES_MAX))
+ if ((DateTime.Now - nowAfterReboot) > TimeSpan.FromMinutes(REBOOT_MINUTES_MAX))
throw new GatewayException("Timeout Error during reboot - Gateway not found during reboot");
//Try Connection
diff --git a/Thermo.Active.CmsConnectGateway/Models/GatewayConfiguration.cs b/Thermo.Active.CmsConnectGateway/Models/GatewayConfiguration.cs
index 08e90973..de4af3ef 100644
--- a/Thermo.Active.CmsConnectGateway/Models/GatewayConfiguration.cs
+++ b/Thermo.Active.CmsConnectGateway/Models/GatewayConfiguration.cs
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Net;
namespace Thermo.Active.CmsConnectGateway
@@ -13,8 +10,8 @@ namespace Thermo.Active.CmsConnectGateway
public class GatewayNetworkConfiguration
{
- internal GatewayNetworkConfiguration() {}
- public Boolean hasDhcp { get; internal set;}
+ internal GatewayNetworkConfiguration() { }
+ public Boolean hasDhcp { get; internal set; }
public IPAddress ipAddress { get; internal set; }
public IPAddress netMaskAddress { get; internal set; }
public IPAddress defaultGatewayAddress { get; internal set; }
@@ -23,18 +20,18 @@ namespace Thermo.Active.CmsConnectGateway
public override string ToString()
{
- return "hasDhcp: " + hasDhcp + Environment.NewLine +
- "ipAddress: " + (ipAddress != null ? ipAddress.ToString() : "null") + Environment.NewLine +
- "netMaskAddress: " + (netMaskAddress != null ? netMaskAddress.ToString() : "null") + Environment.NewLine +
- "defaultGatewayAddress: " + (defaultGatewayAddress != null ? defaultGatewayAddress.ToString() : "null") + Environment.NewLine +
- "dnsAddresses: " + (dnsAddresses != null ? string.Join(",", dnsAddresses) : "null") + Environment.NewLine +
- "dnsPrefixes: " + (dnsPrefixes != null ? string.Join(",", dnsPrefixes) : "null");
+ return "hasDhcp: " + hasDhcp + Environment.NewLine +
+ "ipAddress: " + (ipAddress != null ? ipAddress.ToString() : "null") + Environment.NewLine +
+ "netMaskAddress: " + (netMaskAddress != null ? netMaskAddress.ToString() : "null") + Environment.NewLine +
+ "defaultGatewayAddress: " + (defaultGatewayAddress != null ? defaultGatewayAddress.ToString() : "null") + Environment.NewLine +
+ "dnsAddresses: " + (dnsAddresses != null ? string.Join(",", dnsAddresses) : "null") + Environment.NewLine +
+ "dnsPrefixes: " + (dnsPrefixes != null ? string.Join(",", dnsPrefixes) : "null");
}
}
public class GatewayProxyConfiguration
{
- internal GatewayProxyConfiguration(){}
+ internal GatewayProxyConfiguration() { }
public Boolean hasProxy { get; internal set; }
public string address { get; internal set; }
public uint port { get; internal set; }
@@ -45,12 +42,12 @@ namespace Thermo.Active.CmsConnectGateway
public override string ToString()
{
- return "hasProxy: " + hasProxy + Environment.NewLine +
- "address: " + (address != null ? address.ToString() : "null") + Environment.NewLine +
- "port: " + (port != 0 ? port.ToString() : "null") + Environment.NewLine +
- "username: " + (username != null ? username : "null") + Environment.NewLine +
- "password: " + (password != null ? password : "null") + Environment.NewLine +
- "noproxyAddresses: " + (noproxyAddresses != null ? string.Join(",", noproxyAddresses) : "null");
+ return "hasProxy: " + hasProxy + Environment.NewLine +
+ "address: " + (address != null ? address.ToString() : "null") + Environment.NewLine +
+ "port: " + (port != 0 ? port.ToString() : "null") + Environment.NewLine +
+ "username: " + (username != null ? username : "null") + Environment.NewLine +
+ "password: " + (password != null ? password : "null") + Environment.NewLine +
+ "noproxyAddresses: " + (noproxyAddresses != null ? string.Join(",", noproxyAddresses) : "null");
}
}
}
diff --git a/Thermo.Active.CmsConnectGateway/Properties/AssemblyInfo.cs b/Thermo.Active.CmsConnectGateway/Properties/AssemblyInfo.cs
index 541dc50d..ea978de4 100644
--- a/Thermo.Active.CmsConnectGateway/Properties/AssemblyInfo.cs
+++ b/Thermo.Active.CmsConnectGateway/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Le informazioni generali relative a un assembly sono controllate dal seguente
diff --git a/Thermo.Active.Config/LiveData.cs b/Thermo.Active.Config/LiveData.cs
index e129a251..ea8d785f 100644
--- a/Thermo.Active.Config/LiveData.cs
+++ b/Thermo.Active.Config/LiveData.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Collections.Generic;
namespace Thermo.Active.Config
{
diff --git a/Thermo.Active.Config/Properties/AssemblyInfo.cs b/Thermo.Active.Config/Properties/AssemblyInfo.cs
index 5e52dbf9..8ac4a541 100644
--- a/Thermo.Active.Config/Properties/AssemblyInfo.cs
+++ b/Thermo.Active.Config/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Le informazioni generali relative a un assembly sono controllate dal seguente
diff --git a/Thermo.Active.Config/ServerConfig.cs b/Thermo.Active.Config/ServerConfig.cs
index 9f479ce2..ca673d75 100644
--- a/Thermo.Active.Config/ServerConfig.cs
+++ b/Thermo.Active.Config/ServerConfig.cs
@@ -1,8 +1,8 @@
-using Thermo.Active.Model.ConfigModels;
+using System.Collections.Generic;
+using Thermo.Active.Model.ConfigModels;
using Thermo.Active.Model.DatabaseModels;
using Thermo.Active.Model.DTOModels;
using Thermo.Active.Model.DTOModels.Scada;
-using System.Collections.Generic;
namespace Thermo.Active.Config
{
@@ -11,7 +11,7 @@ namespace Thermo.Active.Config
public static ServerConfigModel ServerStartupConfig;
public static NcConfigModel NcConfig;
public static List ExtSoftwaresConfig;
- public static SoftwareProdConfigModel SoftwareProdConfig;
+ public static SoftwareProdConfigModel SoftwareProdConfig;
public static MachineModel MachineConfig;
public static List MaintenancesConfig;
public static ContactModel CmsContactConfig;
@@ -44,7 +44,7 @@ namespace Thermo.Active.Config
public static AreasConfigModel ScadaConfig;
public static AreasConfigModel JobEditorConfig;
public static AreasConfigModel UsersConfig;
-
+
public static List ProductionScadaSchema = new List();
public static List ConfiguredScadaSchema = new List();
diff --git a/Thermo.Active.Config/ServerConfigController.cs b/Thermo.Active.Config/ServerConfigController.cs
index 99086512..7b5efcb9 100644
--- a/Thermo.Active.Config/ServerConfigController.cs
+++ b/Thermo.Active.Config/ServerConfigController.cs
@@ -1,6 +1,4 @@
-using Thermo.Active.Model.ConfigModels;
-using Thermo.Active.Model.DTOModels.Scada;
-using Thermo.Active.Utils;
+using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -12,10 +10,12 @@ using System.Xml;
using System.Xml.Linq;
using System.Xml.Schema;
using System.Xml.Serialization;
+using Thermo.Active.Model.ConfigModels;
+using Thermo.Active.Model.DTOModels.Scada;
+using Thermo.Active.Utils;
using static Thermo.Active.Config.ServerConfig;
using static Thermo.Active.Model.Constants;
using static Thermo.Active.Utils.SupportFunctions;
-using Newtonsoft.Json;
namespace Thermo.Active.Config
{
@@ -1020,16 +1020,6 @@ namespace Thermo.Active.Config
return answ;
}
-#if false
- public static void ReadMainProgram()
- {
- if (File.Exists(MAIN_PROGRAM_CONFIG_PATH))
- {
- CMSMainProgramContent = File.ReadAllText(MAIN_PROGRAM_CONFIG_PATH);
- }
- }
-#endif
-
public static string CalculateHash(string filename)
{
using (var sha = SHA1.Create())
diff --git a/Thermo.Active.Core/Properties/AssemblyInfo.cs b/Thermo.Active.Core/Properties/AssemblyInfo.cs
index 1fa0d271..5ec7c4ac 100644
--- a/Thermo.Active.Core/Properties/AssemblyInfo.cs
+++ b/Thermo.Active.Core/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Le informazioni generali relative a un assembly sono controllate dal seguente
diff --git a/Thermo.Active.Core/ThreadsFunctions.cs b/Thermo.Active.Core/ThreadsFunctions.cs
index 2abff72a..4adff2d4 100644
--- a/Thermo.Active.Core/ThreadsFunctions.cs
+++ b/Thermo.Active.Core/ThreadsFunctions.cs
@@ -1,12 +1,4 @@
using CMS_CORE_Library.Models;
-using Thermo.Active.Config;
-using Thermo.Active.Core;
-using Thermo.Active.Database.Controllers;
-using Thermo.Active.Model.DTOModels;
-using Thermo.Active.Model.DTOModels.AlarmModels;
-using Thermo.Active.Model.DTOModels.Scada;
-using Thermo.Active.NC;
-using Thermo.Active.Utils;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -18,11 +10,20 @@ using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using TeamDev.SDK.MVVM;
+using Thermo.Active.Core;
+using Thermo.Active.Database.Controllers;
+using Thermo.Active.Model.DTOModels;
+using Thermo.Active.Model.DTOModels.AlarmModels;
+using Thermo.Active.Model.DTOModels.Scada;
+using Thermo.Active.Model.DTOModels.ThModules;
+using Thermo.Active.Model.DTOModels.ThRecipe;
+using Thermo.Active.Model.DTOModels.ThWarmers;
+using Thermo.Active.NC;
+using Thermo.Active.Utils;
using static CMS_CORE_Library.Models.DataStructures;
using static Thermo.Active.Config.ServerConfig;
using static Thermo.Active.Model.Constants;
using static Thermo.Active.Utils.ExceptionManager;
-using Thermo.Active.Model.DTOModels.Recipe;
public static class ThreadsFunctions
{
@@ -121,7 +122,7 @@ public static class ThreadsFunctions
catch (ThreadAbortException ex)
{
ncAdapter.Dispose();
- }
+ }
}
///
diff --git a/Thermo.Active.Core/ThreadsSiemensHmi.cs b/Thermo.Active.Core/ThreadsSiemensHmi.cs
index 21d05591..8fb3e4fb 100644
--- a/Thermo.Active.Core/ThreadsSiemensHmi.cs
+++ b/Thermo.Active.Core/ThreadsSiemensHmi.cs
@@ -1,12 +1,12 @@
-using Thermo.Active.Core.Properties;
-using Thermo.Active.Model;
-using Thermo.Active.Utils;
-using System;
+using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using TeamDev.SDK.MVVM;
+using Thermo.Active.Core.Properties;
+using Thermo.Active.Model;
+using Thermo.Active.Utils;
namespace Thermo.Active.Core
{
@@ -125,7 +125,7 @@ namespace Thermo.Active.Core
public static void StopThread()
{
- if (SiemensHmi!= null && SiemensHmi.IsAlive)
+ if (SiemensHmi != null && SiemensHmi.IsAlive)
SiemensHmi.Abort();
}
diff --git a/Thermo.Active.Database/Controllers/AlarmsController.cs b/Thermo.Active.Database/Controllers/AlarmsController.cs
index a980655f..308ab20b 100644
--- a/Thermo.Active.Database/Controllers/AlarmsController.cs
+++ b/Thermo.Active.Database/Controllers/AlarmsController.cs
@@ -1,15 +1,13 @@
-using Thermo.Active.Model.DatabaseModels;
-using Thermo.Active.Model.DTOModels;
-using Thermo.Active.Model.DTOModels.AlarmModels;
-using System;
+using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.IO;
using System.Linq;
-using static Thermo.Active.Model.Constants;
+using Thermo.Active.Model.DatabaseModels;
+using Thermo.Active.Model.DTOModels;
+using Thermo.Active.Model.DTOModels.AlarmModels;
using static Thermo.Active.Config.ServerConfig;
-using System.Diagnostics;
-using Thermo.Active.Config;
+using static Thermo.Active.Model.Constants;
namespace Thermo.Active.Database.Controllers
{
@@ -37,7 +35,7 @@ namespace Thermo.Active.Database.Controllers
var index = userIds.IndexOf(-1);
if (userIds.IndexOf(-1) != -1)
ifNoUser = true;
-
+
List ncAlarmDescIds = dbCtx
.AlarmDescriptions
.Where(x => x.Title.Contains(title))
@@ -45,7 +43,7 @@ namespace Thermo.Active.Database.Controllers
.ToList();
// Get Plc messages ids
- List plcAlarmDescIds =
+ List plcAlarmDescIds =
plcMessages
.Where(x => x.Value.IndexOf(title, StringComparison.OrdinalIgnoreCase) >= 0)
//.Where(x => x.Value.Contains(title))
@@ -60,8 +58,8 @@ namespace Thermo.Active.Database.Controllers
.Where(x =>
x.TimeStamp >= startDate && x.TimeStamp <= endDate // Filter by date
&& sources.Contains(x.Source) // Check source
- && ( (ifNoUser && x.Users.Count() == 0) || x.Users.Any(y => userIds.Any(z => z == y.UserId))) // Check user
- &&
+ && ((ifNoUser && x.Users.Count() == 0) || x.Users.Any(y => userIds.Any(z => z == y.UserId))) // Check user
+ &&
((x.Source == ALARM_SOURCE.NC && ncAlarmDescIds.Contains(x.AlarmDescriptionId.Value)) // Check if message is contained in NC messages
|| (x.Source == ALARM_SOURCE.PLC && plcAlarmDescIds.Contains(x.AlarmId))) // Check if message is contained in PLC messages
).OrderByDescending(t => t.AlarmOccurrenceId);
@@ -137,7 +135,7 @@ namespace Thermo.Active.Database.Controllers
{
int numberOfRows = CountRows();
- if(numberOfRows >= ServerStartupConfig.MaxAlarmsRows)
+ if (numberOfRows >= ServerStartupConfig.MaxAlarmsRows)
{
dbCtx.Database.ExecuteSqlCommand("DELETE FROM alarm_occurrence LIMIT {0}", ServerStartupConfig.AlarmToDelete);
}
@@ -151,7 +149,7 @@ namespace Thermo.Active.Database.Controllers
public void EmptyAlarms()
{
int numberOfRows = CountRows();
-
+
dbCtx.Database.ExecuteSqlCommand("DELETE FROM alarm_occurrence LIMIT {0}", numberOfRows);
}
diff --git a/Thermo.Active.Database/Controllers/FunctionsAccessController.cs b/Thermo.Active.Database/Controllers/FunctionsAccessController.cs
index 18399403..5f77e418 100644
--- a/Thermo.Active.Database/Controllers/FunctionsAccessController.cs
+++ b/Thermo.Active.Database/Controllers/FunctionsAccessController.cs
@@ -1,8 +1,8 @@
-using Thermo.Active.Model.DatabaseModels;
-using Thermo.Active.Model.DTOModels;
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
+using Thermo.Active.Model.DatabaseModels;
+using Thermo.Active.Model.DTOModels;
using static CMS_CORE_Library.Models.DataStructures;
using static Thermo.Active.Config.ServerConfig;
@@ -59,8 +59,8 @@ namespace Thermo.Active.Database.Controllers
{
return dbCtx
.FunctionsAccess
- .Select( x => new DTORuntimeFunctionalityModel()
- {
+ .Select(x => new DTORuntimeFunctionalityModel()
+ {
Id = x.FunctionAccessId,
Area = x.Area,
Name = x.Name,
diff --git a/Thermo.Active.Database/Controllers/MachinesController.cs b/Thermo.Active.Database/Controllers/MachinesController.cs
index 52b0cca3..8546f620 100644
--- a/Thermo.Active.Database/Controllers/MachinesController.cs
+++ b/Thermo.Active.Database/Controllers/MachinesController.cs
@@ -1,6 +1,6 @@
-using Thermo.Active.Model.DatabaseModels;
-using System;
+using System;
using System.Linq;
+using Thermo.Active.Model.DatabaseModels;
using static Thermo.Active.Config.ServerConfig;
namespace Thermo.Active.Database.Controllers
diff --git a/Thermo.Active.Database/Controllers/MachinesUsersController.cs b/Thermo.Active.Database/Controllers/MachinesUsersController.cs
index 53a9475d..5a891910 100644
--- a/Thermo.Active.Database/Controllers/MachinesUsersController.cs
+++ b/Thermo.Active.Database/Controllers/MachinesUsersController.cs
@@ -1,8 +1,8 @@
-using Thermo.Active.Model.DatabaseModels;
-using Thermo.Active.Model.DTOModels;
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
+using Thermo.Active.Model.DatabaseModels;
+using Thermo.Active.Model.DTOModels;
using static Thermo.Active.Model.Constants;
namespace Thermo.Active.Database.Controllers
diff --git a/Thermo.Active.Database/Controllers/MaintenancesController.cs b/Thermo.Active.Database/Controllers/MaintenancesController.cs
index 97763646..f8a9678b 100644
--- a/Thermo.Active.Database/Controllers/MaintenancesController.cs
+++ b/Thermo.Active.Database/Controllers/MaintenancesController.cs
@@ -1,13 +1,13 @@
-using Thermo.Active.Model.DatabaseModels;
-using Thermo.Active.Model.DTOModels;
-using Thermo.Active.Model.DTOModels.MaintenanceModels;
-using Thermo.Active.Utils;
-using System;
+using System;
using System.Collections;
using System.Collections.Generic;
using System.Data.Entity;
using System.IO;
using System.Linq;
+using Thermo.Active.Model.DatabaseModels;
+using Thermo.Active.Model.DTOModels;
+using Thermo.Active.Model.DTOModels.MaintenanceModels;
+using Thermo.Active.Utils;
using static Thermo.Active.Config.ServerConfig;
using static Thermo.Active.Model.Constants;
@@ -42,7 +42,7 @@ namespace Thermo.Active.Database.Controllers
foreach (PerformedMaintenanceModel maintenance in maintList)
{
- if(maintenance.ControlWord != -2)
+ if (maintenance.ControlWord != -2)
valRet.Add(new DTOPerformModel()
{
Date = maintenance.Date,
@@ -64,7 +64,7 @@ namespace Thermo.Active.Database.Controllers
where m1.MaintenanceId == maintenances.MaintenanceId
select m1.Date
).Max()
- select maintenances)
+ select maintenances)
.Include("Maintainer")
.ToList();
@@ -78,7 +78,7 @@ namespace Thermo.Active.Database.Controllers
CounterValue = (int)counterValue,
Date = DateTime.Now,
MaintenanceId = maintenanceId,
- MaintainerId = userId,
+ MaintainerId = userId,
ControlWord = controlWord
};
@@ -204,7 +204,7 @@ namespace Thermo.Active.Database.Controllers
// find maintenances to be updated into db
var old = dbCtx.Maintenances.FirstOrDefault(x => x.MaintenanceId == item.MaintenanceId);
- if(old != null)
+ if (old != null)
// Update model
old = MaintenancesConfig.Where(x => x.Id == item.MaintenanceId).Select(x =>
{
@@ -397,14 +397,14 @@ namespace Thermo.Active.Database.Controllers
cw = -1;
SupportFunctions.ConvertStringMachineNumberIntoNumber(machineNumber, out bool containsLetters, out int intMachineVal);
- if (!GetDataFromMaintenancePassword(password, containsLetters, out int pwdMachineNumber, out int pwdHours, out cw))
+ if (!GetDataFromMaintenancePassword(password, containsLetters, out int pwdMachineNumber, out int pwdHours, out cw))
return false;
// Check machine number
- if(intMachineVal == pwdMachineNumber)
+ if (intMachineVal == pwdMachineNumber)
{
// Convert plcCounter in hours and check if password is expired
- if(((plcCounter/3600) - pwdHours) <= 50)
+ if (((plcCounter / 3600) - pwdHours) <= 50)
{
return true; // Ok
}
@@ -458,10 +458,10 @@ namespace Thermo.Active.Database.Controllers
tmpPassword4 = tmpPassword5.Remove(tmpPassword5.Length - 1);
// Create tmpPassoword3
- foreach(char c in tmpPassword4)
+ foreach (char c in tmpPassword4)
{
// If tmpPassword is empty copy the first character
- if(tmpPassword3.Length == 0)
+ if (tmpPassword3.Length == 0)
{
tmpPassword3 = c.ToString();
}
diff --git a/Thermo.Active.Database/Controllers/ProdInfoController.cs b/Thermo.Active.Database/Controllers/ProdInfoController.cs
index 9640429b..6e8fa0c5 100644
--- a/Thermo.Active.Database/Controllers/ProdInfoController.cs
+++ b/Thermo.Active.Database/Controllers/ProdInfoController.cs
@@ -1,9 +1,7 @@
-using Thermo.Active.Model.DatabaseModels;
-using System;
-using System.Linq;
-using static Thermo.Active.Config.ServerConfig;
+using System;
using System.Collections.Generic;
-using CMS_CORE_Library.Models;
+using System.Linq;
+using Thermo.Active.Model.DatabaseModels;
namespace Thermo.Active.Database.Controllers
{
diff --git a/Thermo.Active.Database/Controllers/QueueController.cs b/Thermo.Active.Database/Controllers/QueueController.cs
index 629415a9..0e4becc9 100644
--- a/Thermo.Active.Database/Controllers/QueueController.cs
+++ b/Thermo.Active.Database/Controllers/QueueController.cs
@@ -1,10 +1,8 @@
-using Thermo.Active.Model.DatabaseModels;
-using Thermo.Active.Model.DTOModels;
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using Thermo.Active.Model.DatabaseModels;
+using Thermo.Active.Model.DTOModels;
using static Thermo.Active.Model.Constants;
namespace Thermo.Active.Database.Controllers
@@ -30,12 +28,12 @@ namespace Thermo.Active.Database.Controllers
public void UpdateQueue()
{
dbCtx.Queue.RemoveRange(dbCtx.Queue);
-
+
var dbRows = new List();
foreach (var item in PartProgramQueue)
{
// Create database model
- dbRows =item.Value.Select(x => new QueueItemsModel()
+ dbRows = item.Value.Select(x => new QueueItemsModel()
{
Id = x.Id,
AbsolutePath = x.AbsolutePath,
@@ -49,7 +47,7 @@ namespace Thermo.Active.Database.Controllers
// Add to db
dbCtx.Queue.AddRange(dbRows);
}
-
+
dbCtx.SaveChanges();
}
@@ -65,14 +63,14 @@ namespace Thermo.Active.Database.Controllers
item.RemainingReps = reps;
dbCtx.SaveChanges();
-
+
}
public void DeleteItem(int processId, int id)
{
QueueItemsModel item = dbCtx.Queue.FirstOrDefault(x => x.Id == id && x.Process == processId);
- if(item == null)
+ if (item == null)
return;
dbCtx.Queue.Remove(item);
@@ -84,7 +82,7 @@ namespace Thermo.Active.Database.Controllers
{
var dbQueue = dbCtx.Queue.ToList();
bool foundData = false;
- foreach(var entity in dbQueue)
+ foreach (var entity in dbQueue)
{
// Check if process queue exists
if (!PartProgramQueue.ContainsKey(entity.Process))
@@ -111,13 +109,13 @@ namespace Thermo.Active.Database.Controllers
QueueRunningIndexes[entity.Process] = entity.Id - 1;
}
}
-
+
public void UpdateQueueIdsAndSave(int processId)
{
// Fix new ids
for (int i = 0; i < PartProgramQueue[processId].Count(); i++)
PartProgramQueue[processId][i].Id = i + 1;
-
+
UpdateQueue();
}
}
diff --git a/Thermo.Active.Database/Controllers/RedisController.cs b/Thermo.Active.Database/Controllers/RedisController.cs
index ef29f5ba..bad36f97 100644
--- a/Thermo.Active.Database/Controllers/RedisController.cs
+++ b/Thermo.Active.Database/Controllers/RedisController.cs
@@ -1,9 +1,5 @@
-using Thermo.Active.Database.Redis;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Collections.Generic;
+using Thermo.Active.Database.Redis;
namespace Thermo.Active.Database.Controllers
{
@@ -41,7 +37,7 @@ namespace Thermo.Active.Database.Controllers
redUtil.man.setRSV(redisHash, RepsDone);
}
- public static bool WriteAlarmsConfigCurr(Dictionary alarms)
+ public static bool WriteAlarmsConfigCurr(Dictionary alarms)
{
string redisHash = redUtil.man.redHash(redisAlmCurr);
return redUtil.man.redSaveHashDict(redisHash, alarms);
diff --git a/Thermo.Active.Database/Controllers/SessionsController.cs b/Thermo.Active.Database/Controllers/SessionsController.cs
index b545f4b0..506272b2 100644
--- a/Thermo.Active.Database/Controllers/SessionsController.cs
+++ b/Thermo.Active.Database/Controllers/SessionsController.cs
@@ -1,7 +1,7 @@
-using Thermo.Active.Model.DatabaseModels;
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
+using Thermo.Active.Model.DatabaseModels;
namespace Thermo.Active.Database.Controllers
{
diff --git a/Thermo.Active.Database/Controllers/UserSoftkeysController.cs b/Thermo.Active.Database/Controllers/UserSoftkeysController.cs
index e4552b20..cc86becc 100644
--- a/Thermo.Active.Database/Controllers/UserSoftkeysController.cs
+++ b/Thermo.Active.Database/Controllers/UserSoftkeysController.cs
@@ -1,10 +1,10 @@
-using Thermo.Active.Model.DatabaseModels;
-using Thermo.Active.Model.DTOModels;
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
-using static Thermo.Active.Model.Constants;
+using Thermo.Active.Model.DatabaseModels;
+using Thermo.Active.Model.DTOModels;
using static Thermo.Active.Config.ServerConfig;
+using static Thermo.Active.Model.Constants;
namespace Thermo.Active.Database.Controllers
{
diff --git a/Thermo.Active.Database/Controllers/UsersController.cs b/Thermo.Active.Database/Controllers/UsersController.cs
index 4a39ef36..021acb3b 100644
--- a/Thermo.Active.Database/Controllers/UsersController.cs
+++ b/Thermo.Active.Database/Controllers/UsersController.cs
@@ -1,10 +1,10 @@
-using Thermo.Active.Model.DatabaseModels;
-using Thermo.Active.Model.DTOModels;
-using System;
+using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web.Helpers;
+using Thermo.Active.Model.DatabaseModels;
+using Thermo.Active.Model.DTOModels;
using static Thermo.Active.Config.ServerConfig;
using static Thermo.Active.Model.Constants;
@@ -34,7 +34,7 @@ namespace Thermo.Active.Database.Controllers
// Commit changes
dbCtx.SaveChanges();
- using(MachinesUsersController machController = new MachinesUsersController())
+ using (MachinesUsersController machController = new MachinesUsersController())
{
machController.Create(MachineConfig.MachineId, user.UserId, 3);
}
@@ -166,13 +166,13 @@ namespace Thermo.Active.Database.Controllers
var tmpUser = dbCtx
.Users
.Where(x => x.Deleted == false) // Get not deleted users
- .Join( dbCtx.MachinesUsers,
+ .Join(dbCtx.MachinesUsers,
u => u.UserId,
- m => m.UserId,
+ m => m.UserId,
(u, m) => new { Users = u, MachinesUsers = m }
)
.Where(x => x.MachinesUsers.Role.Level < MIN_CMS_ROLE)
- .ToList();
+ .ToList();
return tmpUser
.Select(x => new DTOMessageUserModel() // Return DTOUserModel
@@ -184,7 +184,7 @@ namespace Thermo.Active.Database.Controllers
})
.GroupBy(elem => elem.Id).Select(group => group.First())
.ToList();
- }
+ }
}
#region User Manager
@@ -210,7 +210,7 @@ namespace Thermo.Active.Database.Controllers
Language = x.Language,
Role = machineController.GetUserRoleData(MachineConfig.MachineId, x.UserId)
}).Where(
- x=> x.Role.Level < MIN_CMS_ROLE)
+ x => x.Role.Level < MIN_CMS_ROLE)
.ToList();
}
}
diff --git a/Thermo.Active.Database/DatabaseContext.cs b/Thermo.Active.Database/DatabaseContext.cs
index db17d046..e6d5c470 100644
--- a/Thermo.Active.Database/DatabaseContext.cs
+++ b/Thermo.Active.Database/DatabaseContext.cs
@@ -1,16 +1,15 @@
using Microsoft.Win32;
using MySql.Data.Entity;
-using Thermo.Active.Database.Controllers;
-using Thermo.Active.Database.Migrations;
-using Thermo.Active.Model.DatabaseModels;
using System;
-
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Globalization;
using System.IO;
using System.Linq;
using System.ServiceProcess;
+using Thermo.Active.Database.Controllers;
+using Thermo.Active.Database.Migrations;
+using Thermo.Active.Model.DatabaseModels;
using static Thermo.Active.Config.ServerConfig;
using static Thermo.Active.Model.Constants;
using static Thermo.Active.Utils.ExceptionManager;
@@ -86,7 +85,7 @@ namespace Thermo.Active.Database
{
// Run migrations and seed.
migrator.Update();
- }
+ }
FindOrCreateMachineUniqueId();
diff --git a/Thermo.Active.Database/Migrations/202004241109233_Thermo-Start.cs b/Thermo.Active.Database/Migrations/202004241109233_Thermo-Start.cs
index 43f57be3..553d4610 100644
--- a/Thermo.Active.Database/Migrations/202004241109233_Thermo-Start.cs
+++ b/Thermo.Active.Database/Migrations/202004241109233_Thermo-Start.cs
@@ -1,8 +1,7 @@
namespace Thermo.Active.Database.Migrations
{
- using System;
using System.Data.Entity.Migrations;
-
+
public partial class ThermoStart : DbMigration
{
public override void Up()
@@ -10,268 +9,268 @@ namespace Thermo.Active.Database.Migrations
CreateTable(
"dbo.alarm_description",
c => new
- {
- id = c.Int(nullable: false),
- title = c.String(unicode: false),
- })
+ {
+ id = c.Int(nullable: false),
+ title = c.String(unicode: false),
+ })
.PrimaryKey(t => t.id);
-
+
CreateTable(
"dbo.alarm_file",
c => new
- {
- id = c.Int(nullable: false, identity: true),
- file_name = c.String(unicode: false),
- local_file_name = c.String(unicode: false),
- alarm_desc_id = c.Int(nullable: false),
- source = c.Int(nullable: false),
- user_id = c.Int(),
- })
+ {
+ id = c.Int(nullable: false, identity: true),
+ file_name = c.String(unicode: false),
+ local_file_name = c.String(unicode: false),
+ alarm_desc_id = c.Int(nullable: false),
+ source = c.Int(nullable: false),
+ user_id = c.Int(),
+ })
.PrimaryKey(t => t.id)
.ForeignKey("dbo.user", t => t.user_id)
.Index(t => t.user_id);
-
+
CreateTable(
"dbo.user",
c => new
- {
- id = c.Int(nullable: false, identity: true),
- username = c.String(nullable: false, unicode: false),
- first_name = c.String(unicode: false),
- last_name = c.String(unicode: false),
- password = c.String(unicode: false),
- security_stamp = c.String(unicode: false),
- language = c.String(unicode: false),
- deleted = c.Boolean(nullable: false),
- })
+ {
+ id = c.Int(nullable: false, identity: true),
+ username = c.String(nullable: false, unicode: false),
+ first_name = c.String(unicode: false),
+ last_name = c.String(unicode: false),
+ password = c.String(unicode: false),
+ security_stamp = c.String(unicode: false),
+ language = c.String(unicode: false),
+ deleted = c.Boolean(nullable: false),
+ })
.PrimaryKey(t => t.id);
-
+
CreateTable(
"dbo.alarm_occurrence",
c => new
- {
- id = c.Int(nullable: false, identity: true),
- alarm_id = c.Int(nullable: false),
- alarm_description_id = c.Int(),
- source = c.Int(nullable: false),
- type = c.Int(nullable: false),
- processes = c.Int(nullable: false),
- timestamp = c.DateTime(nullable: false, precision: 0),
- })
+ {
+ id = c.Int(nullable: false, identity: true),
+ alarm_id = c.Int(nullable: false),
+ alarm_description_id = c.Int(),
+ source = c.Int(nullable: false),
+ type = c.Int(nullable: false),
+ processes = c.Int(nullable: false),
+ timestamp = c.DateTime(nullable: false, precision: 0),
+ })
.PrimaryKey(t => t.id)
.ForeignKey("dbo.alarm_description", t => t.alarm_description_id)
.Index(t => t.alarm_description_id);
-
+
CreateTable(
"dbo.alarm_user",
c => new
- {
- user_id = c.Int(nullable: false),
- alarm_occurence_id = c.Int(nullable: false),
- })
+ {
+ user_id = c.Int(nullable: false),
+ alarm_occurence_id = c.Int(nullable: false),
+ })
.PrimaryKey(t => new { t.user_id, t.alarm_occurence_id })
.ForeignKey("dbo.alarm_occurrence", t => t.alarm_occurence_id, cascadeDelete: true)
.ForeignKey("dbo.user", t => t.user_id, cascadeDelete: true)
.Index(t => t.user_id)
.Index(t => t.alarm_occurence_id);
-
+
CreateTable(
"dbo.alarm_note",
c => new
- {
- id = c.Int(nullable: false, identity: true),
- message = c.String(unicode: false),
- user_id = c.Int(nullable: false),
- alarm_desc_id = c.Int(nullable: false),
- source = c.Int(nullable: false),
- timestamp = c.DateTime(nullable: false, precision: 0),
- })
+ {
+ id = c.Int(nullable: false, identity: true),
+ message = c.String(unicode: false),
+ user_id = c.Int(nullable: false),
+ alarm_desc_id = c.Int(nullable: false),
+ source = c.Int(nullable: false),
+ timestamp = c.DateTime(nullable: false, precision: 0),
+ })
.PrimaryKey(t => t.id)
.ForeignKey("dbo.user", t => t.user_id, cascadeDelete: true)
.Index(t => t.user_id);
-
+
CreateTable(
"dbo.family",
c => new
- {
- id = c.Short(nullable: false),
- name = c.String(unicode: false),
- right_size = c.Byte(nullable: false),
- left_size = c.Byte(nullable: false),
- tcp_table = c.Byte(nullable: false),
- gamma = c.Byte(nullable: false),
- rotation_type = c.Byte(nullable: false),
- cooling_byte = c.Byte(nullable: false),
- max_speed = c.Int(nullable: false),
- max_load = c.Byte(nullable: false),
- min_load_pct_autoload = c.Byte(nullable: false),
- max_load_pct_autoload = c.Byte(nullable: false),
- dynamic_compensation = c.Byte(nullable: false),
- min_load_dynamic_comp = c.Byte(nullable: false),
- max_load_dynamic_comp = c.Byte(nullable: false),
- life_type = c.Byte(nullable: false),
- nominal_life = c.Int(nullable: false),
- revive_delta = c.Int(nullable: false),
- })
+ {
+ id = c.Short(nullable: false),
+ name = c.String(unicode: false),
+ right_size = c.Byte(nullable: false),
+ left_size = c.Byte(nullable: false),
+ tcp_table = c.Byte(nullable: false),
+ gamma = c.Byte(nullable: false),
+ rotation_type = c.Byte(nullable: false),
+ cooling_byte = c.Byte(nullable: false),
+ max_speed = c.Int(nullable: false),
+ max_load = c.Byte(nullable: false),
+ min_load_pct_autoload = c.Byte(nullable: false),
+ max_load_pct_autoload = c.Byte(nullable: false),
+ dynamic_compensation = c.Byte(nullable: false),
+ min_load_dynamic_comp = c.Byte(nullable: false),
+ max_load_dynamic_comp = c.Byte(nullable: false),
+ life_type = c.Byte(nullable: false),
+ nominal_life = c.Int(nullable: false),
+ revive_delta = c.Int(nullable: false),
+ })
.PrimaryKey(t => t.id);
-
+
CreateTable(
"dbo.favorite_user_softkey",
c => new
- {
- user_softkey_id = c.Int(nullable: false),
- user_id = c.Int(nullable: false),
- })
+ {
+ user_softkey_id = c.Int(nullable: false),
+ user_id = c.Int(nullable: false),
+ })
.PrimaryKey(t => new { t.user_softkey_id, t.user_id });
-
+
CreateTable(
"dbo.function_access",
c => new
- {
- id = c.Int(nullable: false, identity: true),
- name = c.String(unicode: false),
- write_level_min = c.Int(nullable: false),
- read_level_min = c.Int(nullable: false),
- area = c.String(unicode: false),
- enabled = c.Boolean(nullable: false),
- plc_id = c.Int(nullable: false),
- })
+ {
+ id = c.Int(nullable: false, identity: true),
+ name = c.String(unicode: false),
+ write_level_min = c.Int(nullable: false),
+ read_level_min = c.Int(nullable: false),
+ area = c.String(unicode: false),
+ enabled = c.Boolean(nullable: false),
+ plc_id = c.Int(nullable: false),
+ })
.PrimaryKey(t => t.id);
-
+
CreateTable(
"dbo.machine",
c => new
- {
- id = c.Int(nullable: false, identity: true),
- name = c.String(unicode: false),
- unique_id = c.String(unicode: false),
- })
+ {
+ id = c.Int(nullable: false, identity: true),
+ name = c.String(unicode: false),
+ unique_id = c.String(unicode: false),
+ })
.PrimaryKey(t => t.id);
-
+
CreateTable(
"dbo.machine_user",
c => new
- {
- id = c.Int(nullable: false, identity: true),
- machine_id = c.Int(nullable: false),
- user_id = c.Int(nullable: false),
- role_id = c.Int(nullable: false),
- })
+ {
+ id = c.Int(nullable: false, identity: true),
+ machine_id = c.Int(nullable: false),
+ user_id = c.Int(nullable: false),
+ role_id = c.Int(nullable: false),
+ })
.PrimaryKey(t => t.id)
.ForeignKey("dbo.machine", t => t.machine_id, cascadeDelete: true)
.ForeignKey("dbo.role", t => t.role_id, cascadeDelete: true)
.ForeignKey("dbo.user", t => t.user_id, cascadeDelete: true)
.Index(t => new { t.machine_id, t.user_id }, unique: true, clustered: true, name: "unique_machine_user")
.Index(t => t.role_id);
-
+
CreateTable(
"dbo.role",
c => new
- {
- id = c.Int(nullable: false, identity: true),
- name = c.String(unicode: false),
- level = c.Int(nullable: false),
- })
+ {
+ id = c.Int(nullable: false, identity: true),
+ name = c.String(unicode: false),
+ level = c.Int(nullable: false),
+ })
.PrimaryKey(t => t.id);
-
+
CreateTable(
"dbo.maintenance_file",
c => new
- {
- id = c.Int(nullable: false, identity: true),
- file_name = c.String(unicode: false),
- local_file_name = c.String(unicode: false),
- maintenance_id = c.Int(nullable: false),
- user_id = c.Int(),
- })
+ {
+ id = c.Int(nullable: false, identity: true),
+ file_name = c.String(unicode: false),
+ local_file_name = c.String(unicode: false),
+ maintenance_id = c.Int(nullable: false),
+ user_id = c.Int(),
+ })
.PrimaryKey(t => t.id)
.ForeignKey("dbo.maintenance", t => t.maintenance_id, cascadeDelete: true)
.ForeignKey("dbo.user", t => t.user_id)
.Index(t => t.maintenance_id)
.Index(t => t.user_id);
-
+
CreateTable(
"dbo.maintenance",
c => new
- {
- id = c.Int(nullable: false),
- intervall = c.Double(),
- deadline = c.DateTime(nullable: false, precision: 0),
- type = c.Int(nullable: false),
- counter_id = c.Int(nullable: false),
- title = c.String(unicode: false),
- description = c.String(unicode: false),
- unit_of_measure = c.Int(),
- creation_date = c.DateTime(nullable: false, precision: 0),
- last_expiration_date = c.DateTime(precision: 0),
- user_id = c.Int(),
- })
+ {
+ id = c.Int(nullable: false),
+ intervall = c.Double(),
+ deadline = c.DateTime(nullable: false, precision: 0),
+ type = c.Int(nullable: false),
+ counter_id = c.Int(nullable: false),
+ title = c.String(unicode: false),
+ description = c.String(unicode: false),
+ unit_of_measure = c.Int(),
+ creation_date = c.DateTime(nullable: false, precision: 0),
+ last_expiration_date = c.DateTime(precision: 0),
+ user_id = c.Int(),
+ })
.PrimaryKey(t => t.id)
.ForeignKey("dbo.user", t => t.user_id)
.Index(t => t.user_id);
-
+
CreateTable(
"dbo.maintenance_note",
c => new
- {
- id = c.Int(nullable: false, identity: true),
- message = c.String(unicode: false),
- user_id = c.Int(nullable: false),
- maintenance_id = c.Int(nullable: false),
- timestamp = c.DateTime(nullable: false, precision: 0),
- })
+ {
+ id = c.Int(nullable: false, identity: true),
+ message = c.String(unicode: false),
+ user_id = c.Int(nullable: false),
+ maintenance_id = c.Int(nullable: false),
+ timestamp = c.DateTime(nullable: false, precision: 0),
+ })
.PrimaryKey(t => t.id)
.ForeignKey("dbo.maintenance", t => t.maintenance_id, cascadeDelete: true)
.ForeignKey("dbo.user", t => t.user_id, cascadeDelete: true)
.Index(t => t.user_id)
.Index(t => t.maintenance_id);
-
+
CreateTable(
"dbo.performed_maintenance",
c => new
- {
- id = c.Int(nullable: false, identity: true),
- date = c.DateTime(nullable: false, precision: 0),
- counter_value = c.Int(nullable: false),
- control_word = c.Int(nullable: false),
- maintenance = c.Int(nullable: false),
- maintainers_id = c.Int(),
- })
+ {
+ id = c.Int(nullable: false, identity: true),
+ date = c.DateTime(nullable: false, precision: 0),
+ counter_value = c.Int(nullable: false),
+ control_word = c.Int(nullable: false),
+ maintenance = c.Int(nullable: false),
+ maintainers_id = c.Int(),
+ })
.PrimaryKey(t => t.id)
.ForeignKey("dbo.user", t => t.maintainers_id)
.ForeignKey("dbo.maintenance", t => t.maintenance, cascadeDelete: true)
.Index(t => t.maintenance)
.Index(t => t.maintainers_id);
-
+
CreateTable(
"dbo.queue",
c => new
- {
- id = c.Int(nullable: false),
- process = c.Int(nullable: false),
- part_program_name = c.String(unicode: false),
- reps = c.Int(nullable: false),
- remaining_reps = c.Int(nullable: false),
- absolute_path = c.String(unicode: false),
- status = c.Int(nullable: false),
- })
+ {
+ id = c.Int(nullable: false),
+ process = c.Int(nullable: false),
+ part_program_name = c.String(unicode: false),
+ reps = c.Int(nullable: false),
+ remaining_reps = c.Int(nullable: false),
+ absolute_path = c.String(unicode: false),
+ status = c.Int(nullable: false),
+ })
.PrimaryKey(t => new { t.id, t.process });
-
+
CreateTable(
"dbo.session",
c => new
- {
- id = c.Int(nullable: false, identity: true),
- token = c.String(unicode: false),
- machine_user_id = c.Int(nullable: false),
- first_login = c.DateTime(nullable: false, precision: 0),
- })
+ {
+ id = c.Int(nullable: false, identity: true),
+ token = c.String(unicode: false),
+ machine_user_id = c.Int(nullable: false),
+ first_login = c.DateTime(nullable: false, precision: 0),
+ })
.PrimaryKey(t => t.id)
.ForeignKey("dbo.machine_user", t => t.machine_user_id, cascadeDelete: true)
.Index(t => t.machine_user_id);
-
+
}
-
+
public override void Down()
{
DropForeignKey("dbo.session", "machine_user_id", "dbo.machine_user");
diff --git a/Thermo.Active.Database/Migrations/202006170558519_AddedProdInfoModel.cs b/Thermo.Active.Database/Migrations/202006170558519_AddedProdInfoModel.cs
index b9edff16..f4796750 100644
--- a/Thermo.Active.Database/Migrations/202006170558519_AddedProdInfoModel.cs
+++ b/Thermo.Active.Database/Migrations/202006170558519_AddedProdInfoModel.cs
@@ -1,8 +1,7 @@
namespace Thermo.Active.Database.Migrations
{
- using System;
using System.Data.Entity.Migrations;
-
+
public partial class AddedProdInfoModel : DbMigration
{
public override void Up()
@@ -10,26 +9,26 @@ namespace Thermo.Active.Database.Migrations
CreateTable(
"dbo.ProdInfo",
c => new
- {
- DtEvent = c.DateTime(nullable: false, precision: 0),
- NumTarget = c.Short(nullable: false),
- NumDone = c.Short(nullable: false),
- TimeWarm = c.Int(nullable: false),
- TimeVent = c.Int(nullable: false),
- TimeVacuum = c.Int(nullable: false),
- TimeCycleGross = c.Int(nullable: false),
- TimeCycleNet = c.Int(nullable: false),
- MaterialTempEndWarm = c.Double(nullable: false),
- MaterialTempEndVent = c.Double(nullable: false),
- MoldTemp = c.Double(nullable: false),
- VacuumReadVal = c.Double(nullable: false),
- MouldEnergyOUT = c.Double(nullable: false),
- MouldEnergyIN = c.Double(nullable: false),
- })
+ {
+ DtEvent = c.DateTime(nullable: false, precision: 0),
+ NumTarget = c.Short(nullable: false),
+ NumDone = c.Short(nullable: false),
+ TimeWarm = c.Int(nullable: false),
+ TimeVent = c.Int(nullable: false),
+ TimeVacuum = c.Int(nullable: false),
+ TimeCycleGross = c.Int(nullable: false),
+ TimeCycleNet = c.Int(nullable: false),
+ MaterialTempEndWarm = c.Double(nullable: false),
+ MaterialTempEndVent = c.Double(nullable: false),
+ MoldTemp = c.Double(nullable: false),
+ VacuumReadVal = c.Double(nullable: false),
+ MouldEnergyOUT = c.Double(nullable: false),
+ MouldEnergyIN = c.Double(nullable: false),
+ })
.PrimaryKey(t => t.DtEvent);
-
+
}
-
+
public override void Down()
{
DropTable("dbo.ProdInfo");
diff --git a/Thermo.Active.Database/Migrations/Configuration.cs b/Thermo.Active.Database/Migrations/Configuration.cs
index d33a5d5e..fb926f21 100644
--- a/Thermo.Active.Database/Migrations/Configuration.cs
+++ b/Thermo.Active.Database/Migrations/Configuration.cs
@@ -1,13 +1,10 @@
namespace Thermo.Active.Database.Migrations
{
- using System;
- using System.Data.Entity;
- using System.Linq;
- using Thermo.Active.Model.DatabaseModels;
using System.Data.Entity.Migrations;
- using static Thermo.Active.Model.Constants.FUNCTIONALITY_NAMES;
- using static Thermo.Active.Model.Constants.AREAS;
+ using Thermo.Active.Model.DatabaseModels;
using static Thermo.Active.Model.Constants;
+ using static Thermo.Active.Model.Constants.AREAS;
+ using static Thermo.Active.Model.Constants.FUNCTIONALITY_NAMES;
internal sealed class Configuration : DbMigrationsConfiguration
{
@@ -30,7 +27,7 @@ namespace Thermo.Active.Database.Migrations
new RoleModel() { RoleId = (int)ROLE_IDS.CUSTOMER_MAINTAINER, Level = 10, Name = "Maintainer" }
);
- context.FunctionsAccess.AddOrUpdate(
+ context.FunctionsAccess.AddOrUpdate(x => x.Name,
// General Function, if plcId is 0 then the functionality is not connected to the NC
new FunctionAccessModel() { Name = GENERAL, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 0 },
new FunctionAccessModel() { Name = USER_FUNCTIONS, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 0 },
diff --git a/Thermo.Active.Database/Properties/AssemblyInfo.cs b/Thermo.Active.Database/Properties/AssemblyInfo.cs
index 2ebd8c06..766b0050 100644
--- a/Thermo.Active.Database/Properties/AssemblyInfo.cs
+++ b/Thermo.Active.Database/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Le informazioni generali relative a un assembly sono controllate dal seguente
diff --git a/Thermo.Active.Database/Redis/redUtil.cs b/Thermo.Active.Database/Redis/redUtil.cs
index f9b26a69..e5df7388 100644
--- a/Thermo.Active.Database/Redis/redUtil.cs
+++ b/Thermo.Active.Database/Redis/redUtil.cs
@@ -7,799 +7,799 @@ using System.Collections.Generic;
namespace Thermo.Active.Database.Redis
{
- public class redUtil
- {
- ///
- /// wrapper di log
- ///
- public static Logger lg;
- private const string baseHash = "SOUR";
+ public class redUtil
+ {
+ ///
+ /// wrapper di log
+ ///
+ public static Logger lg;
+ private const string baseHash = "SOUR";
- public redUtil()
- {
- lg = LogManager.GetCurrentClassLogger();
- }
- ///
- /// Metodo accesso statico
- ///
- public static redUtil man = new redUtil();
+ public redUtil()
+ {
+ lg = LogManager.GetCurrentClassLogger();
+ }
+ ///
+ /// Metodo accesso statico
+ ///
+ public static redUtil man = new redUtil();
- #region gestione valori in RedisCache
+ #region gestione valori in RedisCache
- ///
- /// Nome della variabile HASH da utilizzare (dato CodModulo / Server / DB impiegato da funzionalita' DbConfig) + keyName richiesto...
- ///
- public string redHash(string keyName)
- {
- string answ = keyName;
- try
- {
- answ = string.Format("{0}:{1}", baseHash, keyName);
- }
- catch
- { }
- return answ;
- }
+ ///
+ /// Nome della variabile HASH da utilizzare (dato CodModulo / Server / DB impiegato da funzionalita' DbConfig) + keyName richiesto...
+ ///
+ public string redHash(string keyName)
+ {
+ string answ = keyName;
+ try
+ {
+ answ = string.Format("{0}:{1}", baseHash, keyName);
+ }
+ catch
+ { }
+ return answ;
+ }
- ///
- /// Connessione lazy a redis...
- ///
- private static Lazy lazyConnection = new Lazy(() =>
- {
- return ConnectionMultiplexer.Connect("127.0.0.1,abortConnect=false,ssl=false");
- });
- ///
- /// Connessione lazy a redis...
- ///
- private static Lazy lazyConnectionAdmin = new Lazy(() =>
- {
- return ConnectionMultiplexer.Connect("127.0.0.1,abortConnect=false,ssl=false,allowAdmin=true");
- });
- ///
- /// Oggetto statico connessione redis
- ///
- public static ConnectionMultiplexer connRedis
- {
- get
- {
- return lazyConnection.Value;
- }
- }
- ///
- /// Oggetto statico connessione redis
- ///
- public static ConnectionMultiplexer connRedisAdmin
- {
- get
- {
- return lazyConnectionAdmin.Value;
- }
- }
- ///
- /// Restituisce info dei server connessi...
- ///
- ///
- public IServer[] redServInfo()
- {
- IServer[] answ = new IServer[1];
- if (connRedisAdmin.IsConnected)
- {
- try
+ ///
+ /// Connessione lazy a redis...
+ ///
+ private static Lazy lazyConnection = new Lazy(() =>
{
- answ = new IServer[connRedisAdmin.GetEndPoints().Length];
- int i = 0;
- foreach (var ep in connRedisAdmin.GetEndPoints())
- {
- var server = connRedisAdmin.GetServer(ep);
- answ[i] = server;
- i++;
- }
- }
- catch (Exception exc)
+ return ConnectionMultiplexer.Connect("127.0.0.1,abortConnect=false,ssl=false");
+ });
+ ///
+ /// Connessione lazy a redis...
+ ///
+ private static Lazy lazyConnectionAdmin = new Lazy(() =>
{
- lg.Error("Eccezione in redServInfo: " + exc.ToString());
+ return ConnectionMultiplexer.Connect("127.0.0.1,abortConnect=false,ssl=false,allowAdmin=true");
+ });
+ ///
+ /// Oggetto statico connessione redis
+ ///
+ public static ConnectionMultiplexer connRedis
+ {
+ get
+ {
+ return lazyConnection.Value;
+ }
+ }
+ ///
+ /// Oggetto statico connessione redis
+ ///
+ public static ConnectionMultiplexer connRedisAdmin
+ {
+ get
+ {
+ return lazyConnectionAdmin.Value;
+ }
+ }
+ ///
+ /// Restituisce info dei server connessi...
+ ///
+ ///
+ public IServer[] redServInfo()
+ {
+ IServer[] answ = new IServer[1];
+ if (connRedisAdmin.IsConnected)
+ {
+ try
+ {
+ answ = new IServer[connRedisAdmin.GetEndPoints().Length];
+ int i = 0;
+ foreach (var ep in connRedisAdmin.GetEndPoints())
+ {
+ var server = connRedisAdmin.GetServer(ep);
+ answ[i] = server;
+ i++;
+ }
+ }
+ catch (Exception exc)
+ {
+ lg.Error("Eccezione in redServInfo: " + exc.ToString());
+ }
+ }
+ else
+ {
+ lg.Error("Server REDIS Admin non disponibile");
+ }
+ return answ;
}
- }
- else
- {
- lg.Error("Server REDIS Admin non disponibile");
- }
- return answ;
- }
- ///
- /// Restituisce una chiave salvata in RedisCache
- ///
- ///
- ///
- public string getRSV(string chiave)
- {
- string answ = "";
- if (connRedis.IsConnected)
- {
- try
+ ///
+ /// Restituisce una chiave salvata in RedisCache
+ ///
+ ///
+ ///
+ public string getRSV(string chiave)
{
- IDatabase cache = connRedis.GetDatabase();
- answ = cache.StringGet(chiave);
+ string answ = "";
+ if (connRedis.IsConnected)
+ {
+ try
+ {
+ IDatabase cache = connRedis.GetDatabase();
+ answ = cache.StringGet(chiave);
+ }
+ catch (Exception exc)
+ {
+ lg.Info(string.Format("Errore in getRSV:{0}{1}", Environment.NewLine, exc));
+ }
+ }
+ else
+ {
+ lg.Error("Server REDIS non disponibile per getRSV");
+ }
+ return answ;
}
- catch (Exception exc)
+ ///
+ /// Salva una chiave in RedisCache
+ ///
+ ///
+ ///
+ ///
+ public bool setRSV(string chiave, string valore)
{
- lg.Info(string.Format("Errore in getRSV:{0}{1}", Environment.NewLine, exc));
+ bool answ = false;
+ if (connRedis.IsConnected)
+ {
+ try
+ {
+ IDatabase cache = connRedis.GetDatabase();
+ cache.StringSet(chiave, valore);
+ answ = true;
+ }
+ catch (Exception exc)
+ {
+ lg.Info(string.Format("Errore in setRSV:{0}{1}", Environment.NewLine, exc));
+ }
+ }
+ else
+ {
+ lg.Error("Server REDIS non disponibile (setRSV)");
+ }
+ return answ;
}
- }
- else
- {
- lg.Error("Server REDIS non disponibile per getRSV");
- }
- return answ;
- }
- ///
- /// Salva una chiave in RedisCache
- ///
- ///
- ///
- ///
- public bool setRSV(string chiave, string valore)
- {
- bool answ = false;
- if (connRedis.IsConnected)
- {
- try
+ ///
+ /// Salva una chiave in RedisCache
+ ///
+ ///
+ ///
+ /// in secondi
+ ///
+ public bool setRSV(string chiave, string valore, int TTL_sec)
{
- IDatabase cache = connRedis.GetDatabase();
- cache.StringSet(chiave, valore);
- answ = true;
+ bool answ = false;
+ if (connRedis.IsConnected)
+ {
+ try
+ {
+ IDatabase cache = connRedis.GetDatabase();
+ TimeSpan expT = new TimeSpan(0, 0, TTL_sec);
+ // salvo con expyry...
+ cache.StringSet(chiave, valore, expT);
+ answ = true;
+ }
+ catch (Exception exc)
+ {
+ lg.Info(string.Format("Errore in setRSV:{0}{1}", Environment.NewLine, exc));
+ }
+ }
+ else
+ {
+ lg.Error("Server REDIS non disponibile (setRSV:TTL)");
+ }
+ return answ;
}
- catch (Exception exc)
+ ///
+ /// Incrementa un contatore in Redis
+ ///
+ ///
+ ///
+ public long setRCntI(string chiave)
{
- lg.Info(string.Format("Errore in setRSV:{0}{1}", Environment.NewLine, exc));
+ long answ = 0;
+ try
+ {
+ IDatabase cache = connRedis.GetDatabase();
+ answ = cache.StringIncrement(chiave, 1);
+ }
+ catch (Exception exc)
+ {
+ lg.Info(string.Format("Errore in setRCI:{0}{1}", Environment.NewLine, exc));
+ }
+ return answ;
}
- }
- else
- {
- lg.Error("Server REDIS non disponibile (setRSV)");
- }
- return answ;
- }
- ///
- /// Salva una chiave in RedisCache
- ///
- ///
- ///
- /// in secondi
- ///
- public bool setRSV(string chiave, string valore, int TTL_sec)
- {
- bool answ = false;
- if (connRedis.IsConnected)
- {
- try
+ ///
+ /// Decrementa un contatore in Redis
+ ///
+ ///
+ ///
+ public long setRCntD(string chiave)
{
- IDatabase cache = connRedis.GetDatabase();
- TimeSpan expT = new TimeSpan(0, 0, TTL_sec);
- // salvo con expyry...
- cache.StringSet(chiave, valore, expT);
- answ = true;
+ long answ = 0;
+ try
+ {
+ IDatabase cache = connRedis.GetDatabase();
+ answ = cache.StringDecrement(chiave, 1);
+ }
+ catch (Exception exc)
+ {
+ lg.Info(string.Format("Errore in setRCD:{0}{1}", Environment.NewLine, exc));
+ }
+ return answ;
}
- catch (Exception exc)
+ ///
+ /// Restituisce una chiave COUNTER in RedisCache
+ ///
+ ///
+ ///
+ public int getRCnt(string chiave)
{
- lg.Info(string.Format("Errore in setRSV:{0}{1}", Environment.NewLine, exc));
+ int answInt = 0;
+ string answ = "";
+ try
+ {
+ IDatabase cache = connRedis.GetDatabase();
+ answ = cache.StringGet(chiave);
+ answInt = Convert.ToInt32(answ);
+ }
+ catch (Exception exc)
+ {
+ lg.Info(string.Format("Errore in getRSV:{0}{1}", Environment.NewLine, exc));
+ }
+ return answInt;
}
- }
- else
- {
- lg.Error("Server REDIS non disponibile (setRSV:TTL)");
- }
- return answ;
- }
- ///
- /// Incrementa un contatore in Redis
- ///
- ///
- ///
- public long setRCntI(string chiave)
- {
- long answ = 0;
- try
- {
- IDatabase cache = connRedis.GetDatabase();
- answ = cache.StringIncrement(chiave, 1);
- }
- catch (Exception exc)
- {
- lg.Info(string.Format("Errore in setRCI:{0}{1}", Environment.NewLine, exc));
- }
- return answ;
- }
- ///
- /// Decrementa un contatore in Redis
- ///
- ///
- ///
- public long setRCntD(string chiave)
- {
- long answ = 0;
- try
- {
- IDatabase cache = connRedis.GetDatabase();
- answ = cache.StringDecrement(chiave, 1);
- }
- catch (Exception exc)
- {
- lg.Info(string.Format("Errore in setRCD:{0}{1}", Environment.NewLine, exc));
- }
- return answ;
- }
- ///
- /// Restituisce una chiave COUNTER in RedisCache
- ///
- ///
- ///
- public int getRCnt(string chiave)
- {
- int answInt = 0;
- string answ = "";
- try
- {
- IDatabase cache = connRedis.GetDatabase();
- answ = cache.StringGet(chiave);
- answInt = Convert.ToInt32(answ);
- }
- catch (Exception exc)
- {
- lg.Info(string.Format("Errore in getRSV:{0}{1}", Environment.NewLine, exc));
- }
- return answInt;
- }
- ///
- /// Resetta (elimina) un contatore in Redis
- ///
- ///
- ///
- public bool resetRCnt(string chiave)
- {
- bool answ = false;
- try
- {
- IDatabase cache = connRedis.GetDatabase();
- answ = cache.KeyDelete(chiave);
- }
- catch (Exception exc)
- {
- lg.Info(string.Format("Errore in resetRCnt:{0}{1}", Environment.NewLine, exc));
- }
- return answ;
- }
- ///
- /// Restituisce un set KVP (Key Value Pair) salvati in RedisCache
- ///
- ///
- ///
- public RedisValue[] getRKeys(RedisKey[] chiavi)
- {
- RedisValue[] answ = null;
- try
- {
- IDatabase cache = connRedis.GetDatabase();
- answ = cache.StringGet(chiavi);
- }
- catch (Exception exc)
- {
- lg.Info(string.Format("Errore in getRKeys:{0}{1}", Environment.NewLine, exc));
- }
- return answ;
- }
- ///
- /// Salva un set KVP (Key Value Pair) in RedisCache
- ///
- /// Set KVP chiave-valore da salvare
- ///
- public bool setRKeys(KeyValuePair[] valori)
- {
- bool answ = false;
- try
- {
- IDatabase cache = connRedis.GetDatabase();
- cache.StringSet(valori);
- answ = true;
- }
- catch (Exception exc)
- {
- lg.Info(string.Format("Errore in setRKeys:{0}{1}", Environment.NewLine, exc));
- }
- return answ;
- }
- ///
- /// Verifica se ci siano valori nella hash indicata...
- ///
- ///
- ///
- public bool redHashPresent(RedisKey key)
- {
- bool answ = false;
- // cerco se ci sia valore in redis...
- IDatabase cache = connRedis.GetDatabase();
- try
- {
- answ = cache.HashGetAll(key).Length > 0;
- }
- catch
- { }
- return answ;
- }
- ///
- /// Verifica se ci siano valori nella hash indicata (string)
- ///
- ///
- ///
- public bool redHashPresentSz(string key)
- {
- bool answ = false;
- try
- {
- RedisKey chiave = key;
- answ = redHashPresent(chiave);
- }
- catch
- { }
- return answ;
- }
- ///
- /// Recupera tutti i valori dalla hash
- ///
- ///
- ///
- public KeyValuePair[] redGetHash(string hashKey)
- {
- KeyValuePair[] answ = new KeyValuePair[1];
- // cerco se ci sia valore in redis...
- IDatabase cache = connRedis.GetDatabase();
- try
- {
- RedisKey chiave = hashKey;
- HashEntry[] valori = cache.HashGetAll(chiave);
- answ = new KeyValuePair[valori.Length];
- int i = 0;
- foreach (HashEntry item in valori)
+ ///
+ /// Resetta (elimina) un contatore in Redis
+ ///
+ ///
+ ///
+ public bool resetRCnt(string chiave)
{
- answ[i] = new KeyValuePair(item.Name, item.Value);
- i++;
+ bool answ = false;
+ try
+ {
+ IDatabase cache = connRedis.GetDatabase();
+ answ = cache.KeyDelete(chiave);
+ }
+ catch (Exception exc)
+ {
+ lg.Info(string.Format("Errore in resetRCnt:{0}{1}", Environment.NewLine, exc));
+ }
+ return answ;
}
- }
- catch
- { }
- return answ;
- }
- ///
- /// Recupera tutti i valori dalla hash in formato Dictionary
- ///
- ///
- ///
- public Dictionary redGetHashDict(string hashKey)
- {
- Dictionary answ = new Dictionary();
- // cerco se ci sia valore in redis...
- IDatabase cache = connRedis.GetDatabase();
- try
- {
- RedisKey chiave = hashKey;
- HashEntry[] valori = cache.HashGetAll(chiave);
- foreach (HashEntry item in valori)
+ ///
+ /// Restituisce un set KVP (Key Value Pair) salvati in RedisCache
+ ///
+ ///
+ ///
+ public RedisValue[] getRKeys(RedisKey[] chiavi)
{
- answ.Add(item.Name, item.Value);
+ RedisValue[] answ = null;
+ try
+ {
+ IDatabase cache = connRedis.GetDatabase();
+ answ = cache.StringGet(chiavi);
+ }
+ catch (Exception exc)
+ {
+ lg.Info(string.Format("Errore in getRKeys:{0}{1}", Environment.NewLine, exc));
+ }
+ return answ;
}
- }
- catch
- { }
- return answ;
- }
- ///
- /// Recupera UN SINGOLO VALORE dalla hash per un dato field
- ///
- ///
- ///
- ///
- public string redGetHashField(string hashKey, string hashField)
- {
- string answ = "";
- // cerco se ci sia valore in redis...
- IDatabase cache = connRedis.GetDatabase();
- try
- {
- RedisKey chiave = hashKey;
- RedisValue campo = hashField;
- RedisValue valOut = cache.HashGet(chiave, campo);
- answ = valOut.ToString();
- }
- catch
- { }
- return answ;
- }
- ///
- /// Salvataggio di una hash di valori
- ///
- /// chiave
- /// valori
- ///
- public bool redSaveHash(string hashKey, KeyValuePair[] hashFields)
- {
- bool answ = false;
- if (connRedis.IsConnected)
- {
- // cerco se ci sia valore in redis...
- IDatabase cache = connRedis.GetDatabase();
- try
+ ///
+ /// Salva un set KVP (Key Value Pair) in RedisCache
+ ///
+ /// Set KVP chiave-valore da salvare
+ ///
+ public bool setRKeys(KeyValuePair[] valori)
{
- RedisKey chiave = hashKey;
- HashEntry[] valori = new HashEntry[hashFields.Length];
- int i = 0;
- foreach (KeyValuePair kvp in hashFields)
- {
- valori[i] = new HashEntry(kvp.Key, kvp.Value);
- i++;
- }
- cache.HashSet(chiave, valori);
- answ = true;
+ bool answ = false;
+ try
+ {
+ IDatabase cache = connRedis.GetDatabase();
+ cache.StringSet(valori);
+ answ = true;
+ }
+ catch (Exception exc)
+ {
+ lg.Info(string.Format("Errore in setRKeys:{0}{1}", Environment.NewLine, exc));
+ }
+ return answ;
}
- catch
- { }
- }
- else
- {
- lg.Error("Server REDIS non disponibile (redSaveHash)");
- }
- return answ;
- }
- ///
- /// Salvataggio di una hash di valori
- ///
- /// chiave
- /// valori come lista KVP
- ///
- public bool redSaveHashList(string hashKey, List> hashListKVP)
- {
- bool answ = false;
- if (connRedis.IsConnected)
- {
- // cerco se ci sia valore in redis...
- IDatabase cache = connRedis.GetDatabase();
- try
+ ///
+ /// Verifica se ci siano valori nella hash indicata...
+ ///
+ ///
+ ///
+ public bool redHashPresent(RedisKey key)
{
- RedisKey chiave = hashKey;
- HashEntry[] valori = new HashEntry[hashListKVP.Count];
- int i = 0;
- foreach (KeyValuePair kvp in hashListKVP)
- {
- valori[i] = new HashEntry(kvp.Key, kvp.Value);
- i++;
- }
- cache.HashSet(chiave, valori);
- answ = true;
+ bool answ = false;
+ // cerco se ci sia valore in redis...
+ IDatabase cache = connRedis.GetDatabase();
+ try
+ {
+ answ = cache.HashGetAll(key).Length > 0;
+ }
+ catch
+ { }
+ return answ;
}
- catch
- { }
- }
- else
- {
- lg.Error("Server REDIS non disponibile (redSaveHashList)");
- }
- return answ;
- }
- ///
- /// Salvataggio di una hash di valori in formato Dictionary
- ///
- /// chiave
- /// valori
- ///
- public bool redSaveHashDict(string hashKey, Dictionary hashFields)
- {
- bool answ = false;
- // cerco se ci sia valore in redis...
- IDatabase cache = connRedis.GetDatabase();
- try
- {
- RedisKey chiave = hashKey;
- HashEntry[] valori = new HashEntry[hashFields.Count];
- int i = 0;
- foreach (KeyValuePair kvp in hashFields)
+ ///
+ /// Verifica se ci siano valori nella hash indicata (string)
+ ///
+ ///
+ ///
+ public bool redHashPresentSz(string key)
{
- valori[i] = new HashEntry(kvp.Key, kvp.Value);
- i++;
+ bool answ = false;
+ try
+ {
+ RedisKey chiave = key;
+ answ = redHashPresent(chiave);
+ }
+ catch
+ { }
+ return answ;
}
- cache.HashSet(chiave, valori);
- answ = true;
- }
- catch
- { }
- return answ;
- }
- ///
- /// Salvataggio di una hash di valori
- ///
- /// chiave
- /// valori
- /// scadenza preimpostata hash (secondi) | defaoult = -1 (non scade)
- ///
- public bool redSaveHash(string hashKey, KeyValuePair[] hashFields, double expireSeconds = -1)
- {
- bool answ = false;
- // cerco se ci sia valore in redis...
- IDatabase cache = connRedis.GetDatabase();
- try
- {
- RedisKey chiave = hashKey;
- answ = redSaveHash(hashKey, hashFields);
- if (expireSeconds > 0)
+ ///
+ /// Recupera tutti i valori dalla hash
+ ///
+ ///
+ ///
+ public KeyValuePair[] redGetHash(string hashKey)
{
- cache.KeyExpire(chiave, DateTime.Now.AddSeconds(expireSeconds));
+ KeyValuePair[] answ = new KeyValuePair[1];
+ // cerco se ci sia valore in redis...
+ IDatabase cache = connRedis.GetDatabase();
+ try
+ {
+ RedisKey chiave = hashKey;
+ HashEntry[] valori = cache.HashGetAll(chiave);
+ answ = new KeyValuePair[valori.Length];
+ int i = 0;
+ foreach (HashEntry item in valori)
+ {
+ answ[i] = new KeyValuePair(item.Name, item.Value);
+ i++;
+ }
+ }
+ catch
+ { }
+ return answ;
}
- //answ = true;
- }
- catch
- { }
- return answ;
- }
- ///
- /// Salvataggio di una hash di valori in formato Dictionary
- ///
- /// chiave
- /// valori
- /// scadenza preimpostata hash (secondi) | defaoult = -1 (non scade)
- ///
- public bool redSaveHashDict(string hashKey, Dictionary hashFields, double expireSeconds = -1)
- {
- bool answ = false;
- // cerco se ci sia valore in redis...
- IDatabase cache = connRedis.GetDatabase();
- try
- {
- RedisKey chiave = hashKey;
- answ = redSaveHashDict(hashKey, hashFields);
- if (expireSeconds > 0)
+ ///
+ /// Recupera tutti i valori dalla hash in formato Dictionary
+ ///
+ ///
+ ///
+ public Dictionary redGetHashDict(string hashKey)
{
- cache.KeyExpire(chiave, DateTime.Now.AddSeconds(expireSeconds));
+ Dictionary answ = new Dictionary();
+ // cerco se ci sia valore in redis...
+ IDatabase cache = connRedis.GetDatabase();
+ try
+ {
+ RedisKey chiave = hashKey;
+ HashEntry[] valori = cache.HashGetAll(chiave);
+ foreach (HashEntry item in valori)
+ {
+ answ.Add(item.Name, item.Value);
+ }
+ }
+ catch
+ { }
+ return answ;
}
- //answ = true;
- }
- catch
- { }
- return answ;
- }
- ///
- /// Elimina una key (hash, string)
- ///
- ///
- ///
- public bool redDelKey(string key)
- {
- bool answ = false;
- // cerco se ci sia valore in redis...
- IDatabase cache = connRedis.GetDatabase();
- try
- {
- RedisKey chiave = key;
- cache.KeyDelete(chiave);
- answ = true;
- }
- catch
- { }
- return answ;
- }
- ///
- /// Flush completo cache redis
- ///
- /// ** = tutti
- ///
- public bool redFlushKey(string keyPattern)
- {
- bool answ = false;
- // cerco se ci sia valore in redis...
- IDatabase cache = connRedis.GetDatabase();
- // se vuoto = ALL...
- keyPattern = keyPattern == "" ? "**" : keyPattern;
- try
- {
- foreach (var ep in connRedis.GetEndPoints())
+ ///
+ /// Recupera UN SINGOLO VALORE dalla hash per un dato field
+ ///
+ ///
+ ///
+ ///
+ public string redGetHashField(string hashKey, string hashField)
{
- var server = connRedis.GetServer(ep);
- foreach (var key in server.Keys(pattern: keyPattern))
- {
- cache.KeyDelete(key);
- }
+ string answ = "";
+ // cerco se ci sia valore in redis...
+ IDatabase cache = connRedis.GetDatabase();
+ try
+ {
+ RedisKey chiave = hashKey;
+ RedisValue campo = hashField;
+ RedisValue valOut = cache.HashGet(chiave, campo);
+ answ = valOut.ToString();
+ }
+ catch
+ { }
+ return answ;
}
- answ = true;
- }
- catch (Exception exc)
- {
- lg.Error(string.Format("Eccezione: {0}", exc));
- }
- return answ;
- }
- ///
- /// Conta num oggetti cache redis che rispondono a pattern
- ///
- /// ** = tutti
- ///
- public int redCountKey(string keyPattern)
- {
- int answ = 0;
- // cerco se ci sia valore in redis...
- IDatabase cache = connRedis.GetDatabase();
- // se vuoto = ALL...
- keyPattern = keyPattern == "" ? "**" : keyPattern;
- try
- {
- foreach (var ep in connRedis.GetEndPoints())
+ ///
+ /// Salvataggio di una hash di valori
+ ///
+ /// chiave
+ /// valori
+ ///
+ public bool redSaveHash(string hashKey, KeyValuePair[] hashFields)
{
- var server = connRedis.GetServer(ep);
- foreach (var key in server.Keys(pattern: keyPattern))
- {
- answ++;
- }
+ bool answ = false;
+ if (connRedis.IsConnected)
+ {
+ // cerco se ci sia valore in redis...
+ IDatabase cache = connRedis.GetDatabase();
+ try
+ {
+ RedisKey chiave = hashKey;
+ HashEntry[] valori = new HashEntry[hashFields.Length];
+ int i = 0;
+ foreach (KeyValuePair kvp in hashFields)
+ {
+ valori[i] = new HashEntry(kvp.Key, kvp.Value);
+ i++;
+ }
+ cache.HashSet(chiave, valori);
+ answ = true;
+ }
+ catch
+ { }
+ }
+ else
+ {
+ lg.Error("Server REDIS non disponibile (redSaveHash)");
+ }
+ return answ;
+ }
+ ///
+ /// Salvataggio di una hash di valori
+ ///
+ /// chiave
+ /// valori come lista KVP
+ ///
+ public bool redSaveHashList(string hashKey, List> hashListKVP)
+ {
+ bool answ = false;
+ if (connRedis.IsConnected)
+ {
+ // cerco se ci sia valore in redis...
+ IDatabase cache = connRedis.GetDatabase();
+ try
+ {
+ RedisKey chiave = hashKey;
+ HashEntry[] valori = new HashEntry[hashListKVP.Count];
+ int i = 0;
+ foreach (KeyValuePair kvp in hashListKVP)
+ {
+ valori[i] = new HashEntry(kvp.Key, kvp.Value);
+ i++;
+ }
+ cache.HashSet(chiave, valori);
+ answ = true;
+ }
+ catch
+ { }
+ }
+ else
+ {
+ lg.Error("Server REDIS non disponibile (redSaveHashList)");
+ }
+ return answ;
+ }
+ ///
+ /// Salvataggio di una hash di valori in formato Dictionary
+ ///
+ /// chiave
+ /// valori
+ ///
+ public bool redSaveHashDict(string hashKey, Dictionary hashFields)
+ {
+ bool answ = false;
+ // cerco se ci sia valore in redis...
+ IDatabase cache = connRedis.GetDatabase();
+ try
+ {
+ RedisKey chiave = hashKey;
+ HashEntry[] valori = new HashEntry[hashFields.Count];
+ int i = 0;
+ foreach (KeyValuePair kvp in hashFields)
+ {
+ valori[i] = new HashEntry(kvp.Key, kvp.Value);
+ i++;
+ }
+ cache.HashSet(chiave, valori);
+ answ = true;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// Salvataggio di una hash di valori
+ ///
+ /// chiave
+ /// valori
+ /// scadenza preimpostata hash (secondi) | defaoult = -1 (non scade)
+ ///
+ public bool redSaveHash(string hashKey, KeyValuePair[] hashFields, double expireSeconds = -1)
+ {
+ bool answ = false;
+ // cerco se ci sia valore in redis...
+ IDatabase cache = connRedis.GetDatabase();
+ try
+ {
+ RedisKey chiave = hashKey;
+ answ = redSaveHash(hashKey, hashFields);
+ if (expireSeconds > 0)
+ {
+ cache.KeyExpire(chiave, DateTime.Now.AddSeconds(expireSeconds));
+ }
+ //answ = true;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// Salvataggio di una hash di valori in formato Dictionary
+ ///
+ /// chiave
+ /// valori
+ /// scadenza preimpostata hash (secondi) | defaoult = -1 (non scade)
+ ///
+ public bool redSaveHashDict(string hashKey, Dictionary hashFields, double expireSeconds = -1)
+ {
+ bool answ = false;
+ // cerco se ci sia valore in redis...
+ IDatabase cache = connRedis.GetDatabase();
+ try
+ {
+ RedisKey chiave = hashKey;
+ answ = redSaveHashDict(hashKey, hashFields);
+ if (expireSeconds > 0)
+ {
+ cache.KeyExpire(chiave, DateTime.Now.AddSeconds(expireSeconds));
+ }
+ //answ = true;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// Elimina una key (hash, string)
+ ///
+ ///
+ ///
+ public bool redDelKey(string key)
+ {
+ bool answ = false;
+ // cerco se ci sia valore in redis...
+ IDatabase cache = connRedis.GetDatabase();
+ try
+ {
+ RedisKey chiave = key;
+ cache.KeyDelete(chiave);
+ answ = true;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// Flush completo cache redis
+ ///
+ /// ** = tutti
+ ///
+ public bool redFlushKey(string keyPattern)
+ {
+ bool answ = false;
+ // cerco se ci sia valore in redis...
+ IDatabase cache = connRedis.GetDatabase();
+ // se vuoto = ALL...
+ keyPattern = keyPattern == "" ? "**" : keyPattern;
+ try
+ {
+ foreach (var ep in connRedis.GetEndPoints())
+ {
+ var server = connRedis.GetServer(ep);
+ foreach (var key in server.Keys(pattern: keyPattern))
+ {
+ cache.KeyDelete(key);
+ }
+ }
+ answ = true;
+ }
+ catch (Exception exc)
+ {
+ lg.Error(string.Format("Eccezione: {0}", exc));
+ }
+ return answ;
+ }
+ ///
+ /// Conta num oggetti cache redis che rispondono a pattern
+ ///
+ /// ** = tutti
+ ///
+ public int redCountKey(string keyPattern)
+ {
+ int answ = 0;
+ // cerco se ci sia valore in redis...
+ IDatabase cache = connRedis.GetDatabase();
+ // se vuoto = ALL...
+ keyPattern = keyPattern == "" ? "**" : keyPattern;
+ try
+ {
+ foreach (var ep in connRedis.GetEndPoints())
+ {
+ var server = connRedis.GetServer(ep);
+ foreach (var key in server.Keys(pattern: keyPattern))
+ {
+ answ++;
+ }
+ }
+ }
+ catch (Exception exc)
+ {
+ lg.Error(string.Format("Eccezione: {0}", exc));
+ }
+ return answ;
}
- }
- catch (Exception exc)
- {
- lg.Error(string.Format("Eccezione: {0}", exc));
- }
- return answ;
- }
- ///
- /// Restituisce numero record in Redis DB
- ///
- public long numRecRedis
- {
- get
- {
- long answ = 0;
- try
+ ///
+ /// Restituisce numero record in Redis DB
+ ///
+ public long numRecRedis
{
- foreach (var ep in connRedis.GetEndPoints())
- {
- var server = connRedis.GetServer(ep);
- answ += server.DatabaseSize();
- }
+ get
+ {
+ long answ = 0;
+ try
+ {
+ foreach (var ep in connRedis.GetEndPoints())
+ {
+ var server = connRedis.GetServer(ep);
+ answ += server.DatabaseSize();
+ }
+ }
+ catch
+ { }
+ return answ;
+ }
}
- catch
- { }
- return answ;
- }
- }
- ///
- /// Restituisce oggetti cache redis che rispondono a pattern
- ///
- /// ** = tutti
- /// Tipo di ordinamento per kvp
- ///
- public List> redGetCounterByKey(string keyPattern, kvpOrderBy orderBy)
- {
- int numAnsw = redCountKey(keyPattern);
- RedisKey[] chiavi = new RedisKey[numAnsw];
- List> answ = new List>();
- // se vuoto = ALL...
- keyPattern = keyPattern == "" ? "**" : keyPattern;
+ ///
+ /// Restituisce oggetti cache redis che rispondono a pattern
+ ///
+ /// ** = tutti
+ /// Tipo di ordinamento per kvp
+ ///
+ public List> redGetCounterByKey(string keyPattern, kvpOrderBy orderBy)
+ {
+ int numAnsw = redCountKey(keyPattern);
+ RedisKey[] chiavi = new RedisKey[numAnsw];
+ List> answ = new List>();
+ // se vuoto = ALL...
+ keyPattern = keyPattern == "" ? "**" : keyPattern;
- // recupero in primis elenco chiavi
- try
- {
- int i = 0;
- foreach (var ep in connRedis.GetEndPoints())
- {
- var server = connRedis.GetServer(ep);
- foreach (var key in server.Keys(pattern: keyPattern))
- {
- chiavi[i] = key;
- i++;
- }
+ // recupero in primis elenco chiavi
+ try
+ {
+ int i = 0;
+ foreach (var ep in connRedis.GetEndPoints())
+ {
+ var server = connRedis.GetServer(ep);
+ foreach (var key in server.Keys(pattern: keyPattern))
+ {
+ chiavi[i] = key;
+ i++;
+ }
+ }
+ }
+ catch (Exception exc)
+ {
+ lg.Error(string.Format("Eccezione: {0}", exc));
+ }
+ // ora recupero valori!
+ var valori = getRKeys(chiavi);
+ int currVal = 0;
+ // popolo rispsota
+ try
+ {
+ for (int i = 0; i < numAnsw; i++)
+ {
+ Int32.TryParse(valori[i], out currVal);
+ answ.Add(new KeyValuePair(chiavi[i], currVal));
+ }
+ }
+ catch
+ { }
+ // se richiesto riordino...
+ switch (orderBy)
+ {
+ case kvpOrderBy.KeyAsc:
+ answ.Sort(CompareKey);
+ break;
+ case kvpOrderBy.KeyDesc:
+ answ.Sort(CompareKeyDesc);
+ break;
+ case kvpOrderBy.ValAsc:
+ answ.Sort(CompareVal);
+ break;
+ case kvpOrderBy.ValDesc:
+ answ.Sort(CompareValDesc);
+ break;
+ default:
+ break;
+ }
+ return answ;
}
- }
- catch (Exception exc)
- {
- lg.Error(string.Format("Eccezione: {0}", exc));
- }
- // ora recupero valori!
- var valori = getRKeys(chiavi);
- int currVal = 0;
- // popolo rispsota
- try
- {
- for (int i = 0; i < numAnsw; i++)
+ ///
+ /// Effettua comaprazione x CHIAVE in KVP ASC
+ ///
+ ///
+ ///
+ ///
+ private int CompareKey(KeyValuePair x, KeyValuePair y)
{
- Int32.TryParse(valori[i], out currVal);
- answ.Add(new KeyValuePair(chiavi[i], currVal));
+ return x.Key.CompareTo(y.Key);
+ }
+ ///
+ /// Effettua comaprazione x VALORE in KVP ASC
+ ///
+ ///
+ ///
+ ///
+ public int CompareVal(KeyValuePair x, KeyValuePair y)
+ {
+ return x.Value.CompareTo(y.Value);
+ }
+ ///
+ /// Effettua comaprazione x CHIAVE in KVP DESC
+ ///
+ ///
+ ///
+ ///
+ private int CompareKeyDesc(KeyValuePair x, KeyValuePair y)
+ {
+ return y.Key.CompareTo(x.Key);
+ }
+ ///
+ /// Effettua comaprazione x VALORE in KVP DESC
+ ///
+ ///
+ ///
+ ///
+ public int CompareValDesc(KeyValuePair x, KeyValuePair y)
+ {
+ return y.Value.CompareTo(x.Value);
}
- }
- catch
- { }
- // se richiesto riordino...
- switch (orderBy)
- {
- case kvpOrderBy.KeyAsc:
- answ.Sort(CompareKey);
- break;
- case kvpOrderBy.KeyDesc:
- answ.Sort(CompareKeyDesc);
- break;
- case kvpOrderBy.ValAsc:
- answ.Sort(CompareVal);
- break;
- case kvpOrderBy.ValDesc:
- answ.Sort(CompareValDesc);
- break;
- default:
- break;
- }
- return answ;
- }
- ///
- /// Effettua comaprazione x CHIAVE in KVP ASC
- ///
- ///
- ///
- ///
- private int CompareKey(KeyValuePair x, KeyValuePair y)
- {
- return x.Key.CompareTo(y.Key);
- }
- ///
- /// Effettua comaprazione x VALORE in KVP ASC
- ///
- ///
- ///
- ///
- public int CompareVal(KeyValuePair x, KeyValuePair y)
- {
- return x.Value.CompareTo(y.Value);
- }
- ///
- /// Effettua comaprazione x CHIAVE in KVP DESC
- ///
- ///
- ///
- ///
- private int CompareKeyDesc(KeyValuePair x, KeyValuePair y)
- {
- return y.Key.CompareTo(x.Key);
- }
- ///
- /// Effettua comaprazione x VALORE in KVP DESC
- ///
- ///
- ///
- ///
- public int CompareValDesc(KeyValuePair x, KeyValuePair y)
- {
- return y.Value.CompareTo(x.Value);
- }
- ///
- /// Tipologia di ordinamento x liste KVP
- ///
- public enum kvpOrderBy
- {
- ///
- /// Ordinamento ASCending per KEY
- ///
- KeyAsc,
- ///
- /// Ordinamento DESCending per KEY
- ///
- KeyDesc,
- ///
- /// Ordinamento ASCending per VAL
- ///
- ValAsc,
- ///
- /// Ordinamento DESCending per VAL
- ///
- ValDesc
- }
+ ///
+ /// Tipologia di ordinamento x liste KVP
+ ///
+ public enum kvpOrderBy
+ {
+ ///
+ /// Ordinamento ASCending per KEY
+ ///
+ KeyAsc,
+ ///
+ /// Ordinamento DESCending per KEY
+ ///
+ KeyDesc,
+ ///
+ /// Ordinamento ASCending per VAL
+ ///
+ ValAsc,
+ ///
+ /// Ordinamento DESCending per VAL
+ ///
+ ValDesc
+ }
- #endregion
- }
+ #endregion
+ }
}
diff --git a/Thermo.Active.Model/ConfigModels/AlarmsConfigModel.cs b/Thermo.Active.Model/ConfigModels/AlarmsConfigModel.cs
index 3679e82b..7c38d1dc 100644
--- a/Thermo.Active.Model/ConfigModels/AlarmsConfigModel.cs
+++ b/Thermo.Active.Model/ConfigModels/AlarmsConfigModel.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Thermo.Active.Model.ConfigModels
+namespace Thermo.Active.Model.ConfigModels
{
public class AlarmsConfigModel
{
diff --git a/Thermo.Active.Model/ConfigModels/AreasConfigModel.cs b/Thermo.Active.Model/ConfigModels/AreasConfigModel.cs
index dcb70377..cacb1b33 100644
--- a/Thermo.Active.Model/ConfigModels/AreasConfigModel.cs
+++ b/Thermo.Active.Model/ConfigModels/AreasConfigModel.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Thermo.Active.Model.ConfigModels
+namespace Thermo.Active.Model.ConfigModels
{
public class AreasConfigModel
{
diff --git a/Thermo.Active.Model/ConfigModels/CmsConnectConfigModel.cs b/Thermo.Active.Model/ConfigModels/CmsConnectConfigModel.cs
index 5bf60ff3..4b3e89f0 100644
--- a/Thermo.Active.Model/ConfigModels/CmsConnectConfigModel.cs
+++ b/Thermo.Active.Model/ConfigModels/CmsConnectConfigModel.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Thermo.Active.Model.ConfigModels
+namespace Thermo.Active.Model.ConfigModels
{
public class CmsConnectConfigModel
{
diff --git a/Thermo.Active.Model/ConfigModels/ExtSoftwareModel.cs b/Thermo.Active.Model/ConfigModels/ExtSoftwareModel.cs
index e3d8bc6f..f3b02205 100644
--- a/Thermo.Active.Model/ConfigModels/ExtSoftwareModel.cs
+++ b/Thermo.Active.Model/ConfigModels/ExtSoftwareModel.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.Serialization;
-using System.Text;
-using System.Threading.Tasks;
+using System.Runtime.Serialization;
namespace Thermo.Active.Model.ConfigModels
{
diff --git a/Thermo.Active.Model/ConfigModels/MaintenanceConfigModel.cs b/Thermo.Active.Model/ConfigModels/MaintenanceConfigModel.cs
index b16e9590..f9102e44 100644
--- a/Thermo.Active.Model/ConfigModels/MaintenanceConfigModel.cs
+++ b/Thermo.Active.Model/ConfigModels/MaintenanceConfigModel.cs
@@ -6,7 +6,7 @@ namespace Thermo.Active.Model.ConfigModels
public class MaintenanceConfigModel
{
public int Id { get; set; }
- public Dictionary LocalizedName { get; set; }
+ public Dictionary LocalizedName { get; set; }
public TimeSpan Intervall { get; set; }
public DateTime Deadline { get; set; }
public string Type { get; set; }
@@ -20,7 +20,7 @@ namespace Thermo.Active.Model.ConfigModels
{
public Boolean Visible { get; set; }
public string Name { get; set; }
- public string Company { get; set; }
+ public string Company { get; set; }
public string Email { get; set; }
public string PhoneNumber { get; set; }
public string WebSite { get; set; }
diff --git a/Thermo.Active.Model/ConfigModels/MessageModel.cs b/Thermo.Active.Model/ConfigModels/MessageModel.cs
index d8686e1e..061ad542 100644
--- a/Thermo.Active.Model/ConfigModels/MessageModel.cs
+++ b/Thermo.Active.Model/ConfigModels/MessageModel.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using static Thermo.Active.Model.Constants;
+using static Thermo.Active.Model.Constants;
namespace Thermo.Active.Model
{
@@ -11,6 +6,6 @@ namespace Thermo.Active.Model
{
public string Title { get; set; }
public string Message { get; set; }
- public ERROR_LEVEL ErrorLevel { get; set; }
+ public ERROR_LEVEL ErrorLevel { get; set; }
}
}
diff --git a/Thermo.Active.Model/ConfigModels/ModBlockConfigModel.cs b/Thermo.Active.Model/ConfigModels/ModBlockConfigModel.cs
index 52738f36..da75b24b 100644
--- a/Thermo.Active.Model/ConfigModels/ModBlockConfigModel.cs
+++ b/Thermo.Active.Model/ConfigModels/ModBlockConfigModel.cs
@@ -6,10 +6,10 @@ namespace Thermo.Active.Model.ConfigModels
public class ModBlockConfigModel
{
public int Id;
- public Dictionary LocalizedLabels { get; set; }
+ public Dictionary LocalizedLabels { get; set; }
public TACT_MBLOCK_TYPE Type { get; set; }
public TACT_MBLOCK_SECTION Section { get; set; }
- public int IdParam{ get; set; }
+ public int IdParam { get; set; }
public bool ShowDelay { get; set; }
public int Priority { get; set; }
}
diff --git a/Thermo.Active.Model/ConfigModels/NcConfigModel.cs b/Thermo.Active.Model/ConfigModels/NcConfigModel.cs
index 73b8175b..b48f545d 100644
--- a/Thermo.Active.Model/ConfigModels/NcConfigModel.cs
+++ b/Thermo.Active.Model/ConfigModels/NcConfigModel.cs
@@ -1,18 +1,12 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Thermo.Active.Model.ConfigModels
+namespace Thermo.Active.Model.ConfigModels
{
- public class NcConfigModel
+ public class NcConfigModel
{
public string NcVendor { get; set; }
public bool ShowNcHMI { get; set; }
public string NcIpAddress { get; set; }
public ushort NcPort { get; set; }
- public string NcUniqueId { get; set; }
+ public string NcUniqueId { get; set; }
public string NcName { get; set; }
public string SharedPath { get; set; }
public string SharedName { get; set; }
diff --git a/Thermo.Active.Model/ConfigModels/RecipeConfigModel.cs b/Thermo.Active.Model/ConfigModels/RecipeConfigModel.cs
index 8e468a59..7a82cd42 100644
--- a/Thermo.Active.Model/ConfigModels/RecipeConfigModel.cs
+++ b/Thermo.Active.Model/ConfigModels/RecipeConfigModel.cs
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using static Thermo.Active.Model.Constants;
+using static Thermo.Active.Model.Constants;
namespace Thermo.Active.Model.ConfigModels
{
diff --git a/Thermo.Active.Model/ConfigModels/RiskConfigModel.cs b/Thermo.Active.Model/ConfigModels/RiskConfigModel.cs
index c08c65f0..5a00f3c2 100644
--- a/Thermo.Active.Model/ConfigModels/RiskConfigModel.cs
+++ b/Thermo.Active.Model/ConfigModels/RiskConfigModel.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using static Thermo.Active.Model.Constants;
namespace Thermo.Active.Model.ConfigModels
{
diff --git a/Thermo.Active.Model/ConfigModels/ServerConfigModel.cs b/Thermo.Active.Model/ConfigModels/ServerConfigModel.cs
index 349220c7..0d096389 100644
--- a/Thermo.Active.Model/ConfigModels/ServerConfigModel.cs
+++ b/Thermo.Active.Model/ConfigModels/ServerConfigModel.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Globalization;
namespace Thermo.Active.Model.ConfigModels
{
@@ -11,7 +6,7 @@ namespace Thermo.Active.Model.ConfigModels
{
public CultureInfo Language { get; set; }
public int ServerPort { get; set; }
- public string ServerAddress { get; set; }
+ public string ServerAddress { get; set; }
public bool EnableDirectoryBrowsing { get; set; }
public string DatabaseAddress { get; set; }
public bool AutoOpenCmsClient { get; set; }
@@ -19,7 +14,7 @@ namespace Thermo.Active.Model.ConfigModels
public string MTCFolderPath { get; set; }
public string MTCApplicationName { get; set; }
- public bool CmsConnectReady { get; set; }
+ public bool CmsConnectReady { get; set; }
public int MaxAlarmsRows { get; set; }
public int AlarmToDelete { get; set; }
diff --git a/Thermo.Active.Model/ConfigModels/SoftwareProdConfigModel.cs b/Thermo.Active.Model/ConfigModels/SoftwareProdConfigModel.cs
index 7b197f82..4a8a3eb2 100644
--- a/Thermo.Active.Model/ConfigModels/SoftwareProdConfigModel.cs
+++ b/Thermo.Active.Model/ConfigModels/SoftwareProdConfigModel.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Thermo.Active.Model.ConfigModels
+namespace Thermo.Active.Model.ConfigModels
{
public class SoftwareProdConfigModel
{
diff --git a/Thermo.Active.Model/ConfigModels/UserSoftKeyConfigModel.cs b/Thermo.Active.Model/ConfigModels/UserSoftKeyConfigModel.cs
index 0412ecfd..c3f1713f 100644
--- a/Thermo.Active.Model/ConfigModels/UserSoftKeyConfigModel.cs
+++ b/Thermo.Active.Model/ConfigModels/UserSoftKeyConfigModel.cs
@@ -9,7 +9,7 @@ namespace Thermo.Active.Model.ConfigModels
public Dictionary LocalizedNames { get; set; }
public int Category { get; set; }
public bool IsActive { get; set; }
- public bool IsVisible { get; set; }
+ public bool IsVisible { get; set; }
public bool OperatorConfirmationNeeded { get; set; }
public List SubKeys { get; set; }
public int PlcId { get; set; }
diff --git a/Thermo.Active.Model/Constants.cs b/Thermo.Active.Model/Constants.cs
index 72a69148..1c6e61db 100644
--- a/Thermo.Active.Model/Constants.cs
+++ b/Thermo.Active.Model/Constants.cs
@@ -203,11 +203,11 @@ namespace Thermo.Active.Model
#if DEBUG
public static readonly string CLIENT_PATH_64 = BASE_PATH + @"\Client_Debug\x64\" + CLIENT_EXE_NAME;
- public static readonly string CLIENT_PATH_86 = BASE_PATH + @"\Client_Debug\x84\" + CLIENT_EXE_NAME;
+ public static readonly string CLIENT_PATH_86 = BASE_PATH + @"\Client_Debug\x86\" + CLIENT_EXE_NAME;
public static string WEBSITE_DIRECTORY = Path.Combine(BASE_PATH, "..", "wwwroot");
#else
- public static readonly string CLIENT_PATH_64 = BASE_PATH + @"\Client\" + CLIENT_EXE_NAME;
- public static readonly string CLIENT_PATH_86 = BASE_PATH + @"\Client\" + CLIENT_EXE_NAME;
+ public static readonly string CLIENT_PATH_64 = BASE_PATH + @"\Client\x64\" + CLIENT_EXE_NAME;
+ public static readonly string CLIENT_PATH_86 = BASE_PATH + @"\Client\x86\" + CLIENT_EXE_NAME;
public static string WEBSITE_DIRECTORY = BASE_PATH + "\\view";
#endif
public const string CONFIG_DIRECTORY = "Config\\";
diff --git a/Thermo.Active.Model/DTOModels/AlarmModels/DTOAlarmHistoricModel.cs b/Thermo.Active.Model/DTOModels/AlarmModels/DTOAlarmHistoricModel.cs
index 07ceb2ca..3e6376de 100644
--- a/Thermo.Active.Model/DTOModels/AlarmModels/DTOAlarmHistoricModel.cs
+++ b/Thermo.Active.Model/DTOModels/AlarmModels/DTOAlarmHistoricModel.cs
@@ -1,10 +1,9 @@
-using CMS_CORE_Library.Utils;
-using Thermo.Active.Model.DatabaseModels;
-using System;
+using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
+using Thermo.Active.Model.DatabaseModels;
using static Thermo.Active.Model.Constants;
namespace Thermo.Active.Model.DTOModels.AlarmModels
diff --git a/Thermo.Active.Model/DTOModels/AlarmModels/DTOAlarmsModel.cs b/Thermo.Active.Model/DTOModels/AlarmModels/DTOAlarmsModel.cs
index 02388e91..6c3fdcab 100644
--- a/Thermo.Active.Model/DTOModels/AlarmModels/DTOAlarmsModel.cs
+++ b/Thermo.Active.Model/DTOModels/AlarmModels/DTOAlarmsModel.cs
@@ -46,7 +46,7 @@ namespace Thermo.Active.Model.DTOModels.AlarmModels
listAreEquals = item.PlcAlarms.All(PlcAlarms.Contains);
if (!listAreEquals)
return false;
-
+
// Check list's elements
listAreEquals = item.ProcessAlarms.All(ProcessAlarms.Contains);
if (!listAreEquals)
@@ -160,7 +160,7 @@ namespace Thermo.Active.Model.DTOModels.AlarmModels
{
public DateTime DateTime;
public bool RestorationIsEnabled;
-
+
public override bool Equals(object obj)
{
if (!(obj is DTOPlcAlarmModel item))
diff --git a/Thermo.Active.Model/DTOModels/AlarmModels/DTONewAlarmNoteModel.cs b/Thermo.Active.Model/DTOModels/AlarmModels/DTONewAlarmNoteModel.cs
index b4c43f0d..b8541d81 100644
--- a/Thermo.Active.Model/DTOModels/AlarmModels/DTONewAlarmNoteModel.cs
+++ b/Thermo.Active.Model/DTOModels/AlarmModels/DTONewAlarmNoteModel.cs
@@ -1,10 +1,6 @@
-using Thermo.Active.Model.DatabaseModels;
-using System;
-using System.Collections.Generic;
+using System;
using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using Thermo.Active.Model.DatabaseModels;
namespace Thermo.Active.Model.DTOModels.AlarmModels
{
diff --git a/Thermo.Active.Model/DTOModels/DTOAxesModel.cs b/Thermo.Active.Model/DTOModels/DTOAxesModel.cs
index d6ee9013..7d86bee3 100644
--- a/Thermo.Active.Model/DTOModels/DTOAxesModel.cs
+++ b/Thermo.Active.Model/DTOModels/DTOAxesModel.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
namespace Thermo.Active.Model.DTOModels
{
@@ -35,11 +34,11 @@ namespace Thermo.Active.Model.DTOModels
return false;
if (!CheckAxesDictionaries(machine, item.machine))
return false;
- if (!CheckAxesDictionaries(programmePos , item.programmePos))
+ if (!CheckAxesDictionaries(programmePos, item.programmePos))
return false;
if (!CheckAxesDictionaries(toGo, item.toGo))
return false;
-
+
return true;
}
diff --git a/Thermo.Active.Model/DTOModels/DTOClientConfigurationModel.cs b/Thermo.Active.Model/DTOModels/DTOClientConfigurationModel.cs
index b3662c42..517b0ea7 100644
--- a/Thermo.Active.Model/DTOModels/DTOClientConfigurationModel.cs
+++ b/Thermo.Active.Model/DTOModels/DTOClientConfigurationModel.cs
@@ -1,6 +1,6 @@
-using Thermo.Active.Model.ConfigModels;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Globalization;
+using Thermo.Active.Model.ConfigModels;
namespace Thermo.Active.Model.DTOModels
{
diff --git a/Thermo.Active.Model/DTOModels/DTOCmsConnectGateway.cs b/Thermo.Active.Model/DTOModels/DTOCmsConnectGateway.cs
index de99c3c9..0ed29d42 100644
--- a/Thermo.Active.Model/DTOModels/DTOCmsConnectGateway.cs
+++ b/Thermo.Active.Model/DTOModels/DTOCmsConnectGateway.cs
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Thermo.Active.Model.DTOModels
{
diff --git a/Thermo.Active.Model/DTOModels/DTOGaugeDataModel.cs b/Thermo.Active.Model/DTOModels/DTOGaugeDataModel.cs
index ce04a94e..98f12b8e 100644
--- a/Thermo.Active.Model/DTOModels/DTOGaugeDataModel.cs
+++ b/Thermo.Active.Model/DTOModels/DTOGaugeDataModel.cs
@@ -1,7 +1,4 @@
-using CMS_CORE_Library.Models;
-using System.Linq;
-using static CMS_CORE_Library.Models.DataStructures;
-using static CMS_CORE_Library.Models.ThermoModels;
+using static CMS_CORE_Library.Models.ThermoModels;
namespace Thermo.Active.Model.DTOModels
{
diff --git a/Thermo.Active.Model/DTOModels/DTONcGenericDataModel.cs b/Thermo.Active.Model/DTOModels/DTONcGenericDataModel.cs
index 6c2d07f4..bac3badf 100644
--- a/Thermo.Active.Model/DTOModels/DTONcGenericDataModel.cs
+++ b/Thermo.Active.Model/DTOModels/DTONcGenericDataModel.cs
@@ -1,6 +1,4 @@
using System;
-using System.Linq;
-using System.Reflection;
namespace Thermo.Active.Model.DTOModels
{
@@ -18,7 +16,7 @@ namespace Thermo.Active.Model.DTOModels
public string PlcVersion { get; set; }
public string UnitOfMeasurement { get; set; }
public string ServerVersion { get; set; }
- public string CoreLibraryVersion { get; set; }
+ public string CoreLibraryVersion { get; set; }
private DateTime buildDate;
private Version v;
diff --git a/Thermo.Active.Model/DTOModels/DTONcSoftKeyModel.cs b/Thermo.Active.Model/DTOModels/DTONcSoftKeyModel.cs
index a5508660..ef666e6d 100644
--- a/Thermo.Active.Model/DTOModels/DTONcSoftKeyModel.cs
+++ b/Thermo.Active.Model/DTOModels/DTONcSoftKeyModel.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Thermo.Active.Model.DTOModels
+namespace Thermo.Active.Model.DTOModels
{
public class DTONcSoftKeyModel
{
diff --git a/Thermo.Active.Model/DTOModels/DTONetworkMonitor.cs b/Thermo.Active.Model/DTOModels/DTONetworkMonitor.cs
index 3e453613..62eb663d 100644
--- a/Thermo.Active.Model/DTOModels/DTONetworkMonitor.cs
+++ b/Thermo.Active.Model/DTOModels/DTONetworkMonitor.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Thermo.Active.Model.DTOModels
+namespace Thermo.Active.Model.DTOModels
{
public class DTONetworkMonitorModel
{
diff --git a/Thermo.Active.Model/DTOModels/DTOProcessDataModel.cs b/Thermo.Active.Model/DTOModels/DTOProcessDataModel.cs
index ffa10da7..13e33af9 100644
--- a/Thermo.Active.Model/DTOModels/DTOProcessDataModel.cs
+++ b/Thermo.Active.Model/DTOModels/DTOProcessDataModel.cs
@@ -42,7 +42,7 @@ namespace Thermo.Active.Model.DTOModels
if (IsRunning != item.IsRunning)
return false;
- if (SelectedProcess != item.SelectedProcess)
+ if (SelectedProcess != item.SelectedProcess)
return false;
if (SelectedAxis != item.SelectedAxis)
return false;
@@ -50,7 +50,7 @@ namespace Thermo.Active.Model.DTOModels
if (item.processes.Count != processes.Count)
return false;
// Check list's elements
- bool listAreEquals = item.processes.All(processes.Contains);
+ bool listAreEquals = item.processes.All(processes.Contains);
if (!listAreEquals)
return false;
@@ -67,15 +67,15 @@ namespace Thermo.Active.Model.DTOModels
if (ActiveOrigin != item.ActiveOrigin)
return false;
- if (ProcessMessage != item.ProcessMessage)
+ if (ProcessMessage != item.ProcessMessage)
return false;
-
+
if (UnitMeasure != item.UnitMeasure)
return false;
if (CanLoadProgram != item.CanLoadProgram)
return false;
-
+
if (RapidOverride != item.RapidOverride)
return false;
@@ -84,7 +84,7 @@ namespace Thermo.Active.Model.DTOModels
if (offsetData.RealLength != item.offsetData.RealLength)
return false;
-
+
if (offsetData.RealRadius != item.offsetData.RealRadius)
return false;
@@ -94,7 +94,7 @@ namespace Thermo.Active.Model.DTOModels
return true;
}
- public override int GetHashCode()
+ public override int GetHashCode()
{
return base.GetHashCode();
}
diff --git a/Thermo.Active.Model/DTOModels/DTORoleModel.cs b/Thermo.Active.Model/DTOModels/DTORoleModel.cs
index 3813d5f3..bd2b7562 100644
--- a/Thermo.Active.Model/DTOModels/DTORoleModel.cs
+++ b/Thermo.Active.Model/DTOModels/DTORoleModel.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Thermo.Active.Model.DTOModels
+namespace Thermo.Active.Model.DTOModels
{
public class DTORoleModel
{
diff --git a/Thermo.Active.Model/DTOModels/DTOStartupConfigurationModel.cs b/Thermo.Active.Model/DTOModels/DTOStartupConfigurationModel.cs
index d7a2dc51..ed8fd1a3 100644
--- a/Thermo.Active.Model/DTOModels/DTOStartupConfigurationModel.cs
+++ b/Thermo.Active.Model/DTOModels/DTOStartupConfigurationModel.cs
@@ -1,9 +1,4 @@
using Thermo.Active.Model.ConfigModels;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Thermo.Active.Model.DTOModels
{
@@ -16,6 +11,6 @@ namespace Thermo.Active.Model.DTOModels
public AreasConfigModel UtilitiesConfig;
public AreasConfigModel ScadaConfig;
public AreasConfigModel JobEditorConfig;
- public AreasConfigModel UsersConfig;
+ public AreasConfigModel UsersConfig;
}
}
diff --git a/Thermo.Active.Model/DTOModels/DTOUserModel.cs b/Thermo.Active.Model/DTOModels/DTOUserModel.cs
index f51ec268..e0ff6d26 100644
--- a/Thermo.Active.Model/DTOModels/DTOUserModel.cs
+++ b/Thermo.Active.Model/DTOModels/DTOUserModel.cs
@@ -1,10 +1,5 @@
-using Thermo.Active.Model.DatabaseModels;
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Globalization;
+using Thermo.Active.Model.DatabaseModels;
namespace Thermo.Active.Model.DTOModels
{
@@ -36,7 +31,7 @@ namespace Thermo.Active.Model.DTOModels
}
}
- public class DTOUserModel : DTOMessageUserModel
+ public class DTOUserModel : DTOMessageUserModel
{
public CultureInfo Language { get; set; }
public DTORoleModel Role { get; set; }
diff --git a/Thermo.Active.Model/DTOModels/DTOUserSoftKeyModel.cs b/Thermo.Active.Model/DTOModels/DTOUserSoftKeyModel.cs
index 2a60237a..1fe00640 100644
--- a/Thermo.Active.Model/DTOModels/DTOUserSoftKeyModel.cs
+++ b/Thermo.Active.Model/DTOModels/DTOUserSoftKeyModel.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Collections.Generic;
using static Thermo.Active.Model.Constants;
namespace Thermo.Active.Model.DTOModels
diff --git a/Thermo.Active.Model/DTOModels/MaintenanceModels/DTOMaintenanceModel.cs b/Thermo.Active.Model/DTOModels/MaintenanceModels/DTOMaintenanceModel.cs
index dd5f6f8f..50c3db06 100644
--- a/Thermo.Active.Model/DTOModels/MaintenanceModels/DTOMaintenanceModel.cs
+++ b/Thermo.Active.Model/DTOModels/MaintenanceModels/DTOMaintenanceModel.cs
@@ -1,6 +1,4 @@
-using Thermo.Active.Model.DatabaseModels;
-using System;
-using static Thermo.Active.Model.Constants;
+using System;
namespace Thermo.Active.Model.DTOModels.MaintenanceModels
{
diff --git a/Thermo.Active.Model/DTOModels/MaintenanceModels/DTOMaintenanceNoteModel.cs b/Thermo.Active.Model/DTOModels/MaintenanceModels/DTOMaintenanceNoteModel.cs
index 3c165e81..f23cec69 100644
--- a/Thermo.Active.Model/DTOModels/MaintenanceModels/DTOMaintenanceNoteModel.cs
+++ b/Thermo.Active.Model/DTOModels/MaintenanceModels/DTOMaintenanceNoteModel.cs
@@ -1,10 +1,6 @@
-using Thermo.Active.Model.DatabaseModels;
-using System;
-using System.Collections.Generic;
+using System;
using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using Thermo.Active.Model.DatabaseModels;
namespace Thermo.Active.Model.DTOModels.MaintenanceModels
{
@@ -19,15 +15,15 @@ namespace Thermo.Active.Model.DTOModels.MaintenanceModels
public int Id { get; set; }
public DateTime DateTime { get; set; }
-
+
public DTOMessageUserModel User { get; set; }
-
+
public static explicit operator DTOMaintenanceNoteModel(MaintenanceNoteModel note)
{
DTOMessageUserModel user = note.User != null ? (DTOMessageUserModel)note.User : null;
return new DTOMaintenanceNoteModel()
{
- Id = note.Id,
+ Id = note.Id,
DateTime = note.DateTime,
Message = note.Message,
User = user
diff --git a/Thermo.Active.Model/DTOModels/MaintenanceModels/DTONewMaintenanceModel.cs b/Thermo.Active.Model/DTOModels/MaintenanceModels/DTONewMaintenanceModel.cs
index f215faa7..5daf5db3 100644
--- a/Thermo.Active.Model/DTOModels/MaintenanceModels/DTONewMaintenanceModel.cs
+++ b/Thermo.Active.Model/DTOModels/MaintenanceModels/DTONewMaintenanceModel.cs
@@ -1,9 +1,5 @@
using System;
-using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using static Thermo.Active.Model.Constants;
namespace Thermo.Active.Model.DTOModels.MaintenanceModels
@@ -23,7 +19,7 @@ namespace Thermo.Active.Model.DTOModels.MaintenanceModels
[Required]
public MAINTENANCE_TYPE Type { get; set; }
-
+
public MAINTENANCE_UNIT_OF_MEASURE? UnitOfMeasure { get; set; }
}
@@ -53,6 +49,6 @@ namespace Thermo.Active.Model.DTOModels.MaintenanceModels
public int ControlWord { get; set; }
public string User { get; set; }
-
+
}
}
diff --git a/Thermo.Active.Model/DTOModels/Scada/DTOScadaModel.cs b/Thermo.Active.Model/DTOModels/Scada/DTOScadaModel.cs
index 59386046..0e66fbae 100644
--- a/Thermo.Active.Model/DTOModels/Scada/DTOScadaModel.cs
+++ b/Thermo.Active.Model/DTOModels/Scada/DTOScadaModel.cs
@@ -196,7 +196,7 @@ namespace Thermo.Active.Model.DTOModels.Scada
if (item.IsEnabled != IsEnabled)
return false;
- if(item.Value != null && item.Value != null)
+ if (item.Value != null && item.Value != null)
{
if (!item.Value.Equals(Value))
return false;
diff --git a/Thermo.Active.Model/DTOModels/Scada/ScadaSchemaModel.cs b/Thermo.Active.Model/DTOModels/Scada/ScadaSchemaModel.cs
index 6bdc32aa..74e9753e 100644
--- a/Thermo.Active.Model/DTOModels/Scada/ScadaSchemaModel.cs
+++ b/Thermo.Active.Model/DTOModels/Scada/ScadaSchemaModel.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Xml.Serialization;
+using System.Xml.Serialization;
namespace Thermo.Active.Model.DTOModels.Scada
{
@@ -27,7 +25,7 @@ namespace Thermo.Active.Model.DTOModels.Scada
[XmlArray("buttons")]
[XmlArrayItem("button", typeof(ScadaSchemaButtonModel))]
public ScadaSchemaButtonModel[] Buttons { get; set; }
-
+
[XmlArray("images")]
[XmlArrayItem("image", typeof(ScadaSchemaImageModel))]
public ScadaSchemaImageModel[] Images { get; set; }
@@ -39,8 +37,8 @@ namespace Thermo.Active.Model.DTOModels.Scada
[XmlArray("progressBars")]
[XmlArrayItem("progressBar", typeof(ScadaSchemaProgressBarModel))]
public ScadaSchemaProgressBarModel[] ProgressBars { get; set; }
-
- [XmlArray("inputs")]
+
+ [XmlArray("inputs")]
[XmlArrayItem("input", typeof(ScadaSchemaInputModel))]
public ScadaSchemaInputModel[] Inputs { get; set; }
}
@@ -55,7 +53,7 @@ namespace Thermo.Active.Model.DTOModels.Scada
[XmlElement("position")]
public ScadaSchemaPositionModel Position { get; set; }
-
+
[XmlElement("size")]
public ScadaSchemaSizeModel Size { get; set; }
@@ -98,7 +96,7 @@ namespace Thermo.Active.Model.DTOModels.Scada
public ScadaSchemaSizeModel Size { get; set; }
[XmlElement("memEnabledIndex")]
- public string MemEnabledIndex { get; set; }
+ public string MemEnabledIndex { get; set; }
}
public class ScadaSchemaProgressBarModel
@@ -131,16 +129,16 @@ namespace Thermo.Active.Model.DTOModels.Scada
public ScadaSchemaSizeModel Size { get; set; }
[XmlElement("status")]
- public ScadaSchemaInputDataModel Status { get; set; }
+ public ScadaSchemaInputDataModel Status { get; set; }
}
///
/// Support objects
///
- public class ScadaSchemaLabelDataModel
+ public class ScadaSchemaLabelDataModel
{
- [XmlElement("backgroundColor")]
- public string BackgroundColor { get; set; }
+ [XmlElement("backgroundColor")]
+ public string BackgroundColor { get; set; }
[XmlElement("textAlign")]
public string TextAlign { get; set; }
@@ -150,10 +148,10 @@ namespace Thermo.Active.Model.DTOModels.Scada
[XmlElement("textSize")]
public int TextSize { get; set; }
-
+
[XmlElement("textContent")]
public LocalizedText[] TextContents { get; set; }
- }
+ }
public class LocalizedText
{
@@ -193,7 +191,7 @@ namespace Thermo.Active.Model.DTOModels.Scada
{
[XmlElement("memEnabledIndex")]
public string MemEnabledIndex { get; set; }
-
+
[XmlElement("memClickIndex")]
public string MemClickIndex { get; set; }
}
@@ -202,7 +200,7 @@ namespace Thermo.Active.Model.DTOModels.Scada
{
[XmlAttribute("negate")]
public bool Negate { get; set; }
-
+
[XmlAttribute("clickEnabled")]
public bool ClickEnabled { get; set; }
@@ -223,10 +221,10 @@ namespace Thermo.Active.Model.DTOModels.Scada
[XmlElement("type")]
public string Type { get; set; }
-
+
[XmlElement("action")]
public string Action { get; set; }
-
+
[XmlElement("round")]
public int Round { get; set; }
}
diff --git a/Thermo.Active.Model/DTOModels/Recipe/DTOModule.cs b/Thermo.Active.Model/DTOModels/ThModules/DTOModule.cs
similarity index 89%
rename from Thermo.Active.Model/DTOModels/Recipe/DTOModule.cs
rename to Thermo.Active.Model/DTOModels/ThModules/DTOModule.cs
index 26831f6f..d62d74cf 100644
--- a/Thermo.Active.Model/DTOModels/Recipe/DTOModule.cs
+++ b/Thermo.Active.Model/DTOModels/ThModules/DTOModule.cs
@@ -1,10 +1,6 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Collections.Generic;
-namespace Thermo.Active.Model.DTOModels.Recipe
+namespace Thermo.Active.Model.DTOModels.ThModules
{
public class DTOModule
{
@@ -21,7 +17,7 @@ namespace Thermo.Active.Model.DTOModels.Recipe
if (!(obj is DTOModule item))
return false;
- if (Id!= item.Id)
+ if (Id != item.Id)
return false;
if (ActualDuration != item.ActualDuration)
return false;
diff --git a/Thermo.Active.Model/DTOModels/Recipe/DTOModuleConfigModel.cs b/Thermo.Active.Model/DTOModels/ThModules/DTOModuleConfigModel.cs
similarity index 76%
rename from Thermo.Active.Model/DTOModels/Recipe/DTOModuleConfigModel.cs
rename to Thermo.Active.Model/DTOModels/ThModules/DTOModuleConfigModel.cs
index 93d3c905..abc0278c 100644
--- a/Thermo.Active.Model/DTOModels/Recipe/DTOModuleConfigModel.cs
+++ b/Thermo.Active.Model/DTOModels/ThModules/DTOModuleConfigModel.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Thermo.Active.Model.DTOModels.Recipe
+namespace Thermo.Active.Model.DTOModels.ThModules
{
public class DTOModuleConfigModel
{
diff --git a/Thermo.Active.Model/DTOModels/Recipe/DTOModulesBlock.cs b/Thermo.Active.Model/DTOModels/ThModules/DTOModulesBlock.cs
similarity index 61%
rename from Thermo.Active.Model/DTOModels/Recipe/DTOModulesBlock.cs
rename to Thermo.Active.Model/DTOModels/ThModules/DTOModulesBlock.cs
index fb93caa1..c03051a4 100644
--- a/Thermo.Active.Model/DTOModels/Recipe/DTOModulesBlock.cs
+++ b/Thermo.Active.Model/DTOModels/ThModules/DTOModulesBlock.cs
@@ -1,11 +1,8 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using static Thermo.Active.Model.Constants;
-namespace Thermo.Active.Model.DTOModels.Recipe
+namespace Thermo.Active.Model.DTOModels.ThModules
{
public class DTOModulesBlock
{
@@ -31,7 +28,7 @@ namespace Thermo.Active.Model.DTOModels.Recipe
if (!(obj is DTOModulesBlock item))
return false;
- if (Id!= item.Id)
+ if (Id != item.Id)
return false;
if (LocalizedLabel != item.LocalizedLabel)
return false;
@@ -52,8 +49,8 @@ namespace Thermo.Active.Model.DTOModels.Recipe
if (EstimatedDelay != item.EstimatedDelay)
return false;
if (EstimatedDuration != item.EstimatedDuration)
- return false;
- if (!Enumerable.SequenceEqual(PrecedingId,item.PrecedingId))
+ return false;
+ if (!Enumerable.SequenceEqual(PrecedingId, item.PrecedingId))
return false;
if (Visible != item.Visible)
return false;
@@ -71,53 +68,4 @@ namespace Thermo.Active.Model.DTOModels.Recipe
}
}
-#if false
- public struct RPRange
- {
- public double Min { get; set; }
- public double Max { get; set; }
- public override bool Equals(object obj)
- {
- if (!(obj is RPRange item))
- return false;
-
- if (Min != item.Min)
- return false;
- if (Max != item.Max)
- return false;
-
- return true;
- }
-
- public override int GetHashCode()
- {
- return base.GetHashCode();
- }
- }
- public struct RPStatus
- {
- public bool Visible { get; set; }
- public bool Enabled { get; set; }
- public bool HasError { get; set; }
- public override bool Equals(object obj)
- {
- if (!(obj is RPStatus item))
- return false;
-
- if (Visible != item.Visible)
- return false;
- if (Enabled != item.Enabled)
- return false;
- if (HasError != item.HasError)
- return false;
-
- return true;
- }
-
- public override int GetHashCode()
- {
- return base.GetHashCode();
- }
- }
-#endif
}
diff --git a/Thermo.Active.Model/DTOModels/ThermoProd/DTOProdCycle.cs b/Thermo.Active.Model/DTOModels/ThProd/DTOProdCycle.cs
similarity index 68%
rename from Thermo.Active.Model/DTOModels/ThermoProd/DTOProdCycle.cs
rename to Thermo.Active.Model/DTOModels/ThProd/DTOProdCycle.cs
index eacc1386..606048bf 100644
--- a/Thermo.Active.Model/DTOModels/ThermoProd/DTOProdCycle.cs
+++ b/Thermo.Active.Model/DTOModels/ThProd/DTOProdCycle.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Thermo.Active.Model.DTOModels.ThermoProd
+namespace Thermo.Active.Model.DTOModels.ThProd
{
public enum Status
diff --git a/Thermo.Active.Model/DTOModels/Recipe/DTORecipeConfigModel .cs b/Thermo.Active.Model/DTOModels/ThRecipe/DTORecipeConfigModel .cs
similarity index 72%
rename from Thermo.Active.Model/DTOModels/Recipe/DTORecipeConfigModel .cs
rename to Thermo.Active.Model/DTOModels/ThRecipe/DTORecipeConfigModel .cs
index 26b2e8eb..50a89614 100644
--- a/Thermo.Active.Model/DTOModels/Recipe/DTORecipeConfigModel .cs
+++ b/Thermo.Active.Model/DTOModels/ThRecipe/DTORecipeConfigModel .cs
@@ -1,7 +1,4 @@
-using System.Collections.Generic;
-using Thermo.Active.Model.ConfigModels;
-
-namespace Thermo.Active.Model.DTOModels.Recipe
+namespace Thermo.Active.Model.DTOModels.ThRecipe
{
public class DTORecipeConfigModel
{
diff --git a/Thermo.Active.Model/DTOModels/Recipe/DTORecipeOverview.cs b/Thermo.Active.Model/DTOModels/ThRecipe/DTORecipeOverview.cs
similarity index 57%
rename from Thermo.Active.Model/DTOModels/Recipe/DTORecipeOverview.cs
rename to Thermo.Active.Model/DTOModels/ThRecipe/DTORecipeOverview.cs
index 2ce188b7..1e21678e 100644
--- a/Thermo.Active.Model/DTOModels/Recipe/DTORecipeOverview.cs
+++ b/Thermo.Active.Model/DTOModels/ThRecipe/DTORecipeOverview.cs
@@ -1,12 +1,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-namespace Thermo.Active.Model.DTOModels.Recipe
+namespace Thermo.Active.Model.DTOModels.ThRecipe
{
[JsonConverter(typeof(StringEnumConverter))]
diff --git a/Thermo.Active.Model/DTOModels/Recipe/DTORecipeParam.cs b/Thermo.Active.Model/DTOModels/ThRecipe/DTORecipeParam.cs
similarity index 92%
rename from Thermo.Active.Model/DTOModels/Recipe/DTORecipeParam.cs
rename to Thermo.Active.Model/DTOModels/ThRecipe/DTORecipeParam.cs
index 491927cf..b8bfddb4 100644
--- a/Thermo.Active.Model/DTOModels/Recipe/DTORecipeParam.cs
+++ b/Thermo.Active.Model/DTOModels/ThRecipe/DTORecipeParam.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Thermo.Active.Model.DTOModels.Recipe
+namespace Thermo.Active.Model.DTOModels.ThRecipe
{
public class DTORecipeParam
{
@@ -22,7 +16,7 @@ namespace Thermo.Active.Model.DTOModels.Recipe
if (!(obj is DTORecipeParam item))
return false;
- if (Id!= item.Id)
+ if (Id != item.Id)
return false;
if (SetpointHMI != item.SetpointHMI)
return false;
diff --git a/Thermo.Active.Model/DTOModels/Recipe/DTOWarmers.cs b/Thermo.Active.Model/DTOModels/ThWarmers/DTOWarmers.cs
similarity index 89%
rename from Thermo.Active.Model/DTOModels/Recipe/DTOWarmers.cs
rename to Thermo.Active.Model/DTOModels/ThWarmers/DTOWarmers.cs
index 3207553f..91900ab2 100644
--- a/Thermo.Active.Model/DTOModels/Recipe/DTOWarmers.cs
+++ b/Thermo.Active.Model/DTOModels/ThWarmers/DTOWarmers.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Thermo.Active.Model.DTOModels.Recipe
+namespace Thermo.Active.Model.DTOModels.ThWarmers
{
public class DTOWarmers
{
diff --git a/Thermo.Active.Model/DatabaseModels/AlarmDescriptionsModel.cs b/Thermo.Active.Model/DatabaseModels/AlarmDescriptionsModel.cs
index 71032980..b1514ea4 100644
--- a/Thermo.Active.Model/DatabaseModels/AlarmDescriptionsModel.cs
+++ b/Thermo.Active.Model/DatabaseModels/AlarmDescriptionsModel.cs
@@ -1,10 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Thermo.Active.Model.DatabaseModels
{
diff --git a/Thermo.Active.Model/DatabaseModels/AlarmFileModel.cs b/Thermo.Active.Model/DatabaseModels/AlarmFileModel.cs
index 56d9bde7..6340a096 100644
--- a/Thermo.Active.Model/DatabaseModels/AlarmFileModel.cs
+++ b/Thermo.Active.Model/DatabaseModels/AlarmFileModel.cs
@@ -1,10 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using static Thermo.Active.Model.Constants;
namespace Thermo.Active.Model.DatabaseModels
diff --git a/Thermo.Active.Model/DatabaseModels/AlarmOccurrencesModel.cs b/Thermo.Active.Model/DatabaseModels/AlarmOccurrencesModel.cs
index 24137e11..fc6131d5 100644
--- a/Thermo.Active.Model/DatabaseModels/AlarmOccurrencesModel.cs
+++ b/Thermo.Active.Model/DatabaseModels/AlarmOccurrencesModel.cs
@@ -31,7 +31,7 @@ namespace Thermo.Active.Model.DatabaseModels
[Column("timestamp")]
public DateTime TimeStamp { get; set; }
-
+
//[Column("plc_message_id")]
//public int? PlcMessageId { get; set; }
diff --git a/Thermo.Active.Model/DatabaseModels/AlarmUserModel.cs b/Thermo.Active.Model/DatabaseModels/AlarmUserModel.cs
index bf718884..ac73a839 100644
--- a/Thermo.Active.Model/DatabaseModels/AlarmUserModel.cs
+++ b/Thermo.Active.Model/DatabaseModels/AlarmUserModel.cs
@@ -1,10 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Thermo.Active.Model.DatabaseModels
{
@@ -16,7 +11,7 @@ namespace Thermo.Active.Model.DatabaseModels
[Key, Column("alarm_occurence_id", Order = 1)]
public int AlarmOccurrenceId { get; set; }
-
+
[ForeignKey("AlarmOccurrenceId")]
public virtual AlarmOccurrencesModel AlarmOccurrence { get; set; }
diff --git a/Thermo.Active.Model/DatabaseModels/FavoriteUserSoftKeyModel.cs b/Thermo.Active.Model/DatabaseModels/FavoriteUserSoftKeyModel.cs
index 7204fd54..16870a61 100644
--- a/Thermo.Active.Model/DatabaseModels/FavoriteUserSoftKeyModel.cs
+++ b/Thermo.Active.Model/DatabaseModels/FavoriteUserSoftKeyModel.cs
@@ -1,10 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Thermo.Active.Model.DatabaseModels
{
diff --git a/Thermo.Active.Model/DatabaseModels/FunctionAccessModel.cs b/Thermo.Active.Model/DatabaseModels/FunctionAccessModel.cs
index 11e00486..b77b6a1c 100644
--- a/Thermo.Active.Model/DatabaseModels/FunctionAccessModel.cs
+++ b/Thermo.Active.Model/DatabaseModels/FunctionAccessModel.cs
@@ -9,7 +9,7 @@ namespace Thermo.Active.Model.DatabaseModels
[Key]
[Column("id")]
public int FunctionAccessId { get; set; }
-
+
[Column("name")]
public string Name { get; set; }
diff --git a/Thermo.Active.Model/DatabaseModels/MaintenanceFileModel.cs b/Thermo.Active.Model/DatabaseModels/MaintenanceFileModel.cs
index e00a15ec..142ea352 100644
--- a/Thermo.Active.Model/DatabaseModels/MaintenanceFileModel.cs
+++ b/Thermo.Active.Model/DatabaseModels/MaintenanceFileModel.cs
@@ -1,10 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Thermo.Active.Model.DatabaseModels
{
diff --git a/Thermo.Active.Model/DatabaseModels/MaintenanceModel.cs b/Thermo.Active.Model/DatabaseModels/MaintenanceModel.cs
index 7c11f0b4..5dd56f6f 100644
--- a/Thermo.Active.Model/DatabaseModels/MaintenanceModel.cs
+++ b/Thermo.Active.Model/DatabaseModels/MaintenanceModel.cs
@@ -1,5 +1,4 @@
using System;
-using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using static Thermo.Active.Model.Constants;
@@ -34,7 +33,7 @@ namespace Thermo.Active.Model.DatabaseModels
[Column("unit_of_measure")]
public MAINTENANCE_UNIT_OF_MEASURE? UnitOfMeasure { get; set; }
-
+
[Column("creation_date")]
public DateTime CreationDate { get; set; }
diff --git a/Thermo.Active.Model/DatabaseModels/MaintenanceNoteModel.cs b/Thermo.Active.Model/DatabaseModels/MaintenanceNoteModel.cs
index 02974068..0f3fd9bf 100644
--- a/Thermo.Active.Model/DatabaseModels/MaintenanceNoteModel.cs
+++ b/Thermo.Active.Model/DatabaseModels/MaintenanceNoteModel.cs
@@ -1,24 +1,19 @@
-using Thermo.Active.Model.DatabaseModels;
-using System;
-using System.Collections.Generic;
+using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Thermo.Active.Model.DatabaseModels
-{
+{
[Table("maintenance_note")]
public class MaintenanceNoteModel
{
[Key]
[Column("id")]
public int Id { get; set; }
-
+
[Column("message")]
public string Message { get; set; }
-
+
[Column("user_id")]
public int UserId { get; set; }
diff --git a/Thermo.Active.Model/DatabaseModels/NcFamilyModel.cs b/Thermo.Active.Model/DatabaseModels/NcFamilyModel.cs
index 2336f030..f9655725 100644
--- a/Thermo.Active.Model/DatabaseModels/NcFamilyModel.cs
+++ b/Thermo.Active.Model/DatabaseModels/NcFamilyModel.cs
@@ -1,9 +1,6 @@
using CMS_CORE_Library.Models;
-using Newtonsoft.Json;
-using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
-using System.Runtime.Serialization;
namespace Thermo.Active.Model.DatabaseModels
{
@@ -22,7 +19,7 @@ namespace Thermo.Active.Model.DatabaseModels
public byte RightSize { get; set; }
[Column("left_size")]
- public byte LeftSize { get; set; }
+ public byte LeftSize { get; set; }
[Column("tcp_table")]
public byte TcpTable { get; set; }
@@ -77,7 +74,7 @@ namespace Thermo.Active.Model.DatabaseModels
TcpTable = obj.TcpTable,
Gamma = obj.Gamma,
CoolingByte = obj.CoolingByte,
- RotationType = obj.RotationType,
+ RotationType = obj.RotationType,
MaxLoad = obj.MaxLoad,
MaxSpeed = (ushort)obj.MaxSpeed,
MinLoadPctAutoload = obj.MinLoadPctAutoload,
@@ -85,7 +82,7 @@ namespace Thermo.Active.Model.DatabaseModels
MinLoadDynamicCompensation = obj.MinLoadDynamicCompensation,
MaxLoadDynamicCompensation = obj.MaxLoadDynamicCompensation,
DynamicCompensation = obj.DynamicCompensation,
- LifeType = obj.LifeType,
+ LifeType = obj.LifeType,
NominalLife = obj.NominalLife,
ReviveDelta = (ushort)obj.ReviveDelta
};
diff --git a/Thermo.Active.Model/DatabaseModels/ProdInfoModel.cs b/Thermo.Active.Model/DatabaseModels/ProdInfoModel.cs
index 9c95fef8..64e2f1bb 100644
--- a/Thermo.Active.Model/DatabaseModels/ProdInfoModel.cs
+++ b/Thermo.Active.Model/DatabaseModels/ProdInfoModel.cs
@@ -1,10 +1,6 @@
using System;
-using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Thermo.Active.Model.DatabaseModels
{
diff --git a/Thermo.Active.Model/DatabaseModels/QueueItemsModel.cs b/Thermo.Active.Model/DatabaseModels/QueueItemsModel.cs
index 322d2a0b..3f53a4fe 100644
--- a/Thermo.Active.Model/DatabaseModels/QueueItemsModel.cs
+++ b/Thermo.Active.Model/DatabaseModels/QueueItemsModel.cs
@@ -1,10 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Thermo.Active.Model.DatabaseModels
{
@@ -29,7 +24,7 @@ namespace Thermo.Active.Model.DatabaseModels
[Column("remaining_reps")]
public int RemainingReps { get; set; }
-
+
[Column("absolute_path")]
public string AbsolutePath { get; set; }
diff --git a/Thermo.Active.Model/Properties/AssemblyInfo.cs b/Thermo.Active.Model/Properties/AssemblyInfo.cs
index 1750672a..089b9dc4 100644
--- a/Thermo.Active.Model/Properties/AssemblyInfo.cs
+++ b/Thermo.Active.Model/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
diff --git a/Thermo.Active.Model/Thermo.Active.Model.csproj b/Thermo.Active.Model/Thermo.Active.Model.csproj
index 1583fc3f..1d04ca14 100644
--- a/Thermo.Active.Model/Thermo.Active.Model.csproj
+++ b/Thermo.Active.Model/Thermo.Active.Model.csproj
@@ -105,12 +105,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
@@ -120,7 +120,7 @@
-
+
@@ -143,7 +143,7 @@
-
+
DtsGenerator
@@ -169,9 +169,7 @@
-
-
-
+
diff --git a/Thermo.Active.NC/NcAdapter.cs b/Thermo.Active.NC/NcAdapter.cs
index e18bc32e..e50428c4 100644
--- a/Thermo.Active.NC/NcAdapter.cs
+++ b/Thermo.Active.NC/NcAdapter.cs
@@ -1,28 +1,23 @@
using CMS_CORE_Library;
-using CMS_CORE_Library.Demo;
-using CMS_CORE_Library.Fanuc;
using CMS_CORE_Library.Models;
-using CMS_CORE_Library.Osai;
-using CMS_CORE_Library.Siemens;
using CMS_CORE_Library.S7Net;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
using Thermo.Active.Database.Controllers;
using Thermo.Active.Model.DatabaseModels;
using Thermo.Active.Model.DTOModels;
using Thermo.Active.Model.DTOModels.AlarmModels;
using Thermo.Active.Model.DTOModels.MaintenanceModels;
using Thermo.Active.Model.DTOModels.Scada;
+using Thermo.Active.Model.DTOModels.ThModules;
+using Thermo.Active.Model.DTOModels.ThRecipe;
+using Thermo.Active.Model.DTOModels.ThWarmers;
using Thermo.Active.Utils;
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Text.RegularExpressions;
using static CMS_CORE_Library.Models.DataStructures;
using static Thermo.Active.Config.ServerConfig;
using static Thermo.Active.Model.Constants;
-using Thermo.Active.Model.DTOModels.Recipe;
namespace Thermo.Active.NC
{
@@ -30,6 +25,10 @@ namespace Thermo.Active.NC
{
public NcThermo numericalControl;
+ ///
+ /// Lock per connessione PLC
+ ///
+ private readonly static object connectLock = new object();
public NcAdapter() =>
// Choose NC
@@ -48,11 +47,13 @@ namespace Thermo.Active.NC
public CmsError Connect()
{
- // Connect NC
- if (!numericalControl.NC_IsConnected())
- return numericalControl.NC_Connect();
-
- return null;
+ lock (connectLock)
+ {
+ // Connect NC
+ if (!numericalControl.NC_IsConnected())
+ return numericalControl.NC_Connect();
+ }
+ return NO_ERROR;
}
public NcThermo SetNumericalControl()
@@ -1060,80 +1061,6 @@ namespace Thermo.Active.NC
return libraryError;
}
-#if false
- // !!!FARE!!! è copia delle heads
- public CmsError GetRecipeData(out List heads)
- {
- // Returned value
- heads = new List();
- // Number of configured heads
- int headsNumber = HeadsConfig.Count;
-
- List plcHeads = new List();
- // Read value from PLC
- CmsError libraryError = numericalControl.PLC_RHeadsData(plcHeads, headsNumber);
- if (libraryError.IsError())
- return libraryError;
-
- foreach (var head in plcHeads)
- {
- // Get current head config
- var configuredHead = HeadsConfig.Find(x => x.Id == head.Id);
- // Create different model according on type
- switch (configuredHead.Type)
- {
- case HEAD_TYPE.SPINDLE:
- {
- heads.Add(new DTOSpindleModel()
- {
- Id = head.Id,
- Process = head.Process,
- Type = configuredHead.Type.ToString(),
- FixedHead = configuredHead.FixedHead,
- inWarning = head.Load_Abrasive >= configuredHead.WarningLimit,
- inAlarm = head.Load_Abrasive >= configuredHead.AlarmLimit,
- OverrideEditable = head.OverrideEditable,
- ActualSpeed = head.ActualSpeed_Pressure,
- Load = head.Load_Abrasive,
- Override = head.Override,
- IsActive = head.IsActive,
- IsSelected = head.IsSelected,
- AbrasiveIsActive = head.AbrasiveIsActive,
- Configured = head.Configured,
- Rotation = head.Rotation,
- WorkedTime = head.WorkedTime
- });
- }
- break;
-
-
- case HEAD_TYPE.WJ:
- {
- heads.Add(new DTOWaterJet()
- {
- Id = head.Id,
- Process = head.Process,
- Type = configuredHead.Type.ToString(),
- FixedHead = configuredHead.FixedHead,
- inAlarm = false,
- inWarning = false,
- ActualPressure = head.ActualSpeed_Pressure,
- OverrideEditable = head.OverrideEditable,
- Override = head.Override,
- IsActive = head.IsActive,
- IsSelected = head.IsSelected,
- AbrasiveIsActive = head.AbrasiveIsActive,
- WorkedTime = head.WorkedTime
- });
- }
- break;
- }
- }
-
- return libraryError;
- }
-
-#endif
public CmsError GetM155Data(out List data)
{
data = new List();
@@ -1390,8 +1317,8 @@ namespace Thermo.Active.NC
Max = paramPLC.ValMax / item.ScaleFactor
};
- // FIXME TODO impostato a true in debug x testing UI
-#if DEBUG
+ // FIXME TODO impostato a true x testing
+#if true
currStatus = new RPStatus()
{
Visible = true,
@@ -1552,7 +1479,7 @@ namespace Thermo.Active.NC
/// Gestione strobe richiesta cambio modo
///
///
- public CmsError StrobeMode(Model.DTOModels.ThermoProd.Mode mode)
+ public CmsError StrobeMode(Model.DTOModels.ThProd.Mode mode)
{
// solo x S7...
if (NcConfig.NcVendor == NC_VENDOR.S7NET)
diff --git a/Thermo.Active.NC/NcFileAdapter.cs b/Thermo.Active.NC/NcFileAdapter.cs
index a7739b4f..513b9de8 100644
--- a/Thermo.Active.NC/NcFileAdapter.cs
+++ b/Thermo.Active.NC/NcFileAdapter.cs
@@ -3,17 +3,14 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using static CMS_CORE_Library.Models.DataStructures;
-using static Thermo.Active.Model.Constants;
-using static Thermo.Active.Config.ServerConfig;
+using Thermo.Active.Database.Controllers;
using Thermo.Active.Model.DTOModels;
using Thermo.Active.Model.DTOModels.JobModels;
using Thermo.Active.Utils;
-using Thermo.Active.Database.Controllers;
+using static CMS_CORE_Library.Models.DataStructures;
+using static Thermo.Active.Config.ServerConfig;
using static Thermo.Active.Database.Controllers.QueueController;
-using System.Text.RegularExpressions;
+using static Thermo.Active.Model.Constants;
namespace Thermo.Active.NC
{
@@ -68,7 +65,7 @@ namespace Thermo.Active.NC
{
return FILE_NOT_FOUND_ERROR;
}
-
+
return NO_ERROR;
}
diff --git a/Thermo.Active.NC/Properties/AssemblyInfo.cs b/Thermo.Active.NC/Properties/AssemblyInfo.cs
index 846fbf6b..ff533433 100644
--- a/Thermo.Active.NC/Properties/AssemblyInfo.cs
+++ b/Thermo.Active.NC/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Le informazioni generali relative a un assembly sono controllate dal seguente
diff --git a/Thermo.Active.UI/Dialogs/LockForm.cs b/Thermo.Active.UI/Dialogs/LockForm.cs
index c4ff8d04..f3c06f77 100644
--- a/Thermo.Active.UI/Dialogs/LockForm.cs
+++ b/Thermo.Active.UI/Dialogs/LockForm.cs
@@ -1,12 +1,4 @@
-using Thermo.Active.NC;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System;
using System.Windows.Forms;
namespace Thermo.Active.UI
diff --git a/Thermo.Active.UI/Dialogs/PasswordForm.cs b/Thermo.Active.UI/Dialogs/PasswordForm.cs
index 8b500934..271554ed 100644
--- a/Thermo.Active.UI/Dialogs/PasswordForm.cs
+++ b/Thermo.Active.UI/Dialogs/PasswordForm.cs
@@ -1,13 +1,6 @@
-using Thermo.Active.NC;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System;
using System.Windows.Forms;
+using Thermo.Active.NC;
namespace Thermo.Active.UI
{
@@ -67,18 +60,18 @@ namespace Thermo.Active.UI
else if (Utils.CandiesController.LincensePasswordDecode(psw, out string MatricolaString, out int MatricolaNumerica, out int Command, out long Parameter))
//Controllo la matricola
- if (this.Matricola != MatricolaString)
+ if (this.Matricola != MatricolaString)
bValid = false;
else
{
switch (Command)
{
//password del service
- case 1: bValid = true;break;
+ case 1: bValid = true; break;
//SET Licenza Temporanea
case 2:
- if(Nc != null)
+ if (Nc != null)
{
Licenza = new DateTime(Parameter * TimeSpan.TicksPerDay);
Nc.WriteCandy(Licenza, MatricolaNumerica);
@@ -98,7 +91,7 @@ namespace Thermo.Active.UI
}
bValid = false;
- }
+ }
else
bValid = false;
diff --git a/Thermo.Active.UI/Dialogs/ResetCountersForm.cs b/Thermo.Active.UI/Dialogs/ResetCountersForm.cs
index e2e6db0c..166391f7 100644
--- a/Thermo.Active.UI/Dialogs/ResetCountersForm.cs
+++ b/Thermo.Active.UI/Dialogs/ResetCountersForm.cs
@@ -1,15 +1,9 @@
-using CMS_CORE_Library.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
using Thermo.Active.NC;
using Thermo.Active.Utils;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
using static CMS_CORE_Library.Models.DataStructures;
namespace Thermo.Active.UI
@@ -66,7 +60,7 @@ namespace Thermo.Active.UI
private void checkPSW(String psw)
{
- if(Matricola== null || Matricola.Trim() == "" || MatricolaNum <= 0)
+ if (Matricola == null || Matricola.Trim() == "" || MatricolaNum <= 0)
{
MessageBox.Show("Machine ID non correct", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
@@ -76,7 +70,7 @@ namespace Thermo.Active.UI
MessageBox.Show("Counter must be selected", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
-
+
// sfrutto password delle teste, passando la testa 0
if (!Utils.CandiesController.HeadsPasswordCheck(psw, MatricolaNum, 0))
{
@@ -84,12 +78,12 @@ namespace Thermo.Active.UI
return;
}
- if (!Nc.ResetMaintenanceCounter((uint) comboBoxSpindle.SelectedIndex))
+ if (!Nc.ResetMaintenanceCounter((uint)comboBoxSpindle.SelectedIndex))
{
MessageBox.Show("Error While Resetting time", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
-
+
MessageBox.Show("Time resetted", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
ReadHours();
TextBox_Password.Text = "";
diff --git a/Thermo.Active.UI/Dialogs/ResetMachineHoursForm.cs b/Thermo.Active.UI/Dialogs/ResetMachineHoursForm.cs
index ee2cd3a4..e8d8a4a3 100644
--- a/Thermo.Active.UI/Dialogs/ResetMachineHoursForm.cs
+++ b/Thermo.Active.UI/Dialogs/ResetMachineHoursForm.cs
@@ -1,14 +1,7 @@
-using Thermo.Active.NC;
-using Thermo.Active.Utils;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System;
using System.Windows.Forms;
+using Thermo.Active.NC;
+using Thermo.Active.Utils;
namespace Thermo.Active.UI
{
@@ -63,12 +56,12 @@ namespace Thermo.Active.UI
private void checkPSW(String psw)
{
- if(Matricola== null || Matricola.Trim() == "" || MatricolaNum <= 0)
+ if (Matricola == null || Matricola.Trim() == "" || MatricolaNum <= 0)
{
MessageBox.Show("Machine ID non correct", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
-
+
uint val = 0;
bool isNumber = uint.TryParse(textBoxNewVal.Text, out val);
if (!isNumber)
@@ -89,7 +82,7 @@ namespace Thermo.Active.UI
MessageBox.Show("Error While Resetting time", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
-
+
MessageBox.Show("Time resetted", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
ReadHours();
TextBox_Password.Text = "";
@@ -97,7 +90,7 @@ namespace Thermo.Active.UI
}
private void ReadHours()
- {
+ {
uint realVal = 0;
uint secs = 0;
uint hours = 0;
@@ -120,7 +113,7 @@ namespace Thermo.Active.UI
textBoxHours.Text = hours.ToString() + "h " + min.ToString() + "m " + secs.ToString() + "s";
labelValue.Text = realVal.ToString();
}
-
+
}
}
}
diff --git a/Thermo.Active.UI/Dialogs/ResetSpindleForm.cs b/Thermo.Active.UI/Dialogs/ResetSpindleForm.cs
index f0d9cb95..b678b4e5 100644
--- a/Thermo.Active.UI/Dialogs/ResetSpindleForm.cs
+++ b/Thermo.Active.UI/Dialogs/ResetSpindleForm.cs
@@ -1,14 +1,7 @@
-using Thermo.Active.NC;
-using Thermo.Active.Utils;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System;
using System.Windows.Forms;
+using Thermo.Active.NC;
+using Thermo.Active.Utils;
namespace Thermo.Active.UI
{
@@ -64,7 +57,7 @@ namespace Thermo.Active.UI
private void checkPSW(String psw)
{
- if(Matricola== null || Matricola.Trim() == "" || MatricolaNum <= 0)
+ if (Matricola == null || Matricola.Trim() == "" || MatricolaNum <= 0)
{
MessageBox.Show("Machine ID non correct", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
@@ -85,7 +78,7 @@ namespace Thermo.Active.UI
{
MessageBox.Show("Error While Resetting time", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
-
+
MessageBox.Show("Time resetted", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
ReadHours();
TextBox_Password.Text = "";
diff --git a/Thermo.Active.UI/Properties/AssemblyInfo.cs b/Thermo.Active.UI/Properties/AssemblyInfo.cs
index 56a69acb..23ab1fe7 100644
--- a/Thermo.Active.UI/Properties/AssemblyInfo.cs
+++ b/Thermo.Active.UI/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
diff --git a/Thermo.Active.UI/ServerControlWindow.cs b/Thermo.Active.UI/ServerControlWindow.cs
index f488997a..08d6af4b 100644
--- a/Thermo.Active.UI/ServerControlWindow.cs
+++ b/Thermo.Active.UI/ServerControlWindow.cs
@@ -1,19 +1,15 @@
-using Thermo.Active.Core;
-using Thermo.Active.Model;
-using Thermo.Active.Model.DTOModels;
-using Thermo.Active.NC;
-using Thermo.Active.Utils;
-using System;
+using System;
using System.Collections.Generic;
-using System.ComponentModel;
using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
using TeamDev.SDK.MVVM;
+using Thermo.Active.Core;
+using Thermo.Active.Model;
+using Thermo.Active.Model.DTOModels;
+using Thermo.Active.NC;
+using Thermo.Active.Utils;
using static Thermo.Active.Config.ServerConfig;
using static Thermo.Active.Model.Constants;
@@ -44,7 +40,7 @@ namespace Thermo.Active.UI
{
InitializeComponent();
- if (ServerStartupConfig.AutoOpenCmsClient)
+ if (ServerStartupConfig.AutoOpenCmsClient)
this.Opacity = 0;
//Begin the update
@@ -57,7 +53,7 @@ namespace Thermo.Active.UI
LISTThreadStatus.EndUpdate();
// Set software version
TXTVersion.Text = SupportFunctions.GetSoftwareVersionAndBuildDate();
-
+
PswForm = new PasswordForm();
ResSpForm = new ResetSpindleForm();
ResCouForm = new ResetCountersForm();
@@ -160,12 +156,12 @@ namespace Thermo.Active.UI
private void InitializeMessageListeners()
{
MVVMListeners = new List
- {
+ {
MessageServices.Current.Subscribe(SEND_MESSAGE, (a, b) =>
{
// Cast object to ErrorMessageModel
ErrorMessageModel message = (ErrorMessageModel)a;
-
+
if(message.ErrorLevel <= ERROR_LEVEL.ERROR)
{
// If error has a fatal level, icon must be error
@@ -222,7 +218,7 @@ namespace Thermo.Active.UI
{
// Show balloon with new status
StepNotifyIcon.ShowBalloonTip(1000, title, message, toolTipIcon);
- TXTstatus.Text = "[" + DateTime.Now.ToString("T") + "] " + title;
+ TXTstatus.Text = "[" + DateTime.Now.ToString("T") + "] " + title;
});
}
@@ -291,7 +287,7 @@ namespace Thermo.Active.UI
private static bool ClientIsRunning()
{
Process[] p = Process.GetProcessesByName(CLIENT_EXE_NAME_NOEXT);
- foreach(Process pr in p)
+ foreach (Process pr in p)
{
if (pr.MainWindowHandle != IntPtr.Zero)
{
diff --git a/Thermo.Active.UI/Views/OpeningLayer.cs b/Thermo.Active.UI/Views/OpeningLayer.cs
index 118849c4..aed7e087 100644
--- a/Thermo.Active.UI/Views/OpeningLayer.cs
+++ b/Thermo.Active.UI/Views/OpeningLayer.cs
@@ -1,6 +1,6 @@
using System;
-using System.Windows.Forms;
using System.Threading;
+using System.Windows.Forms;
namespace Thermo.Active.UI.Views
{
diff --git a/Thermo.Active.Utils/CandiesController.cs b/Thermo.Active.Utils/CandiesController.cs
index cf0b5563..5d97405d 100644
--- a/Thermo.Active.Utils/CandiesController.cs
+++ b/Thermo.Active.Utils/CandiesController.cs
@@ -1,11 +1,8 @@
using Microsoft.Win32;
-using Thermo.Active.Model;
using System;
-using System.Collections.Generic;
using System.IO;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using Thermo.Active.Model;
namespace Thermo.Active.Utils
{
@@ -51,7 +48,7 @@ namespace Thermo.Active.Utils
int indexParameterOffset = 6;
- if(decryptedString.Count() > 13)
+ if (decryptedString.Count() > 13)
{
// If decrypted string has more than 13 characters means that the machine number contains a letter
var machinNumberString = decryptedString.Substring(1, 11);
@@ -119,14 +116,14 @@ namespace Thermo.Active.Utils
days = Int32.MaxValue;
else
days = 0;
-
+
nLic = ((long)Matricola << 16) + days;
return AlgoritmoLicence(nLic);
}
// Gestisce l'export dei dati partendo dalla licenza letta dal CN
- public static bool GetDataFromLincense(long RawLincence, bool containsLetters, out long EndLincence, out int Matricola, out long Parameter)
+ public static bool GetDataFromLincense(long RawLincence, bool containsLetters, out long EndLincence, out int Matricola, out long Parameter)
{
Matricola = 0;
Parameter = 0;
@@ -134,11 +131,11 @@ namespace Thermo.Active.Utils
if (RawLincence == 0)
return false;
-
+
EndLincence = AlgoritmoLicence_Back(RawLincence.ToString());
Parameter = EndLincence & 0xFFFF;
- if(containsLetters)
+ if (containsLetters)
Matricola = (int)((EndLincence >> 16) & 0xFFFFFFFF);
else
Matricola = (int)((EndLincence >> 16) & 0xFFFF);
@@ -152,7 +149,7 @@ namespace Thermo.Active.Utils
//Elabora la licenza e decide se va riscritta
public static void ElaborateLincense(bool bPC_VALID, bool bNC_VALID, long PCParam, long NCParam, long PcPLic, long NCLic, out DateTime newDate, out bool toRewrite)
{
- long newParam=0;
+ long newParam = 0;
if (bNC_VALID & bPC_VALID)
{
@@ -237,7 +234,7 @@ namespace Thermo.Active.Utils
// Controllo dell'orario per iniziare a controllare
- public static bool ElaborateExpiredBit(DateTime date,bool NcExpiredBit, out bool NewExpiredBit)
+ public static bool ElaborateExpiredBit(DateTime date, bool NcExpiredBit, out bool NewExpiredBit)
{
DateTime LastWriteTime;
NewExpiredBit = false;
@@ -251,11 +248,11 @@ namespace Thermo.Active.Utils
else
File.Create(Constants.CANDY_DUMMYFILE_PATH);
LastWriteTime = File.GetLastWriteTime(Constants.CANDY_DUMMYFILE_PATH);
-
+
//Manage Lincese Expired Bit
//1. If unlimited
- if(date.Ticks / TimeSpan.TicksPerDay == BASE_TIME)
+ if (date.Ticks / TimeSpan.TicksPerDay == BASE_TIME)
{
if (NcExpiredBit)
{
@@ -290,7 +287,7 @@ namespace Thermo.Active.Utils
}
//Nothing to write
- return false;
+ return false;
}
@@ -315,20 +312,20 @@ namespace Thermo.Active.Utils
aCript[8] = "P";
aCript[9] = "A";
aCript[10] = "S";
- aCript[11] = "D" ;
- aCript[12] = "F" ;
- aCript[13] = "G" ;
- aCript[14] = "X" ;
- aCript[15] = "J" ;
- aCript[16] = "K" ;
- aCript[17] = "L" ;
+ aCript[11] = "D";
+ aCript[12] = "F";
+ aCript[13] = "G";
+ aCript[14] = "X";
+ aCript[15] = "J";
+ aCript[16] = "K";
+ aCript[17] = "L";
aCript[18] = "M";
szDay = DateTime.Now.Day.ToString();
szMonth = DateTime.Now.Month.ToString();
szYear = DateTime.Now.ToString("yy");
- if(Matricola > 0 && Testa >= 0)
+ if (Matricola > 0 && Testa >= 0)
{
//First step calculate the DAY
@@ -347,11 +344,11 @@ namespace Thermo.Active.Utils
szRes = String.Format(nRes.ToString(), "{0:0000000}");
//Generate Password
- psw = aCript[Convert.ToInt32(Mid(szRes, 1, 1)) + Convert.ToInt32(Mid(szRes, 7, 1))] + Mid(szRes, 1, 3) +
+ psw = aCript[Convert.ToInt32(Mid(szRes, 1, 1)) + Convert.ToInt32(Mid(szRes, 7, 1))] + Mid(szRes, 1, 3) +
aCript[Convert.ToInt32(Mid(szRes, 6, 1)) + Convert.ToInt32(Mid(szRes, 5, 1))] + Mid(szRes, 4, 3) +
- aCript[Convert.ToInt32(Mid(szRes, 4, 1)) + Convert.ToInt32(Mid(szRes, 3, 1))] + Mid(szRes, 7, szRes.Length -6);
+ aCript[Convert.ToInt32(Mid(szRes, 4, 1)) + Convert.ToInt32(Mid(szRes, 3, 1))] + Mid(szRes, 7, szRes.Length - 6);
- if (Password == psw)
+ if (Password == psw)
return true;
else
return false;
@@ -408,10 +405,10 @@ namespace Thermo.Active.Utils
private static string AlgoritmoLicence(long lVal)
{
String sVal = "";
- while(lVal >= 10)
+ while (lVal >= 10)
{
- sVal = sVal + AlgoritmoLicence(lVal/10);
- lVal = lVal - 10 * (lVal/10);
+ sVal = sVal + AlgoritmoLicence(lVal / 10);
+ lVal = lVal - 10 * (lVal / 10);
}
// lVal < 10
@@ -433,7 +430,7 @@ namespace Thermo.Active.Utils
private static string Mid(string value, int index)
- {
+ {
// Check index and string correctness
if (string.IsNullOrEmpty(value))
return value;
@@ -447,7 +444,7 @@ namespace Thermo.Active.Utils
}
- private static string Mid(string value, int index,int lenght)
+ private static string Mid(string value, int index, int lenght)
{
value = Mid(value, index);
if (lenght <= value.Length)
@@ -462,8 +459,8 @@ namespace Thermo.Active.Utils
// KEY_NAME
if (bWrite)
Registry.SetValue(KEY_NAME, KEY_VALUE_NAME, Licenza, RegistryValueKind.String);
-
- objLicence = Registry.GetValue(KEY_NAME, KEY_VALUE_NAME,0);
+
+ objLicence = Registry.GetValue(KEY_NAME, KEY_VALUE_NAME, 0);
if (objLicence == null) objLicence = 0;
Licenza = objLicence.ToString();
}
diff --git a/Thermo.Active.Utils/ExceptionManager.cs b/Thermo.Active.Utils/ExceptionManager.cs
index ae04a34a..740994d1 100644
--- a/Thermo.Active.Utils/ExceptionManager.cs
+++ b/Thermo.Active.Utils/ExceptionManager.cs
@@ -3,8 +3,8 @@ using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;
-using Thermo.Active.Model;
using TeamDev.SDK.MVVM;
+using Thermo.Active.Model;
using static Thermo.Active.Model.Constants;
using static Thermo.Active.Utils.ThermoActiveLogger;
@@ -15,7 +15,7 @@ namespace Thermo.Active.Utils
public static void ManageException(ERROR_LEVEL errorLevel, Exception exception)
{
string message = exception.Message;
- if(exception.InnerException != null)
+ if (exception.InnerException != null)
{
// Add inner exception message (if exists)
message += " | " + exception.InnerException.Message;
@@ -28,8 +28,8 @@ namespace Thermo.Active.Utils
}
private static bool MessageBoxShow = false;
-
- public static void ManageError(ERROR_LEVEL errorLevel, string message, bool beforeFormReady = false)
+
+ public static void ManageError(ERROR_LEVEL errorLevel, string message, bool beforeFormReady = false)
{
switch (errorLevel)
{
@@ -65,7 +65,8 @@ namespace Thermo.Active.Utils
// Close the application
Environment.Exit(1);
}
- }break;
+ }
+ break;
default:
{
LogFatal(message);
@@ -78,11 +79,11 @@ namespace Thermo.Active.Utils
break;
}
}
-
+
private static void LogAndNotifyUsers(ErrorMessageModel error)
{
// Log
- LogMessage(error.Message, (ERROR_LEVEL)error.ErrorLevel);
+ LogMessage(error.Message, (ERROR_LEVEL)error.ErrorLevel);
NotifyUsersAndClose(error);
}
@@ -119,7 +120,7 @@ namespace Thermo.Active.Utils
{
if (methodName != "")
message = message + " | " + methodName;
-
+
return new ErrorMessageModel()
{
Title = title,
diff --git a/Thermo.Active.Utils/LanguageController.cs b/Thermo.Active.Utils/LanguageController.cs
index d9e60df7..0a4d8ffc 100644
--- a/Thermo.Active.Utils/LanguageController.cs
+++ b/Thermo.Active.Utils/LanguageController.cs
@@ -1,10 +1,10 @@
-using Thermo.Active.Model.DTOModels;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using System.Xml.Schema;
+using Thermo.Active.Model.DTOModels;
using static Thermo.Active.Model.Constants;
namespace Thermo.Active.Utils
@@ -46,7 +46,7 @@ namespace Thermo.Active.Utils
.ToDictionary(x => x.Name.ToString(), x => x.Value); // Populate dictionary
}
- public static List GetLanguageListFromDirectory()
+ public static List GetLanguageListFromDirectory()
{
// Check if directory exists
if (Directory.Exists(LANGUAGE_PACK_DIRECTORY))
diff --git a/Thermo.Active.Utils/Properties/AssemblyInfo.cs b/Thermo.Active.Utils/Properties/AssemblyInfo.cs
index a54242da..9c17a319 100644
--- a/Thermo.Active.Utils/Properties/AssemblyInfo.cs
+++ b/Thermo.Active.Utils/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Le informazioni generali relative a un assembly sono controllate dal seguente
diff --git a/Thermo.Active.Utils/supportFunctions.cs b/Thermo.Active.Utils/supportFunctions.cs
index b41ac62a..8d9a7d97 100644
--- a/Thermo.Active.Utils/supportFunctions.cs
+++ b/Thermo.Active.Utils/supportFunctions.cs
@@ -1,5 +1,4 @@
using Newtonsoft.Json;
-using Thermo.Active.Model.DTOModels.JobModels;
using System;
using System.Collections.Generic;
using System.Drawing;
@@ -11,6 +10,7 @@ using System.Reflection;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
+using Thermo.Active.Model.DTOModels.JobModels;
using static CMS_CORE_Library.Models.DataStructures;
using static Thermo.Active.Model.Constants;
diff --git a/Thermo.Active/App.config b/Thermo.Active/App.config
index 64ce6002..777d1759 100644
--- a/Thermo.Active/App.config
+++ b/Thermo.Active/App.config
@@ -4,154 +4,154 @@
https://go.microsoft.com/fwlink/?LinkId=301879
-->
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Thermo.Active/App_Start/SignalRContractResolver.cs b/Thermo.Active/App_Start/SignalRContractResolver.cs
index 666d165d..959d7bbe 100644
--- a/Thermo.Active/App_Start/SignalRContractResolver.cs
+++ b/Thermo.Active/App_Start/SignalRContractResolver.cs
@@ -1,7 +1,7 @@
-using System;
-using System.Reflection;
-using Microsoft.AspNet.SignalR.Infrastructure;
+using Microsoft.AspNet.SignalR.Infrastructure;
using Newtonsoft.Json.Serialization;
+using System;
+using System.Reflection;
namespace Thermo.Active.App_Start
{
diff --git a/Thermo.Active/App_Start/Startup.cs b/Thermo.Active/App_Start/Startup.cs
index cc68b4db..c984c618 100644
--- a/Thermo.Active/App_Start/Startup.cs
+++ b/Thermo.Active/App_Start/Startup.cs
@@ -4,17 +4,18 @@ using Microsoft.Owin.Cors;
using Microsoft.Owin.FileSystems;
using Microsoft.Owin.Security.OAuth;
using Microsoft.Owin.StaticFiles;
+using Microsoft.Owin.StaticFiles.ContentTypes;
using Newtonsoft.Json;
using Owin;
-using Thermo.Active.Core;
-using Thermo.Active.Provider;
-using Thermo.Active.Utils;
using System;
using System.Configuration;
using System.IO;
using System.Net;
using System.Net.NetworkInformation;
using System.Web.Http;
+using Thermo.Active.Core;
+using Thermo.Active.Provider;
+using Thermo.Active.Utils;
using static Thermo.Active.Config.ServerConfig;
using static Thermo.Active.Model.Constants;
@@ -47,24 +48,35 @@ namespace Thermo.Active.App_Start
ConfigureWebApiOAuth(app);
app.UseWebApi(config);
-
+
// SignalR config & startup
SignalRConfig(app);
var directoryBrowsing = ConfigurationManager.AppSettings["enableDirectoryBrowsing"] == "true";
-
+
// Check if web site directory exists
- if (!Directory.Exists(WEBSITE_DIRECTORY))
+ if (!Directory.Exists(WEBSITE_DIRECTORY))
ExceptionManager.ManageError(ERROR_LEVEL.FATAL, "Main window directory not found!");
- var options = new FileServerOptions()
- {
+ var options = new FileServerOptions()
+ {
EnableDefaultFiles = !directoryBrowsing,
EnableDirectoryBrowsing = directoryBrowsing,
RequestPath = PathString.Empty,
- FileSystem = new PhysicalFileSystem(WEBSITE_DIRECTORY),
+ FileSystem = new PhysicalFileSystem(WEBSITE_DIRECTORY),
+
};
+ options.StaticFileOptions.ServeUnknownFileTypes = true;
+ options.StaticFileOptions.ContentTypeProvider = new FileExtensionContentTypeProvider();
+ ((FileExtensionContentTypeProvider)options.StaticFileOptions.ContentTypeProvider).Mappings.Add("json", "application/json");
+ ((FileExtensionContentTypeProvider)options.StaticFileOptions.ContentTypeProvider).Mappings.Add("ttf", "font/truetype");
+
+
+ //// Setup configuration sources.
+ //Configuration = new Configuration().AddJsonFile("config.json").AddEnvironmentVariables();
+ //contentProvider.Mappings.Add(".woff2", "application/font-woff2");
+
app.UseFileServer(options);
if (!ServerPortIsAvailable(ServerStartupConfig.ServerPort))
{
diff --git a/Thermo.Active/App_Start/SwaggerConfig.cs b/Thermo.Active/App_Start/SwaggerConfig.cs
index 1a178d30..fb0fe40a 100644
--- a/Thermo.Active/App_Start/SwaggerConfig.cs
+++ b/Thermo.Active/App_Start/SwaggerConfig.cs
@@ -1,39 +1,37 @@
-using System.Web.Http;
-using WebActivatorEx;
-using Thermo.Active;
using Swashbuckle.Application;
using Swashbuckle.Swagger;
-using System.Web.Http.Description;
using System.Collections.Generic;
+using System.Web.Http;
+using System.Web.Http.Description;
namespace Thermo.Active
{
- public class SwaggerConfig
- {
- public static void Register(HttpConfiguration config)
+ public class SwaggerConfig
{
- var thisAssembly = typeof(SwaggerConfig).Assembly;
+ public static void Register(HttpConfiguration config)
+ {
+ var thisAssembly = typeof(SwaggerConfig).Assembly;
- config
- .EnableSwagger(c =>
- {
- // By default, the service root url is inferred from the request used to access the docs.
- // However, there may be situations (e.g. proxy and load-balanced environments) where this does not
- // resolve correctly. You can workaround this by providing your own code to determine the root URL.
- //
- //c.RootUrl(req => GetRootUrlFromAppConfig());
+ config
+ .EnableSwagger(c =>
+ {
+ // By default, the service root url is inferred from the request used to access the docs.
+ // However, there may be situations (e.g. proxy and load-balanced environments) where this does not
+ // resolve correctly. You can workaround this by providing your own code to determine the root URL.
+ //
+ //c.RootUrl(req => GetRootUrlFromAppConfig());
- // If schemes are not explicitly provided in a Swagger 2.0 document, then the scheme used to access
- // the docs is taken as the default. If your API supports multiple schemes and you want to be explicit
- // about them, you can use the "Schemes" option as shown below.
- //
- //c.Schemes(new[] { "http", "https" });
+ // If schemes are not explicitly provided in a Swagger 2.0 document, then the scheme used to access
+ // the docs is taken as the default. If your API supports multiple schemes and you want to be explicit
+ // about them, you can use the "Schemes" option as shown below.
+ //
+ //c.Schemes(new[] { "http", "https" });
- // Use "SingleApiVersion" to describe a single version API. Swagger 2.0 includes an "Info" object to
- // hold additional metadata for an API. Version and title are required but you can also provide
- // additional fields by chaining methods off SingleApiVersion.
- //
- c.SingleApiVersion("v1", "ThermoActive");
+ // Use "SingleApiVersion" to describe a single version API. Swagger 2.0 includes an "Info" object to
+ // hold additional metadata for an API. Version and title are required but you can also provide
+ // additional fields by chaining methods off SingleApiVersion.
+ //
+ c.SingleApiVersion("v1", "ThermoActive");
// If you want the output Swagger docs to be indented properly, enable the "PrettyPrint" option.
//
@@ -178,8 +176,8 @@ namespace Thermo.Active
//
//c.CustomProvider((defaultProvider) => new CachingSwaggerProvider(defaultProvider));
})
- .EnableSwaggerUi(c =>
- {
+ .EnableSwaggerUi(c =>
+ {
// Use the "DocumentTitle" option to change the Document title.
// Very helpful when you have multiple Swagger pages open, to tell them apart.
//
@@ -251,8 +249,8 @@ namespace Thermo.Active
//
//c.EnableApiKeySupport("apiKey", "header");
});
+ }
}
- }
public class AddRequiredHeaderParameter : IOperationFilter
{
diff --git a/Thermo.Active/App_Start/WebApiConfig.cs b/Thermo.Active/App_Start/WebApiConfig.cs
index d4212895..c6e0e24d 100644
--- a/Thermo.Active/App_Start/WebApiConfig.cs
+++ b/Thermo.Active/App_Start/WebApiConfig.cs
@@ -1,7 +1,4 @@
using Newtonsoft.Json.Serialization;
-using System;
-using System.Collections.Generic;
-using System.Linq;
using System.Web.Http;
using System.Web.Http.ExceptionHandling;
diff --git a/Thermo.Active/Attributes/PositiveNumberAttribute.cs b/Thermo.Active/Attributes/PositiveNumberAttribute.cs
index 87ad92a6..2a76af5d 100644
--- a/Thermo.Active/Attributes/PositiveNumberAttribute.cs
+++ b/Thermo.Active/Attributes/PositiveNumberAttribute.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.ComponentModel.DataAnnotations;
namespace Thermo.Active.Attributes
{
diff --git a/Thermo.Active/Attributes/SignalRAuthorizeAttribute.cs b/Thermo.Active/Attributes/SignalRAuthorizeAttribute.cs
index 464cd5e7..d5162742 100644
--- a/Thermo.Active/Attributes/SignalRAuthorizeAttribute.cs
+++ b/Thermo.Active/Attributes/SignalRAuthorizeAttribute.cs
@@ -1,18 +1,16 @@
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Hubs;
using Microsoft.AspNet.SignalR.Owin;
-using Thermo.Active.App_Start;
-using Thermo.Active.Config;
-using Thermo.Active.Database.Controllers;
-using Thermo.Active.Model.DatabaseModels;
-using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Security.Principal;
+using Thermo.Active.Config;
+using Thermo.Active.Database.Controllers;
+using Thermo.Active.Model.DatabaseModels;
using static Thermo.Active.Config.ServerConfig;
-using static Thermo.Active.Model.Constants;
using static Thermo.Active.Listeners.SignalRStaticObjects;
+using static Thermo.Active.Model.Constants;
namespace Thermo.Active.Attributes
{
@@ -58,7 +56,7 @@ namespace Thermo.Active.Attributes
}
return false;
}
-
+
private bool CheckAuthorization(string functionName, string token, out int machineId, out int userId)
{
diff --git a/Thermo.Active/Attributes/WebApiAuthorizeAttribute.cs b/Thermo.Active/Attributes/WebApiAuthorizeAttribute.cs
index 2049fc0e..04a03871 100644
--- a/Thermo.Active/Attributes/WebApiAuthorizeAttribute.cs
+++ b/Thermo.Active/Attributes/WebApiAuthorizeAttribute.cs
@@ -1,17 +1,13 @@
-using System;
-using System.Linq;
+using System.Linq;
+using System.Security.Claims;
using System.Web.Http;
using System.Web.Http.Controllers;
-using Thermo.Active.Database.Controllers;
using Thermo.Active.Config;
+using Thermo.Active.Database.Controllers;
using Thermo.Active.Model.DatabaseModels;
using static Thermo.Active.Config.ServerConfig;
-using static Thermo.Active.Model.Constants;
using static Thermo.Active.Listeners.SignalRStaticObjects;
-
-using Microsoft.Owin.Security.OAuth;
-using System.Security.Claims;
-using Microsoft.Owin.Security;
+using static Thermo.Active.Model.Constants;
namespace Thermo.Active
{
@@ -19,14 +15,14 @@ namespace Thermo.Active
{
public string FunctionAccess;
public ACTIONS Action;
- protected override bool IsAuthorized(HttpActionContext actionContext)
+ protected override bool IsAuthorized(HttpActionContext actionContext)
{
// Get token from headers
if (actionContext.Request.Headers.Authorization == null)
return false;
string token = actionContext.Request.Headers.Authorization.ToString();
-
+
token = token.Split(' ')[1];
if (!base.IsAuthorized(actionContext))
@@ -100,7 +96,7 @@ namespace Thermo.Active
}
// Check if PLC bit exists
- if(functionAccess.PlcId != 0)
+ if (functionAccess.PlcId != 0)
{
// Check if functionality is enabled by PLC
var functionalityIsEnabled = LastRuntimeFunctionality.Where(x => x.Name == functionName).FirstOrDefault();
diff --git a/Thermo.Active/Controllers/SignalR/NcHub.cs b/Thermo.Active/Controllers/SignalR/NcHub.cs
index fa220825..f30512e0 100644
--- a/Thermo.Active/Controllers/SignalR/NcHub.cs
+++ b/Thermo.Active/Controllers/SignalR/NcHub.cs
@@ -1,10 +1,10 @@
using CMS_CORE_Library.Models;
using Microsoft.AspNet.SignalR;
-using Thermo.Active.Attributes;
-using Thermo.Active.NC;
using System.Collections.Generic;
using System.Threading.Tasks;
using TeamDev.SDK.MVVM;
+using Thermo.Active.Attributes;
+using Thermo.Active.NC;
using static CMS_CORE_Library.Models.DataStructures;
using static Thermo.Active.Config.ServerConfig;
using static Thermo.Active.Model.Constants;
@@ -102,8 +102,8 @@ namespace Thermo.Active.Controllers.SignalR
if (libraryError.IsError())
throw new HubException(libraryError.localizationKey);
}
-
- // MessageServices.Current.Publish(SHOW_MSG_UI, null, "Recovery Alarm. ID: " + id);
+
+ // MessageServices.Current.Publish(SHOW_MSG_UI, null, "Recovery Alarm. ID: " + id);
}
[SignalRAuthorize(FunctionAccess = NC_SOFTKEY, Action = ACTIONS.WRITE)]
@@ -235,6 +235,6 @@ namespace Thermo.Active.Controllers.SignalR
throw new HubException(libraryError.localizationKey);
}
}
-
+
}
}
\ No newline at end of file
diff --git a/Thermo.Active/Controllers/WebApi/ApiAlarmController.cs b/Thermo.Active/Controllers/WebApi/ApiAlarmController.cs
index 4dc84730..2c4d70d0 100644
--- a/Thermo.Active/Controllers/WebApi/ApiAlarmController.cs
+++ b/Thermo.Active/Controllers/WebApi/ApiAlarmController.cs
@@ -1,13 +1,7 @@
-using Thermo.Active.Database.Controllers;
-using Thermo.Active.Model.DatabaseModels;
-using Thermo.Active.Model.DTOModels.AlarmModels;
-using Thermo.Active.NC;
-using Thermo.Active.Provider;
-using System;
+using System;
using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
+using System.IO;
+using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
@@ -15,9 +9,13 @@ using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
-using static Thermo.Active.Model.Constants;
-using static Thermo.Active.Config.ServerConfig;
+using Thermo.Active.Database.Controllers;
using Thermo.Active.Listeners;
+using Thermo.Active.Model.DatabaseModels;
+using Thermo.Active.Model.DTOModels.AlarmModels;
+using Thermo.Active.Provider;
+using static Thermo.Active.Config.ServerConfig;
+using static Thermo.Active.Model.Constants;
namespace Thermo.Active.Controllers.WebApi
{
@@ -47,10 +45,10 @@ namespace Thermo.Active.Controllers.WebApi
.ToDictionary(
x => Convert.ToInt32(x.Key.Split('_').Last()), // This function return "alarm_id" as id, i need only the id number
x => x.Value
- );
-
+ );
+
using (AlarmsController alarm = new AlarmsController())
- {
+ {
List alarms = alarm.GetPaginatedWithFilter(filter.Title, filter.Sources, filter.Page, filter.PageSize, filter.StartDate.Value, filter.EndDate, filter.UserIds, plcMessages, out int pages);
return Ok(new DTOPaginatedAlarmsModel()
@@ -89,7 +87,7 @@ namespace Thermo.Active.Controllers.WebApi
alm = AlmPLCTras["alarm_" + model.AlarmId];
//csv += model.ToCsvString(alm) + Environment.NewLine;
- csv.Append(model.ToCsvString(alm) + Environment.NewLine);
+ csv.Append(model.ToCsvString(alm) + Environment.NewLine);
}
//Parallel.ForEach(alarms, model =>
@@ -105,8 +103,8 @@ namespace Thermo.Active.Controllers.WebApi
//st.Restart();
- var stream = new MemoryStream(Encoding.UTF8.GetBytes(csv.ToString()),0, Encoding.UTF8.GetBytes(csv.ToString()).Length, false,true);
-
+ var stream = new MemoryStream(Encoding.UTF8.GetBytes(csv.ToString()), 0, Encoding.UTF8.GetBytes(csv.ToString()).Length, false, true);
+
var result = new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new ByteArrayContent(stream.GetBuffer())
@@ -139,7 +137,7 @@ namespace Thermo.Active.Controllers.WebApi
[Route("data"), HttpPost]
- public IHttpActionResult GetAlarmsData(int pageSize)
+ public IHttpActionResult GetAlarmsData(int pageSize)
{
using (AlarmsController alarmController = new AlarmsController())
{
diff --git a/Thermo.Active/Controllers/WebApi/ApiMaintenanceController.cs b/Thermo.Active/Controllers/WebApi/ApiMaintenanceController.cs
index 32479740..b819c579 100644
--- a/Thermo.Active/Controllers/WebApi/ApiMaintenanceController.cs
+++ b/Thermo.Active/Controllers/WebApi/ApiMaintenanceController.cs
@@ -1,12 +1,5 @@
using CMS_CORE_Library.Models;
using Newtonsoft.Json;
-using Thermo.Active.Database.Controllers;
-using Thermo.Active.Model.DatabaseModels;
-using Thermo.Active.Model.DTOModels;
-using Thermo.Active.Model.DTOModels.MaintenanceModels;
-using Thermo.Active.NC;
-using Thermo.Active.Provider;
-using Thermo.Active.Utils;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
@@ -17,6 +10,12 @@ using System.Net.Http;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Web.Http;
+using Thermo.Active.Database.Controllers;
+using Thermo.Active.Model.DatabaseModels;
+using Thermo.Active.Model.DTOModels;
+using Thermo.Active.Model.DTOModels.MaintenanceModels;
+using Thermo.Active.NC;
+using Thermo.Active.Provider;
using static Thermo.Active.Config.ServerConfig;
using static Thermo.Active.Model.Constants;
@@ -55,12 +54,12 @@ namespace Thermo.Active.Controllers.WebApi
var identity = User.Identity as ClaimsIdentity;
// Find user id from the bearer token
var userId = identity.Claims.FirstOrDefault(c => c.Type == USER_ID_KEY);
-
+
using (MaintenancesController maintenancesController = new MaintenancesController())
{
MaintenanceModel dbMaint = maintenancesController.Create(newMaint, Convert.ToInt32(userId.Value));
- if(dbMaint.Type == MAINTENANCE_TYPE.MACHINE_INTERVAL)
+ if (dbMaint.Type == MAINTENANCE_TYPE.MACHINE_INTERVAL)
{
// Update data
@@ -100,7 +99,7 @@ namespace Thermo.Active.Controllers.WebApi
return Ok(maintenance);
}
- }
+ }
}
}
@@ -216,9 +215,9 @@ namespace Thermo.Active.Controllers.WebApi
{
bool passwordIsValid = maintenancesController.CheckPassword(password.Password, data.CmsMachineIdNumber, maintData.OriginalPlcCounter, out controlWord);
if (!passwordIsValid)
- return BadRequest(API_ERROR_KEYS.PASSWORD_IS_INVALID);
- }
-
+ return BadRequest(API_ERROR_KEYS.PASSWORD_IS_INVALID);
+ }
+
// Check if maintenance id
PerformedMaintenanceModel performed = maintenancesController.PerformeMaintenance(maintData.OriginalPlcCounter / 60, maintenanceId, Convert.ToInt32(userId.Value), controlWord);
diff --git a/Thermo.Active/Controllers/WebApi/AuthorizationController.cs b/Thermo.Active/Controllers/WebApi/AuthorizationController.cs
index e42fc5f5..ff4c5c85 100644
--- a/Thermo.Active/Controllers/WebApi/AuthorizationController.cs
+++ b/Thermo.Active/Controllers/WebApi/AuthorizationController.cs
@@ -1,10 +1,10 @@
-using Thermo.Active.Database.Controllers;
-using Thermo.Active.Model.DTOModels;
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Web.Http;
+using Thermo.Active.Database.Controllers;
+using Thermo.Active.Model.DTOModels;
using static Thermo.Active.Model.Constants;
namespace Thermo.Active.Controllers.WebApi
diff --git a/Thermo.Active/Controllers/WebApi/CmsConnectController.cs b/Thermo.Active/Controllers/WebApi/CmsConnectController.cs
index 61642469..1ec77b6f 100644
--- a/Thermo.Active/Controllers/WebApi/CmsConnectController.cs
+++ b/Thermo.Active/Controllers/WebApi/CmsConnectController.cs
@@ -1,16 +1,14 @@
-using Thermo.Active.CmsConnectGateway;
-using Thermo.Active.CmsConnectGateway.Events;
-using Thermo.Active.CmsConnectGateway.Exceptions;
-using Thermo.Active.Model.DTOModels;
-using System;
+using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Net;
-using System.Text;
-using System.Threading.Tasks;
using System.Web.Http;
using TeamDev.SDK.MVVM;
+using Thermo.Active.CmsConnectGateway;
+using Thermo.Active.CmsConnectGateway.Events;
+using Thermo.Active.CmsConnectGateway.Exceptions;
+using Thermo.Active.Model.DTOModels;
using static Thermo.Active.Model.Constants;
namespace Thermo.Active.Controllers.WebApi
@@ -21,9 +19,9 @@ namespace Thermo.Active.Controllers.WebApi
[Route("runConnectionTest"), HttpGet]
public IHttpActionResult RunConnectionTest()
{
- using(GatewayAdapter Adp = new GatewayAdapter(Config.ServerConfig.CmsConnectConfig.Gateway.Address, Config.ServerConfig.CmsConnectConfig.Gateway.Username, Config.ServerConfig.CmsConnectConfig.Gateway.Password))
+ using (GatewayAdapter Adp = new GatewayAdapter(Config.ServerConfig.CmsConnectConfig.Gateway.Address, Config.ServerConfig.CmsConnectConfig.Gateway.Username, Config.ServerConfig.CmsConnectConfig.Gateway.Password))
{
-
+
try
{
GatewayConnectionStatus sts = Adp.TestGatewayConnection(1);
@@ -58,7 +56,7 @@ namespace Thermo.Active.Controllers.WebApi
}
}
}
-
+
[Route("getGatewayNetworkSetup"), HttpGet]
public IHttpActionResult GetGatewayNetworkSetup()
@@ -76,7 +74,7 @@ namespace Thermo.Active.Controllers.WebApi
ipAddress = config.ipAddress != null ? config.ipAddress.ToString() : "",
netMaskAddress = config.netMaskAddress != null ? config.netMaskAddress.ToString() : "",
defaultGatewayAddress = config.defaultGatewayAddress != null ? config.defaultGatewayAddress.ToString() : "",
- dnsAddresses = config.dnsAddresses != null? config.dnsAddresses.Select(i => i.ToString()) : new List(),
+ dnsAddresses = config.dnsAddresses != null ? config.dnsAddresses.Select(i => i.ToString()) : new List(),
dnsPrefixes = config.dnsPrefixes != null ? config.dnsPrefixes : new List()
};
@@ -87,7 +85,7 @@ namespace Thermo.Active.Controllers.WebApi
return InternalServerError(e);
}
}
- }
+ }
[Route("getGatewayProxySetup"), HttpGet]
@@ -95,7 +93,7 @@ namespace Thermo.Active.Controllers.WebApi
{
using (GatewayAdapter Adp = new GatewayAdapter(Config.ServerConfig.CmsConnectConfig.Gateway.Address, Config.ServerConfig.CmsConnectConfig.Gateway.Username, Config.ServerConfig.CmsConnectConfig.Gateway.Password))
{
-
+
try
{
@@ -118,10 +116,10 @@ namespace Thermo.Active.Controllers.WebApi
return InternalServerError(e);
}
}
- }
+ }
- [Route("setGatewayNetworkSetup"), HttpPut]
+ [Route("setGatewayNetworkSetup"), HttpPut]
public IHttpActionResult SetGatewayNetworkSetup([FromBody][Required]DTOCmsConnectGatewayNetworkModel dtoGatewayNetworkModel)
{
using (GatewayAdapter Adp = new GatewayAdapter(Config.ServerConfig.CmsConnectConfig.Gateway.Address, Config.ServerConfig.CmsConnectConfig.Gateway.Username, Config.ServerConfig.CmsConnectConfig.Gateway.Password))
@@ -151,14 +149,14 @@ namespace Thermo.Active.Controllers.WebApi
builder.DefaultGatewayAddress(addr);
else
throw new ArgumentException("D.Gateway Address not ok");
- }
-
- if(dtoGatewayNetworkModel.dnsAddresses != null)
+ }
+
+ if (dtoGatewayNetworkModel.dnsAddresses != null)
{
List dnsAddr = new List();
foreach (string addr in dtoGatewayNetworkModel.dnsAddresses)
{
- if(!string.IsNullOrWhiteSpace(addr))
+ if (!string.IsNullOrWhiteSpace(addr))
dnsAddr.Add(IPAddress.Parse(addr));
}
builder.DnsAddresses(dnsAddr);
@@ -216,7 +214,7 @@ namespace Thermo.Active.Controllers.WebApi
if (dtoGatewayProxyModel.password != null && !string.IsNullOrWhiteSpace(dtoGatewayProxyModel.password))
builder.Username(dtoGatewayProxyModel.password);
-
+
if (dtoGatewayProxyModel.noproxyAddresses != null)
{
List noProx = new List();
@@ -227,7 +225,7 @@ namespace Thermo.Active.Controllers.WebApi
}
builder.NoproxyAddresses(noProx);
}
-
+
Adp.WriteGatewayProxyConfiguration(builder.GenerateConfiguration());
diff --git a/Thermo.Active/Controllers/WebApi/ConfigurationController.cs b/Thermo.Active/Controllers/WebApi/ConfigurationController.cs
index 9ab19464..1fa44e29 100644
--- a/Thermo.Active/Controllers/WebApi/ConfigurationController.cs
+++ b/Thermo.Active/Controllers/WebApi/ConfigurationController.cs
@@ -1,14 +1,12 @@
-using CMS_CORE_Library.Models;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web.Http;
using Thermo.Active.Database.Controllers;
using Thermo.Active.Model.ConfigModels;
using Thermo.Active.Model.DTOModels;
using Thermo.Active.Model.DTOModels.AlarmModels;
-using Thermo.Active.NC;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web.Http;
+using Thermo.Active.Model.DTOModels.ThRecipe;
using static Thermo.Active.Config.ServerConfig;
-using Thermo.Active.Model.DTOModels.Recipe;
namespace Thermo.Active.Controllers.WebApi
{
@@ -122,31 +120,6 @@ namespace Thermo.Active.Controllers.WebApi
return Ok(recipeConfig);
}
-#if false
- [Route("ThermoParams"), HttpGet]
- public IHttpActionResult GetThermoParamsConfig()
- {
- // TODO FIXME
-
- // passa i parametri di configurazione es min/max dei gauge...
-
-
- List recipeConfig = RecipeConfig.Select(x => new DTORecipeConfigModel()
- {
- Id = x.Id,
- Category = x.Category.ToString(),
- SubCategory_1 = x.SubCategory_1,
- SubCategory_2 = x.SubCategory_2,
- Name = x.Name,
- Description = x.Description,
- Format = x.Format,
- Label = $"{x.Category}_{x.SubCategory_1}_{x.SubCategory_2}_{x.Name}".Replace("__", "_").Replace("__", "_").ToLower()
- }).ToList();
-
- return Ok(recipeConfig);
- }
-#endif
-
[Route("alarms"), HttpGet]
public IHttpActionResult GetAlarmsConfig()
{
@@ -156,10 +129,10 @@ namespace Thermo.Active.Controllers.WebApi
{
var configuredAlarm = InitialAlarmsConfig.Where(x => x.PlcId == i).FirstOrDefault();
- if (configuredAlarm == null)
+ if (configuredAlarm == null)
restoreIsEnabled = false;
else
- restoreIsEnabled = configuredAlarm.RestoreIsActive;
+ restoreIsEnabled = configuredAlarm.RestoreIsActive;
alarmsConfig.Add(new DTOAlarmConfigModel
{
@@ -185,20 +158,20 @@ namespace Thermo.Active.Controllers.WebApi
ContactModel ItalyContactConfig = CmsContactConfig;
if (DealerContactConfig != null && DealerAuxContact1 != null && DealerAuxContact2 != null)
- {
+ {
ContactConfig = DealerContactConfig;
AuxContact1 = DealerAuxContact1;
AuxContact2 = DealerAuxContact2;
}
return Ok(new
- {
- ContactConfig,
- AuxContact1,
- AuxContact2,
- ItalyContactConfig,
- ContactInfoError
- });
+ {
+ ContactConfig,
+ AuxContact1,
+ AuxContact2,
+ ItalyContactConfig,
+ ContactInfoError
+ });
}
[Route("scmcontact"), HttpGet]
diff --git a/Thermo.Active/Controllers/WebApi/FavoriteUserSoftKeyController.cs b/Thermo.Active/Controllers/WebApi/FavoriteUserSoftKeyController.cs
index 64483281..bb565f86 100644
--- a/Thermo.Active/Controllers/WebApi/FavoriteUserSoftKeyController.cs
+++ b/Thermo.Active/Controllers/WebApi/FavoriteUserSoftKeyController.cs
@@ -1,13 +1,10 @@
-using Thermo.Active.Database.Controllers;
-using Thermo.Active.Model.DatabaseModels;
-using Thermo.Active.Model.DTOModels;
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
-using System.Text;
-using System.Threading.Tasks;
using System.Web.Http;
+using Thermo.Active.Database.Controllers;
+using Thermo.Active.Model.DTOModels;
using static Thermo.Active.Model.Constants;
namespace Thermo.Active.Controllers.WebApi
diff --git a/Thermo.Active/Controllers/WebApi/LanguageController.cs b/Thermo.Active/Controllers/WebApi/LanguageController.cs
index c4cc269a..1f90c8a9 100644
--- a/Thermo.Active/Controllers/WebApi/LanguageController.cs
+++ b/Thermo.Active/Controllers/WebApi/LanguageController.cs
@@ -1,11 +1,10 @@
using CMS_CORE_Library.Models;
-using Thermo.Active.Model.DTOModels;
-using Thermo.Active.NC;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web.Http;
-using static CMS_CORE_Library.Models.DataStructures;
+using Thermo.Active.Model.DTOModels;
+using Thermo.Active.NC;
using static Thermo.Active.Config.ServerConfig;
using static Thermo.Active.Model.Constants;
using static Thermo.Active.Utils.LanguageController;
@@ -53,7 +52,7 @@ namespace Thermo.Active.Controllers.WebApi
Dictionary softKeysNames = GetLocalizedSoftKeysNames(language);
Dictionary alarmsNames = GetPlcAlarmsTranslations(language);
Dictionary headsNames = GetLocalizedHeadsNames(language);
-
+
Dictionary scadaTranslations = GetScadaTranslations(language);
@@ -135,7 +134,7 @@ namespace Thermo.Active.Controllers.WebApi
Dictionary messages = new Dictionary();
// Read data from CN
ncAdapter.numericalControl.NC_GetTranslatedPlcMessages(language, ref messages); // Avoid checking error because in the worst case "messages" is empty
-
+
// Id start from 1
for (int i = 1; i <= 1024; i++)
{
@@ -166,18 +165,18 @@ namespace Thermo.Active.Controllers.WebApi
Dictionary translatedNames = new Dictionary();
// Loop throught labels Scada -> Layers -> Labels
- foreach(var scada in ProductionScadaSchema.Concat(ConfiguredScadaSchema))
+ foreach (var scada in ProductionScadaSchema.Concat(ConfiguredScadaSchema))
{
- foreach(var layer in scada.Layers)
+ foreach (var layer in scada.Layers)
{
- foreach(var label in layer.Labels)
+ foreach (var label in layer.Labels)
{
// Find selected language
var translatedValue = label.Label.TextContents?.Where(y => y.LangKey == language).FirstOrDefault();
if (translatedValue != null)
translatedNames.Add("scada_label_" + label.Id, translatedValue.TextContent);
else
- // default value
+ // default value
translatedNames.Add("scada_label_" + label.Id, "scada_label_" + label.Id);
}
diff --git a/Thermo.Active/Controllers/WebApi/ModulesController.cs b/Thermo.Active/Controllers/WebApi/ModulesController.cs
index 4c5fe34d..ed750509 100644
--- a/Thermo.Active/Controllers/WebApi/ModulesController.cs
+++ b/Thermo.Active/Controllers/WebApi/ModulesController.cs
@@ -1,18 +1,8 @@
using CMS_CORE_Library.Models;
-using Thermo.Active.Model.DTOModels;
-using Thermo.Active.NC;
-using System;
using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Net.Http;
-using System.Threading.Tasks;
using System.Web.Http;
-using static CMS_CORE_Library.Models.DataStructures;
-using static Thermo.Active.Config.ServerConfig;
-using static Thermo.Active.Model.Constants;
-using Thermo.Active.Model.DTOModels.Recipe;
+using Thermo.Active.Model.DTOModels.ThModules;
+using Thermo.Active.NC;
using Thermo.Active.Utils;
namespace Thermo.Active.Controllers.WebApi
diff --git a/Thermo.Active/Controllers/WebApi/NcApiController.cs b/Thermo.Active/Controllers/WebApi/NcApiController.cs
index c1520fdb..632895b0 100644
--- a/Thermo.Active/Controllers/WebApi/NcApiController.cs
+++ b/Thermo.Active/Controllers/WebApi/NcApiController.cs
@@ -1,8 +1,8 @@
using CMS_CORE_Library.Models;
-using Thermo.Active.Model.DTOModels;
-using Thermo.Active.NC;
using System.Globalization;
using System.Web.Http;
+using Thermo.Active.Model.DTOModels;
+using Thermo.Active.NC;
using static Thermo.Active.Model.Constants;
namespace Thermo.Active.Controllers.WebApi
@@ -22,7 +22,7 @@ namespace Thermo.Active.Controllers.WebApi
if (libraryError.errorCode == CMS_ERROR_CODES.NOT_CONNECTED)
return Ok(genericData);
else
- return BadRequest(libraryError.localizationKey);
+ return BadRequest(libraryError.localizationKey);
return Ok(genericData);
}
@@ -54,7 +54,7 @@ namespace Thermo.Active.Controllers.WebApi
CmsError libraryError = ncAdapter.SetActiveScreen((short)screen);
if (libraryError.errorCode == CMS_ERROR_CODES.NOT_CONNECTED)
- return BadRequest();
+ return BadRequest();
else
return Ok();
}
@@ -69,7 +69,7 @@ namespace Thermo.Active.Controllers.WebApi
CmsError libraryError = ncAdapter.GetActiveClient(out int selectedClientId);
if (libraryError.IsError())
return BadRequest();
-
+
return Ok(new { selectedClientId });
}
diff --git a/Thermo.Active/Controllers/WebApi/NcFileController.cs b/Thermo.Active/Controllers/WebApi/NcFileController.cs
index fd743aee..5518d795 100644
--- a/Thermo.Active/Controllers/WebApi/NcFileController.cs
+++ b/Thermo.Active/Controllers/WebApi/NcFileController.cs
@@ -1,6 +1,4 @@
using CMS_CORE_Library.Models;
-using Thermo.Active.Model.DTOModels;
-using Thermo.Active.NC;
using System;
using System.Collections.Generic;
using System.IO;
@@ -9,6 +7,8 @@ using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;
+using Thermo.Active.Model.DTOModels;
+using Thermo.Active.NC;
using static CMS_CORE_Library.Models.DataStructures;
using static Thermo.Active.Config.ServerConfig;
using static Thermo.Active.Model.Constants;
@@ -120,11 +120,11 @@ namespace Thermo.Active.Controllers.WebApi
}
ActiveProgramDataModel programData = new ActiveProgramDataModel();
- foreach (FormItem item in formItems)
+ foreach (FormItem item in formItems)
{
if (item.IsAFile)
{
- if (item.ParameterName == "main")
+ if (item.ParameterName == "main")
{
File.WriteAllBytes(TEMP_PP_FOLDER + item.FileName, item.Data);
programs.Add(item.FileName);
@@ -180,7 +180,8 @@ namespace Thermo.Active.Controllers.WebApi
}
- if (NcConfig.NcVendor != NC_VENDOR.OSAI) {
+ if (NcConfig.NcVendor != NC_VENDOR.OSAI)
+ {
List lines = new List();
string outputFileName = NcConfig.SharedPath + PARTPRG_LIST_FILE;
@@ -252,7 +253,7 @@ namespace Thermo.Active.Controllers.WebApi
return Ok(true);
else
{
- foreach(string filename in Directory.GetFiles(NcConfig.SharedPath))
+ foreach (string filename in Directory.GetFiles(NcConfig.SharedPath))
{
File.Delete(filename);
}
@@ -264,10 +265,10 @@ namespace Thermo.Active.Controllers.WebApi
public IHttpActionResult BackupSharedFolder()
{
if (NcConfig.NcVendor == NC_VENDOR.OSAI)
- return Ok(true);
+ return Ok(true);
else
{
- string newFolder = "C:\\Backup_" + new DirectoryInfo(NcConfig.SharedPath).Name + "\\" + DateTime.Now.ToString("dd-MM-yyyy_HH-mm-ss") + "\\";
+ string newFolder = "C:\\Backup_" + new DirectoryInfo(NcConfig.SharedPath).Name + "\\" + DateTime.Now.ToString("dd-MM-yyyy_HH-mm-ss") + "\\";
File.Delete(NcConfig.SharedPath + PARTPRG_LIST_FILE);
Directory.CreateDirectory(newFolder);
@@ -281,7 +282,7 @@ namespace Thermo.Active.Controllers.WebApi
[Route("shared_files"), HttpGet]
public IHttpActionResult GetSharedFolderFileList(string sharedPath)
- {
+ {
List