简体   繁体   English

BinaryReader 读取值列表 C#

[英]BinaryReader read a list of values C#

I am trying to understand how the BinaryReader works in C#.我试图了解 BinaryReader 在 C# 中的工作原理。 But how does it works for lists I would like to ask an explanation.但它如何适用于列表我想问一个解释。

I am following this documentation: http://paulbourke.net/dataformats/ply/我正在关注此文档: http://paulbourke.net/dataformats/ply/

The documentation says that the list of mesh faces are stored in the property:文档说网格面列表存储在属性中:

property list int int vertex_index 

I believe it means that there are list of faces, where the first integer is the number of vertices per face, and other properties indicates the vertex indices.我相信这意味着有面列表,其中第一个 integer 是每个面的顶点数,其他属性表示顶点索引。 How to retrieve this list of list is my question.如何检索此列表列表是我的问题。

Here I have the function:这里我有 function:

private static DataBody ReadDataBodyBinary(DataHeader header, BinaryReader reader) {

            for (int i = 0; i < header.faceCount; i++) {
                //how can I retrieve the face list here?
            }

}

I tried to write inside loop:我试图在循环内写:

int faceVertex = reader.ReadInt32();

But this gives me sometimes positives and sometimes negative values.但这有时会给我带来正面的价值,有时会给我带来负面的价值。

By reading the通过阅读

Incase someone will try to search for binary ply reader for Poisson pointcloud reconstruction using C# use this: https://github.com/petrasvestartas/PlyReader如果有人会尝试使用 C# 搜索用于泊松点云重建的二进制层阅读器,请使用: https://github.com/petrasvestartas/PlyReader

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM