• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# D3TypeDescriptor.FieldDescriptor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



FieldDescriptor类属于D3TypeDescriptor命名空间,在下文中一共展示了FieldDescriptor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GenerateFieldFileRead

        public override void GenerateFieldFileRead(StringBuilder b, int pad, FieldDescriptor f, string bitBufferName, string fieldname, FieldDescriptor[] fields)
        {
            b.Append(' ', pad); b.Append(fieldname + " = ");

            b.Append(bitBufferName + ".ReadValueS32()");
            b.AppendLine(";");
        }
开发者ID:starcasters,项目名称:type-extractor,代码行数:7,代码来源:DT_ATTRIBUTEPARAM.cs


示例2: GenerateAsTextField

 public override void GenerateAsTextField(StringBuilder b, int pad, FieldDescriptor f, string fieldname)
 {
     b.Append(' ', pad); b.AppendLine("for(int loop" + pad + " = 0;loop" + pad + " < _" + fieldname + ".Length;loop" + pad + "++)");
     b.Append(' ', pad); b.AppendLine("{");
     f.SubType.GenerateAsTextField(b, pad, f, "_" + fieldname + "[loop" + pad + "]");
     b.Append(' ', pad); b.AppendLine("}");
 }
开发者ID:starcasters,项目名称:type-extractor,代码行数:7,代码来源:DT_FIXEDARRAY.cs


示例3: GenerateParseBitBuffer

        public override void GenerateParseBitBuffer(StringBuilder b, int pad, FieldDescriptor f, string bitBufferName, string fieldname)
        {
            if (f.HasMinMax)
                throw new NotImplementedException();

            b.Append(' ', pad); b.AppendLine(fieldname + " = (ushort)" + bitBufferName + ".ReadInt(" + f.EncodedBits + ");");
        }
开发者ID:starcasters,项目名称:type-extractor,代码行数:7,代码来源:DT_WORD.cs


示例4: 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


示例5: 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() + ");");
 }
开发者ID:rotacioskapa,项目名称:mooege,代码行数:7,代码来源:DT_INT64.cs


示例6: GenerateEncodeBitBuffer

 public override void GenerateEncodeBitBuffer(StringBuilder b, int pad, FieldDescriptor f, string bitBufferName, string fieldname)
 {
     b.Append(' ', pad); b.AppendLine("//still checking variablearrays");
     b.Append(' ', pad); b.AppendLine(bitBufferName + ".WriteInt(0, _"+ fieldname+".Count);");
     b.Append(' ', pad); b.AppendLine("for(int loop" + pad + " = 0; loop" + pad + " < _" + fieldname + ".Count; loop" + pad + "++)");
     b.Append(' ', pad); b.AppendLine("{");
     f.SubType.GenerateEncodeBitBuffer(b, pad + 4, f, bitBufferName, "_" + fieldname + "[loop" + pad + "]");
     b.Append(' ', pad); b.AppendLine("}");
 }
开发者ID:starcasters,项目名称:type-extractor,代码行数:9,代码来源:DT_VARIABLEARRAY.cs


示例7: GenerateAsTextField

 public override void GenerateAsTextField(StringBuilder b, int pad, FieldDescriptor f, string fieldname)
 {
     b.Append(' ', pad); b.AppendLine("for(int loop" + pad + " = 0; loop" + pad + " < _" + fieldname + ".Count; loop" + pad + "++)");
     b.Append(' ', pad); b.AppendLine("{");
     b.Append(' ', pad + 4);
     var fname = "_" + fieldname + "[loop" + pad + "]";
     b.AppendLine("b.Append(' ', pad); b.AppendLine(\"" + "_" + fieldname + "[loop" + pad + "]" + ":\" + " + fname + ".ToString() );");
     b.Append(' ', pad); b.AppendLine("}");
 }
开发者ID:starcasters,项目名称:type-extractor,代码行数:9,代码来源:DT_FORMULA.cs


示例8: LoadFields

        public override void LoadFields(FieldDescriptor[] fields)
        {
            if (fields.Length != 3 ||
                fields[0].Type.Name != "DT_OPTIONAL" || fields[0].SubType.Name != "DT_INT" ||
                fields[1].Type.Name != "DT_INT" ||
                fields[2].Type != null)
                throw new Exception("Unexpected fields in NetAttributeKeyValue structure.");
            fields[1].Type = AttributeFieldType.Instance;

            base.LoadFields(fields);
        }
开发者ID:wow4all,项目名称:mooege,代码行数:11,代码来源:NetAttributeKeyValue.cs


示例9: LoadFields

        public override void LoadFields(FieldDescriptor[] fields)
        {
            if(fields[0].Type.Name != "RequiredMessageHeader")
                throw new Exception("Expected RequiredMessageHeader.");
            fields = fields.Skip(1).ToArray();

            for (int i = 0; i < fields.Length; i++)
                fields[i].Index = i;

            base.LoadFields(fields);
        }
开发者ID:wow4all,项目名称:mooege,代码行数:11,代码来源:GameMessageDescriptor.cs


示例10: 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();");
 }
开发者ID:rotacioskapa,项目名称:mooege,代码行数:11,代码来源:DT_FLOAT.cs


示例11: 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);");
 }
开发者ID:rotacioskapa,项目名称:mooege,代码行数:12,代码来源:DT_FLOAT.cs


示例12: GenerateFieldFileRead

        public override void GenerateFieldFileRead(StringBuilder b, int pad, FieldDescriptor f, string bitBufferName, string fieldname, FieldDescriptor[] fields)
        {
            b.Append(' ', pad); b.AppendLine(fieldname + " = new " + f.SubType.Name + "["+f.ArrayLength+"];");

            var tfield = "temp" + pad + "_" + fieldname;
            var lname = "loop"+pad.ToString();
            b.Append(' ', pad); b.AppendLine("for(int " + lname + "=0; " + lname + " < " + f.ArrayLength + "; " + lname + "++ )");
            b.Append(' ', pad); b.AppendLine("{");
            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 + "[" + lname + "] = " + tfield + ";");
            b.Append(' ', pad); b.AppendLine("}");
        }
开发者ID:starcasters,项目名称:type-extractor,代码行数:13,代码来源:DT_FIXEDARRAY.cs


示例13: GenerateFixedArrayEncodeBitBuffer

        public override void GenerateFixedArrayEncodeBitBuffer(StringBuilder b, int pad, FieldDescriptor f, string bitBufferName, string fieldname)
        {
            b.Append(' ', pad); b.AppendLine("//still checking fixedarrays on basictypes");

            if (f.HasArrayLengthOffset)
            {
                b.Append(' ', pad);
                b.AppendLine(bitBufferName + ".WriteInt(" + f.EncodedBits2 + ", " + fieldname + ".Length);");
            }

            b.Append(' ', pad); b.AppendLine("for(int loop" + pad + " = 0;loop" + pad + " < _" + fieldname + ".Length;loop" + pad + "++)");
            b.Append(' ', pad); b.AppendLine("{");
            f.SubType.GenerateEncodeBitBuffer(b, pad, f, bitBufferName, "_" + fieldname + "[loop" + pad + "]");
            b.Append(' ', pad); b.AppendLine("}");
        }
开发者ID:starcasters,项目名称:type-extractor,代码行数:15,代码来源:BasicTypeDescriptor.cs


示例14: 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


示例15: GenerateEncodeBitBuffer

 public override void GenerateEncodeBitBuffer(StringBuilder b, int pad, FieldDescriptor f, string bitBufferName, string fieldname)
 {
     if (f.HasMinMax)
     {
         b.Append(' ', pad);
         b.AppendLine("minmax is still unsupported on floats.");
     }
     if (
        (f.Float16Encoding) ||
        (f.EncodedBits != 32)
         )
     {
         b.Append(' ', pad); b.AppendLine(bitBufferName + ".WriteFloat(" + fieldname + "," + f.EncodedBits.ToString() + ");");
     }
     if (f.EncodedBits == 32)
     {
         b.Append(' ', pad); b.AppendLine(bitBufferName + ".WriteFloat32(" + fieldname + ");");
     }
 }
开发者ID:starcasters,项目名称:type-extractor,代码行数:19,代码来源:DT_FLOAT.cs


示例16: 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() + ";");
     }
 }
开发者ID:starcasters,项目名称:type-extractor,代码行数:20,代码来源:DT_INT.cs


示例17: 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


示例18: GenerateEncodeBitBuffer

 public override void GenerateEncodeBitBuffer(StringBuilder b, int pad, FieldDescriptor f, string bitBufferName, string fieldname)
 {
     if (f.HasMinMax)
     {
         if (f.Min == 0 && f.Max == 1)
         {
             b.Append(' ', pad); b.AppendLine(bitBufferName + ".WriteBool(" + fieldname + ");");
         }
         else
         {
             b.Append(' ', pad);
             if(f.Min != 0)
                 b.AppendLine(bitBufferName + ".WriteInt(" + f.EncodedBits + ", " + fieldname + " - (" + f.Min + "));");
             else
                 b.AppendLine(bitBufferName + ".WriteInt(" + f.EncodedBits + ", " + fieldname + ");");
         }
     }
     else
     {
         b.Append(' ', pad); b.AppendLine(bitBufferName + ".WriteInt(" + f.EncodedBits + ", " + fieldname + ");");
     }
 }
开发者ID:starcasters,项目名称:type-extractor,代码行数:22,代码来源:DT_INT.cs


示例19: 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 + ");");
     }
 }
开发者ID:wow4all,项目名称:mooege,代码行数:23,代码来源:DT_INT.cs


示例20: GenerateParseBitBuffer

 public override void GenerateParseBitBuffer(StringBuilder b, int pad, FieldDescriptor f, string bitBufferName)
 {
     f.SubType.GenerateFixedArrayParseBitBuffer(b, pad, f, bitBufferName);
 }
开发者ID:wow4all,项目名称:mooege,代码行数:4,代码来源:DT_FIXEDARRAY.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DAL.ClassConnectDB类代码示例发布时间:2022-05-24
下一篇:
C# Packets.GameBitBuffer类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap