1 // <auto-generated> 2 // Generated by the protocol buffer compiler. DO NOT EDIT! 3 // source: addressbook.proto 4 // </auto-generated> 5 #pragma warning disable 1591, 0612, 3021, 8981 6 #region Designer generated code 7 8 using pb = global::Google.Protobuf; 9 using pbc = global::Google.Protobuf.Collections; 10 using pbr = global::Google.Protobuf.Reflection; 11 using scg = global::System.Collections.Generic; 12 namespace Google.Protobuf.Examples.AddressBook { 13 14 /// <summary>Holder for reflection information generated from addressbook.proto</summary> 15 public static partial class AddressbookReflection { 16 17 #region Descriptor 18 /// <summary>File descriptor for addressbook.proto</summary> 19 public static pbr::FileDescriptor Descriptor { 20 get { return descriptor; } 21 } 22 private static pbr::FileDescriptor descriptor; 23 AddressbookReflection()24 static AddressbookReflection() { 25 byte[] descriptorData = global::System.Convert.FromBase64String( 26 string.Concat( 27 "ChFhZGRyZXNzYm9vay5wcm90bxIIdHV0b3JpYWwaH2dvb2dsZS9wcm90b2J1", 28 "Zi90aW1lc3RhbXAucHJvdG8ihwIKBlBlcnNvbhIMCgRuYW1lGAEgASgJEgoK", 29 "AmlkGAIgASgFEg0KBWVtYWlsGAMgASgJEiwKBnBob25lcxgEIAMoCzIcLnR1", 30 "dG9yaWFsLlBlcnNvbi5QaG9uZU51bWJlchIwCgxsYXN0X3VwZGF0ZWQYBSAB", 31 "KAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wGkcKC1Bob25lTnVtYmVy", 32 "Eg4KBm51bWJlchgBIAEoCRIoCgR0eXBlGAIgASgOMhoudHV0b3JpYWwuUGVy", 33 "c29uLlBob25lVHlwZSIrCglQaG9uZVR5cGUSCgoGTU9CSUxFEAASCAoESE9N", 34 "RRABEggKBFdPUksQAiIvCgtBZGRyZXNzQm9vaxIgCgZwZW9wbGUYASADKAsy", 35 "EC50dXRvcmlhbC5QZXJzb25ClQEKG2NvbS5leGFtcGxlLnR1dG9yaWFsLnBy", 36 "b3Rvc0IRQWRkcmVzc0Jvb2tQcm90b3NQAVo6Z2l0aHViLmNvbS9wcm90b2Nv", 37 "bGJ1ZmZlcnMvcHJvdG9idWYvZXhhbXBsZXMvZ28vdHV0b3JpYWxwYqoCJEdv", 38 "b2dsZS5Qcm90b2J1Zi5FeGFtcGxlcy5BZGRyZXNzQm9va2IGcHJvdG8z")); 39 descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, 40 new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, }, 41 new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { 42 new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person), global::Google.Protobuf.Examples.AddressBook.Person.Parser, new[]{ "Name", "Id", "Email", "Phones", "LastUpdated" }, null, new[]{ typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType) }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber), global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber.Parser, new[]{ "Number", "Type" }, null, null, null, null)}), 43 new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.AddressBook), global::Google.Protobuf.Examples.AddressBook.AddressBook.Parser, new[]{ "People" }, null, null, null, null) 44 })); 45 } 46 #endregion 47 48 } 49 #region Messages 50 /// <summary> 51 /// [START messages] 52 /// </summary> 53 public sealed partial class Person : pb::IMessage<Person> 54 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 55 , pb::IBufferMessage 56 #endif 57 { 58 private static readonly pb::MessageParser<Person> _parser = new pb::MessageParser<Person>(() => new Person()); 59 private pb::UnknownFieldSet _unknownFields; 60 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 61 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] 62 public static pb::MessageParser<Person> Parser { get { return _parser; } } 63 64 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 65 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] 66 public static pbr::MessageDescriptor Descriptor { 67 get { return global::Google.Protobuf.Examples.AddressBook.AddressbookReflection.Descriptor.MessageTypes[0]; } 68 } 69 70 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 71 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] 72 pbr::MessageDescriptor pb::IMessage.Descriptor { 73 get { return Descriptor; } 74 } 75 76 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 77 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] Person()78 public Person() { 79 OnConstruction(); 80 } 81 OnConstruction()82 partial void OnConstruction(); 83 84 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 85 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] Person(Person other)86 public Person(Person other) : this() { 87 name_ = other.name_; 88 id_ = other.id_; 89 email_ = other.email_; 90 phones_ = other.phones_.Clone(); 91 lastUpdated_ = other.lastUpdated_ != null ? other.lastUpdated_.Clone() : null; 92 _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); 93 } 94 95 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 96 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] Clone()97 public Person Clone() { 98 return new Person(this); 99 } 100 101 /// <summary>Field number for the "name" field.</summary> 102 public const int NameFieldNumber = 1; 103 private string name_ = ""; 104 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 105 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] 106 public string Name { 107 get { return name_; } 108 set { 109 name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); 110 } 111 } 112 113 /// <summary>Field number for the "id" field.</summary> 114 public const int IdFieldNumber = 2; 115 private int id_; 116 /// <summary> 117 /// Unique ID number for this person. 118 /// </summary> 119 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 120 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] 121 public int Id { 122 get { return id_; } 123 set { 124 id_ = value; 125 } 126 } 127 128 /// <summary>Field number for the "email" field.</summary> 129 public const int EmailFieldNumber = 3; 130 private string email_ = ""; 131 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 132 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] 133 public string Email { 134 get { return email_; } 135 set { 136 email_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); 137 } 138 } 139 140 /// <summary>Field number for the "phones" field.</summary> 141 public const int PhonesFieldNumber = 4; 142 private static readonly pb::FieldCodec<global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber> _repeated_phones_codec 143 = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber.Parser); 144 private readonly pbc::RepeatedField<global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber> phones_ = new pbc::RepeatedField<global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber>(); 145 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 146 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] 147 public pbc::RepeatedField<global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber> Phones { 148 get { return phones_; } 149 } 150 151 /// <summary>Field number for the "last_updated" field.</summary> 152 public const int LastUpdatedFieldNumber = 5; 153 private global::Google.Protobuf.WellKnownTypes.Timestamp lastUpdated_; 154 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 155 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] 156 public global::Google.Protobuf.WellKnownTypes.Timestamp LastUpdated { 157 get { return lastUpdated_; } 158 set { 159 lastUpdated_ = value; 160 } 161 } 162 163 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 164 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] Equals(object other)165 public override bool Equals(object other) { 166 return Equals(other as Person); 167 } 168 169 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 170 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] Equals(Person other)171 public bool Equals(Person other) { 172 if (ReferenceEquals(other, null)) { 173 return false; 174 } 175 if (ReferenceEquals(other, this)) { 176 return true; 177 } 178 if (Name != other.Name) return false; 179 if (Id != other.Id) return false; 180 if (Email != other.Email) return false; 181 if(!phones_.Equals(other.phones_)) return false; 182 if (!object.Equals(LastUpdated, other.LastUpdated)) return false; 183 return Equals(_unknownFields, other._unknownFields); 184 } 185 186 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 187 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] GetHashCode()188 public override int GetHashCode() { 189 int hash = 1; 190 if (Name.Length != 0) hash ^= Name.GetHashCode(); 191 if (Id != 0) hash ^= Id.GetHashCode(); 192 if (Email.Length != 0) hash ^= Email.GetHashCode(); 193 hash ^= phones_.GetHashCode(); 194 if (lastUpdated_ != null) hash ^= LastUpdated.GetHashCode(); 195 if (_unknownFields != null) { 196 hash ^= _unknownFields.GetHashCode(); 197 } 198 return hash; 199 } 200 201 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 202 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] ToString()203 public override string ToString() { 204 return pb::JsonFormatter.ToDiagnosticString(this); 205 } 206 207 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 208 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] WriteTo(pb::CodedOutputStream output)209 public void WriteTo(pb::CodedOutputStream output) { 210 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 211 output.WriteRawMessage(this); 212 #else 213 if (Name.Length != 0) { 214 output.WriteRawTag(10); 215 output.WriteString(Name); 216 } 217 if (Id != 0) { 218 output.WriteRawTag(16); 219 output.WriteInt32(Id); 220 } 221 if (Email.Length != 0) { 222 output.WriteRawTag(26); 223 output.WriteString(Email); 224 } 225 phones_.WriteTo(output, _repeated_phones_codec); 226 if (lastUpdated_ != null) { 227 output.WriteRawTag(42); 228 output.WriteMessage(LastUpdated); 229 } 230 if (_unknownFields != null) { 231 _unknownFields.WriteTo(output); 232 } 233 #endif 234 } 235 236 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 237 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 238 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] IBufferMessage.InternalWriteTo(ref pb::WriteContext output)239 void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { 240 if (Name.Length != 0) { 241 output.WriteRawTag(10); 242 output.WriteString(Name); 243 } 244 if (Id != 0) { 245 output.WriteRawTag(16); 246 output.WriteInt32(Id); 247 } 248 if (Email.Length != 0) { 249 output.WriteRawTag(26); 250 output.WriteString(Email); 251 } 252 phones_.WriteTo(ref output, _repeated_phones_codec); 253 if (lastUpdated_ != null) { 254 output.WriteRawTag(42); 255 output.WriteMessage(LastUpdated); 256 } 257 if (_unknownFields != null) { 258 _unknownFields.WriteTo(ref output); 259 } 260 } 261 #endif 262 263 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 264 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] CalculateSize()265 public int CalculateSize() { 266 int size = 0; 267 if (Name.Length != 0) { 268 size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); 269 } 270 if (Id != 0) { 271 size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); 272 } 273 if (Email.Length != 0) { 274 size += 1 + pb::CodedOutputStream.ComputeStringSize(Email); 275 } 276 size += phones_.CalculateSize(_repeated_phones_codec); 277 if (lastUpdated_ != null) { 278 size += 1 + pb::CodedOutputStream.ComputeMessageSize(LastUpdated); 279 } 280 if (_unknownFields != null) { 281 size += _unknownFields.CalculateSize(); 282 } 283 return size; 284 } 285 286 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 287 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] MergeFrom(Person other)288 public void MergeFrom(Person other) { 289 if (other == null) { 290 return; 291 } 292 if (other.Name.Length != 0) { 293 Name = other.Name; 294 } 295 if (other.Id != 0) { 296 Id = other.Id; 297 } 298 if (other.Email.Length != 0) { 299 Email = other.Email; 300 } 301 phones_.Add(other.phones_); 302 if (other.lastUpdated_ != null) { 303 if (lastUpdated_ == null) { 304 LastUpdated = new global::Google.Protobuf.WellKnownTypes.Timestamp(); 305 } 306 LastUpdated.MergeFrom(other.LastUpdated); 307 } 308 _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); 309 } 310 311 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 312 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] MergeFrom(pb::CodedInputStream input)313 public void MergeFrom(pb::CodedInputStream input) { 314 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 315 input.ReadRawMessage(this); 316 #else 317 uint tag; 318 while ((tag = input.ReadTag()) != 0) { 319 switch(tag) { 320 default: 321 _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); 322 break; 323 case 10: { 324 Name = input.ReadString(); 325 break; 326 } 327 case 16: { 328 Id = input.ReadInt32(); 329 break; 330 } 331 case 26: { 332 Email = input.ReadString(); 333 break; 334 } 335 case 34: { 336 phones_.AddEntriesFrom(input, _repeated_phones_codec); 337 break; 338 } 339 case 42: { 340 if (lastUpdated_ == null) { 341 LastUpdated = new global::Google.Protobuf.WellKnownTypes.Timestamp(); 342 } 343 input.ReadMessage(LastUpdated); 344 break; 345 } 346 } 347 } 348 #endif 349 } 350 351 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 352 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 353 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] IBufferMessage.InternalMergeFrom(ref pb::ParseContext input)354 void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { 355 uint tag; 356 while ((tag = input.ReadTag()) != 0) { 357 switch(tag) { 358 default: 359 _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); 360 break; 361 case 10: { 362 Name = input.ReadString(); 363 break; 364 } 365 case 16: { 366 Id = input.ReadInt32(); 367 break; 368 } 369 case 26: { 370 Email = input.ReadString(); 371 break; 372 } 373 case 34: { 374 phones_.AddEntriesFrom(ref input, _repeated_phones_codec); 375 break; 376 } 377 case 42: { 378 if (lastUpdated_ == null) { 379 LastUpdated = new global::Google.Protobuf.WellKnownTypes.Timestamp(); 380 } 381 input.ReadMessage(LastUpdated); 382 break; 383 } 384 } 385 } 386 } 387 #endif 388 389 #region Nested types 390 /// <summary>Container for nested types declared in the Person message type.</summary> 391 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 392 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] 393 public static partial class Types { 394 public enum PhoneType { 395 [pbr::OriginalName("MOBILE")] Mobile = 0, 396 [pbr::OriginalName("HOME")] Home = 1, 397 [pbr::OriginalName("WORK")] Work = 2, 398 } 399 400 public sealed partial class PhoneNumber : pb::IMessage<PhoneNumber> 401 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 402 , pb::IBufferMessage 403 #endif 404 { 405 private static readonly pb::MessageParser<PhoneNumber> _parser = new pb::MessageParser<PhoneNumber>(() => new PhoneNumber()); 406 private pb::UnknownFieldSet _unknownFields; 407 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 408 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] 409 public static pb::MessageParser<PhoneNumber> Parser { get { return _parser; } } 410 411 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 412 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] 413 public static pbr::MessageDescriptor Descriptor { 414 get { return global::Google.Protobuf.Examples.AddressBook.Person.Descriptor.NestedTypes[0]; } 415 } 416 417 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 418 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] 419 pbr::MessageDescriptor pb::IMessage.Descriptor { 420 get { return Descriptor; } 421 } 422 423 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 424 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] PhoneNumber()425 public PhoneNumber() { 426 OnConstruction(); 427 } 428 OnConstruction()429 partial void OnConstruction(); 430 431 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 432 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] PhoneNumber(PhoneNumber other)433 public PhoneNumber(PhoneNumber other) : this() { 434 number_ = other.number_; 435 type_ = other.type_; 436 _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); 437 } 438 439 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 440 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] Clone()441 public PhoneNumber Clone() { 442 return new PhoneNumber(this); 443 } 444 445 /// <summary>Field number for the "number" field.</summary> 446 public const int NumberFieldNumber = 1; 447 private string number_ = ""; 448 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 449 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] 450 public string Number { 451 get { return number_; } 452 set { 453 number_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); 454 } 455 } 456 457 /// <summary>Field number for the "type" field.</summary> 458 public const int TypeFieldNumber = 2; 459 private global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType type_ = global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.Mobile; 460 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 461 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] 462 public global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType Type { 463 get { return type_; } 464 set { 465 type_ = value; 466 } 467 } 468 469 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 470 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] Equals(object other)471 public override bool Equals(object other) { 472 return Equals(other as PhoneNumber); 473 } 474 475 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 476 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] Equals(PhoneNumber other)477 public bool Equals(PhoneNumber other) { 478 if (ReferenceEquals(other, null)) { 479 return false; 480 } 481 if (ReferenceEquals(other, this)) { 482 return true; 483 } 484 if (Number != other.Number) return false; 485 if (Type != other.Type) return false; 486 return Equals(_unknownFields, other._unknownFields); 487 } 488 489 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 490 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] GetHashCode()491 public override int GetHashCode() { 492 int hash = 1; 493 if (Number.Length != 0) hash ^= Number.GetHashCode(); 494 if (Type != global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.Mobile) hash ^= Type.GetHashCode(); 495 if (_unknownFields != null) { 496 hash ^= _unknownFields.GetHashCode(); 497 } 498 return hash; 499 } 500 501 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 502 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] ToString()503 public override string ToString() { 504 return pb::JsonFormatter.ToDiagnosticString(this); 505 } 506 507 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 508 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] WriteTo(pb::CodedOutputStream output)509 public void WriteTo(pb::CodedOutputStream output) { 510 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 511 output.WriteRawMessage(this); 512 #else 513 if (Number.Length != 0) { 514 output.WriteRawTag(10); 515 output.WriteString(Number); 516 } 517 if (Type != global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.Mobile) { 518 output.WriteRawTag(16); 519 output.WriteEnum((int) Type); 520 } 521 if (_unknownFields != null) { 522 _unknownFields.WriteTo(output); 523 } 524 #endif 525 } 526 527 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 528 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 529 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] IBufferMessage.InternalWriteTo(ref pb::WriteContext output)530 void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { 531 if (Number.Length != 0) { 532 output.WriteRawTag(10); 533 output.WriteString(Number); 534 } 535 if (Type != global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.Mobile) { 536 output.WriteRawTag(16); 537 output.WriteEnum((int) Type); 538 } 539 if (_unknownFields != null) { 540 _unknownFields.WriteTo(ref output); 541 } 542 } 543 #endif 544 545 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 546 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] CalculateSize()547 public int CalculateSize() { 548 int size = 0; 549 if (Number.Length != 0) { 550 size += 1 + pb::CodedOutputStream.ComputeStringSize(Number); 551 } 552 if (Type != global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.Mobile) { 553 size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type); 554 } 555 if (_unknownFields != null) { 556 size += _unknownFields.CalculateSize(); 557 } 558 return size; 559 } 560 561 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 562 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] MergeFrom(PhoneNumber other)563 public void MergeFrom(PhoneNumber other) { 564 if (other == null) { 565 return; 566 } 567 if (other.Number.Length != 0) { 568 Number = other.Number; 569 } 570 if (other.Type != global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.Mobile) { 571 Type = other.Type; 572 } 573 _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); 574 } 575 576 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 577 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] MergeFrom(pb::CodedInputStream input)578 public void MergeFrom(pb::CodedInputStream input) { 579 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 580 input.ReadRawMessage(this); 581 #else 582 uint tag; 583 while ((tag = input.ReadTag()) != 0) { 584 switch(tag) { 585 default: 586 _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); 587 break; 588 case 10: { 589 Number = input.ReadString(); 590 break; 591 } 592 case 16: { 593 Type = (global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType) input.ReadEnum(); 594 break; 595 } 596 } 597 } 598 #endif 599 } 600 601 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 602 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 603 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] IBufferMessage.InternalMergeFrom(ref pb::ParseContext input)604 void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { 605 uint tag; 606 while ((tag = input.ReadTag()) != 0) { 607 switch(tag) { 608 default: 609 _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); 610 break; 611 case 10: { 612 Number = input.ReadString(); 613 break; 614 } 615 case 16: { 616 Type = (global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType) input.ReadEnum(); 617 break; 618 } 619 } 620 } 621 } 622 #endif 623 624 } 625 626 } 627 #endregion 628 629 } 630 631 /// <summary> 632 /// Our address book file is just one of these. 633 /// </summary> 634 public sealed partial class AddressBook : pb::IMessage<AddressBook> 635 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 636 , pb::IBufferMessage 637 #endif 638 { 639 private static readonly pb::MessageParser<AddressBook> _parser = new pb::MessageParser<AddressBook>(() => new AddressBook()); 640 private pb::UnknownFieldSet _unknownFields; 641 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 642 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] 643 public static pb::MessageParser<AddressBook> Parser { get { return _parser; } } 644 645 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 646 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] 647 public static pbr::MessageDescriptor Descriptor { 648 get { return global::Google.Protobuf.Examples.AddressBook.AddressbookReflection.Descriptor.MessageTypes[1]; } 649 } 650 651 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 652 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] 653 pbr::MessageDescriptor pb::IMessage.Descriptor { 654 get { return Descriptor; } 655 } 656 657 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 658 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] AddressBook()659 public AddressBook() { 660 OnConstruction(); 661 } 662 OnConstruction()663 partial void OnConstruction(); 664 665 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 666 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] AddressBook(AddressBook other)667 public AddressBook(AddressBook other) : this() { 668 people_ = other.people_.Clone(); 669 _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); 670 } 671 672 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 673 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] Clone()674 public AddressBook Clone() { 675 return new AddressBook(this); 676 } 677 678 /// <summary>Field number for the "people" field.</summary> 679 public const int PeopleFieldNumber = 1; 680 private static readonly pb::FieldCodec<global::Google.Protobuf.Examples.AddressBook.Person> _repeated_people_codec 681 = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Examples.AddressBook.Person.Parser); 682 private readonly pbc::RepeatedField<global::Google.Protobuf.Examples.AddressBook.Person> people_ = new pbc::RepeatedField<global::Google.Protobuf.Examples.AddressBook.Person>(); 683 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 684 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] 685 public pbc::RepeatedField<global::Google.Protobuf.Examples.AddressBook.Person> People { 686 get { return people_; } 687 } 688 689 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 690 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] Equals(object other)691 public override bool Equals(object other) { 692 return Equals(other as AddressBook); 693 } 694 695 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 696 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] Equals(AddressBook other)697 public bool Equals(AddressBook other) { 698 if (ReferenceEquals(other, null)) { 699 return false; 700 } 701 if (ReferenceEquals(other, this)) { 702 return true; 703 } 704 if(!people_.Equals(other.people_)) return false; 705 return Equals(_unknownFields, other._unknownFields); 706 } 707 708 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 709 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] GetHashCode()710 public override int GetHashCode() { 711 int hash = 1; 712 hash ^= people_.GetHashCode(); 713 if (_unknownFields != null) { 714 hash ^= _unknownFields.GetHashCode(); 715 } 716 return hash; 717 } 718 719 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 720 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] ToString()721 public override string ToString() { 722 return pb::JsonFormatter.ToDiagnosticString(this); 723 } 724 725 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 726 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] WriteTo(pb::CodedOutputStream output)727 public void WriteTo(pb::CodedOutputStream output) { 728 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 729 output.WriteRawMessage(this); 730 #else 731 people_.WriteTo(output, _repeated_people_codec); 732 if (_unknownFields != null) { 733 _unknownFields.WriteTo(output); 734 } 735 #endif 736 } 737 738 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 739 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 740 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] IBufferMessage.InternalWriteTo(ref pb::WriteContext output)741 void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { 742 people_.WriteTo(ref output, _repeated_people_codec); 743 if (_unknownFields != null) { 744 _unknownFields.WriteTo(ref output); 745 } 746 } 747 #endif 748 749 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 750 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] CalculateSize()751 public int CalculateSize() { 752 int size = 0; 753 size += people_.CalculateSize(_repeated_people_codec); 754 if (_unknownFields != null) { 755 size += _unknownFields.CalculateSize(); 756 } 757 return size; 758 } 759 760 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 761 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] MergeFrom(AddressBook other)762 public void MergeFrom(AddressBook other) { 763 if (other == null) { 764 return; 765 } 766 people_.Add(other.people_); 767 _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); 768 } 769 770 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 771 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] MergeFrom(pb::CodedInputStream input)772 public void MergeFrom(pb::CodedInputStream input) { 773 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 774 input.ReadRawMessage(this); 775 #else 776 uint tag; 777 while ((tag = input.ReadTag()) != 0) { 778 switch(tag) { 779 default: 780 _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); 781 break; 782 case 10: { 783 people_.AddEntriesFrom(input, _repeated_people_codec); 784 break; 785 } 786 } 787 } 788 #endif 789 } 790 791 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 792 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 793 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] IBufferMessage.InternalMergeFrom(ref pb::ParseContext input)794 void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { 795 uint tag; 796 while ((tag = input.ReadTag()) != 0) { 797 switch(tag) { 798 default: 799 _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); 800 break; 801 case 10: { 802 people_.AddEntriesFrom(ref input, _repeated_people_codec); 803 break; 804 } 805 } 806 } 807 } 808 #endif 809 810 } 811 812 #endregion 813 814 } 815 816 #endregion Designer generated code 817