Пример #1
0
        public static GameTimeInfo DeserializeLengthDelimited(Stream stream)
        {
            GameTimeInfo gameTimeInfo = new GameTimeInfo();

            GameTimeInfo.DeserializeLengthDelimited(stream, gameTimeInfo);
            return(gameTimeInfo);
        }
Пример #2
0
 public static GameAccountState Deserialize(Stream stream, GameAccountState instance, long limit)
 {
     while (limit < 0L || stream.Position < limit)
     {
         int num = stream.ReadByte();
         if (num == -1)
         {
             if (limit >= 0L)
             {
                 throw new EndOfStreamException();
             }
             return(instance);
         }
         else if (num != 10)
         {
             if (num != 18)
             {
                 if (num != 26)
                 {
                     Key  key   = ProtocolParser.ReadKey((byte)num, stream);
                     uint field = key.Field;
                     if (field == 0u)
                     {
                         throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                     }
                     ProtocolParser.SkipKey(stream, key);
                 }
                 else if (instance.GameStatus == null)
                 {
                     instance.GameStatus = GameStatus.DeserializeLengthDelimited(stream);
                 }
                 else
                 {
                     GameStatus.DeserializeLengthDelimited(stream, instance.GameStatus);
                 }
             }
             else if (instance.GameTimeInfo == null)
             {
                 instance.GameTimeInfo = GameTimeInfo.DeserializeLengthDelimited(stream);
             }
             else
             {
                 GameTimeInfo.DeserializeLengthDelimited(stream, instance.GameTimeInfo);
             }
         }
         else if (instance.GameLevelInfo == null)
         {
             instance.GameLevelInfo = GameLevelInfo.DeserializeLengthDelimited(stream);
         }
         else
         {
             GameLevelInfo.DeserializeLengthDelimited(stream, instance.GameLevelInfo);
         }
     }
     if (stream.Position == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }