| OLD | NEW |
| (Empty) |
| 1 // Generated by the protocol buffer compiler. DO NOT EDIT! | |
| 2 // source: addressbook.proto | |
| 3 #pragma warning disable 1591, 0612, 3021 | |
| 4 #region Designer generated code | |
| 5 | |
| 6 using pb = global::Google.Protobuf; | |
| 7 using pbc = global::Google.Protobuf.Collections; | |
| 8 using pbr = global::Google.Protobuf.Reflection; | |
| 9 using scg = global::System.Collections.Generic; | |
| 10 namespace Google.Protobuf.Examples.AddressBook { | |
| 11 | |
| 12 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] | |
| 13 public static partial class Addressbook { | |
| 14 | |
| 15 #region Descriptor | |
| 16 public static pbr::FileDescriptor Descriptor { | |
| 17 get { return descriptor; } | |
| 18 } | |
| 19 private static pbr::FileDescriptor descriptor; | |
| 20 | |
| 21 static Addressbook() { | |
| 22 byte[] descriptorData = global::System.Convert.FromBase64String( | |
| 23 string.Concat( | |
| 24 "ChFhZGRyZXNzYm9vay5wcm90bxIIdHV0b3JpYWwi1QEKBlBlcnNvbhIMCgRu", | |
| 25 "YW1lGAEgASgJEgoKAmlkGAIgASgFEg0KBWVtYWlsGAMgASgJEiwKBnBob25l", | |
| 26 "cxgEIAMoCzIcLnR1dG9yaWFsLlBlcnNvbi5QaG9uZU51bWJlchpHCgtQaG9u", | |
| 27 "ZU51bWJlchIOCgZudW1iZXIYASABKAkSKAoEdHlwZRgCIAEoDjIaLnR1dG9y", | |
| 28 "aWFsLlBlcnNvbi5QaG9uZVR5cGUiKwoJUGhvbmVUeXBlEgoKBk1PQklMRRAA", | |
| 29 "EggKBEhPTUUQARIICgRXT1JLEAIiLwoLQWRkcmVzc0Jvb2sSIAoGcGVvcGxl", | |
| 30 "GAEgAygLMhAudHV0b3JpYWwuUGVyc29uQlAKFGNvbS5leGFtcGxlLnR1dG9y", | |
| 31 "aWFsQhFBZGRyZXNzQm9va1Byb3Rvc6oCJEdvb2dsZS5Qcm90b2J1Zi5FeGFt", | |
| 32 "cGxlcy5BZGRyZXNzQm9va2IGcHJvdG8z")); | |
| 33 descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptor
Data, | |
| 34 new pbr::FileDescriptor[] { }, | |
| 35 new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] { | |
| 36 new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.Examples.A
ddressBook.Person), new[]{ "Name", "Id", "Email", "Phones" }, null, new[]{ typeo
f(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType) }, new pb
r::GeneratedCodeInfo[] { new pbr::GeneratedCodeInfo(typeof(global::Google.Protob
uf.Examples.AddressBook.Person.Types.PhoneNumber), new[]{ "Number", "Type" }, nu
ll, null, null)}), | |
| 37 new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.Examples.A
ddressBook.AddressBook), new[]{ "People" }, null, null, null) | |
| 38 })); | |
| 39 } | |
| 40 #endregion | |
| 41 | |
| 42 } | |
| 43 #region Messages | |
| 44 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] | |
| 45 public sealed partial class Person : pb::IMessage<Person> { | |
| 46 private static readonly pb::MessageParser<Person> _parser = new pb::MessageP
arser<Person>(() => new Person()); | |
| 47 public static pb::MessageParser<Person> Parser { get { return _parser; } } | |
| 48 | |
| 49 public static pbr::MessageDescriptor Descriptor { | |
| 50 get { return global::Google.Protobuf.Examples.AddressBook.Addressbook.Desc
riptor.MessageTypes[0]; } | |
| 51 } | |
| 52 | |
| 53 pbr::MessageDescriptor pb::IMessage.Descriptor { | |
| 54 get { return Descriptor; } | |
| 55 } | |
| 56 | |
| 57 public Person() { | |
| 58 OnConstruction(); | |
| 59 } | |
| 60 | |
| 61 partial void OnConstruction(); | |
| 62 | |
| 63 public Person(Person other) : this() { | |
| 64 name_ = other.name_; | |
| 65 id_ = other.id_; | |
| 66 email_ = other.email_; | |
| 67 phones_ = other.phones_.Clone(); | |
| 68 } | |
| 69 | |
| 70 public Person Clone() { | |
| 71 return new Person(this); | |
| 72 } | |
| 73 | |
| 74 public const int NameFieldNumber = 1; | |
| 75 private string name_ = ""; | |
| 76 public string Name { | |
| 77 get { return name_; } | |
| 78 set { | |
| 79 name_ = pb::Preconditions.CheckNotNull(value, "value"); | |
| 80 } | |
| 81 } | |
| 82 | |
| 83 public const int IdFieldNumber = 2; | |
| 84 private int id_; | |
| 85 public int Id { | |
| 86 get { return id_; } | |
| 87 set { | |
| 88 id_ = value; | |
| 89 } | |
| 90 } | |
| 91 | |
| 92 public const int EmailFieldNumber = 3; | |
| 93 private string email_ = ""; | |
| 94 public string Email { | |
| 95 get { return email_; } | |
| 96 set { | |
| 97 email_ = pb::Preconditions.CheckNotNull(value, "value"); | |
| 98 } | |
| 99 } | |
| 100 | |
| 101 public const int PhonesFieldNumber = 4; | |
| 102 private static readonly pb::FieldCodec<global::Google.Protobuf.Examples.Addr
essBook.Person.Types.PhoneNumber> _repeated_phones_codec | |
| 103 = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.Examples.Address
Book.Person.Types.PhoneNumber.Parser); | |
| 104 private readonly pbc::RepeatedField<global::Google.Protobuf.Examples.Address
Book.Person.Types.PhoneNumber> phones_ = new pbc::RepeatedField<global::Google.P
rotobuf.Examples.AddressBook.Person.Types.PhoneNumber>(); | |
| 105 public pbc::RepeatedField<global::Google.Protobuf.Examples.AddressBook.Perso
n.Types.PhoneNumber> Phones { | |
| 106 get { return phones_; } | |
| 107 } | |
| 108 | |
| 109 public override bool Equals(object other) { | |
| 110 return Equals(other as Person); | |
| 111 } | |
| 112 | |
| 113 public bool Equals(Person other) { | |
| 114 if (ReferenceEquals(other, null)) { | |
| 115 return false; | |
| 116 } | |
| 117 if (ReferenceEquals(other, this)) { | |
| 118 return true; | |
| 119 } | |
| 120 if (Name != other.Name) return false; | |
| 121 if (Id != other.Id) return false; | |
| 122 if (Email != other.Email) return false; | |
| 123 if(!phones_.Equals(other.phones_)) return false; | |
| 124 return true; | |
| 125 } | |
| 126 | |
| 127 public override int GetHashCode() { | |
| 128 int hash = 1; | |
| 129 if (Name.Length != 0) hash ^= Name.GetHashCode(); | |
| 130 if (Id != 0) hash ^= Id.GetHashCode(); | |
| 131 if (Email.Length != 0) hash ^= Email.GetHashCode(); | |
| 132 hash ^= phones_.GetHashCode(); | |
| 133 return hash; | |
| 134 } | |
| 135 | |
| 136 public override string ToString() { | |
| 137 return pb::JsonFormatter.Default.Format(this); | |
| 138 } | |
| 139 | |
| 140 public void WriteTo(pb::CodedOutputStream output) { | |
| 141 if (Name.Length != 0) { | |
| 142 output.WriteRawTag(10); | |
| 143 output.WriteString(Name); | |
| 144 } | |
| 145 if (Id != 0) { | |
| 146 output.WriteRawTag(16); | |
| 147 output.WriteInt32(Id); | |
| 148 } | |
| 149 if (Email.Length != 0) { | |
| 150 output.WriteRawTag(26); | |
| 151 output.WriteString(Email); | |
| 152 } | |
| 153 phones_.WriteTo(output, _repeated_phones_codec); | |
| 154 } | |
| 155 | |
| 156 public int CalculateSize() { | |
| 157 int size = 0; | |
| 158 if (Name.Length != 0) { | |
| 159 size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); | |
| 160 } | |
| 161 if (Id != 0) { | |
| 162 size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); | |
| 163 } | |
| 164 if (Email.Length != 0) { | |
| 165 size += 1 + pb::CodedOutputStream.ComputeStringSize(Email); | |
| 166 } | |
| 167 size += phones_.CalculateSize(_repeated_phones_codec); | |
| 168 return size; | |
| 169 } | |
| 170 | |
| 171 public void MergeFrom(Person other) { | |
| 172 if (other == null) { | |
| 173 return; | |
| 174 } | |
| 175 if (other.Name.Length != 0) { | |
| 176 Name = other.Name; | |
| 177 } | |
| 178 if (other.Id != 0) { | |
| 179 Id = other.Id; | |
| 180 } | |
| 181 if (other.Email.Length != 0) { | |
| 182 Email = other.Email; | |
| 183 } | |
| 184 phones_.Add(other.phones_); | |
| 185 } | |
| 186 | |
| 187 public void MergeFrom(pb::CodedInputStream input) { | |
| 188 uint tag; | |
| 189 while ((tag = input.ReadTag()) != 0) { | |
| 190 switch(tag) { | |
| 191 default: | |
| 192 input.SkipLastField(); | |
| 193 break; | |
| 194 case 10: { | |
| 195 Name = input.ReadString(); | |
| 196 break; | |
| 197 } | |
| 198 case 16: { | |
| 199 Id = input.ReadInt32(); | |
| 200 break; | |
| 201 } | |
| 202 case 26: { | |
| 203 Email = input.ReadString(); | |
| 204 break; | |
| 205 } | |
| 206 case 34: { | |
| 207 phones_.AddEntriesFrom(input, _repeated_phones_codec); | |
| 208 break; | |
| 209 } | |
| 210 } | |
| 211 } | |
| 212 } | |
| 213 | |
| 214 #region Nested types | |
| 215 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] | |
| 216 public static partial class Types { | |
| 217 public enum PhoneType { | |
| 218 MOBILE = 0, | |
| 219 HOME = 1, | |
| 220 WORK = 2, | |
| 221 } | |
| 222 | |
| 223 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] | |
| 224 public sealed partial class PhoneNumber : pb::IMessage<PhoneNumber> { | |
| 225 private static readonly pb::MessageParser<PhoneNumber> _parser = new pb:
:MessageParser<PhoneNumber>(() => new PhoneNumber()); | |
| 226 public static pb::MessageParser<PhoneNumber> Parser { get { return _pars
er; } } | |
| 227 | |
| 228 public static pbr::MessageDescriptor Descriptor { | |
| 229 get { return global::Google.Protobuf.Examples.AddressBook.Person.Descr
iptor.NestedTypes[0]; } | |
| 230 } | |
| 231 | |
| 232 pbr::MessageDescriptor pb::IMessage.Descriptor { | |
| 233 get { return Descriptor; } | |
| 234 } | |
| 235 | |
| 236 public PhoneNumber() { | |
| 237 OnConstruction(); | |
| 238 } | |
| 239 | |
| 240 partial void OnConstruction(); | |
| 241 | |
| 242 public PhoneNumber(PhoneNumber other) : this() { | |
| 243 number_ = other.number_; | |
| 244 type_ = other.type_; | |
| 245 } | |
| 246 | |
| 247 public PhoneNumber Clone() { | |
| 248 return new PhoneNumber(this); | |
| 249 } | |
| 250 | |
| 251 public const int NumberFieldNumber = 1; | |
| 252 private string number_ = ""; | |
| 253 public string Number { | |
| 254 get { return number_; } | |
| 255 set { | |
| 256 number_ = pb::Preconditions.CheckNotNull(value, "value"); | |
| 257 } | |
| 258 } | |
| 259 | |
| 260 public const int TypeFieldNumber = 2; | |
| 261 private global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneT
ype type_ = global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.
MOBILE; | |
| 262 public global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneTy
pe Type { | |
| 263 get { return type_; } | |
| 264 set { | |
| 265 type_ = value; | |
| 266 } | |
| 267 } | |
| 268 | |
| 269 public override bool Equals(object other) { | |
| 270 return Equals(other as PhoneNumber); | |
| 271 } | |
| 272 | |
| 273 public bool Equals(PhoneNumber other) { | |
| 274 if (ReferenceEquals(other, null)) { | |
| 275 return false; | |
| 276 } | |
| 277 if (ReferenceEquals(other, this)) { | |
| 278 return true; | |
| 279 } | |
| 280 if (Number != other.Number) return false; | |
| 281 if (Type != other.Type) return false; | |
| 282 return true; | |
| 283 } | |
| 284 | |
| 285 public override int GetHashCode() { | |
| 286 int hash = 1; | |
| 287 if (Number.Length != 0) hash ^= Number.GetHashCode(); | |
| 288 if (Type != global::Google.Protobuf.Examples.AddressBook.Person.Types.
PhoneType.MOBILE) hash ^= Type.GetHashCode(); | |
| 289 return hash; | |
| 290 } | |
| 291 | |
| 292 public override string ToString() { | |
| 293 return pb::JsonFormatter.Default.Format(this); | |
| 294 } | |
| 295 | |
| 296 public void WriteTo(pb::CodedOutputStream output) { | |
| 297 if (Number.Length != 0) { | |
| 298 output.WriteRawTag(10); | |
| 299 output.WriteString(Number); | |
| 300 } | |
| 301 if (Type != global::Google.Protobuf.Examples.AddressBook.Person.Types.
PhoneType.MOBILE) { | |
| 302 output.WriteRawTag(16); | |
| 303 output.WriteEnum((int) Type); | |
| 304 } | |
| 305 } | |
| 306 | |
| 307 public int CalculateSize() { | |
| 308 int size = 0; | |
| 309 if (Number.Length != 0) { | |
| 310 size += 1 + pb::CodedOutputStream.ComputeStringSize(Number); | |
| 311 } | |
| 312 if (Type != global::Google.Protobuf.Examples.AddressBook.Person.Types.
PhoneType.MOBILE) { | |
| 313 size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type); | |
| 314 } | |
| 315 return size; | |
| 316 } | |
| 317 | |
| 318 public void MergeFrom(PhoneNumber other) { | |
| 319 if (other == null) { | |
| 320 return; | |
| 321 } | |
| 322 if (other.Number.Length != 0) { | |
| 323 Number = other.Number; | |
| 324 } | |
| 325 if (other.Type != global::Google.Protobuf.Examples.AddressBook.Person.
Types.PhoneType.MOBILE) { | |
| 326 Type = other.Type; | |
| 327 } | |
| 328 } | |
| 329 | |
| 330 public void MergeFrom(pb::CodedInputStream input) { | |
| 331 uint tag; | |
| 332 while ((tag = input.ReadTag()) != 0) { | |
| 333 switch(tag) { | |
| 334 default: | |
| 335 input.SkipLastField(); | |
| 336 break; | |
| 337 case 10: { | |
| 338 Number = input.ReadString(); | |
| 339 break; | |
| 340 } | |
| 341 case 16: { | |
| 342 type_ = (global::Google.Protobuf.Examples.AddressBook.Person.Typ
es.PhoneType) input.ReadEnum(); | |
| 343 break; | |
| 344 } | |
| 345 } | |
| 346 } | |
| 347 } | |
| 348 | |
| 349 } | |
| 350 | |
| 351 } | |
| 352 #endregion | |
| 353 | |
| 354 } | |
| 355 | |
| 356 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] | |
| 357 public sealed partial class AddressBook : pb::IMessage<AddressBook> { | |
| 358 private static readonly pb::MessageParser<AddressBook> _parser = new pb::Mes
sageParser<AddressBook>(() => new AddressBook()); | |
| 359 public static pb::MessageParser<AddressBook> Parser { get { return _parser;
} } | |
| 360 | |
| 361 public static pbr::MessageDescriptor Descriptor { | |
| 362 get { return global::Google.Protobuf.Examples.AddressBook.Addressbook.Desc
riptor.MessageTypes[1]; } | |
| 363 } | |
| 364 | |
| 365 pbr::MessageDescriptor pb::IMessage.Descriptor { | |
| 366 get { return Descriptor; } | |
| 367 } | |
| 368 | |
| 369 public AddressBook() { | |
| 370 OnConstruction(); | |
| 371 } | |
| 372 | |
| 373 partial void OnConstruction(); | |
| 374 | |
| 375 public AddressBook(AddressBook other) : this() { | |
| 376 people_ = other.people_.Clone(); | |
| 377 } | |
| 378 | |
| 379 public AddressBook Clone() { | |
| 380 return new AddressBook(this); | |
| 381 } | |
| 382 | |
| 383 public const int PeopleFieldNumber = 1; | |
| 384 private static readonly pb::FieldCodec<global::Google.Protobuf.Examples.Addr
essBook.Person> _repeated_people_codec | |
| 385 = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Examples.Address
Book.Person.Parser); | |
| 386 private readonly pbc::RepeatedField<global::Google.Protobuf.Examples.Address
Book.Person> people_ = new pbc::RepeatedField<global::Google.Protobuf.Examples.A
ddressBook.Person>(); | |
| 387 public pbc::RepeatedField<global::Google.Protobuf.Examples.AddressBook.Perso
n> People { | |
| 388 get { return people_; } | |
| 389 } | |
| 390 | |
| 391 public override bool Equals(object other) { | |
| 392 return Equals(other as AddressBook); | |
| 393 } | |
| 394 | |
| 395 public bool Equals(AddressBook other) { | |
| 396 if (ReferenceEquals(other, null)) { | |
| 397 return false; | |
| 398 } | |
| 399 if (ReferenceEquals(other, this)) { | |
| 400 return true; | |
| 401 } | |
| 402 if(!people_.Equals(other.people_)) return false; | |
| 403 return true; | |
| 404 } | |
| 405 | |
| 406 public override int GetHashCode() { | |
| 407 int hash = 1; | |
| 408 hash ^= people_.GetHashCode(); | |
| 409 return hash; | |
| 410 } | |
| 411 | |
| 412 public override string ToString() { | |
| 413 return pb::JsonFormatter.Default.Format(this); | |
| 414 } | |
| 415 | |
| 416 public void WriteTo(pb::CodedOutputStream output) { | |
| 417 people_.WriteTo(output, _repeated_people_codec); | |
| 418 } | |
| 419 | |
| 420 public int CalculateSize() { | |
| 421 int size = 0; | |
| 422 size += people_.CalculateSize(_repeated_people_codec); | |
| 423 return size; | |
| 424 } | |
| 425 | |
| 426 public void MergeFrom(AddressBook other) { | |
| 427 if (other == null) { | |
| 428 return; | |
| 429 } | |
| 430 people_.Add(other.people_); | |
| 431 } | |
| 432 | |
| 433 public void MergeFrom(pb::CodedInputStream input) { | |
| 434 uint tag; | |
| 435 while ((tag = input.ReadTag()) != 0) { | |
| 436 switch(tag) { | |
| 437 default: | |
| 438 input.SkipLastField(); | |
| 439 break; | |
| 440 case 10: { | |
| 441 people_.AddEntriesFrom(input, _repeated_people_codec); | |
| 442 break; | |
| 443 } | |
| 444 } | |
| 445 } | |
| 446 } | |
| 447 | |
| 448 } | |
| 449 | |
| 450 #endregion | |
| 451 | |
| 452 } | |
| 453 | |
| 454 #endregion Designer generated code | |
| OLD | NEW |