73 lines
2.1 KiB
C#
73 lines
2.1 KiB
C#
using Aitex.Core.RT.DataCenter;
|
|
using Aitex.Core.RT.OperationCenter;
|
|
using Aitex.Core.Util;
|
|
using MECF.Framework.Common.Device.Bases;
|
|
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Xml.Linq;
|
|
using System.Xml.Serialization;
|
|
using static System.Net.Mime.MediaTypeNames;
|
|
|
|
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.GasFlow
|
|
{
|
|
public class GasFlowManager : Singleton<GasFlowManager>
|
|
{
|
|
ModuleGsaFlow PM1GsaFlow { get; set; }
|
|
|
|
public GasFlowManager()
|
|
{
|
|
|
|
}
|
|
public void Initialize()
|
|
{
|
|
PM1GsaFlow = CustomXmlSerializer.Deserialize<ModuleGsaFlow>(new FileInfo($"Config\\PM\\PM1\\RealtimeGasFlow.xml"));
|
|
|
|
DATA.Subscribe($"\"PM1\".GasFlowManagerTest", () => PM1GsaFlow.GasFlowUnitLise);
|
|
|
|
|
|
OP.Subscribe("GasFlowManager.QueryUpdate", (string cmd, object[] args) => QueryUpdate());
|
|
}
|
|
|
|
private void IniPM(string pmName)
|
|
{
|
|
ModuleGsaFlow moduleGsaFlow = CustomXmlSerializer.Deserialize<ModuleGsaFlow>(new FileInfo($"Config\\PM\\{pmName}\\RealtimeGasFlow.xml"));
|
|
|
|
DATA.Subscribe($"{pmName}.GasFlowManagerTest", () => moduleGsaFlow.GasFlowUnitLise);
|
|
}
|
|
|
|
public T DeserializeFromXml<T>(string filePath)
|
|
{
|
|
try
|
|
{
|
|
if (!File.Exists(filePath))
|
|
throw new ArgumentNullException(filePath + " not Exists");
|
|
using (StreamReader reader = new StreamReader(filePath))
|
|
{
|
|
XmlSerializer xs = new XmlSerializer(typeof(T));
|
|
T ret = (T)xs.Deserialize(reader);
|
|
return ret;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return default(T);
|
|
}
|
|
}
|
|
|
|
public string GasFlowManagerTest()
|
|
{
|
|
return DateTime.Now.ToString("");
|
|
}
|
|
|
|
public bool QueryUpdate()
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|