Addressbook.cs 26 KB

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