예제 #1
0
        public static tagID createUnitTestClass(Dictionary <string, object> dic)
        {
            string tag       = string.Empty;
            string startTime = string.Empty;
            string cmd       = string.Empty;
            string state     = string.Empty;
            object tmpTag    = null;
            object tmpTime   = null;
            object tmpCmd    = null;
            object tmpState  = null;

            if (dic.TryGetValue("tag", out tmpTag) == true)
            {
                tag = (string)tmpTag;
            }
            if (dic.TryGetValue("startTime", out tmpTime) == true)
            {
                startTime = (string)tmpTime;
            }
            if (dic.TryGetValue("cmd", out tmpCmd) == true)
            {
                cmd = (string)tmpCmd;
            }
            if (dic.TryGetValue("state", out tmpState) == true)
            {
                state = (string)tmpState;
            }
            tagID u = new tagID(tag, startTime, cmd, state);

            return(u);
        }
예제 #2
0
        public static string toJSONFromList(List <tagID> list)
        {
            if (list == null || list.Count <= 0)
            {
                return("[]");
            }
            string strR = "[";

            for (int i = 0; i < list.Count; i++)
            {
                tagID t = list[i];
                if (i > 0)
                {
                    strR += "," + t.toJSON();
                }
                else
                {
                    strR += t.toJSON();
                }
            }
            strR += "]";
            return(strR);
        }