首次上传
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
namespace SicModules.PMs.Utilities
|
||||
{
|
||||
public class UnitAlarmItem
|
||||
{
|
||||
public string DI { get; set; }//IO name
|
||||
public string ID { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string GlobalDescription_en { get; set; }
|
||||
public string GlobalDescription_zh { get; set; }
|
||||
public string Level { get; set; }
|
||||
public bool AlarmValue { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Aitex.Common.Util;
|
||||
|
||||
namespace SicModules.PMs.Utilities
|
||||
{
|
||||
public static class XmlConfig
|
||||
{
|
||||
|
||||
public static Dictionary<string, UnitAlarmItem> LoadUnitAlarmDefineConfig(string moduleName, string target)
|
||||
{
|
||||
var path = PathManager.GetCfgDir() + $"UnitAlarmDefine/{moduleName}UnitAlarmDefine.xml";
|
||||
var spinUnitAlarmDic = new Dictionary<string, UnitAlarmItem>();
|
||||
var doc = XDocument.Load(path);
|
||||
|
||||
var items = doc.Root.Elements();
|
||||
if (items == null)
|
||||
return null;
|
||||
|
||||
items.ToList().ForEach(x => spinUnitAlarmDic[$"{target}.{x.Attribute("DI").Value}"] = new UnitAlarmItem()
|
||||
{
|
||||
DI = x.Attribute("DI").Value,
|
||||
ID = x.Attribute("ID").Value,
|
||||
Description = x.Attribute("Description").Value,
|
||||
GlobalDescription_en = x.Attribute("GlobalDescription_en").Value,
|
||||
GlobalDescription_zh = x.Attribute("GlobalDescription_zh").Value,
|
||||
Level = x.Attribute("Level").Value,
|
||||
AlarmValue = x.Attribute("AlarmValue").Value == "1"?true:false,
|
||||
});
|
||||
|
||||
return spinUnitAlarmDic;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user