Пример #1
0
        public void Read(TProtocol iprot)
        {
            TField field;

            iprot.ReadStructBegin();
            while (true)
            {
                field = iprot.ReadFieldBegin();
                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 10:
                    if (field.Type == TType.Double)
                    {
                        Difficulty = iprot.ReadDouble();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 20:
                    if (field.Type == TType.String)
                    {
                        OptionContent = iprot.ReadString();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 30:
                    if (field.Type == TType.List)
                    {
                        {
                            ItemList = new List <ArithmeticItem>();
                            TList _list45 = iprot.ReadListBegin();
                            for (int _i46 = 0; _i46 < _list45.Count; ++_i46)
                            {
                                ArithmeticItem _elem47 = new ArithmeticItem();
                                _elem47 = new ArithmeticItem();
                                _elem47.Read(iprot);
                                ItemList.Add(_elem47);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 10:
         if (field.Type == TType.Double) {
           Difficulty = iprot.ReadDouble();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 20:
         if (field.Type == TType.String) {
           OptionContent = iprot.ReadString();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 30:
         if (field.Type == TType.List) {
           {
             ItemList = new List<ArithmeticItem>();
             TList _list45 = iprot.ReadListBegin();
             for( int _i46 = 0; _i46 < _list45.Count; ++_i46)
             {
               ArithmeticItem _elem47 = new ArithmeticItem();
               _elem47 = new ArithmeticItem();
               _elem47.Read(iprot);
               ItemList.Add(_elem47);
             }
             iprot.ReadListEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }