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


C# ProtoReader.ReadUInt32方法代码示例

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


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

示例1: ReadDecimal

 public static decimal ReadDecimal(ProtoReader reader)
 {
     ulong num = 0uL;
     uint num2 = 0u;
     uint num3 = 0u;
     SubItemToken token = ProtoReader.StartSubItem(reader);
     int num4;
     while ((num4 = reader.ReadFieldHeader()) > 0)
     {
         switch (num4)
         {
         case 1:
             num = reader.ReadUInt64();
             break;
         case 2:
             num2 = reader.ReadUInt32();
             break;
         case 3:
             num3 = reader.ReadUInt32();
             break;
         default:
             reader.SkipField();
             break;
         }
     }
     ProtoReader.EndSubItem(token, reader);
     if (num == 0uL && num2 == 0u)
     {
         return 0m;
     }
     int lo = (int)(num & 0xFFFFFFFFL);
     int mid = (int)(num >> 32 & 0xFFFFFFFFL);
     int hi = (int)num2;
     bool isNegative = (num3 & 1u) == 1u;
     byte scale = (byte)((num3 & 510u) >> 1);
     return new decimal(lo, mid, hi, isNegative, scale);
 }
开发者ID:floatyears,项目名称:Decrypt,代码行数:37,代码来源:BclHelpers.cs

示例2: ReadDecimal

        /// <summary>
        /// Parses a decimal from a protobuf stream
        /// </summary>
        public static decimal ReadDecimal(ProtoReader reader)
        {
            ulong low = 0;
            uint high = 0;
            uint signScale = 0;

            int fieldNumber;
            SubItemToken token = ProtoReader.StartSubItem(reader);
            while ((fieldNumber = reader.ReadFieldHeader()) > 0)
            {
                switch (fieldNumber)
                {
                    case FieldDecimalLow: low = reader.ReadUInt64(); break;
                    case FieldDecimalHigh: high = reader.ReadUInt32(); break;
                    case FieldDecimalSignScale: signScale = reader.ReadUInt32(); break;
                    default: reader.SkipField(); break;
                }
                
            }
            ProtoReader.EndSubItem(token, reader);

            if (low == 0 && high == 0) return decimal.Zero;

            int lo = (int)(low & 0xFFFFFFFFL),
                mid = (int)((low >> 32) & 0xFFFFFFFFL),
                hi = (int)high;
            bool isNeg = (signScale & 0x0001) == 0x0001;
            byte scale = (byte)((signScale & 0x01FE) >> 1);
            return new decimal(lo, mid, hi, isNeg, scale);
        }
开发者ID:tsuixl,项目名称:Frame,代码行数:33,代码来源:BclHelpers.cs

示例3: ReadField

 object ReadField(ProtoReader reader, Type memberT, string sClassName, CLS_Environment environment)
 {
     if (memberT == typeof(int))
     {
         return reader.ReadInt32();
     }
     else if (memberT == typeof(uint))
     {
         return reader.ReadUInt32();
     }
     else if (memberT == typeof(bool))
     {
         return reader.ReadBoolean();
     }
     else if (memberT == typeof(byte))
     {
         return reader.ReadByte();
     }
     else if (memberT == typeof(sbyte))
     {
         return reader.ReadSByte();
     }
     else if (memberT == typeof(float))
     {
         return reader.ReadSingle();
     }
     else if (memberT == typeof(double))
     {
         return reader.ReadDouble();
     }
     else if (memberT == typeof(short))
     {
         return reader.ReadInt16();
     }
     else if (memberT == typeof(ushort))
     {
         return reader.ReadUInt16();
     }
     else if (memberT == typeof(long))
     {
         return reader.ReadInt64();
     }
     else if (memberT == typeof(ulong))
     {
         return reader.ReadUInt64();
     }
     else if (memberT == typeof(string))
     {
         return reader.ReadString();
     }
     else if (memberT == typeof(byte[]))
     {
         return ProtoReader.AppendBytes(null, reader);
     }
     else if (memberT == typeof(SInstance))
     {
         SubItemToken st = ProtoReader.StartSubItem(reader);
         CLS_Type_Class sClass = environment.GetTypeByKeywordQuiet(sClassName) as CLS_Type_Class;
         if (!sClass.compiled)
             RuntimeCompilerClass(sClassName);
         CLS_Content content = CLS_Content.NewContent(environment);
         CLS_Content.Value retVal = sClass.function.New(content, m_emptyParams);
         CLS_Content.PoolContent(content);
         SInstance sInstance = (SInstance)retVal.value;
         ReadSInstance(reader, sInstance, environment);
         ProtoReader.EndSubItem(st, reader);
         return sInstance;
     }
     else
     {
         throw new NotImplementedException("未实现类型: " + memberT);
     }
 }
开发者ID:wpszz,项目名称:CSLightForUnity,代码行数:73,代码来源:CSLightMng_ProtoBuf.cs

示例4: Read

        /// <summary>
        /// The read.
        /// </summary>
        /// <param name="mxMessage">
        /// The mx message.
        /// </param>
        /// <param name="protoReader">
        /// The proto reader.
        /// </param>
        /// <returns>
        /// The <see cref="MxMessage"/>.
        /// </returns>
        private static MxMessage Read(MxMessage mxMessage, ProtoReader protoReader)
        {
            int num;
            while ((num = protoReader.ReadFieldHeader()) > 0)
            {
                if (num != 1)
                {
                    if (num != 2)
                    {
                        if (num != 3)
                        {
                            if (num != 4)
                            {
                                if (num != 6)
                                {
                                    if (mxMessage == null)
                                    {
                                        var expr_170 = new MxMessage();
                                        ProtoReader.NoteObject(expr_170, protoReader);
                                        mxMessage = expr_170;
                                    }

                                    protoReader.SkipField();
                                }
                                else
                                {
                                    if (mxMessage == null)
                                    {
                                        var expr_D9 = new MxMessage();
                                        ProtoReader.NoteObject(expr_D9, protoReader);
                                        mxMessage = expr_D9;
                                    }

                                    MxPayload[] payloads = mxMessage.Payloads;
                                    var list = new List<MxPayload>();
                                    int num2 = protoReader.FieldNumber;
                                    do
                                    {
                                        List<MxPayload> arg_111_0 = list;
                                        MxPayload arg_104_0 = null;
                                        SubItemToken token = ProtoReader.StartSubItem(protoReader);
                                        MxPayload arg_111_1 = Read(arg_104_0, protoReader);
                                        ProtoReader.EndSubItem(token, protoReader);
                                        arg_111_0.Add(arg_111_1);
                                    }
                                    while (protoReader.TryReadFieldHeader(num2));
                                    MxPayload[] expr_124 = payloads;
                                    var array =
                                        new MxPayload[(num2 = (expr_124 != null) ? expr_124.Length : 0) + list.Count];
                                    if (num2 != 0)
                                    {
                                        payloads.CopyTo(array, 0);
                                    }

                                    list.CopyTo(array, num2);
                                    array = array;
                                    if (array != null)
                                    {
                                        mxMessage.Payloads = array;
                                    }
                                }
                            }
                            else
                            {
                                if (mxMessage == null)
                                {
                                    var expr_A9 = new MxMessage();
                                    ProtoReader.NoteObject(expr_A9, protoReader);
                                    mxMessage = expr_A9;
                                }

                                uint num3 = protoReader.ReadUInt32();
                                mxMessage.AckBitfield = num3;
                            }
                        }
                        else
                        {
                            if (mxMessage == null)
                            {
                                var expr_79 = new MxMessage();
                                ProtoReader.NoteObject(expr_79, protoReader);
                                mxMessage = expr_79;
                            }

                            uint num3 = protoReader.ReadUInt32();
                            mxMessage.Ack = num3;
                        }
                    }
//.........这里部分代码省略.........
开发者ID:johnsonc,项目名称:Protogame,代码行数:101,代码来源:MxMessageSerializer.cs


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