OLD | NEW |
1 #region Copyright notice and license | 1 #region Copyright notice and license |
2 // Protocol Buffers - Google's data interchange format | 2 // Protocol Buffers - Google's data interchange format |
3 // Copyright 2008 Google Inc. All rights reserved. | 3 // Copyright 2008 Google Inc. All rights reserved. |
4 // https://developers.google.com/protocol-buffers/ | 4 // https://developers.google.com/protocol-buffers/ |
5 // | 5 // |
6 // Redistribution and use in source and binary forms, with or without | 6 // Redistribution and use in source and binary forms, with or without |
7 // modification, are permitted provided that the following conditions are | 7 // modification, are permitted provided that the following conditions are |
8 // met: | 8 // met: |
9 // | 9 // |
10 // * Redistributions of source code must retain the above copyright | 10 // * Redistributions of source code must retain the above copyright |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 Console.WriteLine(" Name: {0}", person.Name); | 48 Console.WriteLine(" Name: {0}", person.Name); |
49 if (person.Email != "") | 49 if (person.Email != "") |
50 { | 50 { |
51 Console.WriteLine(" E-mail address: {0}", person.Email); | 51 Console.WriteLine(" E-mail address: {0}", person.Email); |
52 } | 52 } |
53 | 53 |
54 foreach (Person.Types.PhoneNumber phoneNumber in person.Phones) | 54 foreach (Person.Types.PhoneNumber phoneNumber in person.Phones) |
55 { | 55 { |
56 switch (phoneNumber.Type) | 56 switch (phoneNumber.Type) |
57 { | 57 { |
58 case Person.Types.PhoneType.MOBILE: | 58 case Person.Types.PhoneType.Mobile: |
59 Console.Write(" Mobile phone #: "); | 59 Console.Write(" Mobile phone #: "); |
60 break; | 60 break; |
61 case Person.Types.PhoneType.HOME: | 61 case Person.Types.PhoneType.Home: |
62 Console.Write(" Home phone #: "); | 62 Console.Write(" Home phone #: "); |
63 break; | 63 break; |
64 case Person.Types.PhoneType.WORK: | 64 case Person.Types.PhoneType.Work: |
65 Console.Write(" Work phone #: "); | 65 Console.Write(" Work phone #: "); |
66 break; | 66 break; |
67 } | 67 } |
68 Console.WriteLine(phoneNumber.Number); | 68 Console.WriteLine(phoneNumber.Number); |
69 } | 69 } |
70 } | 70 } |
71 } | 71 } |
72 | 72 |
73 /// <summary> | 73 /// <summary> |
74 /// Entry point - loads the addressbook and then displays it. | 74 /// Entry point - loads the addressbook and then displays it. |
(...skipping 15 matching lines...) Expand all Loading... |
90 // Read the existing address book. | 90 // Read the existing address book. |
91 using (Stream stream = File.OpenRead(args[0])) | 91 using (Stream stream = File.OpenRead(args[0])) |
92 { | 92 { |
93 AddressBook addressBook = AddressBook.Parser.ParseFrom(stream); | 93 AddressBook addressBook = AddressBook.Parser.ParseFrom(stream); |
94 Print(addressBook); | 94 Print(addressBook); |
95 } | 95 } |
96 return 0; | 96 return 0; |
97 } | 97 } |
98 } | 98 } |
99 } | 99 } |
OLD | NEW |