public static OpcValue ReadTag(NewOpcServer.OpcList obj, string tag) { if (!string.IsNullOrEmpty(tag)) { var result = NewOpcServer.GetInstance().GetOpc(obj)?.ReadNode(tag.ToNode(), OpcAttribute.Value); return(result); } return(null); }
public static bool WriteTags(NewOpcServer.OpcList obj, Dictionary <ApiOpcParameter, string> parameters) { var opcWriteNodeList = new List <OpcWriteNode>(); foreach (var parameter in parameters) { var opcWriteNode = GetOpcWriteNode(parameter.Value, parameter.Key); opcWriteNodeList.Add(opcWriteNode); } var commands = opcWriteNodeList.ToArray(); var results = NewOpcServer.GetInstance().GetOpc(obj)?.WriteNodes(commands); var goodResult = (results ?? throw new InvalidOperationException()).Count(x => x.Code == 0); return(goodResult == parameters.Count); }