コード例 #1
0
        public void load(JsonActionNode node)
        {
            value        = node.value;
            endValue     = node.endValue;
            foundContent = node.foundContent;
            filePath     = node.filePath;

            type = ActionType.EXIT;
            if (node.type != string.Empty)
            {
                for (int i = 0; i < xType.Length; i++)
                {
                    if (xType[i] == node.type)
                    {
                        type = (ActionType)i;
                    }
                }
            }

            checkType = ActionCheckType.MD5;
            if (string.IsNullOrEmpty(node.type) != true)
            {
                for (int i = 0; i < xCheckType.Length; i++)
                {
                    if (xCheckType[i] == node.checkType)
                    {
                        checkType = (ActionCheckType)i;
                    }
                }
            }
        }
コード例 #2
0
        private static void show_project_content(Project project)
        {
            Console.WriteLine("---project.timeout: " + project.timeout);
            Console.WriteLine("---project.com.port: " + project.com.port);
            Console.WriteLine("---project.com.baudrate: " + project.com.baudrate);
            Console.WriteLine("---project.log.enable: " + project.log.enable);
            Console.WriteLine("---project.log.path: " + project.log.path);
            Console.WriteLine();
            Console.WriteLine("---project.sequence.Count: " + project.sequence.Count);

            for (int Index = 0; Index < project.sequence.Count; Index++)
            {
                JsonActionNode node  = project.sequence[Index];
                ActionNode     anode = new ActionNode();
                anode.load(node);
                if (anode.type != ActionType.NONE)
                {
                    Console.WriteLine("----[{0}].type: " + node.type, Index);

                    switch (anode.type)
                    {
                    case ActionType.EXIT:
                        break;

                    case ActionType.SET_BAUD:
                        Console.WriteLine("----[{0}].value: " + node.value, Index);
                        break;

                    case ActionType.READ_UTIL:
                        Console.WriteLine("----[{0}].endValue: " + node.endValue, Index);
                        Console.WriteLine("----[{0}].foundContent: " + node.foundContent, Index);
                        break;

                    case ActionType.SEND_CHECK:
                        Console.WriteLine("----[{0}].checkType: " + node.checkType, Index);
                        Console.WriteLine("----[{0}].filePath: " + node.filePath, Index);
                        break;

                    case ActionType.SEND_DATA:
                        Console.WriteLine("----[{0}].value: " + node.value, Index);
                        break;

                    case ActionType.SEND_FILE:
                        Console.WriteLine("----[{0}].filePath: " + node.filePath, Index);
                        break;
                    }
                }
                else
                {
                    Console.WriteLine("sequence[{0}] has problem", Index);
                }
                Console.WriteLine();
            }
        }