Beispiel #1
0
        private string get_print_msg(List <Field_Info> info_list, Bit_Buffer buffer)
        {
            string ret = "";

            foreach (Field_Info info in info_list)
            {
                if (info.field_label == "arg")
                {
                    string value = get_arg_string(info, buffer);
                    ret += value;
                }
                else if (info.field_label == "vector")
                {
                    string value = get_vector_string(info, buffer);
                    ret += value;
                }
                else if (info.field_label == "struct")
                {
                    string value = get_struct_string(info, buffer);
                    ret += value;
                }
                else if (info.field_label == "if")
                {
                    if (buffer.read_bits_available() >= 1 && buffer.read_bool())
                    {
                        ret += get_print_msg(info.field_list, buffer);
                    }
                }
                else if (info.field_label == "switch")
                {
                    if (buffer.read_bits_available() >= info.field_bit)
                    {
                        uint case_val = buffer.read_uint(info.field_bit);
                        foreach (Field_Info swinfo in info.field_list)
                        {
                            if (swinfo.field_label == "case" && swinfo.case_val == case_val)
                            {
                                //找到对应的case标签,对case标签内的child数组进行build
                                ret += get_print_msg(swinfo.field_list, buffer);
                                break;
                            }
                        }
                    }
                }
            }
            return(ret);
        }