public static string GetUnitDisplay(EnmPoint type, string value, string unit) { switch (type) { case EnmPoint.DI: case EnmPoint.DO: case EnmPoint.AL: var result = string.Empty; var units = (unit ?? string.Empty).Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); foreach (var u in units) { var vs = u.Split(new char[] { '&' }, StringSplitOptions.RemoveEmptyEntries); if (vs.Length != 2) { continue; } if (vs[0].Trim() == value) { result = vs[1].Trim(); break; } } return(result); case EnmPoint.AI: case EnmPoint.AO: return(unit); default: return(""); } }
public static string GetPointTypeDisplay(EnmPoint type) { switch (type) { case EnmPoint.AI: return("遥测"); case EnmPoint.AO: return("遥调"); case EnmPoint.DI: return("遥信"); case EnmPoint.DO: return("遥控"); case EnmPoint.AL: return("告警"); default: return("未定义"); } }