示例#1
0
        public dynamic Clone()
        {
            TracePortData c_Clonado = new TracePortData();

            c_Clonado.port        = this.port;
            c_Clonado.temperature = this.temperature;
            c_Clonado.power       = this.power;
            c_Clonado.status      = this.status;
            c_Clonado.tool        = this.tool;
            // HT hot air stations
            c_Clonado.flow       = this.flow;
            c_Clonado.tempTC1    = this.tempTC1;
            c_Clonado.tempTC2    = this.tempTC2;
            c_Clonado.timetostop = this.timetostop;

            return(c_Clonado);
        }
示例#2
0
        private TracePortData[] getPortsData(string jsondata)
        {
            List <TracePortData> data = new List <TracePortData>();

            // parse the array
            JArray arr = (JArray)(JArray.Parse(jsondata));

            foreach (JObject elem in arr)
            {
                // create port data
                TracePortData portdata = new TracePortData();

                foreach (JProperty propPortElem in elem.Children())
                {
                    switch (propPortElem.Name)
                    {
                    case "p":
                        //port
                        portdata.port = (Port)(int.Parse(propPortElem.Value.ToString()));
                        break;

                    case "o":
                        //tool
                        portdata.tool = (GenericStationTools)(int.Parse(propPortElem.Value.ToString()));
                        break;

                    case "s":
                        //status
                        portdata.status = byte.Parse(propPortElem.Value.ToString());
                        break;

                    case "t":
                        //temp
                        portdata.temperature = int.Parse(propPortElem.Value.ToString());
                        break;

                    case "w":
                        //power
                        portdata.power = int.Parse(propPortElem.Value.ToString());
                        break;

                    case "f":
                        //caudal (JTSE)
                        portdata.flow = int.Parse(propPortElem.Value.ToString());
                        break;

                    case "x1":
                        //external TC1 (JTSE)
                        portdata.tempTC1 = int.Parse(propPortElem.Value.ToString());
                        break;

                    case "x2":
                        //external TC1 (JTSE)
                        portdata.tempTC2 = int.Parse(propPortElem.Value.ToString());
                        break;

                    case "ts":
                        //time to stop (JTSE)
                        portdata.timetostop = int.Parse(propPortElem.Value.ToString());
                        break;

                    default:
                        break;
                    }
                }

                // add port data
                data.Add(portdata);
            }

            return(data.ToArray());
        }