Example #1
0
 public MDependency(string ID, MDependencyType Type, MVersion MinVersion, MVersion MaxVersion) : this()
 {
     this.ID         = ID;
     this.Type       = Type;
     this.MinVersion = MinVersion;
     this.MaxVersion = MaxVersion;
 }
Example #2
0
        public void Read(TProtocol iprot)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                bool   isset_ID         = false;
                bool   isset_Type       = false;
                bool   isset_MinVersion = false;
                bool   isset_MaxVersion = false;
                TField field;
                iprot.ReadStructBegin();
                while (true)
                {
                    field = iprot.ReadFieldBegin();
                    if (field.Type == TType.Stop)
                    {
                        break;
                    }
                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.String)
                        {
                            ID       = iprot.ReadString();
                            isset_ID = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.I32)
                        {
                            Type       = (MDependencyType)iprot.ReadI32();
                            isset_Type = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.Struct)
                        {
                            MinVersion = new MVersion();
                            MinVersion.Read(iprot);
                            isset_MinVersion = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 4:
                        if (field.Type == TType.Struct)
                        {
                            MaxVersion = new MVersion();
                            MaxVersion.Read(iprot);
                            isset_MaxVersion = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 5:
                        if (field.Type == TType.List)
                        {
                            {
                                ExcludedVersions = new List <MVersion>();
                                TList _list37 = iprot.ReadListBegin();
                                for (int _i38 = 0; _i38 < _list37.Count; ++_i38)
                                {
                                    MVersion _elem39;
                                    _elem39 = new MVersion();
                                    _elem39.Read(iprot);
                                    ExcludedVersions.Add(_elem39);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

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

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
                if (!isset_ID)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "required field ID not set");
                }
                if (!isset_Type)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "required field Type not set");
                }
                if (!isset_MinVersion)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "required field MinVersion not set");
                }
                if (!isset_MaxVersion)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "required field MaxVersion not set");
                }
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }