本文整理汇总了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("}");
}
示例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("}");
}
示例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);");
}