예제 #1
0
        private void ReadModuleVariables(XmlReader reader)
        {
            map.Clear();

            if (reader.IsEmptyElement)
            {
                return;
            }

            ObjectRef currentObj = new ObjectRef();

            string var_Name    = "";
            string var_Time    = "";
            string var_Quality = "";
            bool   inVar       = false;

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:

                    inVar = false;

                    switch (reader.Name)
                    {
                    case "Obj":
                        currentObj = ObjectRef.Make(moduleID, reader.GetAttribute("id"));
                        break;

                    case "Var":
                        var_Name    = reader.GetAttribute("name");
                        var_Time    = reader.GetAttribute("time");
                        var_Quality = reader.GetAttribute("quality");
                        inVar       = true;
                        break;
                    }
                    break;

                case XmlNodeType.Text:

                    if (inVar)
                    {
                        var t = TimestampFromString(var_Time);
                        var q = QualityFromString(var_Quality);
                        var v = DataValue.FromJSON(reader.Value);

                        var varRef = new VariableRef(currentObj, var_Name);
                        map[varRef] = new VTQ(t, q, v);

                        inVar = false;
                    }
                    break;

                case XmlNodeType.EndElement:
                    inVar = false;
                    if (reader.Name == "Module")
                    {
                        return;
                    }
                    break;
                }
            }
        }
예제 #2
0
 public static MemberValue Make(string moduleID, string localObjectID, string memberName, DataValue value)
 {
     return(new MemberValue(MemberRef.Make(ObjectRef.Make(moduleID, localObjectID), memberName), value));
 }
예제 #3
0
 public static AddArrayElement Make(string moduleID, string localObjectID, string arrayMemberName, DataValue valueToAdd)
 {
     return(new AddArrayElement(MemberRef.Make(ObjectRef.Make(moduleID, localObjectID), arrayMemberName), valueToAdd));
 }
예제 #4
0
 public static MemberRefIdx Make(string moduleID, string localObjectID, string memberName, int index)
 {
     return(new MemberRefIdx(ObjectRef.Make(moduleID, localObjectID), memberName, index));
 }
예제 #5
0
 public static MemberRef Make(string moduleID, string localObjectID, string memberName)
 {
     return(new MemberRef(ObjectRef.Make(moduleID, localObjectID), memberName));
 }
예제 #6
0
 public static VariableValue Make(string moduleID, string localObjectID, string variable, VTQ value)
 {
     return(new VariableValue(VariableRef.Make(ObjectRef.Make(moduleID, localObjectID), variable), value));
 }
예제 #7
0
 public static VariableRef Make(string moduleID, string localObjectID, string variableName)
 {
     return(new VariableRef(ObjectRef.Make(moduleID, localObjectID), variableName));
 }
예제 #8
0
 public static ObjectValue Make(string moduleID, string localObjectID, DataValue value)
 {
     return(new ObjectValue(ObjectRef.Make(moduleID, localObjectID), value));
 }