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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 244 |
245 // Validate that the dependencies we've been passed (as FileDescript
ors) are actually the ones we | 245 // Validate that the dependencies we've been passed (as FileDescript
ors) are actually the ones we |
246 // need. | 246 // need. |
247 if (dependencies.Length != proto.Dependency.Count) | 247 if (dependencies.Length != proto.Dependency.Count) |
248 { | 248 { |
249 throw new DescriptorValidationException( | 249 throw new DescriptorValidationException( |
250 result, | 250 result, |
251 "Dependencies passed to FileDescriptor.BuildFrom() don't mat
ch " + | 251 "Dependencies passed to FileDescriptor.BuildFrom() don't mat
ch " + |
252 "those listed in the FileDescriptorProto."); | 252 "those listed in the FileDescriptorProto."); |
253 } | 253 } |
| 254 for (int i = 0; i < proto.Dependency.Count; i++) |
| 255 { |
| 256 if (dependencies[i].Name != proto.Dependency[i]) |
| 257 { |
| 258 throw new DescriptorValidationException( |
| 259 result, |
| 260 "Dependencies passed to FileDescriptor.BuildFrom() don't
match " + |
| 261 "those listed in the FileDescriptorProto. Expected: " + |
| 262 proto.Dependency[i] + " but was: " + dependencies[i].Nam
e); |
| 263 } |
| 264 } |
254 | 265 |
255 result.CrossLink(); | 266 result.CrossLink(); |
256 return result; | 267 return result; |
257 } | 268 } |
258 | 269 |
259 private void CrossLink() | 270 private void CrossLink() |
260 { | 271 { |
261 foreach (MessageDescriptor message in MessageTypes) | 272 foreach (MessageDescriptor message in MessageTypes) |
262 { | 273 { |
263 message.CrossLink(); | 274 message.CrossLink(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 /// annotations. While <c>descriptor.proto</c> is a proto2 file, it is b
uilt into the Google.Protobuf | 334 /// annotations. While <c>descriptor.proto</c> is a proto2 file, it is b
uilt into the Google.Protobuf |
324 /// runtime for reflection purposes. The messages are internal to the ru
ntime as they would require | 335 /// runtime for reflection purposes. The messages are internal to the ru
ntime as they would require |
325 /// proto2 semantics for full support, but the file descriptor is availa
ble via this property. The | 336 /// proto2 semantics for full support, but the file descriptor is availa
ble via this property. The |
326 /// C# codegen in protoc automatically uses this property when it detect
s a dependency on <c>descriptor.proto</c>. | 337 /// C# codegen in protoc automatically uses this property when it detect
s a dependency on <c>descriptor.proto</c>. |
327 /// </remarks> | 338 /// </remarks> |
328 /// <value> | 339 /// <value> |
329 /// The file descriptor for <c>descriptor.proto</c>. | 340 /// The file descriptor for <c>descriptor.proto</c>. |
330 /// </value> | 341 /// </value> |
331 public static FileDescriptor DescriptorProtoFileDescriptor { get { retur
n DescriptorReflection.Descriptor; } } | 342 public static FileDescriptor DescriptorProtoFileDescriptor { get { retur
n DescriptorReflection.Descriptor; } } |
332 } | 343 } |
333 } | 344 } |
OLD | NEW |