Example #1
0
    public static PtOutNode Read(byte[] value)
    {
        //创建结构体
        PtOutNode info = new PtOutNode();
        //创建字节缓存
        ByteBuffer bfs = new ByteBuffer();

        bfs.source = value;


        //读取cols数组
        if (bfs.ReadBool())
        {
            int len = bfs.ReadInt32();
            info.cols = new List <string>();
            for (int i = 0; i < len; ++i)
            {
                info.cols.Add(bfs.ReadString());
            }
        }



        //返回 PtOutNode 实例
        return(info);
    }
Example #2
0
    public static PtOutBinary Read(byte[] value)
    {
        //创建结构体
        PtOutBinary info = new PtOutBinary();
        //创建字节缓存
        ByteBuffer bfs = new ByteBuffer();

        bfs.source = value;


        //读取class_name
        if (bfs.ReadBool())
        {
            info.class_name = bfs.ReadString();
        }


        //读取field_count
        if (bfs.ReadBool())
        {
            info.field_count = bfs.ReadInt32();
        }


        //读取rows数组
        if (bfs.ReadBool())
        {
            int len = bfs.ReadInt32();
            info.rows = new List <PtOutNode>();
            for (int i = 0; i < len; ++i)
            {
                info.rows.Add(PtOutNode.Read(bfs.ReadBytes()));
            }
        }



        //返回 PtOutBinary 实例
        return(info);
    }
Example #3
0
    public static byte[] Write(PtOutBinary value)
    {
        //创建字节缓存
        ByteBuffer bfs = new ByteBuffer();


        //写入class_name
        bfs.WriteBool(value.has_class_name);
        if (value.has_class_name)
        {
            bfs.WriteString(value.class_name);
        }


        //写入field_count
        bfs.WriteBool(value.has_field_count);
        if (value.has_field_count)
        {
            bfs.WriteInt32(value.field_count);
        }


        //写入rows数组
        bfs.WriteBool(value.has_rows);
        if (value.has_rows)
        {
            int len = value.rows.Count;
            bfs.WriteInt32(len);
            for (int i = 0; i < len; ++i)
            {
                bfs.WriteBytes(PtOutNode.Write(value.rows[i]));
            }
        }



        //返回 字节数组
        return(bfs.source);
    }
Example #4
0
    public static byte[] Write(PtOutNode value)
    {
        //创建字节缓存
        ByteBuffer bfs = new ByteBuffer();


        //写入cols数组
        bfs.WriteBool(value.has_cols);
        if (value.has_cols)
        {
            int len = value.cols.Count;
            bfs.WriteInt32(len);
            for (int i = 0; i < len; ++i)
            {
                bfs.WriteString(value.cols[i]);
            }
        }



        //返回 字节数组
        return(bfs.source);
    }