当前位置: 首页>>代码示例>>C#>>正文


C# FieldDescriptor.First方法代码示例

本文整理汇总了C#中D3TypeDescriptor.FieldDescriptor.First方法的典型用法代码示例。如果您正苦于以下问题:C# FieldDescriptor.First方法的具体用法?C# FieldDescriptor.First怎么用?C# FieldDescriptor.First使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在D3TypeDescriptor.FieldDescriptor的用法示例。


在下文中一共展示了FieldDescriptor.First方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateFieldFileRead

        public override void GenerateFieldFileRead(StringBuilder b, int pad, FieldDescriptor f, string bitBufferName, string fieldname, FieldDescriptor[] fields)
        {
            b.Append(' ', pad); b.AppendLine("//still checking variablearrays");
            b.Append(' ', pad); b.AppendLine(fieldname + " = new List<" + f.SubType.Name + ">();");
            var ser = fields.First((w) => w.Offset == f.Offset + f.VariableOffset);

            var tfield = "temp" + pad + "_" + fieldname;

            int subfieldsize = 1;
            if (f.SubType is StructureTypeDescriptor)
            {
                subfieldsize = (f.SubType as StructureTypeDescriptor).Fields.Last().Offset;
            }
            else
            {
                subfieldsize = (f.SubType as BasicTypeDescriptor).TypeSize;
            }

            b.Append(' ', pad); b.AppendLine("for(int i = 0; i < (int)(" + ser.Name + ".Field1 / "+subfieldsize.ToString()+"); i++)");
            b.Append(' ', pad); b.AppendLine("{");
            b.Append(' ', pad); b.AppendLine(bitBufferName + ".Position = " + ser.Name + ".Field0 + 16 + (" + subfieldsize.ToString()+ "*i) ;");
            b.Append(' ', pad + 4); b.AppendLine(f.SubType.Name + " " + tfield + ";");
            f.SubType.GenerateFieldFileRead(b, pad + 4, f, bitBufferName, tfield, fields);
            b.Append(' ', pad + 4); b.AppendLine("_" + fieldname + ".Add(" + tfield + ");");
            b.Append(' ', pad); b.AppendLine("}");
        }
开发者ID:starcasters,项目名称:type-extractor,代码行数:26,代码来源:DT_VARIABLEARRAY.cs

示例2: GenerateFieldFileRead

        public override void GenerateFieldFileRead(StringBuilder b, int pad, FieldDescriptor f, string bitBufferName, string fieldname, FieldDescriptor[] fields)
        {
            b.Append(' ', pad); b.AppendLine("//still checking variablearrays");
            b.Append(' ', pad); b.AppendLine(fieldname + " = new List<byte>();");
            var ser = fields.First((w) => w.Offset == f.Offset + f.VariableOffset);

            var tfield = "temp" + pad + "_" + fieldname;

            int subfieldsize = 1;

            b.Append(' ', pad); b.AppendLine("for(int i = 0; i < (int)(" + ser.GetFieldName() + ".Field1 / " + subfieldsize.ToString() + "); i++)");
            b.Append(' ', pad); b.AppendLine("{");
            b.Append(' ', pad + 4); b.AppendLine(bitBufferName + ".Position = " + ser.GetFieldName() + ".Field0 + 16 + (" + subfieldsize.ToString() + "*i) ;");
            b.Append(' ', pad + 4); b.AppendLine("byte " + tfield + ";");
            b.Append(' ', pad + 4); b.AppendLine(tfield + " = (byte)stream.ReadByte();");
            b.Append(' ', pad + 4); b.AppendLine("_" + fieldname + ".Add(" + tfield + ");");
            b.Append(' ', pad); b.AppendLine("}");
        }
开发者ID:starcasters,项目名称:type-extractor,代码行数:18,代码来源:DT_FORMULA.cs

示例3: GenerateFieldFileRead

        public override void GenerateFieldFileRead(StringBuilder b, int pad, FieldDescriptor f, string bitBufferName, string fieldname, FieldDescriptor[] fields)
        {
            b.Append(' ', pad); b.AppendLine("//still checking cstrings");
            var ser = fields.First((w) => w.Offset == f.Offset + f.VariableOffset);

            var tfield = "temp" + pad + "_" + fieldname;

            int subfieldsize = 1;
            if (f.SubType is StructureTypeDescriptor)
            {
                subfieldsize = (f.SubType as StructureTypeDescriptor).Fields.Last().Offset;
            }
            else
            {
                subfieldsize = (f.SubType as BasicTypeDescriptor).TypeSize;
            }

            b.Append(' ', pad); b.AppendLine("stream.Position = "+ser.Name + ".Field0 + 16;");
            b.Append(' ', pad); b.AppendLine(fieldname + " = stream.ReadString((uint)" + ser.Name + ".Field1);");
        }
开发者ID:starcasters,项目名称:type-extractor,代码行数:20,代码来源:DT_CSTRING.cs


注:本文中的D3TypeDescriptor.FieldDescriptor.First方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。