diff --git a/CMS_CORE_Application/Form1.cs b/CMS_CORE_Application/Form1.cs index aec655b..308b329 100644 --- a/CMS_CORE_Application/Form1.cs +++ b/CMS_CORE_Application/Form1.cs @@ -20,8 +20,8 @@ namespace CMS_CORE_Application public partial class Form1 : Form { private static Nc N; - private static String NCType; - private static String NCIp; + private static string NCType; + private static string NCIp; private static ushort NCPort; private Thread t; private Thread toolThread; @@ -61,18 +61,18 @@ namespace CMS_CORE_Application PROC_MODE mode = PROC_MODE.AUTO; PROC_STATUS status = PROC_STATUS.ERROR; ushort procnum = 0; - String MachNumber = ""; - String ModelName = ""; - String SFTVersion = ""; - String PPName = ""; + string MachNumber = ""; + string ModelName = ""; + string SFTVersion = ""; + string PPName = ""; DateTime NcTime = new DateTime(); - Dictionary Axes = new Dictionary(); + Dictionary Axes = new Dictionary(); Stopwatch sw = new Stopwatch(); List procAlarms = new List(); List Msg = new List(); PreAndPostPowerOnModel powerOn = new PreAndPostPowerOnModel(); List ncAlarms = new List(); - List Lines = new List(); + List Lines = new List(); N = SetNcByType(); @@ -151,7 +151,7 @@ namespace CMS_CORE_Application Console.WriteLine(st.ElapsedMilliseconds); ActiveProgramDataModel info = new ActiveProgramDataModel(); cmsError = N.FILES_RActiveProgramData(1, ref info); - + cmsError = N.PLC_RPowerOnData(ref powerOn); sw.Stop(); if (!this.IsDisposed && this.InvokeRequired) @@ -165,16 +165,16 @@ namespace CMS_CORE_Application TXTMachNum.Text = MachNumber; TXTSft.Text = SFTVersion; TXTTime.Text = sw.ElapsedMilliseconds.ToString() + " mS"; - TXTAlm.Text = String.Join(Environment.NewLine, procAlarms.Select(x => x.Message)); - TXTAlmNc.Text = String.Join(Environment.NewLine, ncAlarms.Select(x => x.Message)); - TXTMsg.Text = String.Join(Environment.NewLine, Msg.Select(x => x.Id)); + TXTAlm.Text = string.Join(Environment.NewLine, procAlarms.Select(x => x.Message)); + TXTAlmNc.Text = string.Join(Environment.NewLine, ncAlarms.Select(x => x.Message)); + TXTMsg.Text = string.Join(Environment.NewLine, Msg.Select(x => x.Id)); TXTPPName.Text = PPName; TXTNow.Text = NcTime.ToString(); if (error == false) Error.Text = ""; - TXTPPLines.Text = String.Join(Environment.NewLine, Lines); + TXTPPLines.Text = string.Join(Environment.NewLine, Lines); Connect.Enabled = false; Disconnect.Enabled = true; }); @@ -294,7 +294,7 @@ namespace CMS_CORE_Application return tools; } - private void SetError(List Lines, CmsError cmsError) + private void SetError(List Lines, CmsError cmsError) { if (!this.IsDisposed && this.InvokeRequired) { @@ -302,7 +302,7 @@ namespace CMS_CORE_Application { Error.Text = cmsError.localizationKey; - TXTPPLines.Text = String.Join(Environment.NewLine, Lines); + TXTPPLines.Text = string.Join(Environment.NewLine, Lines); Connect.Enabled = true; Disconnect.Enabled = false; }); diff --git a/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs b/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs index e553a5c..518f779 100644 --- a/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs +++ b/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs @@ -8,6 +8,8 @@ using System.Linq; using System.Threading; using System.Windows.Forms; using static CMS_CORE_Library.Models.DataStructures; +using static CMS_CORE_Library.Siemens.MEMORY_ADDRESS; +using static CMS_CORE_Library.Utils.Nc_Utils; #pragma warning disable 1591 @@ -18,9 +20,9 @@ namespace CMS_CORE_Library.Fanuc private int TimeOut; private Focas1 FocasEnv; private List nLibHandle; - private String Cnc_name; - private String Cnc_SftVersion; - private String Cnc_SeriesNum; + private string Cnc_name; + private string Cnc_SftVersion; + private string Cnc_SeriesNum; private short Cnc_NumPath; private byte FanucLanguage; private DateTime Last_Static_Read; @@ -38,7 +40,7 @@ namespace CMS_CORE_Library.Fanuc * Send/Recieve timeout connection [mS] * */ - public Nc_Fanuc(String IpAddress, ushort RemotePort, ushort ConnectionTimeOut) + public Nc_Fanuc(string IpAddress, ushort RemotePort, ushort ConnectionTimeOut) { //Set internal valiables Connected = false; @@ -435,6 +437,40 @@ namespace CMS_CORE_Library.Fanuc // Get pre and post power on data public override CmsError PLC_RPowerOnData(ref PreAndPostPowerOnModel powerOnModel) { + int readValue = 0; + // Read pre power on and post power on data from memory + CmsError cmsError = MEM_RWInteger(R, 0, PRE_POST_POWER_ON.MemType, PRE_POST_POWER_ON.Address, ref readValue); + if (cmsError.IsError()) + return cmsError; + + bool[] bits = new bool[32]; + + // Convert int into to true/false array + bits = IntToBool(readValue); + + // Create adn set pre power on object + PrePowerOnModel prePowerOn = new PrePowerOnModel() + { + PowerOn = new PowerOnDataModel() { Id = 1, Active = bits[0], Clickable = bits[16] }, // id = N, bits = N, Clickable = N + 8 (Second bit) + AirPressure = new PowerOnDataModel() { Id = 2, Active = bits[1], Clickable = bits[17] }, + ProtectionStatus = new PowerOnDataModel() { Id = 3, Active = bits[2], Clickable = bits[18] }, + EmergencyButtons = new PowerOnDataModel() { Id = 4, Active = bits[3], Clickable = bits[19] }, + SettingMode = new PowerOnDataModel() { Id = 5, Active = bits[4], Clickable = bits[20] }, + StartingKey = new PowerOnDataModel() { Id = 6, Active = bits[5], Clickable = bits[21] } + }; + // Create and set post power on object + PostPowerOnModel postPowerOn = new PostPowerOnModel() + { + AxisReset = new PowerOnDataModel() { Id = 9, Active = bits[8], Clickable = bits[24] }, // id = N - 8, bits = N, Clickable = N + 8 (Second bit) + WaterjetPump = new PowerOnDataModel() { Id = 10, Active = bits[9], Clickable = bits[25] } + }; + + powerOnModel = new PreAndPostPowerOnModel() + { + PostPowerOn = postPowerOn, + PrePowerOn = prePowerOn + }; + return NO_ERROR; } @@ -561,8 +597,8 @@ namespace CMS_CORE_Library.Fanuc int linN; ushort Lenght = 256; short ReturnIndex = 1; - Char[] Chars = new Char[255]; - String[] newLines; + char[] Chars = new char[255]; + string[] newLines; short path = GetHandleIndexFromPath(ProcNumber); if (path < 0) @@ -582,7 +618,7 @@ namespace CMS_CORE_Library.Fanuc //Execute the method nReturn = Focas1.cnc_rdexecprog(nLibHandle[path], ref Lenght, out ReturnIndex, Chars); - newLines = new String(Chars).Replace("\0", String.Empty).Split('\n'); + newLines = new string(Chars).Replace("\0", string.Empty).Split('\n'); //Throw Exception if there's an error if (nReturn != 0) @@ -590,7 +626,7 @@ namespace CMS_CORE_Library.Fanuc //Setup the return values Lines.Clear(); - foreach (String Line in newLines) + foreach (string Line in newLines) Lines.Add(Line); return NO_ERROR; @@ -619,7 +655,7 @@ namespace CMS_CORE_Library.Fanuc if (nReturn != 0) return GetNcError(nReturn); - Name = new String(Prg.name).Replace("\0", String.Empty); + Name = new string(Prg.name).Replace("\0", string.Empty); return NO_ERROR; } @@ -924,7 +960,7 @@ namespace CMS_CORE_Library.Fanuc //In fanuc is not implemented, so i need to build it Dictionary ActualMach = new Dictionary(); Dictionary ToGo = new Dictionary(); - KeyValuePair val; + KeyValuePair val; //Read the positions CmsError cmsError = AXES_RMachinePosition(ProcNumber, ref ActualMach); @@ -944,7 +980,7 @@ namespace CMS_CORE_Library.Fanuc Axes.Clear(); } - foreach (KeyValuePair axis in ActualMach) + foreach (KeyValuePair axis in ActualMach) { val = Axes.FirstOrDefault(X => X.Key == axis.Key); if (val.Key != null) @@ -1464,7 +1500,7 @@ namespace CMS_CORE_Library.Fanuc #region NC Low-level function: Parameters //Get NC Bit Parameter - public override CmsError NC_RParam(short Index, short Bit, ref Boolean Value) + public override CmsError NC_RParam(short Index, short Bit, ref bool Value) { //Check if the NC is Connected CmsError cmsError = CheckConnection(); @@ -2028,7 +2064,7 @@ namespace CMS_CORE_Library.Fanuc { string AxName; double AxVal; - KeyValuePair val; + KeyValuePair val; //Read the name and Value AxName = pos.name.ToString() + pos.suff.ToString().Trim('\0'); @@ -2247,7 +2283,7 @@ namespace CMS_CORE_Library.Fanuc } //Check if Memory Area is corrected - private CmsError CheckMemoryArea(String AreaName) + private CmsError CheckMemoryArea(string AreaName) { if (!AreaName.StartsWith(FANUC_MEMTYPE) && !AreaName.StartsWith(UNDEFINED_MEMTYPE)) return INCORRECT_PARAMETERS_ERROR; @@ -2265,10 +2301,10 @@ namespace CMS_CORE_Library.Fanuc } // Convert the internal Name var in Readable STEP Name - private String getName(char[] Cnc_Type, char[] Mt_Type) + private string getName(char[] Cnc_Type, char[] Mt_Type) { - String name = "Fanuc "; - switch (new String(Cnc_Type)) + string name = "Fanuc "; + switch (new string(Cnc_Type)) { case "15": name += "15 Series"; break; case "16": name += "16 Series"; break; @@ -2352,7 +2388,7 @@ namespace CMS_CORE_Library.Fanuc } break; - case (short)Focas1.EW_OK: + case Focas1.EW_OK: { // Add the characters into string with all the content partProgramContent += new string(tmpContentBuffer); @@ -2378,7 +2414,7 @@ namespace CMS_CORE_Library.Fanuc ErrorHandler(nReturn); - partProgramContent = partProgramContent.Replace("\0", String.Empty); + partProgramContent = partProgramContent.Replace("\0", string.Empty); return NO_ERROR; } @@ -2392,9 +2428,9 @@ namespace CMS_CORE_Library.Fanuc } // Convert the internal error in a readable-String error - private String GetErrorMessage(short Value) + private string GetErrorMessage(short Value) { - String ErrororOwner = ""; + string ErrororOwner = ""; ErrororOwner = "Fanuc-Core-Error: "; Focas1.focas_ret Val = (Focas1.focas_ret)Value; switch (Val) @@ -2437,5 +2473,71 @@ namespace CMS_CORE_Library.Fanuc #endregion Subordinate Private Functions /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + internal static class MEMORY_ADDRESS + { + internal const int STARTING_ADDRESS = 50000; + internal static MEMORY_CELL FUNCTION_ACCESS = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 50005, 8); + + internal static MEMORY_CELL PRE_POST_POWER_ON = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52573, 2); + internal static MEMORY_CELL PRE_POST_POWER_ON_CLICKABLE = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52575, 2); + internal static MEMORY_CELL PRE_POST_POWER_ON_ACK = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52577, 2); + internal static MEMORY_CELL PRE_POST_POWER_ON_CLICKED = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52579, 2); + + internal static MEMORY_CELL AXIS_RESET_PROCEDURE = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52607, 7, 1); + + internal static MEMORY_CELL PROCESS_STATUS = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52581, 0, 24); + internal static MEMORY_CELL SELECTED_PROCESS = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52581, 2, 24); + internal static MEMORY_CELL SELECT_PROCESS = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52605, 1); + + internal static MEMORY_CELL COUNTERS = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 43, 0, 40); + + internal static MEMORY_CELL SELECTED_AXIS = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52624, 0, 1); + internal static MEMORY_CELL SELECT_AXIS = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52625, 1, 1); + + internal static MEMORY_CELL NC_SOFTKEYS_VALUE = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52608, 0, 4); + internal static MEMORY_CELL NC_SOFTKEYS_CLICKABLE = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52612, 0, 4); + internal static MEMORY_CELL NC_SOFT_KEYS_ACK = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52616, 4); + internal static MEMORY_CELL NC_SOFT_KEYS_CLICKED = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52620, 4); + + internal static MEMORY_CELL USER_SOFTKEYS_VALUE = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52626, 0, 16); + internal static MEMORY_CELL USER_SOFTKEYS_CLICKABLE = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52642, 0, 16); + internal static MEMORY_CELL USER_SOFT_KEYS_ACK = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52658, 16); + internal static MEMORY_CELL USER_SOFT_KEYS_CLICKED = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52674, 16); + + internal static MEMORY_CELL ALARMS_STATUS = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 50013, 128); + internal static MEMORY_CELL ALARMS_DATA = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 50141, 1024); + + internal static MEMORY_CELL ALARM_ACK = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52189, 128); + internal static MEMORY_CELL ALARM_RESTORATION_STROBE = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52445, 128); + internal static MEMORY_CELL ALARM_REFRESH_STROBE = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52445, 128); + + internal static MEMORY_CELL HEADS_DATA = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52690, 240); + + internal static MEMORY_CELL HEADS_ACK = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52921, 4); + internal static MEMORY_CELL HEADS_STROBE_INCREMENT = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52924, 4); + internal static MEMORY_CELL HEADS_STROBE_DECREMENT = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 52927, 4); + + // Tool manager areas + internal static MEMORY_CELL TOOL_MANAGER_COMMAND = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 13000, 2); + + internal static MEMORY_CELL TOOL_MANAGER_STATUS = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 13001, 2); + + internal static MEMORY_CELL TOOL_MANAGER_OPTIONS = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 13002, 2); + + internal static MEMORY_CELL MAGAZINE_TYPES = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 13062, 4); + internal static MEMORY_CELL MAGAZINE_POSITIONS_NUMBER = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 13072, 4); + + internal static MEMORY_CELL MAGAZINES_ENABLED_CMD = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 13082, 2); + internal static MEMORY_CELL MAGAZINES_TOOLING_CMD = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 13084, 2); + + internal static MEMORY_CELL TOOL_STATUS_UPDATED_CMD = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 13003, 2); + internal static MEMORY_CELL TOOL_LIFE_UPDATED_CMD = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 13005, 2); + internal static MEMORY_CELL TOOL_STATUS_UPDATED_ACK = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 13007, 2); + internal static MEMORY_CELL TOOL_LIFE_UPDATED_ACK = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 13009, 2); + + internal static MEMORY_CELL TOOL_STATUS_UPDATED_DATA = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 13011, 10); + internal static MEMORY_CELL TOOL_LIFE_UPDATED_DATA = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 13022, 40); + } } } \ No newline at end of file diff --git a/CMS_CORE_Library/Osai/Nc_Osai.cs b/CMS_CORE_Library/Osai/Nc_Osai.cs index 70f0585..3ba6040 100644 --- a/CMS_CORE_Library/Osai/Nc_Osai.cs +++ b/CMS_CORE_Library/Osai/Nc_Osai.cs @@ -69,7 +69,7 @@ namespace CMS_CORE_Library.Osai * Send/Recieve timeout connection [mS] * */ - public Nc_Osai(String IpAddress, ushort RemotePort, ushort ConnectionTimeOut) + public Nc_Osai(string IpAddress, ushort RemotePort, ushort ConnectionTimeOut) { //Set internal valiables Connected = false; @@ -1036,14 +1036,14 @@ namespace CMS_CORE_Library.Osai if (cmsError.IsError()) return cmsError; ushort nReturn; - String L1 = ""; - String L2 = ""; - String L3 = ""; - String L4 = ""; - String L5 = ""; - String L6 = ""; - String L7 = ""; - String L8 = ""; + string L1 = ""; + string L2 = ""; + string L3 = ""; + string L4 = ""; + string L5 = ""; + string L6 = ""; + string L7 = ""; + string L8 = ""; //Try to get information try @@ -1085,8 +1085,8 @@ namespace CMS_CORE_Library.Osai return cmsError; ushort nReturn; ushort Level = 0; - String MainName = ""; - String SubName = ""; + string MainName = ""; + string SubName = ""; //Try to get information try @@ -1201,7 +1201,7 @@ namespace CMS_CORE_Library.Osai #region PROCESS-AXES (PATH) High-level data //Get a dictionary with the Actual position of the axes in Process - public override CmsError AXES_RInterpPosition(ushort process, ref Dictionary Axes) + public override CmsError AXES_RInterpPosition(ushort process, ref Dictionary Axes) { //Check if the NC is Connected CmsError cmsError = CheckConnection(); @@ -1209,8 +1209,8 @@ namespace CMS_CORE_Library.Osai return cmsError; ushort nReturn; ushort nAxis = 20; - String AxName = ""; - KeyValuePair val; + string AxName = ""; + KeyValuePair val; List axesN = new List(); //Try to get information @@ -1259,7 +1259,7 @@ namespace CMS_CORE_Library.Osai } //Get a dictionary with the Programmed position of the axes in Process - public override CmsError AXES_RProgrPosition(ushort process, ref Dictionary Axes) + public override CmsError AXES_RProgrPosition(ushort process, ref Dictionary Axes) { //Check if the NC is Connected CmsError cmsError = CheckConnection(); @@ -1267,8 +1267,8 @@ namespace CMS_CORE_Library.Osai return cmsError; ushort nReturn; ushort nAxis = 20; - String AxName = ""; - KeyValuePair val; + string AxName = ""; + KeyValuePair val; List axesN = new List(); //Try to get information @@ -1317,7 +1317,7 @@ namespace CMS_CORE_Library.Osai } //Get a dictionary with the Machine position of the axes in Process - public override CmsError AXES_RMachinePosition(ushort process, ref Dictionary Axes) + public override CmsError AXES_RMachinePosition(ushort process, ref Dictionary Axes) { //Check if the NC is Connected CmsError cmsError = CheckConnection(); @@ -1325,8 +1325,8 @@ namespace CMS_CORE_Library.Osai return cmsError; ushort nReturn; ushort nAxis = 20; - String AxName = ""; - KeyValuePair val; + string AxName = ""; + KeyValuePair val; List axesN = new List(); //Try to get information @@ -1375,7 +1375,7 @@ namespace CMS_CORE_Library.Osai } //Get a dictionary with the Following Error of the axes in Process - public override CmsError AXES_RFollowingError(ushort process, ref Dictionary Axes) + public override CmsError AXES_RFollowingError(ushort process, ref Dictionary Axes) { //Check if the NC is Connected CmsError cmsError = CheckConnection(); @@ -1383,8 +1383,8 @@ namespace CMS_CORE_Library.Osai return cmsError; ushort nReturn; ushort nAxis = 20; - String AxName = ""; - KeyValuePair val; + string AxName = ""; + KeyValuePair val; List axesN = new List(); //Try to get information @@ -1433,7 +1433,7 @@ namespace CMS_CORE_Library.Osai } //Get a dictionary with the Distance To Go of the axes in Process - public override CmsError AXES_RDistanceToGo(ushort process, ref Dictionary Axes) + public override CmsError AXES_RDistanceToGo(ushort process, ref Dictionary Axes) { //Check if the NC is Connected CmsError cmsError = CheckConnection(); @@ -1441,8 +1441,8 @@ namespace CMS_CORE_Library.Osai return cmsError; ushort nReturn; ushort nAxis = 20; - String AxName = ""; - KeyValuePair val; + string AxName = ""; + KeyValuePair val; List axesN = new List(); //Try to get information @@ -1956,7 +1956,7 @@ namespace CMS_CORE_Library.Osai public override CmsError FILES_RGetFileList(string path, ref List files) { ushort nReturn; - String temppath; + string temppath; uint findHandler; bool found; FILEFINDDATA filesearch = new FILEFINDDATA(); @@ -2006,7 +2006,7 @@ namespace CMS_CORE_Library.Osai { ushort nReturn; string fileContent = ""; - List rows; + List rows; CmsError cmsError; //Check if the NC is Connected @@ -2055,7 +2055,7 @@ namespace CMS_CORE_Library.Osai public override CmsError FILES_WSetActiveProgram(int processId, string filePath, ref ActiveProgramDataModel data) { - String temppath; + string temppath; //Check if the NC is Connected CmsError cmsError = CheckConnection(); if (cmsError.IsError()) @@ -2117,8 +2117,8 @@ namespace CMS_CORE_Library.Osai if (cmsError.IsError()) return cmsError; - List lines = new List(); - String path = ""; + List lines = new List(); + string path = ""; try { //read all the datas @@ -3037,7 +3037,7 @@ namespace CMS_CORE_Library.Osai string backupFilePath = TOOL_MANAGER_BACKUP_DIRECTORY_PATH + "{0}.csv"; List families = File.ReadAllLines(string.Format(backupFilePath, FAMILIES_FILE_NAME)) // Read file - .Where(x => x != String.Empty) + .Where(x => x != string.Empty) .Select(x => x.Split(';')) // Split line .Select(x => new NcFamilyFileModel // Setup new model for each line { @@ -3060,7 +3060,7 @@ namespace CMS_CORE_Library.Osai }).ToList(); List familiesSize = File.ReadAllLines(string.Format(backupFilePath, FAM_SIZE_FILE_NAME)) // Read file - .Where(x => x != String.Empty) + .Where(x => x != string.Empty) .Select(x => x.Split(';')) // Split line .Select(x => new NcFamilySizeFileModel // Setup new model for each line { @@ -3070,7 +3070,7 @@ namespace CMS_CORE_Library.Osai }).ToList(); List tools = File.ReadAllLines(string.Format(backupFilePath, TOOLS_FILE_NAME)) - .Where(x => x != String.Empty) + .Where(x => x != string.Empty) .Select(x => x.Split(';')) .Select(x => new NcToolModel { @@ -3087,7 +3087,7 @@ namespace CMS_CORE_Library.Osai }).ToList(); List shanks = File.ReadAllLines(string.Format(backupFilePath, SHANKS_FILE_NAME)) - .Where(x => x != String.Empty) + .Where(x => x != string.Empty) .Select(x => x.Split(';')) .Select(x => new NcShankModel { @@ -3099,7 +3099,7 @@ namespace CMS_CORE_Library.Osai }).ToList(); List positions = File.ReadAllLines(string.Format(backupFilePath, MAG_POSITION_FILE_NAME)) - .Where(x => x != String.Empty) + .Where(x => x != string.Empty) .Select(x => x.Split(';')) .Select(x => new NcMagazinePositionModel { @@ -3268,7 +3268,7 @@ namespace CMS_CORE_Library.Osai } //Check if Memory Area is corrected - private CmsError CheckMemoryArea(String AreaName) + private CmsError CheckMemoryArea(string AreaName) { if (!AreaName.StartsWith(OSAI_MEMTYPE) && !AreaName.StartsWith(UNDEFINED_MEMTYPE)) return INCORRECT_PARAMETERS_ERROR; @@ -3327,14 +3327,14 @@ namespace CMS_CORE_Library.Osai } //Convert OSAI MESSAGE to STEP Message - private String OsaiToStepMessage(MESSAGE_TEXT Message) + private string OsaiToStepMessage(MESSAGE_TEXT Message) { - String ActMSG = Message.Line1.Trim(); - if (!String.IsNullOrWhiteSpace(Message.Line2)) + string ActMSG = Message.Line1.Trim(); + if (!string.IsNullOrWhiteSpace(Message.Line2)) ActMSG += "\n" + Message.Line2.Trim(); - if (!String.IsNullOrWhiteSpace(Message.Line3)) + if (!string.IsNullOrWhiteSpace(Message.Line3)) ActMSG += "\n" + Message.Line3.Trim(); - if (!String.IsNullOrWhiteSpace(Message.Line4)) + if (!string.IsNullOrWhiteSpace(Message.Line4)) ActMSG += "\n" + Message.Line4.Trim(); return ActMSG; @@ -3343,9 +3343,9 @@ namespace CMS_CORE_Library.Osai //Read Language Configuration private CmsError LanguageConfig() { - String[] ConfigLines; - String LangLine; - String[] SPlitted; + string[] ConfigLines; + string LangLine; + string[] SPlitted; try { @@ -3356,7 +3356,7 @@ namespace CMS_CORE_Library.Osai LangLine = ConfigLines.FirstOrDefault(X => X.ToUpper().Contains("ID_LANGUAGE")); //Check if i found it - if (String.IsNullOrEmpty(LangLine)) + if (string.IsNullOrEmpty(LangLine)) throw new Nc_Exception("'ID_LANGUAGE' Line in Osai Config File not Found"); //Split the string @@ -3379,7 +3379,7 @@ namespace CMS_CORE_Library.Osai //Read Plc Messages private CmsError ReadPlcMessages() { - String Path; + string Path; try { PlcMessages = new Dictionary(); @@ -3399,7 +3399,7 @@ namespace CMS_CORE_Library.Osai } //Manage the Languages - private CultureInfo ConverToSTEPLanguage(String Lang) + private CultureInfo ConverToSTEPLanguage(string Lang) { CultureInfo Culture = CultureInfo.GetCultures(CultureTypes.AllCultures).FirstOrDefault(X => X.EnglishName.ToLower() == Lang.ToLower()); @@ -3502,8 +3502,8 @@ namespace CMS_CORE_Library.Osai return cmsError; ushort nReturn; ushort Level = 0; - String mainPath = ""; - String SubPath = ""; + string mainPath = ""; + string SubPath = ""; //Try to get information try @@ -3551,10 +3551,10 @@ namespace CMS_CORE_Library.Osai //Get Program Path without extension private string GetFilepathWithoutExt(string path) { - String name = path.Split('\\').LastOrDefault(); - String ext = name.Split('.').LastOrDefault(); + string name = path.Split('\\').LastOrDefault(); + string ext = name.Split('.').LastOrDefault(); - if (String.IsNullOrWhiteSpace(ext) || name == ext) + if (string.IsNullOrWhiteSpace(ext) || name == ext) return path; else return path.Remove(path.LastIndexOf("." + ext)); @@ -3563,8 +3563,8 @@ namespace CMS_CORE_Library.Osai //Get Program extension private string getFileExt(string path) { - String name = path.Split('\\').LastOrDefault(); - String ext = name.Split('.').LastOrDefault(); + string name = path.Split('\\').LastOrDefault(); + string ext = name.Split('.').LastOrDefault(); if (name == ext) return ""; else