This commit is contained in:
Lucio Maranta
2019-02-04 17:34:42 +01:00
parent 83a93407b5
commit 69733580e8
3 changed files with 43 additions and 12 deletions
+13 -8
View File
@@ -22,7 +22,7 @@ public static class ThreadsFunctions
public static bool reconnectionIsRunning = false;
private static long ReadAlarmsTimer = 0, ReadAlarmsTimes = 0;
private static long ReadAxesTimer = 0, ReadAxesTimes = 0;
private static long ReadPowerOnTimer = 0, ReadPowerOnTimes = 0;
private static long ReadPowerOnTimer = 0, ReadPowerOnTimes = 0;
private static long ReadProcPPTimer = 0, ReadProcPPTimes = 0;
private static long ReadFunctionTimer = 0, ReadFunctionTimes = 0;
private static long ReadMaintenanceTimer = 0, ReadMaintenanceTimes = 0;
@@ -787,14 +787,14 @@ public static class ThreadsFunctions
if (libraryError.IsError())
ManageLibraryError(libraryError);
string MTCProcessName = "PROGRAMPARSER_MTC_ADAPTER";
string ApplicationPath = ServerStartupConfig.MTCFolderPath + ServerStartupConfig.MTCApplicationName + ".exe";
string ApplicationPath = ServerStartupConfig.MTCFolderPath + "\\" + ServerStartupConfig.MTCApplicationName + ".exe";
if (ServerStartupConfig.MTCFolderPath != "")
{
// Check if process exists
Process[] processes = Process.GetProcessesByName(MTCProcessName);
Process[] processes = Process.GetProcessesByName(ServerStartupConfig.MTCApplicationName);
if (!MTCStatus)
{
// Kill if is running
if (processes.Count() > 0)
processes[0].Kill();
}
@@ -836,15 +836,15 @@ public static class ThreadsFunctions
if (!Directory.Exists(ServerStartupConfig.MTCFolderPath))
Directory.CreateDirectory(ServerStartupConfig.MTCFolderPath);
string outputFileName = ServerStartupConfig.MTCFolderPath + "CmsGeneralStatus.mtc";
string outputFileName = ServerStartupConfig.MTCFolderPath + "\\DATA\\CmsGeneralStatus.mtc";
// Create file if not exits
if (!File.Exists(outputFileName))
File.Create(outputFileName);
using (var f = File.Create(outputFileName)) { };
// Read file
List<string> fileLines = File.ReadAllLines(outputFileName).ToList();
string[] parametersInLine;
bool found = false;
for (int i = 0; i < fileLines.Count(); i++)
for (int i = 0; i < fileLines.Count() && !found; i++)
{
// Get tag & value from row
parametersInLine = fileLines[i].Split('|');
@@ -859,7 +859,12 @@ public static class ThreadsFunctions
fileLines.Add(stringVal + "|" + val);
// Write file
File.WriteAllLines(ServerStartupConfig.MTCFolderPath, fileLines.ToArray());
File.WriteAllLines(outputFileName, fileLines.ToArray());
// Write ack
libraryError = ncHandler.WriteM154Ack((int)m154.Process);
if (libraryError.IsError())
ManageLibraryError(libraryError);
}
}
}