本文整理汇总了C#中D3TypeDescriptor.FieldDescriptor.GetFieldName方法的典型用法代码示例。如果您正苦于以下问题:C# FieldDescriptor.GetFieldName方法的具体用法?C# FieldDescriptor.GetFieldName怎么用?C# FieldDescriptor.GetFieldName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类D3TypeDescriptor.FieldDescriptor
的用法示例。
在下文中一共展示了FieldDescriptor.GetFieldName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateOptionalEncodeBitBuffer
public override void GenerateOptionalEncodeBitBuffer(StringBuilder b, int pad, FieldDescriptor f, string bitBufferName)
{
if (f.HasMinMax)
throw new NotImplementedException();
if (f.Float16Encoding)
throw new NotImplementedException();
if (f.EncodedBits != 32)
throw new NotImplementedException();
var fieldName = f.GetFieldName();
b.Append(' ', pad); b.AppendLine("if(" + fieldName + ".HasValue)");
b.Append(' ', pad+4); b.AppendLine(bitBufferName + ".WriteFloat32(" + f.GetFieldName() + ".Value);");
}
示例2: GenerateEncodeBitBuffer
public override void GenerateEncodeBitBuffer(StringBuilder b, int pad, FieldDescriptor f, string bitBufferName)
{
if (f.HasMinMax)
throw new NotImplementedException();
b.Append(' ', pad);
b.AppendLine(bitBufferName + ".WriteInt64(" + f.EncodedBits + ", " + f.GetFieldName() + ");");
}
示例3: GenerateField
public override void GenerateField(StringBuilder b, int pad, FieldDescriptor f)
{
if (f.HasMinMax)
{
if (f.Min == 0 && f.Max == 1)
{
b.Append(' ', pad); b.AppendLine("public bool " + f.GetFieldName() + ";");
}
else
{
var name = f.GetFieldName();
b.Append(' ', pad); b.AppendLine("int _" + name + ";");
b.Append(' ', pad); b.AppendLine("public int " + name + " { get { return _" + name + "; } set { if(value < " + f.Min.ToMaybeHexString(1024) + " || value > " + f.Max.ToMaybeHexString(1024) + ") throw new ArgumentOutOfRangeException(); _" + name + " = value; } }");
}
}
else
{
b.Append(' ', pad); b.AppendLine("public int " + f.GetFieldName() + ";");
}
}
示例4: GenerateParseBitBuffer
public override void GenerateParseBitBuffer(StringBuilder b, int pad, FieldDescriptor f, string bitBufferName)
{
if (f.HasMinMax)
throw new NotImplementedException();
if (f.Float16Encoding)
throw new NotImplementedException();
if (f.EncodedBits != 32)
throw new NotImplementedException();
b.Append(' ', pad);
b.AppendLine(f.GetFieldName() + " = " + bitBufferName + ".ReadFloat32();");
}
示例5: GenerateParseBitBuffer
public override void GenerateParseBitBuffer(StringBuilder b, int pad, FieldDescriptor f, string bitBufferName)
{
var fieldName = f.GetFieldName();
b.Append(' ', pad); b.Append(fieldName + " = ");
if (f.HasMinMax)
{
if (f.Min == 0 && f.Max == 1)
{
b.AppendLine(bitBufferName + ".ReadBool();");
}
else
{
if(f.Min != 0)
b.AppendLine(bitBufferName + ".ReadInt(" + f.EncodedBits + ") + (" + f.Min + ");");
else
b.AppendLine(bitBufferName + ".ReadInt(" + f.EncodedBits + ");");
}
}
else
{
b.AppendLine(bitBufferName + ".ReadInt(" + f.EncodedBits + ");");
}
}
示例6: GenerateFixedArrayEncodeBitBuffer
public override void GenerateFixedArrayEncodeBitBuffer(StringBuilder b, int pad, FieldDescriptor f, string bitBufferName)
{
var fieldName = f.GetFieldName();
if (f.HasArrayLengthOffset)
{
b.Append(' ', pad);
b.AppendLine(bitBufferName + ".WriteInt(" + f.EncodedBits2 + ", _" + f.GetFieldName() + ".Length);");
}
b.Append(' ', pad); b.AppendLine("for(int i = 0;i < _" + fieldName + ".Length;i++) _" + fieldName + "[i].Encode(" + bitBufferName + ");");
}
示例7: GenerateOptionalEncodeBitBuffer
public override void GenerateOptionalEncodeBitBuffer(StringBuilder b, int pad, FieldDescriptor f, string bitBufferName)
{
b.Append(' ', pad); b.AppendLine("if(" + f.GetFieldName() + " != null)");
b.Append(' ', pad); b.AppendLine(f.GetFieldName() + ".Encode(" + bitBufferName + ");");
}
示例8: GenerateFixedArrayParseBitBuffer
public override void GenerateFixedArrayParseBitBuffer(StringBuilder b, int pad, FieldDescriptor f, string bitBufferName)
{
var name = f.GetFieldName();
b.Append(' ', pad);
if (f.HasArrayLengthOffset)
b.AppendLine(name + " = new " + Name + "[" + bitBufferName + ".ReadInt(" + f.EncodedBits2 + ")];");
else
b.AppendLine(name + " = new " + Name + "[" + f.ArrayLength + "];");
b.Append(' ', pad); b.AppendLine("for(int i = 0;i < _" + name + ".Length;i++)");
b.Append(' ', pad); b.AppendLine("{");
b.Append(' ', pad + 4); b.AppendLine("_" + name + "[i] = new " + Name + "();");
b.Append(' ', pad + 4); b.AppendLine("_" + name + "[i].Parse(" + bitBufferName + ");");
b.Append(' ', pad); b.AppendLine("}");
}
示例9: GenerateParseBitBuffer
public override void GenerateParseBitBuffer(StringBuilder b, int pad, FieldDescriptor f, string bitBufferName)
{
b.Append(' ', pad); b.AppendLine(f.GetFieldName() + " = new " + Name + "();");
b.Append(' ', pad); b.AppendLine(f.GetFieldName() + ".Parse(" + bitBufferName + ");");
}
示例10: GenerateFixedArrayField
public override void GenerateFixedArrayField(StringBuilder b, int pad, FieldDescriptor f)
{
b.Append(' ', pad); b.AppendLine(Name + "[] _" + f.GetFieldName() + ";");
b.Append(' ', pad);
b.AppendLine("public " + Name + "[] " + f.GetFieldName() + " { get { return _" + f.GetFieldName() + "; } set { if(value != null && value.Length " + (f.HasArrayLengthOffset ? "> " : "!= ") + f.ArrayLength + ") throw new ArgumentOutOfRangeException(); _" + f.GetFieldName() + " = value; } }");
}
示例11: GenerateField
public override void GenerateField(StringBuilder b, int pad, FieldDescriptor f)
{
b.Append(' ', pad); b.AppendLine("public " + Name + " " + f.GetFieldName() + ";");
}
示例12: GenerateParseBitBuffer
public override void GenerateParseBitBuffer(StringBuilder b, int pad, FieldDescriptor f, string bitBufferName)
{
b.Append(' ', pad);
b.AppendLine(f.GetFieldName() + " = " + bitBufferName + ".ReadCharArray(" + f.ArrayLength + ");");
}
示例13: GenerateField
public override void GenerateField(StringBuilder b, int pad, FieldDescriptor f)
{
b.Append(' ', pad); b.AppendLine("public string _" + f.GetFieldName() + ";");
b.Append(' ', pad); b.AppendLine("public string " + f.GetFieldName() + " { get { return _" + f.GetFieldName() + "; } set { if(value != null && value.Length > " + f.ArrayLength + ") throw new ArgumentOutOfRangeException(); _" + f.GetFieldName() + " = value; } }");
}
示例14: GenerateOptionalEncodeBitBuffer
public override void GenerateOptionalEncodeBitBuffer(StringBuilder b, int pad, FieldDescriptor f, string bitBufferName)
{
b.Append(' ', pad); b.AppendLine("if(" + f.GetFieldName() + " != null)");
b.Append(' ', pad+4); b.AppendLine(bitBufferName + ".WriteCharArray(" + f.ArrayLength + ", " + f.GetFieldName() + ");");
}
示例15: GenerateOptionalField
public override void GenerateOptionalField(StringBuilder b, int pad, FieldDescriptor f)
{
b.Append(' ', pad); b.AppendLine("public float? " + f.GetFieldName() + ";");
}