public override object Decode(ProtocolBuffer protocolBuffer) { int count = LengthCodecHelper.DecodeLength(protocolBuffer.Reader); byte[] bytes = protocolBuffer.Reader.ReadBytes(count); return(Encoding.GetString(bytes)); }
public object Decode(ProtocolBuffer protocolBuffer) { IList list = (IList)Activator.CreateInstance(this.type); int num = LengthCodecHelper.DecodeLength(protocolBuffer.Reader); if (num > 0) { for (int i = 0; i < num; i++) { object obj2 = this.elementCodec.Decode(protocolBuffer); list.Add(obj2); } } return(list); }
public object Decode(ProtocolBuffer protocolBuffer) { int num = LengthCodecHelper.DecodeLength(protocolBuffer.Reader); IDictionary dictionary = (IDictionary)Activator.CreateInstance(this.type, (object[])null); if (num > 0) { for (int i = 0; i < num; i++) { object key = this.keyCodec.Decode(protocolBuffer); object obj3 = this.valueCodec.Decode(protocolBuffer); dictionary.Add(key, obj3); } } return(dictionary); }
public object Decode(ProtocolBuffer protocolBuffer) { object obj2 = Activator.CreateInstance(this.type); int num = LengthCodecHelper.DecodeLength(protocolBuffer.Reader); if (num > 0) { for (int i = 0; i < num; i++) { object obj3 = this.elementCodec.Decode(protocolBuffer); object[] parameters = new object[] { obj3 }; this.addMethod.Invoke(obj2, parameters); } } return(obj2); }
public object Decode(ProtocolBuffer protocolBuffer) { object obj3; int index = 0; Array array = null; int length = 0; try { length = LengthCodecHelper.DecodeLength(protocolBuffer.Reader); array = Array.CreateInstance(this.elementType, length); while (true) { if (index >= length) { obj3 = array; break; } object obj2 = this.elementCodec.Decode(protocolBuffer); array.SetValue(obj2, index); index++; } } catch (Exception exception) { StringBuilder builder = new StringBuilder(); for (int i = 0; i <= index; i++) { object obj4 = array.GetValue(i); builder.Append(i); builder.Append(") "); builder.Append(obj4); builder.Append("\n"); } object[] objArray1 = new object[] { "Array decode failed; ElementType: ", this.elementType.Name, " length: ", length, " decodedElements: ", builder }; throw new Exception(string.Concat(objArray1), exception); } return(obj3); }