Example #1
0
        public override string ToString()
        {
            StringBuilder __sb    = new StringBuilder("RequestMsg(");
            bool          __first = true;

            if (Play != null && __isset.Play)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("Play: ");
                __sb.Append(Play == null ? "<null>" : Play.ToString());
            }
            if (Pause != null && __isset.Pause)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("Pause: ");
                __sb.Append(Pause == null ? "<null>" : Pause.ToString());
            }
            if (Stop != null && __isset.Stop)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("Stop: ");
                __sb.Append(Stop == null ? "<null>" : Stop.ToString());
            }
            if (AddPath != null && __isset.AddPath)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("AddPath: ");
                __sb.Append(AddPath == null ? "<null>" : AddPath.ToString());
            }
            if (RemovePath != null && __isset.RemovePath)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("RemovePath: ");
                __sb.Append(RemovePath == null ? "<null>" : RemovePath.ToString());
            }
            if (Query != null && __isset.Query)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("Query: ");
                __sb.Append(Query == null ? "<null>" : Query.ToString());
            }
            __sb.Append(")");
            return(__sb.ToString());
        }
Example #2
0
        public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)
        {
            oprot.IncrementRecursionDepth();
            try
            {
                var struc = new TStruct("RequestMsg");
                await oprot.WriteStructBeginAsync(struc, cancellationToken);

                var field = new TField();
                if (Play != null && __isset.Play)
                {
                    field.Name = "Play";
                    field.Type = TType.Struct;
                    field.ID   = 1;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await Play.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (Pause != null && __isset.Pause)
                {
                    field.Name = "Pause";
                    field.Type = TType.Struct;
                    field.ID   = 2;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await Pause.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (Stop != null && __isset.Stop)
                {
                    field.Name = "Stop";
                    field.Type = TType.Struct;
                    field.ID   = 3;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await Stop.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (AddPath != null && __isset.AddPath)
                {
                    field.Name = "AddPath";
                    field.Type = TType.Struct;
                    field.ID   = 4;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await AddPath.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (RemovePath != null && __isset.RemovePath)
                {
                    field.Name = "RemovePath";
                    field.Type = TType.Struct;
                    field.ID   = 5;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await RemovePath.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (Query != null && __isset.Query)
                {
                    field.Name = "Query";
                    field.Type = TType.Struct;
                    field.ID   = 6;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await Query.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                await oprot.WriteFieldStopAsync(cancellationToken);

                await oprot.WriteStructEndAsync(cancellationToken);
            }
            finally
            {
                oprot.DecrementRecursionDepth();
            }
        }
Example #3
0
 public void Write(TProtocol oprot)
 {
     oprot.IncrementRecursionDepth();
     try
     {
         TStruct struc = new TStruct("RequestMsg");
         oprot.WriteStructBegin(struc);
         TField field = new TField();
         if (Play != null && __isset.Play)
         {
             field.Name = "Play";
             field.Type = TType.Struct;
             field.ID   = 1;
             oprot.WriteFieldBegin(field);
             Play.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (Pause != null && __isset.Pause)
         {
             field.Name = "Pause";
             field.Type = TType.Struct;
             field.ID   = 2;
             oprot.WriteFieldBegin(field);
             Pause.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (Stop != null && __isset.Stop)
         {
             field.Name = "Stop";
             field.Type = TType.Struct;
             field.ID   = 3;
             oprot.WriteFieldBegin(field);
             Stop.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (AddPath != null && __isset.AddPath)
         {
             field.Name = "AddPath";
             field.Type = TType.Struct;
             field.ID   = 4;
             oprot.WriteFieldBegin(field);
             AddPath.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (RemovePath != null && __isset.RemovePath)
         {
             field.Name = "RemovePath";
             field.Type = TType.Struct;
             field.ID   = 5;
             oprot.WriteFieldBegin(field);
             RemovePath.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (Query != null && __isset.Query)
         {
             field.Name = "Query";
             field.Type = TType.Struct;
             field.ID   = 6;
             oprot.WriteFieldBegin(field);
             Query.Write(oprot);
             oprot.WriteFieldEnd();
         }
         oprot.WriteFieldStop();
         oprot.WriteStructEnd();
     }
     finally
     {
         oprot.DecrementRecursionDepth();
     }
 }
Example #4
0
        public static async Task <RequestMsg> ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                RequestMsg retval;
                await iprot.ReadStructBeginAsync(cancellationToken);

                TField field = await iprot.ReadFieldBeginAsync(cancellationToken);

                if (field.Type == TType.Stop)
                {
                    await iprot.ReadFieldEndAsync(cancellationToken);

                    retval = new ___undefined();
                }
                else
                {
                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.Struct)
                        {
                            PlayMsg temp;
                            temp = new PlayMsg();
                            await temp.ReadAsync(iprot, cancellationToken);

                            retval = new Play(temp);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                            retval = new ___undefined();
                        }
                        break;

                    case 2:
                        if (field.Type == TType.Struct)
                        {
                            PauseMsg temp;
                            temp = new PauseMsg();
                            await temp.ReadAsync(iprot, cancellationToken);

                            retval = new Pause(temp);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                            retval = new ___undefined();
                        }
                        break;

                    case 3:
                        if (field.Type == TType.Struct)
                        {
                            StopMsg temp;
                            temp = new StopMsg();
                            await temp.ReadAsync(iprot, cancellationToken);

                            retval = new Stop(temp);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                            retval = new ___undefined();
                        }
                        break;

                    case 4:
                        if (field.Type == TType.Struct)
                        {
                            AddPathMsg temp;
                            temp = new AddPathMsg();
                            await temp.ReadAsync(iprot, cancellationToken);

                            retval = new AddPath(temp);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                            retval = new ___undefined();
                        }
                        break;

                    case 5:
                        if (field.Type == TType.Struct)
                        {
                            RemovePathMsg temp;
                            temp = new RemovePathMsg();
                            await temp.ReadAsync(iprot, cancellationToken);

                            retval = new RemovePath(temp);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                            retval = new ___undefined();
                        }
                        break;

                    case 6:
                        if (field.Type == TType.Struct)
                        {
                            QueryMsg temp;
                            temp = new QueryMsg();
                            await temp.ReadAsync(iprot, cancellationToken);

                            retval = new Query(temp);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                            retval = new ___undefined();
                        }
                        break;

                    default:
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                        retval = new ___undefined();
                        break;
                    }
                    await iprot.ReadFieldEndAsync(cancellationToken);

                    if ((await iprot.ReadFieldBeginAsync(cancellationToken)).Type != TType.Stop)
                    {
                        throw new TProtocolException(TProtocolException.INVALID_DATA);
                    }
                }
                await iprot.ReadStructEndAsync(cancellationToken);

                return(retval);
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }