Example #1
0
        /// <summary>
        /// Adds entries to the map from the given stream.
        /// </summary>
        /// <remarks>
        /// It is assumed that the stream is initially positioned after the tag specified by the codec.
        /// This method will continue reading entries from the stream until the end is reached, or
        /// a different tag is encountered.
        /// </remarks>
        /// <param name="input">Stream to read from</param>
        /// <param name="codec">Codec describing how the key/value pairs are encoded</param>
        public void AddEntriesFrom(CodedInputStream input, Codec codec)
        {
            var adapter = new Codec.MessageAdapter(codec);

            do
            {
                adapter.Reset();
                input.ReadMessage(adapter);
                this[adapter.Key] = adapter.Value;
            } while (input.MaybeConsumeTag(codec.MapTag));
        }
Example #2
0
        public void AddEntriesFrom(CodedInputStream input, FieldCodec <T> codec)
        {
            uint lastTag = input.LastTag;
            Func <CodedInputStream, T> valueReader = codec.ValueReader;

            if (RepeatedField <T> .smethod_1(typeof(T).TypeHandle).IsValueType())
            {
                goto IL_79;
            }
            goto IL_189;
            uint arg_147_0;

            while (true)
            {
IL_142:
                uint num;
                switch ((num = (arg_147_0 ^ 349581016u)) % 13u)
                {
                case 0u:
                    arg_147_0 = ((input.MaybeConsumeTag(lastTag) ? 2792542167u : 2493560502u) ^ num * 4283985340u);
                    continue;

                case 1u:
                    arg_147_0 = (((WireFormat.GetTagWireType(lastTag) == WireFormat.WireType.LengthDelimited) ? 4182580420u : 2445968179u) ^ num * 3573087188u);
                    continue;

                case 2u:
                    arg_147_0 = (num * 2407926176u ^ 627495612u);
                    continue;

                case 3u:
                {
                    int num2;
                    arg_147_0 = (((num2 > 0) ? 704969730u : 1347903514u) ^ num * 2106852334u);
                    continue;
                }

                case 4u:
                {
                    int oldLimit;
                    input.PopLimit(oldLimit);
                    arg_147_0 = (num * 2913868755u ^ 1655185686u);
                    continue;
                }

                case 6u:
                {
                    int num2;
                    int oldLimit = input.PushLimit(num2);
                    arg_147_0 = (num * 3972840873u ^ 320789690u);
                    continue;
                }

                case 7u:
                    goto IL_79;

                case 8u:
                    this.Add(valueReader(input));
                    arg_147_0 = 1293084732u;
                    continue;

                case 9u:
                    arg_147_0 = ((!input.ReachedLimit) ? 862879642u : 1176527045u);
                    continue;

                case 10u:
                    return;

                case 11u:
                    goto IL_189;

                case 12u:
                {
                    int num2 = input.ReadLength();
                    arg_147_0 = (num * 1888486294u ^ 430467554u);
                    continue;
                }
                }
                break;
            }
            return;

IL_79:
            arg_147_0 = 431838837u;
            goto IL_142;
IL_189:
            this.Add(valueReader(input));
            arg_147_0 = 320588544u;
            goto IL_142;
        }