Merge branch 'feature/Scada' into develop
# Conflicts: # Client.Utils/Constants.cs # Client/View/NcWindow.cs # Libs/CMS_CORE_Library.dll # Step.Config/Config/serverConfig.xml # Step.Core/ThreadsFunctions.cs # Step.Model/Constants.cs # Step.Model/DTOModels/AlarmModels/DTOAlarmHistoricModel.cs # Step.Model/DatabaseModels/NcMagazinePositionModel.cs # Step.Model/Step.Model.csproj
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using Step.Model.ConfigModels;
|
||||
using Step.Model.DTOModels.Scada;
|
||||
using Step.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -8,6 +10,7 @@ using System.Reflection;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.Schema;
|
||||
using System.Xml.Serialization;
|
||||
using static Step.Config.ServerConfig;
|
||||
using static Step.Model.Constants;
|
||||
using static Step.Utils.SupportFunctions;
|
||||
@@ -29,6 +32,7 @@ namespace Step.Config
|
||||
ReadHeadsConfig();
|
||||
ReadToolManagerConfig();
|
||||
ReadMacros();
|
||||
ReadScadaFile();
|
||||
}
|
||||
catch (XmlException ex)
|
||||
{
|
||||
@@ -169,8 +173,41 @@ namespace Step.Config
|
||||
}
|
||||
}
|
||||
|
||||
private static void ReadScadaFile()
|
||||
{
|
||||
DirectoryInfo d = new DirectoryInfo(SCADA_DIRECTORY);
|
||||
FileInfo[] files = d.GetFiles("*.xml");
|
||||
|
||||
int i = 1;
|
||||
// Cycle inside xml files
|
||||
foreach (var file in files)
|
||||
{
|
||||
StreamReader sr = new StreamReader(SCADA_DIRECTORY + file.Name);
|
||||
XmlSerializer xmlSerializer = new XmlSerializer(typeof(ScadaSchemaModel));
|
||||
ScadaSchemaModel schema = xmlSerializer.Deserialize(sr) as ScadaSchemaModel;
|
||||
schema.Id = i++;
|
||||
// Setup incremental ids
|
||||
schema.Layers = schema.Layers.Select(x => new ScadaSchemaLayerModel()
|
||||
{
|
||||
Id = i++,
|
||||
Buttons = x.Buttons.Select(y => { y.Id = i++; return y; }).ToArray(),
|
||||
Images = x.Images.Select(y => { y.Id = i++; return y; }).ToArray(),
|
||||
ProgressBars = x.ProgressBars.Select(y => { y.Id = i++; return y; }).ToArray(),
|
||||
Inputs = x.Inputs.Select(y => { y.Id = i++; return y; }).ToArray()
|
||||
})
|
||||
.ToArray();
|
||||
|
||||
if (schema.IsInProductionPage == true)
|
||||
ProductionScadaSchema.Add(schema);
|
||||
else
|
||||
ConfiguredScadaSchema.Add(schema);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region Read config from file from configuration
|
||||
|
||||
|
||||
public static void ReadServerConfig()
|
||||
{
|
||||
// Get server file handler
|
||||
|
||||
Reference in New Issue
Block a user