コード例 #1
0
 public WXMessageP.Builder SetAppExtendMessage(WXAppExtendMessageP value)
 {
     ThrowHelper.ThrowIfNull(value, "value");
     this.PrepareBuilder();
     this.result.hasAppExtendMessage = true;
     this.result.appExtendMessage_   = value;
     return(this);
 }
コード例 #2
0
 public WXMessageP.Builder MergeAppExtendMessage(WXAppExtendMessageP value)
 {
     ThrowHelper.ThrowIfNull(value, "value");
     this.PrepareBuilder();
     if (this.result.hasAppExtendMessage && (this.result.appExtendMessage_ != WXAppExtendMessageP.DefaultInstance))
     {
         this.result.appExtendMessage_ = WXAppExtendMessageP.CreateBuilder(this.result.appExtendMessage_).MergeFrom(value).BuildPartial();
     }
     else
     {
         this.result.appExtendMessage_ = value;
     }
     this.result.hasAppExtendMessage = true;
     return(this);
 }
コード例 #3
0
            public override WXMessageP.Builder MergeFrom(ICodedInputStream input, ExtensionRegistry extensionRegistry)
            {
                uint   num;
                string str;

                this.PrepareBuilder();
                while (input.ReadTag(out num, out str))
                {
                    if ((num == 0) && (str != null))
                    {
                        int index = Array.BinarySearch <string>(WXMessageP._wXMessagePFieldNames, str, StringComparer.Ordinal);
                        if (index >= 0)
                        {
                            num = WXMessageP._wXMessagePFieldTags[index];
                        }
                        else
                        {
                            this.ParseUnknownField(input, extensionRegistry, num, str);
                            continue;
                        }
                    }
                    switch (num)
                    {
                    case 0x1a:
                    {
                        this.result.hasDescription = input.ReadString(ref this.result.description_);
                        continue;
                    }

                    case 0x22:
                    {
                        this.result.hasThumbData = input.ReadBytes(ref this.result.thumbData_);
                        continue;
                    }

                    case 0x2a:
                    {
                        WXEmojiMessageP.Builder builder = WXEmojiMessageP.CreateBuilder();
                        if (this.result.hasEmojiMessage)
                        {
                            builder.MergeFrom(this.EmojiMessage);
                        }
                        input.ReadMessage(builder, extensionRegistry);
                        this.EmojiMessage = builder.BuildPartial();
                        continue;
                    }

                    case 0:
                        throw InvalidProtocolBufferException.InvalidTag();

                    case 8:
                    {
                        this.result.hasType = input.ReadUInt32(ref this.result.type_);
                        continue;
                    }

                    case 0x12:
                    {
                        this.result.hasTitle = input.ReadString(ref this.result.title_);
                        continue;
                    }

                    case 50:
                    {
                        WXFileMessageP.Builder builder2 = WXFileMessageP.CreateBuilder();
                        if (this.result.hasFileMessage)
                        {
                            builder2.MergeFrom(this.FileMessage);
                        }
                        input.ReadMessage(builder2, extensionRegistry);
                        this.FileMessage = builder2.BuildPartial();
                        continue;
                    }

                    case 0x3a:
                    {
                        WXImageMessageP.Builder builder3 = WXImageMessageP.CreateBuilder();
                        if (this.result.hasImageMessage)
                        {
                            builder3.MergeFrom(this.ImageMessage);
                        }
                        input.ReadMessage(builder3, extensionRegistry);
                        this.ImageMessage = builder3.BuildPartial();
                        continue;
                    }

                    case 0x42:
                    {
                        WXMusicMessageP.Builder builder4 = WXMusicMessageP.CreateBuilder();
                        if (this.result.hasMusicMessage)
                        {
                            builder4.MergeFrom(this.MusicMessage);
                        }
                        input.ReadMessage(builder4, extensionRegistry);
                        this.MusicMessage = builder4.BuildPartial();
                        continue;
                    }

                    case 0x4a:
                    {
                        WXTextMessageP.Builder builder5 = WXTextMessageP.CreateBuilder();
                        if (this.result.hasTextMessage)
                        {
                            builder5.MergeFrom(this.TextMessage);
                        }
                        input.ReadMessage(builder5, extensionRegistry);
                        this.TextMessage = builder5.BuildPartial();
                        continue;
                    }

                    case 0x52:
                    {
                        WXVideoMessageP.Builder builder6 = WXVideoMessageP.CreateBuilder();
                        if (this.result.hasVideoMessage)
                        {
                            builder6.MergeFrom(this.VideoMessage);
                        }
                        input.ReadMessage(builder6, extensionRegistry);
                        this.VideoMessage = builder6.BuildPartial();
                        continue;
                    }

                    case 90:
                    {
                        WXWebpageMessageP.Builder builder7 = WXWebpageMessageP.CreateBuilder();
                        if (this.result.hasWebpageMessage)
                        {
                            builder7.MergeFrom(this.WebpageMessage);
                        }
                        input.ReadMessage(builder7, extensionRegistry);
                        this.WebpageMessage = builder7.BuildPartial();
                        continue;
                    }

                    case 0x62:
                    {
                        WXAppExtendMessageP.Builder builder8 = WXAppExtendMessageP.CreateBuilder();
                        if (this.result.hasAppExtendMessage)
                        {
                            builder8.MergeFrom(this.AppExtendMessage);
                        }
                        input.ReadMessage(builder8, extensionRegistry);
                        this.AppExtendMessage = builder8.BuildPartial();
                        continue;
                    }
                    }
                    if (WireFormat.IsEndGroupTag(num))
                    {
                        return(this);
                    }
                    this.ParseUnknownField(input, extensionRegistry, num, str);
                }
                return(this);
            }
コード例 #4
0
            public override WXMessageP.Builder MergeFrom(ICodedInputStream input, ExtensionRegistry extensionRegistry)
            {
                this.PrepareBuilder();
                uint   num;
                string text;

                while (input.ReadTag(out num, out text))
                {
                    if (num == 0u && text != null)
                    {
                        int num2 = Array.BinarySearch <string>(WXMessageP._wXMessagePFieldNames, text, StringComparer.Ordinal);
                        if (num2 < 0)
                        {
                            this.ParseUnknownField(input, extensionRegistry, num, text);
                            continue;
                        }
                        num = WXMessageP._wXMessagePFieldTags[num2];
                    }
                    uint num3 = num;
                    if (num3 <= 42u)
                    {
                        if (num3 <= 18u)
                        {
                            if (num3 == 0u)
                            {
                                throw InvalidProtocolBufferException.InvalidTag();
                            }
                            if (num3 == 8u)
                            {
                                this.result.hasType = input.ReadUInt32(ref this.result.type_);
                                continue;
                            }
                            if (num3 == 18u)
                            {
                                this.result.hasTitle = input.ReadString(ref this.result.title_);
                                continue;
                            }
                        }
                        else
                        {
                            if (num3 == 26u)
                            {
                                this.result.hasDescription = input.ReadString(ref this.result.description_);
                                continue;
                            }
                            if (num3 == 34u)
                            {
                                this.result.hasThumbData = input.ReadBytes(ref this.result.thumbData_);
                                continue;
                            }
                            if (num3 == 42u)
                            {
                                WXEmojiMessageP.Builder builder = WXEmojiMessageP.CreateBuilder();
                                if (this.result.hasEmojiMessage)
                                {
                                    builder.MergeFrom(this.EmojiMessage);
                                }
                                input.ReadMessage(builder, extensionRegistry);
                                this.EmojiMessage = builder.BuildPartial();
                                continue;
                            }
                        }
                    }
                    else if (num3 <= 66u)
                    {
                        if (num3 == 50u)
                        {
                            WXFileMessageP.Builder builder2 = WXFileMessageP.CreateBuilder();
                            if (this.result.hasFileMessage)
                            {
                                builder2.MergeFrom(this.FileMessage);
                            }
                            input.ReadMessage(builder2, extensionRegistry);
                            this.FileMessage = builder2.BuildPartial();
                            continue;
                        }
                        if (num3 == 58u)
                        {
                            WXImageMessageP.Builder builder3 = WXImageMessageP.CreateBuilder();
                            if (this.result.hasImageMessage)
                            {
                                builder3.MergeFrom(this.ImageMessage);
                            }
                            input.ReadMessage(builder3, extensionRegistry);
                            this.ImageMessage = builder3.BuildPartial();
                            continue;
                        }
                        if (num3 == 66u)
                        {
                            WXMusicMessageP.Builder builder4 = WXMusicMessageP.CreateBuilder();
                            if (this.result.hasMusicMessage)
                            {
                                builder4.MergeFrom(this.MusicMessage);
                            }
                            input.ReadMessage(builder4, extensionRegistry);
                            this.MusicMessage = builder4.BuildPartial();
                            continue;
                        }
                    }
                    else if (num3 <= 82u)
                    {
                        if (num3 == 74u)
                        {
                            WXTextMessageP.Builder builder5 = WXTextMessageP.CreateBuilder();
                            if (this.result.hasTextMessage)
                            {
                                builder5.MergeFrom(this.TextMessage);
                            }
                            input.ReadMessage(builder5, extensionRegistry);
                            this.TextMessage = builder5.BuildPartial();
                            continue;
                        }
                        if (num3 == 82u)
                        {
                            WXVideoMessageP.Builder builder6 = WXVideoMessageP.CreateBuilder();
                            if (this.result.hasVideoMessage)
                            {
                                builder6.MergeFrom(this.VideoMessage);
                            }
                            input.ReadMessage(builder6, extensionRegistry);
                            this.VideoMessage = builder6.BuildPartial();
                            continue;
                        }
                    }
                    else
                    {
                        if (num3 == 90u)
                        {
                            WXWebpageMessageP.Builder builder7 = WXWebpageMessageP.CreateBuilder();
                            if (this.result.hasWebpageMessage)
                            {
                                builder7.MergeFrom(this.WebpageMessage);
                            }
                            input.ReadMessage(builder7, extensionRegistry);
                            this.WebpageMessage = builder7.BuildPartial();
                            continue;
                        }
                        if (num3 == 98u)
                        {
                            WXAppExtendMessageP.Builder builder8 = WXAppExtendMessageP.CreateBuilder();
                            if (this.result.hasAppExtendMessage)
                            {
                                builder8.MergeFrom(this.AppExtendMessage);
                            }
                            input.ReadMessage(builder8, extensionRegistry);
                            this.AppExtendMessage = builder8.BuildPartial();
                            continue;
                        }
                    }
                    if (WireFormat.IsEndGroupTag(num))
                    {
                        return(this);
                    }
                    this.ParseUnknownField(input, extensionRegistry, num, text);
                }
                return(this);
            }