├── .icon.png
├── Runtime
├── Assembly
│ ├── Preserve.cs
│ └── Preserve.cs.meta
├── Assembly.meta
├── Google.Protobuf.meta
├── GameWorkstore.Google.Protobuf.asmdef.meta
├── Google.Protobuf.Config.meta
├── Google.Protobuf
│ ├── Properties.meta
│ ├── Reflection.meta
│ ├── Collections.meta
│ ├── Compatibility.meta
│ ├── WellKnownTypes.meta
│ ├── ByteArray.cs.meta
│ ├── ByteString.cs.meta
│ ├── Extension.cs.meta
│ ├── ExtensionSet.cs.meta
│ ├── FieldCodec.cs.meta
│ ├── IMessage.cs.meta
│ ├── JsonParser.cs.meta
│ ├── JsonToken.cs.meta
│ ├── ParseContext.cs.meta
│ ├── UnknownField.cs.meta
│ ├── WireFormat.cs.meta
│ ├── WriteContext.cs.meta
│ ├── ByteStringAsync.cs.meta
│ ├── CodedInputStream.cs.meta
│ ├── CodedOutputStream.cs.meta
│ ├── Collections
│ │ ├── Lists.cs.meta
│ │ ├── MapField.cs.meta
│ │ ├── RepeatedField.cs.meta
│ │ ├── ReadOnlyDictionary.cs.meta
│ │ ├── ProtobufEqualityComparers.cs.meta
│ │ ├── Lists.cs
│ │ └── ReadOnlyDictionary.cs
│ ├── ExtensionRegistry.cs.meta
│ ├── ExtensionValue.cs.meta
│ ├── FieldMaskTree.cs.meta
│ ├── IBufferMessage.cs.meta
│ ├── IDeepCloneable.cs.meta
│ ├── JsonFormatter.cs.meta
│ ├── JsonTokenizer.cs.meta
│ ├── MessageExtensions.cs.meta
│ ├── MessageParser.cs.meta
│ ├── ObjectIntPair.cs.meta
│ ├── ParsingPrimitives.cs.meta
│ ├── UnknownFieldSet.cs.meta
│ ├── WriteBufferHelper.cs.meta
│ ├── WritingPrimitives.cs.meta
│ ├── FrameworkPortability.cs.meta
│ ├── IExtendableMessage.cs.meta
│ ├── InvalidJsonException.cs.meta
│ ├── LimitedInputStream.cs.meta
│ ├── ParserInternalState.cs.meta
│ ├── ProtoPreconditions.cs.meta
│ ├── Reflection
│ │ ├── Descriptor.cs.meta
│ │ ├── FieldType.cs.meta
│ │ ├── IDescriptor.cs.meta
│ │ ├── CustomOptions.cs.meta
│ │ ├── DescriptorBase.cs.meta
│ │ ├── DescriptorPool.cs.meta
│ │ ├── DescriptorUtil.cs.meta
│ │ ├── EnumDescriptor.cs.meta
│ │ ├── FieldDescriptor.cs.meta
│ │ ├── FileDescriptor.cs.meta
│ │ ├── IFieldAccessor.cs.meta
│ │ ├── MapFieldAccessor.cs.meta
│ │ ├── MethodDescriptor.cs.meta
│ │ ├── OneofAccessor.cs.meta
│ │ ├── OneofDescriptor.cs.meta
│ │ ├── ReflectionUtil.cs.meta
│ │ ├── TypeRegistry.cs.meta
│ │ ├── DescriptorDeclaration.cs.meta
│ │ ├── EnumValueDescriptor.cs.meta
│ │ ├── ExtensionAccessor.cs.meta
│ │ ├── ExtensionCollection.cs.meta
│ │ ├── FieldAccessorBase.cs.meta
│ │ ├── GeneratedClrTypeInfo.cs.meta
│ │ ├── MessageDescriptor.cs.meta
│ │ ├── OriginalNameAttribute.cs.meta
│ │ ├── PackageDescriptor.cs.meta
│ │ ├── RepeatedFieldAccessor.cs.meta
│ │ ├── ServiceDescriptor.cs.meta
│ │ ├── SingleFieldAccessor.cs.meta
│ │ ├── DescriptorValidationException.cs.meta
│ │ ├── IDescriptor.cs
│ │ ├── MapFieldAccessor.cs
│ │ ├── RepeatedFieldAccessor.cs
│ │ ├── PackageDescriptor.cs
│ │ ├── OriginalNameAttribute.cs
│ │ ├── FieldAccessorBase.cs
│ │ ├── ExtensionAccessor.cs
│ │ ├── DescriptorUtil.cs
│ │ ├── IFieldAccessor.cs
│ │ ├── DescriptorValidationException.cs
│ │ ├── FieldType.cs
│ │ ├── DescriptorBase.cs
│ │ ├── OneofAccessor.cs
│ │ ├── EnumValueDescriptor.cs
│ │ └── DescriptorDeclaration.cs
│ ├── SegmentedBufferHelper.cs.meta
│ ├── UnsafeByteOperations.cs.meta
│ ├── WellKnownTypes
│ │ ├── Any.cs.meta
│ │ ├── Api.cs.meta
│ │ ├── Empty.cs.meta
│ │ ├── Struct.cs.meta
│ │ ├── Type.cs.meta
│ │ ├── AnyPartial.cs.meta
│ │ ├── Duration.cs.meta
│ │ ├── FieldMask.cs.meta
│ │ ├── Timestamp.cs.meta
│ │ ├── ValuePartial.cs.meta
│ │ ├── Wrappers.cs.meta
│ │ ├── DurationPartial.cs.meta
│ │ ├── FieldMaskPartial.cs.meta
│ │ ├── SourceContext.cs.meta
│ │ ├── TimeExtensions.cs.meta
│ │ ├── TimestampPartial.cs.meta
│ │ ├── WrappersPartial.cs.meta
│ │ ├── WrappersPartial.cs
│ │ ├── TimeExtensions.cs
│ │ └── ValuePartial.cs
│ ├── WriterInternalState.cs.meta
│ ├── ICustomDiagnosticMessage.cs.meta
│ ├── ParsingPrimitivesMessages.cs.meta
│ ├── ParsingPrimitivesWrappers.cs.meta
│ ├── Properties
│ │ ├── AssemblyInfo.cs.meta
│ │ └── AssemblyInfo.cs
│ ├── WritingPrimitivesMessages.cs.meta
│ ├── CodedOutputStream.ComputeSize.cs.meta
│ ├── Compatibility
│ │ ├── StreamExtensions.cs.meta
│ │ ├── TypeExtensions.cs.meta
│ │ ├── MethodInfoExtensions.cs.meta
│ │ ├── PropertyInfoExtensions.cs.meta
│ │ ├── MethodInfoExtensions.cs
│ │ ├── StreamExtensions.cs
│ │ ├── PropertyInfoExtensions.cs
│ │ └── TypeExtensions.cs
│ ├── InvalidProtocolBufferException.cs.meta
│ ├── ObjectIntPair.cs
│ ├── FrameworkPortability.cs
│ ├── IDeepCloneable.cs
│ ├── IBufferMessage.cs
│ ├── InvalidJsonException.cs
│ ├── WriterInternalState.cs
│ ├── ByteStringAsync.cs
│ ├── ByteArray.cs
│ ├── ProtoPreconditions.cs
│ ├── ICustomDiagnosticMessage.cs
│ ├── IExtendableMessage.cs
│ ├── UnsafeByteOperations.cs
│ ├── IMessage.cs
│ ├── LimitedInputStream.cs
│ ├── WireFormat.cs
│ ├── ParserInternalState.cs
│ └── Extension.cs
├── Google.Protobuf.Config
│ ├── ProtobufConfig.cs.meta
│ └── ProtobufConfig.cs
└── GameWorkstore.Google.Protobuf.asmdef
├── Binary
├── Win
│ ├── protoc.exe
│ └── protoc.exe.meta
└── Win.meta
├── Dependencies
├── System.Buffers.dll
├── System.Memory.dll
├── System.Runtime.CompilerServices.Unsafe.dll
├── System.Buffers.dll.meta
├── System.Memory.dll.meta
└── System.Runtime.CompilerServices.Unsafe.dll.meta
├── CHANGES.txt.meta
├── LICENSE.md.meta
├── README.md.meta
├── package.json.meta
├── Binary.meta
├── Editor.meta
├── Runtime.meta
├── Dependencies.meta
├── Editor
├── GameWorkstore.Google.Protobuf.Editor.asmdef.meta
├── ProtobufCompiler.cs.meta
├── ProtobufPreferences.cs.meta
├── GameWorkstore.Google.Protobuf.Editor.asmdef
└── ProtobufPreferences.cs
├── package.json
├── LICENSE.md
└── README.md
/.icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GameWorkstore/google-protobuf-unity/HEAD/.icon.png
--------------------------------------------------------------------------------
/Runtime/Assembly/Preserve.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine.Scripting;
2 |
3 | [assembly: Preserve]
4 |
--------------------------------------------------------------------------------
/Binary/Win/protoc.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GameWorkstore/google-protobuf-unity/HEAD/Binary/Win/protoc.exe
--------------------------------------------------------------------------------
/Dependencies/System.Buffers.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GameWorkstore/google-protobuf-unity/HEAD/Dependencies/System.Buffers.dll
--------------------------------------------------------------------------------
/Dependencies/System.Memory.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GameWorkstore/google-protobuf-unity/HEAD/Dependencies/System.Memory.dll
--------------------------------------------------------------------------------
/Dependencies/System.Runtime.CompilerServices.Unsafe.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GameWorkstore/google-protobuf-unity/HEAD/Dependencies/System.Runtime.CompilerServices.Unsafe.dll
--------------------------------------------------------------------------------
/CHANGES.txt.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bf16747bcbb44b94fb6005867779d07a
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/LICENSE.md.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d3edc515bbc60724893e68f267a17208
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/README.md.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e7b5dfaf63666674bb488581d561f5a9
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/package.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8ddd1097c3631854e816ca395a632700
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Binary/Win/protoc.exe.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4fcc78b8e2ed4144abe0c9ef6c93b5c4
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Binary.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7885e7883024a444284d21b0bccdc6ca
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a725fe350db024048be92483a8dd2724
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cdcceef0dba9f4f74af5ed77b0011cd4
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Binary/Win.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9c53632abc1dd437193643fa4f1ed8ab
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Dependencies.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 059089b53d5774a409da0919f0416c79
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/Assembly.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 970ded55d400c4882a403ad248ada386
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 44284861c7c02734fbd54662fb28825f
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/GameWorkstore.Google.Protobuf.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ea86e1e2f3573eb4192e1dd536f1057d
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf.Config.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e7a05bb1cfdba46cf8d7e0081771df73
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Properties.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9f9659c92cbfbec4c89ac153ac40e35c
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e827df273fb49204d8e8768f9759ab07
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Collections.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: acf13ff68b97b2d4fbd265af0638581e
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Compatibility.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9a3b6a8b39256e346bc4faeb814dacf6
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WellKnownTypes.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 803fe74a6c10c7649a4ba73b3cefd98e
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Editor/GameWorkstore.Google.Protobuf.Editor.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3937ac67621074b87a04b4e05b0ca66f
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Editor/ProtobufCompiler.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a9358304eb433614db9bfda13004618c
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/ProtobufPreferences.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 668ffb21d29050c4fa7efcde9294daea
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Assembly/Preserve.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5cc679d1f75f74fad8242ef65cc352c6
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/ByteArray.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: da680627fd613db4c910c16e8874e303
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/ByteString.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f3c69cd8b7e056540a8ab654b46c2193
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Extension.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0555c2c57fac55d46b814e6a0b10c09e
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/ExtensionSet.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 19a442e9fd9ce284ea44380308978849
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/FieldCodec.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 13521157c377c8d468b1e03df93f669a
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/IMessage.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fc514857569791b43ae239a1fdb3ffb1
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/JsonParser.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3cc242fdd403a4c4898fac2e576451c5
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/JsonToken.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a7a1da17036535f479f23cc117328a04
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/ParseContext.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8c8e15676b24fca41bc307890550d693
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/UnknownField.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d4acbe833eff4814a894b3ef89bff73b
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WireFormat.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 41d4aa206f5d7c04087a513b1ff118d0
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WriteContext.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 766b72c3db8f9024bb32086f86ba1def
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/ByteStringAsync.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5ac1ff5b662944a95ba671d7485ccf22
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/CodedInputStream.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b5a1307a1d671eb4db4e91cd08971ea7
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/CodedOutputStream.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 60924466bbdb30c40960d5a989465984
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Collections/Lists.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 49083ff4e0e912d4bb4bba76391a0510
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/ExtensionRegistry.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f7a6bad7f5e9a7b4ebb67b48496cb5d5
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/ExtensionValue.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0eae5cd1cd48f434da20f00ca1a5b256
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/FieldMaskTree.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 906dfe097dbbb5a48bab997fb478e31f
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/IBufferMessage.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a05edd82f2efdec4da13984dfd004782
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/IDeepCloneable.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 283ab5b1be7de1643a260286587073e9
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/JsonFormatter.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: add3762d066ff4e43b041f5dcabbc779
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/JsonTokenizer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 16a84dc4762991942bc34789e49cb334
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/MessageExtensions.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 94bc159db0a771145824b837abf91ef8
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/MessageParser.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 352d906e49b479242a2e2ee6ba7e7720
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/ObjectIntPair.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 45341c34d1deafb47a3547ede6f9480a
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/ParsingPrimitives.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 04b871629041b4f408a76b1086b01633
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/UnknownFieldSet.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0372c60f85032b340bc73b16e9ee626d
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WriteBufferHelper.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a8ffee91550194b40bfc0dc5c76b47da
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WritingPrimitives.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 170a40aece2d359428f8158e03479854
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf.Config/ProtobufConfig.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c7926016a0aff42d0811489f5433ce59
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Collections/MapField.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 665b20e1bbfaab747b8a185c7fb7852c
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/FrameworkPortability.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8384336c722512a42a02db4dd9d3273f
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/IExtendableMessage.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2bf5b0af8cbd1ef4aa6a9dbbcdbecc5f
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/InvalidJsonException.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cd2e1a01cf19bae4a93fe93207a08aa9
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/LimitedInputStream.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bbbcb21d322763f418e0768ad9548eaa
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/ParserInternalState.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7ebb12a8b7af2eb4d8302a5760ffdca8
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/ProtoPreconditions.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d4c74cf3e3682fe4fae809bc03ec5cc4
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/Descriptor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: aeef06ef40e91604e8a2ac48827684cc
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/FieldType.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 449232338a2786144bcfb0e7b0163042
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/IDescriptor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5f2532029ea3f184cb22f50a37705f88
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/SegmentedBufferHelper.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: edeab71632eb3264eb3e07273aa5dc77
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/UnsafeByteOperations.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e32e332ca8f1d418fb2a70e8411dc02d
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WellKnownTypes/Any.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 990403929c224df408342c7789851ec6
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WellKnownTypes/Api.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 76ebc4260348dc24cbd4765cb556ce51
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WellKnownTypes/Empty.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cb7e0b01022564045a91f999b90266a0
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WellKnownTypes/Struct.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 059c4f28e9e487a4fbfd7db0f123e68a
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WellKnownTypes/Type.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9cc8a742ecac87844ba482d99aa76107
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WriterInternalState.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0c541836e1d7b82448ab16f25c2293cc
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Collections/RepeatedField.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 47c79561f28e3f2448bad2f29e85df6e
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/ICustomDiagnosticMessage.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6dabe2238c278ac4c9c50def18e2833c
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/ParsingPrimitivesMessages.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0042956166aed2046874a5bd6ad6212a
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/ParsingPrimitivesWrappers.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 972ac92f9caebd74a9a469e2b4ed0411
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Properties/AssemblyInfo.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 71adafc45e339144ebcd8005c8f291e0
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/CustomOptions.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 12a4feacd1a9c174288bec255e19d903
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/DescriptorBase.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 51383023f27cda947a386dbb5ee3a811
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/DescriptorPool.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 37f7770c32c4c8845911df1b3d2d11aa
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/DescriptorUtil.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e9834013448a6de43a4a6f97de7fb630
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/EnumDescriptor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b4171fd9f6c618449b1f7390cfcfdccd
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/FieldDescriptor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 95effd5ed0e943146b01efab950662de
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/FileDescriptor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3fe9e309ba88623459ae776e5fe8a505
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/IFieldAccessor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 20646cc81d318304dbe97b1652a00b0b
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/MapFieldAccessor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4c138637d991f8c448cf2df337ff7a62
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/MethodDescriptor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ae1c35813505fc14197e46e7db8437ef
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/OneofAccessor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ea9bb3a824902c348a961bedaeb6e5bb
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/OneofDescriptor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e9bfd0112ede13d40a461698e2de13d6
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/ReflectionUtil.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 282f9af6693fd4c4e92aa33b2f2cd1c8
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/TypeRegistry.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0b0478ceec28da04ba997f8d468a2db3
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WellKnownTypes/AnyPartial.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 455cfee12b03569449e4236552e41b65
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WellKnownTypes/Duration.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 15c666e50a0f34944a0a5bec265e358d
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WellKnownTypes/FieldMask.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b99c7fc5be1d26440a7f586b8017a16b
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WellKnownTypes/Timestamp.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e790cb04e026f2f479dd6c65c83864f2
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WellKnownTypes/ValuePartial.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 24d4bbf51d8c568458176ac8139e14fb
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WellKnownTypes/Wrappers.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5f44aca7436e10b43ab24dec36e3899c
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WritingPrimitivesMessages.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 37add24e17031ec48a6e1b09be484595
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/CodedOutputStream.ComputeSize.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 875c26628fafe324bae840629cadd11f
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Collections/ReadOnlyDictionary.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6809ef02b465b5f48bdc089aad7e07c9
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Compatibility/StreamExtensions.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1f77b79d2d2a2114090ec202adbd4485
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Compatibility/TypeExtensions.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1e4e66140e08da34e826916fbfe2ece6
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/InvalidProtocolBufferException.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 13f6c4543a25d14499201d138407950d
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/DescriptorDeclaration.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: eeb002039d51a594d8a5da44de7fdaf9
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/EnumValueDescriptor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9a12f86834a81ba40880a7338b114a6d
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/ExtensionAccessor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e198bd3633ee389479c355a446a8f799
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/ExtensionCollection.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e975ae3e8dffbc044bde63ecfa736807
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/FieldAccessorBase.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1ebc1d31777783c4ca28b214d8190bab
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/GeneratedClrTypeInfo.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1b4ffc491e8897f4092686aabf2b42f4
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/MessageDescriptor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 232e5ac740371d14993629ef49e2863d
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/OriginalNameAttribute.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a3820b2deb9608d44ad4acee53501cc6
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/PackageDescriptor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 64745feeea01ff442b1868cd9eb1411a
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/RepeatedFieldAccessor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 19f14a356a144ed4e994626a880c7a2e
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/ServiceDescriptor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 42dac52d202ef3649bd3f952332a9f21
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/SingleFieldAccessor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 848d582a972bc1c448d59e9131d8a2fb
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WellKnownTypes/DurationPartial.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0e1b2eaf604183742836fbaa649b20ff
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f3624cf6dddf8784da006a5f970d5079
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WellKnownTypes/SourceContext.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 66f6f1750ff52b848bd2dc50095eec02
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WellKnownTypes/TimeExtensions.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 778fc726558fc0047a9252abaf6e80d6
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WellKnownTypes/TimestampPartial.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1caa35eab9a92e94eb2749b5250a6147
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WellKnownTypes/WrappersPartial.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5d7a4ee17340dff438712d11dc450202
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Collections/ProtobufEqualityComparers.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2a1bee30d0bba0440a67128c3b84e27a
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Compatibility/MethodInfoExtensions.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 05a1a7e47dad5d644baecdf3651ce5e5
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 53b7f3d7a4fae81409cdd893eef76894
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/DescriptorValidationException.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 206310602d6f7f84589427247e5819ed
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/GameWorkstore.Google.Protobuf.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "GameWorkstore.Google.Protobuf",
3 | "references": [],
4 | "includePlatforms": [],
5 | "excludePlatforms": [],
6 | "allowUnsafeCode": true,
7 | "overrideReferences": false,
8 | "precompiledReferences": [],
9 | "autoReferenced": true,
10 | "defineConstraints": [],
11 | "versionDefines": [],
12 | "noEngineReferences": false
13 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "com.gameworkstore.googleprotobufunity",
3 | "version": "3.15.2012",
4 | "displayName": "GameWorkstore GoogleProtobuf Unity",
5 | "description": "Google Protobuf C#/GoLang/Python Library for Unity",
6 | "unity": "2021.3",
7 | "icon": ".icon.png",
8 | "keywords": [ "google", "protobuf", "csharp", "golang", "python" ],
9 | "author": {
10 | "name": "Game Workstore",
11 | "email": "contact@gameworkstore.com",
12 | "url": "https://gameworkstore.com"
13 | },
14 | "dependencies": {
15 |
16 | }
17 | }
--------------------------------------------------------------------------------
/Editor/GameWorkstore.Google.Protobuf.Editor.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "GameWorkstore.Google.Protobuf.Editor",
3 | "rootNamespace": "",
4 | "references": [
5 | "GUID:ea86e1e2f3573eb4192e1dd536f1057d"
6 | ],
7 | "includePlatforms": [
8 | "Editor"
9 | ],
10 | "excludePlatforms": [],
11 | "allowUnsafeCode": false,
12 | "overrideReferences": false,
13 | "precompiledReferences": [],
14 | "autoReferenced": true,
15 | "defineConstraints": [],
16 | "versionDefines": [],
17 | "noEngineReferences": false
18 | }
--------------------------------------------------------------------------------
/Dependencies/System.Buffers.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e375b52232ea843498b4f42b185fe649
3 | PluginImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | iconMap: {}
7 | executionOrder: {}
8 | defineConstraints: []
9 | isPreloaded: 0
10 | isOverridable: 0
11 | isExplicitlyReferenced: 0
12 | validateReferences: 1
13 | platformData:
14 | - first:
15 | Any:
16 | second:
17 | enabled: 1
18 | settings: {}
19 | - first:
20 | Editor: Editor
21 | second:
22 | enabled: 0
23 | settings:
24 | DefaultValueInitialized: true
25 | - first:
26 | Windows Store Apps: WindowsStoreApps
27 | second:
28 | enabled: 0
29 | settings:
30 | CPU: AnyCPU
31 | userData:
32 | assetBundleName:
33 | assetBundleVariant:
34 |
--------------------------------------------------------------------------------
/Dependencies/System.Memory.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8f3e9c4addcf39f4d927a45e97d271af
3 | PluginImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | iconMap: {}
7 | executionOrder: {}
8 | defineConstraints: []
9 | isPreloaded: 0
10 | isOverridable: 0
11 | isExplicitlyReferenced: 0
12 | validateReferences: 1
13 | platformData:
14 | - first:
15 | Any:
16 | second:
17 | enabled: 1
18 | settings: {}
19 | - first:
20 | Editor: Editor
21 | second:
22 | enabled: 0
23 | settings:
24 | DefaultValueInitialized: true
25 | - first:
26 | Windows Store Apps: WindowsStoreApps
27 | second:
28 | enabled: 0
29 | settings:
30 | CPU: AnyCPU
31 | userData:
32 | assetBundleName:
33 | assetBundleVariant:
34 |
--------------------------------------------------------------------------------
/Dependencies/System.Runtime.CompilerServices.Unsafe.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b85da8d5c5260c64ba1433a1b20ab75b
3 | PluginImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | iconMap: {}
7 | executionOrder: {}
8 | defineConstraints: []
9 | isPreloaded: 0
10 | isOverridable: 0
11 | isExplicitlyReferenced: 0
12 | validateReferences: 1
13 | platformData:
14 | - first:
15 | Any:
16 | second:
17 | enabled: 1
18 | settings: {}
19 | - first:
20 | Editor: Editor
21 | second:
22 | enabled: 0
23 | settings:
24 | DefaultValueInitialized: true
25 | - first:
26 | Windows Store Apps: WindowsStoreApps
27 | second:
28 | enabled: 0
29 | settings:
30 | CPU: AnyCPU
31 | userData:
32 | assetBundleName:
33 | assetBundleVariant:
34 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/ObjectIntPair.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Google.Protobuf
4 | {
5 | ///
6 | /// Struct used to hold the keys for the fieldByNumber table in DescriptorPool and the keys for the
7 | /// extensionByNumber table in ExtensionRegistry.
8 | ///
9 | internal struct ObjectIntPair : IEquatable> where T : class
10 | {
11 | private readonly int number;
12 | private readonly T obj;
13 |
14 | internal ObjectIntPair(T obj, int number)
15 | {
16 | this.number = number;
17 | this.obj = obj;
18 | }
19 |
20 | public bool Equals(ObjectIntPair other)
21 | {
22 | return obj == other.obj
23 | && number == other.number;
24 | }
25 |
26 | public override bool Equals(object obj)
27 | {
28 | if (obj is ObjectIntPair)
29 | {
30 | return Equals((ObjectIntPair)obj);
31 | }
32 | return false;
33 | }
34 |
35 | public override int GetHashCode()
36 | {
37 | return obj.GetHashCode() * ((1 << 16) - 1) + number;
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf.Config/ProtobufConfig.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace Google.Protobuf.Config
4 | {
5 | [CreateAssetMenu(fileName = "ProtobufConfig", menuName = "Protobuf/ProtobufConfig")]
6 | public class ProtobufConfig : ScriptableObject
7 | {
8 | public bool ProtocolCompilerEnabled = true;
9 |
10 | [Header("C#")]
11 | public bool CSharpCompilerEnabled = true;
12 | [Tooltip("Leave custom paths empty if it should compile right next to original.")]
13 | public string CSharpCustomPath = string.Empty;
14 |
15 | [Header("GoLang#")]
16 | public bool GoLangCompilerEnabled = false;
17 | [Tooltip("Leave custom paths empty if it should compile right next to original.")]
18 | public string GoLangCustomPath = string.Empty;
19 |
20 | [Header("Python#")]
21 | public bool PythonCompilerEnabled = false;
22 | [Tooltip("Make protobuf local inside python exportations. [ 'from google' --> 'from . google'] and [ 'import' --> 'from . import']")]
23 | public bool PythonLocalLibrary = false;
24 | [Tooltip("Leave custom paths empty if it should compile right next to original.")]
25 | public string PythonCustomPath = string.Empty;
26 |
27 | [Header("Cpp#")]
28 | public bool CppCompilerEnabled = false;
29 | [Tooltip("Leave custom paths empty if it should compile right next to original.")]
30 | public string CppCustomPath = string.Empty;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright 2020 Game Workstore
2 |
3 | Copyright 2008 Google Inc. All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright
10 | notice, this list of conditions and the following disclaimer.
11 | * Redistributions in binary form must reproduce the above
12 | copyright notice, this list of conditions and the following disclaimer
13 | in the documentation and/or other materials provided with the
14 | distribution.
15 | * Neither the name of Google Inc. nor the names of its
16 | contributors may be used to endorse or promote products derived from
17 | this software without specific prior written permission.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | Code generated by the Protocol Buffer compiler is owned by the owner
32 | of the input file used when generating it. This code is not
33 | standalone and requires a support library to be linked with it. This
34 | support library is itself covered by the above license.
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WellKnownTypes/WrappersPartial.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | namespace Google.Protobuf.WellKnownTypes
34 | {
35 | public static partial class WrappersReflection
36 | {
37 | ///
38 | /// Field number for the single "value" field in all wrapper types.
39 | ///
40 | internal const int WrapperValueFieldNumber = Int32Value.ValueFieldNumber;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Compatibility/MethodInfoExtensions.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2017 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | #if NET35
34 | using System;
35 | using System.Reflection;
36 |
37 | namespace Google.Protobuf.Compatibility
38 | {
39 | // .NET Core (at least netstandard1.0) doesn't have Delegate.CreateDelegate, and .NET 3.5 doesn't have
40 | // MethodInfo.CreateDelegate. Proxy from one to the other on .NET 3.5...
41 | internal static class MethodInfoExtensions
42 | {
43 | internal static Delegate CreateDelegate(this MethodInfo method, Type type) =>
44 | Delegate.CreateDelegate(type, method);
45 | }
46 | }
47 | #endif
48 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/FrameworkPortability.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System;
34 | using System.Text.RegularExpressions;
35 |
36 | namespace Google.Protobuf
37 | {
38 | ///
39 | /// Class containing helpful workarounds for various platform compatibility
40 | ///
41 | internal static class FrameworkPortability
42 | {
43 | // The value of RegexOptions.Compiled is 8. We can test for the presence at
44 | // execution time using Enum.IsDefined, so a single build will do the right thing
45 | // on each platform. (RegexOptions.Compiled isn't supported by PCLs.)
46 | internal static readonly RegexOptions CompiledRegexWhereAvailable =
47 | Enum.IsDefined(typeof(RegexOptions), 8) ? (RegexOptions)8 : RegexOptions.None;
48 | }
49 | }
--------------------------------------------------------------------------------
/Editor/ProtobufPreferences.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEditor;
3 | using UnityEngine;
4 |
5 | namespace Google.Protobuf.Editor
6 | {
7 | public static class ProtobufPreferences
8 | {
9 | private const string prefLogError = "protobufcompiler_logerror";
10 | private const string prefLogDebug = "protobufcompiler_logstandard";
11 |
12 | internal static bool LogErrors
13 | {
14 | get
15 | {
16 | return EditorPrefs.GetBool(prefLogError, true);
17 | }
18 | set
19 | {
20 | EditorPrefs.SetBool(prefLogError, value);
21 | }
22 | }
23 |
24 | internal static bool LogDebug
25 | {
26 | get
27 | {
28 | return EditorPrefs.GetBool(prefLogDebug, false);
29 | }
30 | set
31 | {
32 | EditorPrefs.SetBool(prefLogDebug, value);
33 | }
34 | }
35 |
36 | internal class ProtobufUnitySettingsProvider : SettingsProvider
37 | {
38 | public ProtobufUnitySettingsProvider(string path, SettingsScope scope = SettingsScope.User) : base(path, scope)
39 | {
40 | }
41 |
42 | public override void OnGUI(string searchContext)
43 | {
44 | ProtobufPreference();
45 | }
46 |
47 | [SettingsProvider]
48 | public static SettingsProvider ProtobufPreferenceSettingsProvider()
49 | {
50 | return new ProtobufUnitySettingsProvider("Preferences/Protobuf");
51 | }
52 | }
53 |
54 | private static void ProtobufPreference()
55 | {
56 | EditorGUI.BeginChangeCheck();
57 |
58 | LogErrors = EditorGUILayout.Toggle(new GUIContent("Log Error Output", "Log compilation errors from protoc command."), LogErrors);
59 | LogDebug = EditorGUILayout.Toggle(new GUIContent("Log Standard Output", "Log compilation completion messages."), LogDebug);
60 |
61 | if (GUILayout.Button(new GUIContent("Force Compilation")))
62 | {
63 | ProtobufCompiler.ForceRecompile();
64 | }
65 |
66 | if (GUILayout.Button(new GUIContent("Debug PATH")))
67 | {
68 | var path = Environment.GetEnvironmentVariable("PATH");
69 | Debug.Log($"PATH value: {path}");
70 | }
71 |
72 | EditorGUI.EndDisabledGroup();
73 | EditorGUI.EndChangeCheck();
74 | }
75 | }
76 | }
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/IDescriptor.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | namespace Google.Protobuf.Reflection
34 | {
35 | ///
36 | /// Interface implemented by all descriptor types.
37 | ///
38 | public interface IDescriptor
39 | {
40 | ///
41 | /// Returns the name of the entity (message, field etc) being described.
42 | ///
43 | string Name { get; }
44 |
45 | ///
46 | /// Returns the fully-qualified name of the entity being described.
47 | ///
48 | string FullName { get; }
49 |
50 | ///
51 | /// Returns the descriptor for the .proto file that this entity is part of.
52 | ///
53 | FileDescriptor File { get; }
54 | }
55 | }
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/IDeepCloneable.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2015 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | namespace Google.Protobuf
34 | {
35 | ///
36 | /// Generic interface for a deeply cloneable type.
37 | ///
38 | ///
39 | ///
40 | /// All generated messages implement this interface, but so do some non-message types.
41 | /// Additionally, due to the type constraint on T in ,
42 | /// it is simpler to keep this as a separate interface.
43 | ///
44 | ///
45 | /// The type itself, returned by the method.
46 | public interface IDeepCloneable
47 | {
48 | ///
49 | /// Creates a deep clone of this object.
50 | ///
51 | /// A deep clone of this object.
52 | T Clone();
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/IBufferMessage.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | namespace Google.Protobuf
34 | {
35 | ///
36 | /// Interface for a Protocol Buffers message, supporting
37 | /// parsing from and writing to .
38 | ///
39 | public interface IBufferMessage : IMessage
40 | {
41 | ///
42 | /// Internal implementation of merging data from given parse context into this message.
43 | /// Users should never invoke this method directly.
44 | ///
45 | void InternalMergeFrom(ref ParseContext ctx);
46 |
47 | ///
48 | /// Internal implementation of writing this message to a given write context.
49 | /// Users should never invoke this method directly.
50 | ///
51 | void InternalWriteTo(ref WriteContext ctx);
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/InvalidJsonException.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2015 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System.IO;
34 |
35 | namespace Google.Protobuf
36 | {
37 | ///
38 | /// Thrown when an attempt is made to parse invalid JSON, e.g. using
39 | /// a non-string property key, or including a redundant comma. Parsing a protocol buffer
40 | /// message represented in JSON using can throw both this
41 | /// exception and depending on the situation. This
42 | /// exception is only thrown for "pure JSON" errors, whereas InvalidProtocolBufferException
43 | /// is thrown when the JSON may be valid in and of itself, but cannot be parsed as a protocol buffer
44 | /// message.
45 | ///
46 | public sealed class InvalidJsonException : IOException
47 | {
48 | internal InvalidJsonException(string message)
49 | : base(message)
50 | {
51 | }
52 | }
53 | }
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/MapFieldAccessor.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2015 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System;
34 | using System.Collections;
35 | using System.Reflection;
36 |
37 | namespace Google.Protobuf.Reflection
38 | {
39 | ///
40 | /// Accessor for map fields.
41 | ///
42 | internal sealed class MapFieldAccessor : FieldAccessorBase
43 | {
44 | internal MapFieldAccessor(PropertyInfo property, FieldDescriptor descriptor) : base(property, descriptor)
45 | {
46 | }
47 |
48 | public override void Clear(IMessage message)
49 | {
50 | IDictionary list = (IDictionary) GetValue(message);
51 | list.Clear();
52 | }
53 |
54 | public override bool HasValue(IMessage message)
55 | {
56 | throw new InvalidOperationException("HasValue is not implemented for map fields");
57 | }
58 |
59 | public override void SetValue(IMessage message, object value)
60 | {
61 | throw new InvalidOperationException("SetValue is not implemented for map fields");
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Google Protobuf C# Library for Unity
2 |
3 | Unity NPM version of Google Protobuf! This repository applies the same license terms of the original version.
4 |
5 | Original repo: [protocolbuffers](https://github.com/protocolbuffers/protobuf)
6 |
7 | # Current Version
8 |
9 | You can find at Assets/Package/CHANGES.txt
10 |
11 | # Updating this package:
12 |
13 | This package will receive updates from time to time.
14 | To do this:
15 |
16 | 1) Replace Google.Protobuf folder for the original Root > csharp > src > Google.Protobuf
17 | 2) Replace CHANGES.txt for the original at Root.
18 | 3) Replace Assets/Package/Protoc/{versions} for related OS versions (current MacOS 64, Windows 64 and Linux 64) from original repo.
19 |
20 | # How to install
21 |
22 | ## Unity
23 |
24 | At package.json, add these line of code:
25 | > "com.gameworkstore.googleprotobufunity": "https://github.com/GameWorkstore/google-protobuf-unity.git#3.15.2012"
26 |
27 | And wait for unity to download and compile the package.
28 |
29 | for update package for a newer version, update end of line from 3.15.2012 to any released version on Releases.
30 |
31 | ## Unreal
32 |
33 | In Progress
34 |
35 | # Installing Protoc
36 |
37 | ### Windows
38 |
39 | This package comes with preinstalled protoc for Windows 64 bits.
40 |
41 | ### MacOS
42 |
43 | Install protobuf using brew
44 |
45 | > brew install protobuf
46 |
47 | Install protoc-gen-go using brew
48 |
49 | > brew install protoc-gen-go
50 |
51 | While the package contains solutions to fix PATH by itself,
52 | if you run into problems, follow this advice:
53 |
54 | Brew must simlink both protoc and protoc-gen-go binaries into /usr/local/bin folder.
55 | Use the button on preferences to debug your PATH variable and see which folders are available.
56 | Fixing this should get rid of any binary not found errors appearing while compiling.
57 |
58 | # Configuring
59 |
60 | There are two modes of configuration:
61 |
62 | ## Global
63 | You must configure at least a ProtobufConfig file anywhere in the project folder to allow the ProtobufCompiler to compile .proto files.
64 | This is the preferred one for simple projects.
65 |
66 | ## Local
67 | ProtobufCompiler also accepts multiple ProtobufConfig.
68 | Put one ProtobufConfig inside each folder containing your .proto files to allow it find them and compile on each custom path properly.
69 | This method is used for a project with more complex configurations or sub-projects inside Assets folder.
70 |
71 | #FAQ
72 | ### [ProtobufCompiler]:protoc-gen-go: program not found or is not executable
73 | Please specify a program using absolute path or make sure the program is available in your PATH system variable
74 | --go_out: protoc-gen-go: Plugin failed with status code 1.
75 |
76 | This happens when your protoc and/or protoc-gen-go installation isn't configured properly. Verify PATH on windows,
77 | or /usr/local/bin to see if all binaries are there.
78 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/RepeatedFieldAccessor.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2015 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System;
34 | using System.Collections;
35 | using System.Reflection;
36 |
37 | namespace Google.Protobuf.Reflection
38 | {
39 | ///
40 | /// Accessor for repeated fields.
41 | ///
42 | internal sealed class RepeatedFieldAccessor : FieldAccessorBase
43 | {
44 | internal RepeatedFieldAccessor(PropertyInfo property, FieldDescriptor descriptor) : base(property, descriptor)
45 | {
46 | }
47 |
48 | public override void Clear(IMessage message)
49 | {
50 | IList list = (IList) GetValue(message);
51 | list.Clear();
52 | }
53 |
54 | public override bool HasValue(IMessage message)
55 | {
56 | throw new InvalidOperationException("HasValue is not implemented for repeated fields");
57 | }
58 |
59 | public override void SetValue(IMessage message, object value)
60 | {
61 | throw new InvalidOperationException("SetValue is not implemented for repeated fields");
62 | }
63 |
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/PackageDescriptor.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | namespace Google.Protobuf.Reflection
34 | {
35 | ///
36 | /// Represents a package in the symbol table. We use PackageDescriptors
37 | /// just as placeholders so that someone cannot define, say, a message type
38 | /// that has the same name as an existing package.
39 | ///
40 | internal sealed class PackageDescriptor : IDescriptor
41 | {
42 | private readonly string name;
43 | private readonly string fullName;
44 | private readonly FileDescriptor file;
45 |
46 | internal PackageDescriptor(string name, string fullName, FileDescriptor file)
47 | {
48 | this.file = file;
49 | this.fullName = fullName;
50 | this.name = name;
51 | }
52 |
53 | public string Name
54 | {
55 | get { return name; }
56 | }
57 |
58 | public string FullName
59 | {
60 | get { return fullName; }
61 | }
62 |
63 | public FileDescriptor File
64 | {
65 | get { return file; }
66 | }
67 | }
68 | }
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/OriginalNameAttribute.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System;
34 |
35 | namespace Google.Protobuf.Reflection
36 | {
37 | ///
38 | /// Specifies the original name (in the .proto file) of a named element,
39 | /// such as an enum value.
40 | ///
41 | [AttributeUsage(AttributeTargets.Field)]
42 | public class OriginalNameAttribute : Attribute
43 | {
44 | ///
45 | /// The name of the element in the .proto file.
46 | ///
47 | public string Name { get; set; }
48 |
49 | ///
50 | /// If the name is preferred in the .proto file.
51 | ///
52 | public bool PreferredAlias { get; set; }
53 |
54 | ///
55 | /// Constructs a new attribute instance for the given name.
56 | ///
57 | /// The name of the element in the .proto file.
58 | public OriginalNameAttribute(string name)
59 | {
60 | Name = ProtoPreconditions.CheckNotNull(name, nameof(name));
61 | PreferredAlias = true;
62 | }
63 |
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/FieldAccessorBase.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2015 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System;
34 | using System.Reflection;
35 | using Google.Protobuf.Compatibility;
36 |
37 | namespace Google.Protobuf.Reflection
38 | {
39 | ///
40 | /// Base class for field accessors.
41 | ///
42 | internal abstract class FieldAccessorBase : IFieldAccessor
43 | {
44 | private readonly Func getValueDelegate;
45 | private readonly FieldDescriptor descriptor;
46 |
47 | internal FieldAccessorBase(PropertyInfo property, FieldDescriptor descriptor)
48 | {
49 | this.descriptor = descriptor;
50 | getValueDelegate = ReflectionUtil.CreateFuncIMessageObject(property.GetGetMethod());
51 | }
52 |
53 | public FieldDescriptor Descriptor { get { return descriptor; } }
54 |
55 | public object GetValue(IMessage message)
56 | {
57 | return getValueDelegate(message);
58 | }
59 |
60 | public abstract bool HasValue(IMessage message);
61 | public abstract void Clear(IMessage message);
62 | public abstract void SetValue(IMessage message, object value);
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Compatibility/StreamExtensions.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2015 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | #if NET35
34 | using System;
35 | using System.IO;
36 |
37 | namespace Google.Protobuf.Compatibility
38 | {
39 | ///
40 | /// Extension methods for in order to provide
41 | /// backwards compatibility with .NET 3.5
42 | ///
43 | public static class StreamExtensions
44 | {
45 | // 81920 seems to be the default buffer size used in .NET 4.5.1
46 | private const int BUFFER_SIZE = 81920;
47 |
48 | ///
49 | /// Write the contents of the current stream to the destination stream
50 | ///
51 | public static void CopyTo(this Stream source, Stream destination)
52 | {
53 | if (destination == null)
54 | {
55 | throw new ArgumentNullException(nameof(destination));
56 | }
57 |
58 | byte[] buffer = new byte[BUFFER_SIZE];
59 | int numBytesRead;
60 | while ((numBytesRead = source.Read(buffer, 0, buffer.Length)) > 0) {
61 | destination.Write(buffer, 0, numBytesRead);
62 | }
63 | }
64 | }
65 | }
66 | #endif
67 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/ExtensionAccessor.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | namespace Google.Protobuf.Reflection
34 | {
35 | internal sealed class ExtensionAccessor : IFieldAccessor
36 | {
37 | private readonly Extension extension;
38 | private readonly ReflectionUtil.IExtensionReflectionHelper helper;
39 |
40 | internal ExtensionAccessor(FieldDescriptor descriptor)
41 | {
42 | Descriptor = descriptor;
43 | extension = descriptor.Extension;
44 | helper = ReflectionUtil.CreateExtensionHelper(extension);
45 | }
46 |
47 | public FieldDescriptor Descriptor { get; }
48 |
49 | public void Clear(IMessage message)
50 | {
51 | helper.ClearExtension(message);
52 | }
53 |
54 | public bool HasValue(IMessage message)
55 | {
56 | return helper.HasExtension(message);
57 | }
58 |
59 | public object GetValue(IMessage message)
60 | {
61 | return helper.GetExtension(message);
62 | }
63 |
64 | public void SetValue(IMessage message, object value)
65 | {
66 | helper.SetExtension(message, value);
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WriterInternalState.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System;
34 | using System.Buffers;
35 | using System.Buffers.Binary;
36 | using System.Collections.Generic;
37 | using System.IO;
38 | using System.Runtime.CompilerServices;
39 | using System.Runtime.InteropServices;
40 | using System.Security;
41 | using System.Text;
42 | using Google.Protobuf.Collections;
43 |
44 | namespace Google.Protobuf
45 | {
46 |
47 | // warning: this is a mutable struct, so it needs to be only passed as a ref!
48 | internal struct WriterInternalState
49 | {
50 | // NOTE: the Span representing the current buffer is kept separate so that this doesn't have to be a ref struct and so it can
51 | // be included in CodedOutputStream's internal state
52 |
53 | internal int limit; // the size of the current buffer
54 | internal int position; // position in the current buffer
55 |
56 | internal WriteBufferHelper writeBufferHelper;
57 |
58 | // If non-null, the top level parse method was started with given coded output stream as an argument
59 | // which also means we can potentially fallback to calling WriteTo(CodedOutputStream cos) if needed.
60 | internal CodedOutputStream CodedOutputStream => writeBufferHelper.CodedOutputStream;
61 | }
62 | }
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/DescriptorUtil.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System.Collections.Generic;
34 | using System.Collections.ObjectModel;
35 |
36 | namespace Google.Protobuf.Reflection
37 | {
38 | ///
39 | /// Internal class containing utility methods when working with descriptors.
40 | ///
41 | internal static class DescriptorUtil
42 | {
43 | ///
44 | /// Equivalent to Func[TInput, int, TOutput] but usable in .NET 2.0. Only used to convert
45 | /// arrays.
46 | ///
47 | internal delegate TOutput IndexedConverter(TInput element, int index);
48 |
49 | ///
50 | /// Converts the given array into a read-only list, applying the specified conversion to
51 | /// each input element.
52 | ///
53 | internal static IList ConvertAndMakeReadOnly
54 | (IList input, IndexedConverter converter)
55 | {
56 | TOutput[] array = new TOutput[input.Count];
57 | for (int i = 0; i < array.Length; i++)
58 | {
59 | array[i] = converter(input[i], i);
60 | }
61 | return new ReadOnlyCollection(array);
62 | }
63 | }
64 | }
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System.Runtime.CompilerServices;
34 | using System.Security;
35 |
36 | // General Information about an assembly is controlled through the following
37 | // set of attributes. Change these attribute values to modify the information
38 | // associated with an assembly.
39 |
40 | #if !NCRUNCH
41 | [assembly: AllowPartiallyTrustedCallers]
42 | #endif
43 |
44 | [assembly: InternalsVisibleTo("Google.Protobuf.Test, PublicKey=" +
45 | "002400000480000094000000060200000024000052534131000400000100010025800fbcfc63a1" +
46 | "7c66b303aae80b03a6beaa176bb6bef883be436f2a1579edd80ce23edf151a1f4ced97af83abcd" +
47 | "981207041fd5b2da3b498346fcfcd94910d52f25537c4a43ce3fbe17dc7d43e6cbdb4d8f1242dc" +
48 | "b6bd9b5906be74da8daa7d7280f97130f318a16c07baf118839b156299a48522f9fae2371c9665" +
49 | "c5ae9cb6")]
50 |
51 | [assembly: InternalsVisibleTo("Google.Protobuf.Benchmarks, PublicKey=" +
52 | "002400000480000094000000060200000024000052534131000400000100010025800fbcfc63a1" +
53 | "7c66b303aae80b03a6beaa176bb6bef883be436f2a1579edd80ce23edf151a1f4ced97af83abcd" +
54 | "981207041fd5b2da3b498346fcfcd94910d52f25537c4a43ce3fbe17dc7d43e6cbdb4d8f1242dc" +
55 | "b6bd9b5906be74da8daa7d7280f97130f318a16c07baf118839b156299a48522f9fae2371c9665" +
56 | "c5ae9cb6")]
57 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/ByteStringAsync.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System;
34 | using System.IO;
35 | using System.Threading;
36 | using System.Threading.Tasks;
37 |
38 | namespace Google.Protobuf
39 | {
40 | ///
41 | /// SecuritySafeCritical attribute can not be placed on types with async methods.
42 | /// This class has ByteString's async methods so it can be marked with SecuritySafeCritical.
43 | ///
44 | internal static class ByteStringAsync
45 | {
46 | #if !NET35
47 | internal static async Task FromStreamAsyncCore(Stream stream, CancellationToken cancellationToken)
48 | {
49 | int capacity = stream.CanSeek ? checked((int)(stream.Length - stream.Position)) : 0;
50 | var memoryStream = new MemoryStream(capacity);
51 | // We have to specify the buffer size here, as there's no overload accepting the cancellation token
52 | // alone. But it's documented to use 81920 by default if not specified.
53 | await stream.CopyToAsync(memoryStream, 81920, cancellationToken);
54 | #if NETSTANDARD1_1
55 | byte[] bytes = memoryStream.ToArray();
56 | #else
57 | // Avoid an extra copy if we can.
58 | byte[] bytes = memoryStream.Length == memoryStream.Capacity ? memoryStream.GetBuffer() : memoryStream.ToArray();
59 | #endif
60 | return ByteString.AttachBytes(bytes);
61 | }
62 | #endif
63 | }
64 | }
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2015 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System.Reflection;
34 |
35 | namespace Google.Protobuf.Compatibility
36 | {
37 | ///
38 | /// Extension methods for , effectively providing
39 | /// the familiar members from previous desktop framework versions while
40 | /// targeting the newer releases, .NET Core etc.
41 | ///
42 | internal static class PropertyInfoExtensions
43 | {
44 | ///
45 | /// Returns the public getter of a property, or null if there is no such getter
46 | /// (either because it's read-only, or the getter isn't public).
47 | ///
48 | internal static MethodInfo GetGetMethod(this PropertyInfo target)
49 | {
50 | #if NET35
51 | var method = target.GetGetMethod();
52 | #else
53 | var method = target.GetMethod;
54 | #endif
55 | return method != null && method.IsPublic ? method : null;
56 | }
57 |
58 | ///
59 | /// Returns the public setter of a property, or null if there is no such setter
60 | /// (either because it's write-only, or the setter isn't public).
61 | ///
62 | internal static MethodInfo GetSetMethod(this PropertyInfo target)
63 | {
64 | #if NET35
65 | var method = target.GetSetMethod();
66 | #else
67 | var method = target.SetMethod;
68 | #endif
69 | return method != null && method.IsPublic ? method : null;
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/ByteArray.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System;
34 |
35 | namespace Google.Protobuf
36 | {
37 | ///
38 | /// Provides a utility routine to copy small arrays much more quickly than Buffer.BlockCopy
39 | ///
40 | internal static class ByteArray
41 | {
42 | ///
43 | /// The threshold above which you should use Buffer.BlockCopy rather than ByteArray.Copy
44 | ///
45 | private const int CopyThreshold = 12;
46 |
47 | ///
48 | /// Determines which copy routine to use based on the number of bytes to be copied.
49 | ///
50 | internal static void Copy(byte[] src, int srcOffset, byte[] dst, int dstOffset, int count)
51 | {
52 | if (count > CopyThreshold)
53 | {
54 | Buffer.BlockCopy(src, srcOffset, dst, dstOffset, count);
55 | }
56 | else
57 | {
58 | int stop = srcOffset + count;
59 | for (int i = srcOffset; i < stop; i++)
60 | {
61 | dst[dstOffset++] = src[i];
62 | }
63 | }
64 | }
65 |
66 | ///
67 | /// Reverses the order of bytes in the array
68 | ///
69 | internal static void Reverse(byte[] bytes)
70 | {
71 | for (int first = 0, last = bytes.Length - 1; first < last; first++, last--)
72 | {
73 | byte temp = bytes[first];
74 | bytes[first] = bytes[last];
75 | bytes[last] = temp;
76 | }
77 | }
78 | }
79 | }
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Collections/Lists.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2017 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System.Collections.Generic;
34 | using System.Collections.ObjectModel;
35 |
36 | namespace Google.Protobuf.Collections
37 | {
38 | ///
39 | /// Utility to compare if two Lists are the same, and the hash code
40 | /// of a List.
41 | ///
42 | public static class Lists
43 | {
44 | ///
45 | /// Checks if two lists are equal.
46 | ///
47 | public static bool Equals(List left, List right)
48 | {
49 | if (left == right)
50 | {
51 | return true;
52 | }
53 | if (left == null || right == null)
54 | {
55 | return false;
56 | }
57 | if (left.Count != right.Count)
58 | {
59 | return false;
60 | }
61 | IEqualityComparer comparer = EqualityComparer.Default;
62 | for (int i = 0; i < left.Count; i++)
63 | {
64 | if (!comparer.Equals(left[i], right[i]))
65 | {
66 | return false;
67 | }
68 | }
69 | return true;
70 | }
71 |
72 | ///
73 | /// Gets the list's hash code.
74 | ///
75 | public static int GetHashCode(List list)
76 | {
77 | if (list == null)
78 | {
79 | return 0;
80 | }
81 | int hash = 31;
82 | foreach (T element in list)
83 | {
84 | hash = hash * 29 + element.GetHashCode();
85 | }
86 | return hash;
87 | }
88 | }
89 | }
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/IFieldAccessor.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System;
34 | using System.Collections;
35 |
36 | namespace Google.Protobuf.Reflection
37 | {
38 | ///
39 | /// Allows fields to be reflectively accessed.
40 | ///
41 | public interface IFieldAccessor
42 | {
43 | ///
44 | /// Returns the descriptor associated with this field.
45 | ///
46 | FieldDescriptor Descriptor { get; }
47 |
48 | ///
49 | /// Clears the field in the specified message. (For repeated fields,
50 | /// this clears the list.)
51 | ///
52 | void Clear(IMessage message);
53 |
54 | ///
55 | /// Fetches the field value. For repeated values, this will be an
56 | /// implementation. For map values, this will be an
57 | /// implementation.
58 | ///
59 | object GetValue(IMessage message);
60 |
61 | ///
62 | /// Indicates whether the field in the specified message is set.
63 | /// For proto3 fields that aren't explicitly optional, this throws an
64 | ///
65 | bool HasValue(IMessage message);
66 |
67 | ///
68 | /// Mutator for single "simple" fields only.
69 | ///
70 | ///
71 | /// Repeated fields are mutated by fetching the value and manipulating it as a list.
72 | /// Map fields are mutated by fetching the value and manipulating it as a dictionary.
73 | ///
74 | /// The field is not a "simple" field.
75 | void SetValue(IMessage message, object value);
76 | }
77 | }
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/DescriptorValidationException.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System;
34 |
35 | namespace Google.Protobuf.Reflection
36 | {
37 | ///
38 | /// Thrown when building descriptors fails because the source DescriptorProtos
39 | /// are not valid.
40 | ///
41 | public sealed class DescriptorValidationException : Exception
42 | {
43 | private readonly String name;
44 | private readonly string description;
45 |
46 | ///
47 | /// The full name of the descriptor where the error occurred.
48 | ///
49 | public String ProblemSymbolName
50 | {
51 | get { return name; }
52 | }
53 |
54 | ///
55 | /// A human-readable description of the error. (The Message property
56 | /// is made up of the descriptor's name and this description.)
57 | ///
58 | public string Description
59 | {
60 | get { return description; }
61 | }
62 |
63 | internal DescriptorValidationException(IDescriptor problemDescriptor, string description) :
64 | base(problemDescriptor.FullName + ": " + description)
65 | {
66 | // Note that problemDescriptor may be partially uninitialized, so we
67 | // don't want to expose it directly to the user. So, we only provide
68 | // the name and the original proto.
69 | name = problemDescriptor.FullName;
70 | this.description = description;
71 | }
72 |
73 | internal DescriptorValidationException(IDescriptor problemDescriptor, string description, Exception cause) :
74 | base(problemDescriptor.FullName + ": " + description, cause)
75 | {
76 | name = problemDescriptor.FullName;
77 | this.description = description;
78 | }
79 | }
80 | }
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/ProtoPreconditions.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System;
34 |
35 | namespace Google.Protobuf
36 | {
37 | ///
38 | /// Helper methods for throwing exceptions when preconditions are not met.
39 | ///
40 | ///
41 | /// This class is used internally and by generated code; it is not particularly
42 | /// expected to be used from application code, although nothing prevents it
43 | /// from being used that way.
44 | ///
45 | public static class ProtoPreconditions
46 | {
47 | ///
48 | /// Throws an ArgumentNullException if the given value is null, otherwise
49 | /// return the value to the caller.
50 | ///
51 | public static T CheckNotNull(T value, string name) where T : class
52 | {
53 | if (value == null)
54 | {
55 | throw new ArgumentNullException(name);
56 | }
57 | return value;
58 | }
59 |
60 | ///
61 | /// Throws an ArgumentNullException if the given value is null, otherwise
62 | /// return the value to the caller.
63 | ///
64 | ///
65 | /// This is equivalent to but without the type parameter
66 | /// constraint. In most cases, the constraint is useful to prevent you from calling CheckNotNull
67 | /// with a value type - but it gets in the way if either you want to use it with a nullable
68 | /// value type, or you want to use it with an unconstrained type parameter.
69 | ///
70 | internal static T CheckNotNullUnconstrained(T value, string name)
71 | {
72 | if (value == null)
73 | {
74 | throw new ArgumentNullException(name);
75 | }
76 | return value;
77 | }
78 | }
79 | }
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WellKnownTypes/TimeExtensions.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2015 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System;
34 |
35 | namespace Google.Protobuf.WellKnownTypes
36 | {
37 | ///
38 | /// Extension methods on BCL time-related types, converting to protobuf types.
39 | ///
40 | public static class TimeExtensions
41 | {
42 | ///
43 | /// Converts the given to a .
44 | ///
45 | /// The date and time to convert to a timestamp.
46 | /// The value has a other than Utc.
47 | /// The converted timestamp.
48 | public static Timestamp ToTimestamp(this DateTime dateTime)
49 | {
50 | return Timestamp.FromDateTime(dateTime);
51 | }
52 |
53 | ///
54 | /// Converts the given to a
55 | ///
56 | /// The offset is taken into consideration when converting the value (so the same instant in time
57 | /// is represented) but is not a separate part of the resulting value. In other words, there is no
58 | /// roundtrip operation to retrieve the original DateTimeOffset.
59 | /// The date and time (with UTC offset) to convert to a timestamp.
60 | /// The converted timestamp.
61 | public static Timestamp ToTimestamp(this DateTimeOffset dateTimeOffset)
62 | {
63 | return Timestamp.FromDateTimeOffset(dateTimeOffset);
64 | }
65 |
66 | ///
67 | /// Converts the given to a .
68 | ///
69 | /// The time span to convert.
70 | /// The converted duration.
71 | public static Duration ToDuration(this TimeSpan timeSpan)
72 | {
73 | return Duration.FromTimeSpan(timeSpan);
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/ICustomDiagnosticMessage.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2016 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | namespace Google.Protobuf
34 | {
35 | ///
36 | /// A message type that has a custom string format for diagnostic purposes.
37 | ///
38 | ///
39 | ///
40 | /// Calling on a generated message type normally
41 | /// returns the JSON representation. If a message type implements this interface,
42 | /// then the method will be called instead of the regular
43 | /// JSON formatting code, but only when ToString() is called either on the message itself
44 | /// or on another message which contains it. This does not affect the normal JSON formatting of
45 | /// the message.
46 | ///
47 | ///
48 | /// For example, if you create a proto message representing a GUID, the internal
49 | /// representation may be a bytes field or four fixed32 fields. However, when debugging
50 | /// it may be more convenient to see a result in the same format as provides.
51 | ///
52 | /// This interface extends to avoid it accidentally being implemented
53 | /// on types other than messages, where it would not be used by anything in the framework.
54 | ///
55 | public interface ICustomDiagnosticMessage : IMessage
56 | {
57 | ///
58 | /// Returns a string representation of this object, for diagnostic purposes.
59 | ///
60 | ///
61 | /// This method is called when a message is formatted as part of a
62 | /// call. It does not affect the JSON representation used by other than
63 | /// in calls to . While it is recommended
64 | /// that the result is valid JSON, this is never assumed by the Protobuf library.
65 | ///
66 | /// A string representation of this object, for diagnostic purposes.
67 | string ToDiagnosticString();
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/IExtendableMessage.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2015 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using Google.Protobuf.Collections;
34 |
35 | namespace Google.Protobuf
36 | {
37 | ///
38 | /// Generic interface for a Protocol Buffers message containing one or more extensions, where the type parameter is expected to be the same type as the implementation class.
39 | /// This interface is experiemental and is subject to change.
40 | ///
41 | public interface IExtendableMessage : IMessage where T : IExtendableMessage
42 | {
43 | ///
44 | /// Gets the value of the specified extension
45 | ///
46 | TValue GetExtension(Extension extension);
47 |
48 | ///
49 | /// Gets the value of the specified repeated extension or null if the extension isn't registered in this set.
50 | /// For a version of this method that never returns null, use
51 | ///
52 | RepeatedField GetExtension(RepeatedExtension extension);
53 |
54 | ///
55 | /// Gets the value of the specified repeated extension, registering it if it hasn't already been registered.
56 | ///
57 | RepeatedField GetOrInitializeExtension(RepeatedExtension extension);
58 |
59 | ///
60 | /// Sets the value of the specified extension
61 | ///
62 | void SetExtension(Extension extension, TValue value);
63 |
64 | ///
65 | /// Gets whether the value of the specified extension is set
66 | ///
67 | bool HasExtension(Extension extension);
68 |
69 | ///
70 | /// Clears the value of the specified extension
71 | ///
72 | void ClearExtension(Extension extension);
73 |
74 | ///
75 | /// Clears the value of the specified repeated extension
76 | ///
77 | void ClearExtension(RepeatedExtension extension);
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/UnsafeByteOperations.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System;
34 | using System.Security;
35 |
36 | namespace Google.Protobuf
37 | {
38 | ///
39 | /// Provides a number of unsafe byte operations to be used by advanced applications with high performance
40 | /// requirements. These methods are referred to as "unsafe" due to the fact that they potentially expose
41 | /// the backing buffer of a to the application.
42 | ///
43 | ///
44 | ///
45 | /// The methods in this class should only be called if it is guaranteed that the buffer backing the
46 | /// will never change! Mutation of a can lead to unexpected
47 | /// and undesirable consequences in your application, and will likely be difficult to debug. Proceed with caution!
48 | ///
49 | ///
50 | /// This can have a number of significant side affects that have spooky-action-at-a-distance-like behavior. In
51 | /// particular, if the bytes value changes out from under a Protocol Buffer:
52 | ///
53 | ///
54 | /// -
55 | /// serialization may throw
56 | ///
57 | /// -
58 | /// serialization may succeed but the wrong bytes may be written out
59 | ///
60 | /// -
61 | /// objects that are normally immutable (such as ByteString) are no longer immutable
62 | ///
63 | /// -
64 | /// hashCode may be incorrect
65 | ///
66 | ///
67 | ///
68 | [SecuritySafeCritical]
69 | public static class UnsafeByteOperations
70 | {
71 | ///
72 | /// Constructs a new from the given bytes. The bytes are not copied,
73 | /// and must not be modified while the is in use.
74 | /// This API is experimental and subject to change.
75 | ///
76 | public static ByteString UnsafeWrap(ReadOnlyMemory bytes)
77 | {
78 | return ByteString.AttachBytes(bytes);
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/IMessage.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System;
34 | using Google.Protobuf.Reflection;
35 |
36 | namespace Google.Protobuf
37 | {
38 | ///
39 | /// Interface for a Protocol Buffers message, supporting
40 | /// basic operations required for serialization.
41 | ///
42 | public interface IMessage
43 | {
44 | ///
45 | /// Merges the data from the specified coded input stream with the current message.
46 | ///
47 | /// See the user guide for precise merge semantics.
48 | ///
49 | void MergeFrom(CodedInputStream input);
50 |
51 | ///
52 | /// Writes the data to the given coded output stream.
53 | ///
54 | /// Coded output stream to write the data to. Must not be null.
55 | void WriteTo(CodedOutputStream output);
56 |
57 | ///
58 | /// Calculates the size of this message in Protocol Buffer wire format, in bytes.
59 | ///
60 | /// The number of bytes required to write this message
61 | /// to a coded output stream.
62 | int CalculateSize();
63 |
64 | ///
65 | /// Descriptor for this message. All instances are expected to return the same descriptor,
66 | /// and for generated types this will be an explicitly-implemented member, returning the
67 | /// same value as the static property declared on the type.
68 | ///
69 | MessageDescriptor Descriptor { get; }
70 | }
71 |
72 | ///
73 | /// Generic interface for a Protocol Buffers message,
74 | /// where the type parameter is expected to be the same type as
75 | /// the implementation class.
76 | ///
77 | /// The message type.
78 | public interface IMessage : IMessage, IEquatable, IDeepCloneable where T : IMessage
79 | {
80 | ///
81 | /// Merges the given message into this one.
82 | ///
83 | /// See the user guide for precise merge semantics.
84 | /// The message to merge with this one. Must not be null.
85 | void MergeFrom(T message);
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/LimitedInputStream.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2015 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System;
34 | using System.IO;
35 |
36 | namespace Google.Protobuf
37 | {
38 | ///
39 | /// Stream implementation which proxies another stream, only allowing a certain amount
40 | /// of data to be read. Note that this is only used to read delimited streams, so it
41 | /// doesn't attempt to implement everything.
42 | ///
43 | internal sealed class LimitedInputStream : Stream
44 | {
45 | private readonly Stream proxied;
46 | private int bytesLeft;
47 |
48 | internal LimitedInputStream(Stream proxied, int size)
49 | {
50 | this.proxied = proxied;
51 | bytesLeft = size;
52 | }
53 |
54 | public override bool CanRead
55 | {
56 | get { return true; }
57 | }
58 |
59 | public override bool CanSeek
60 | {
61 | get { return false; }
62 | }
63 |
64 | public override bool CanWrite
65 | {
66 | get { return false; }
67 | }
68 |
69 | public override void Flush()
70 | {
71 | }
72 |
73 | public override long Length
74 | {
75 | get { throw new NotSupportedException(); }
76 | }
77 |
78 | public override long Position
79 | {
80 | get { throw new NotSupportedException(); }
81 | set { throw new NotSupportedException(); }
82 | }
83 |
84 | public override int Read(byte[] buffer, int offset, int count)
85 | {
86 | if (bytesLeft > 0)
87 | {
88 | int bytesRead = proxied.Read(buffer, offset, Math.Min(bytesLeft, count));
89 | bytesLeft -= bytesRead;
90 | return bytesRead;
91 | }
92 | return 0;
93 | }
94 |
95 | public override long Seek(long offset, SeekOrigin origin)
96 | {
97 | throw new NotSupportedException();
98 | }
99 |
100 | public override void SetLength(long value)
101 | {
102 | throw new NotSupportedException();
103 | }
104 |
105 | public override void Write(byte[] buffer, int offset, int count)
106 | {
107 | throw new NotSupportedException();
108 | }
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/FieldType.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | namespace Google.Protobuf.Reflection
34 | {
35 | ///
36 | /// Enumeration of all the possible field types.
37 | ///
38 | public enum FieldType
39 | {
40 | ///
41 | /// The double field type.
42 | ///
43 | Double,
44 | ///
45 | /// The float field type.
46 | ///
47 | Float,
48 | ///
49 | /// The int64 field type.
50 | ///
51 | Int64,
52 | ///
53 | /// The uint64 field type.
54 | ///
55 | UInt64,
56 | ///
57 | /// The int32 field type.
58 | ///
59 | Int32,
60 | ///
61 | /// The fixed64 field type.
62 | ///
63 | Fixed64,
64 | ///
65 | /// The fixed32 field type.
66 | ///
67 | Fixed32,
68 | ///
69 | /// The bool field type.
70 | ///
71 | Bool,
72 | ///
73 | /// The string field type.
74 | ///
75 | String,
76 | ///
77 | /// The field type used for groups.
78 | ///
79 | Group,
80 | ///
81 | /// The field type used for message fields.
82 | ///
83 | Message,
84 | ///
85 | /// The bytes field type.
86 | ///
87 | Bytes,
88 | ///
89 | /// The uint32 field type.
90 | ///
91 | UInt32,
92 | ///
93 | /// The sfixed32 field type.
94 | ///
95 | SFixed32,
96 | ///
97 | /// The sfixed64 field type.
98 | ///
99 | SFixed64,
100 | ///
101 | /// The sint32 field type.
102 | ///
103 | SInt32,
104 | ///
105 | /// The sint64 field type.
106 | ///
107 | SInt64,
108 | ///
109 | /// The field type used for enum fields.
110 | ///
111 | Enum
112 | }
113 | }
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/DescriptorBase.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System.Collections.Generic;
34 |
35 | namespace Google.Protobuf.Reflection
36 | {
37 | ///
38 | /// Base class for nearly all descriptors, providing common functionality.
39 | ///
40 | public abstract class DescriptorBase : IDescriptor
41 | {
42 | internal DescriptorBase(FileDescriptor file, string fullName, int index)
43 | {
44 | File = file;
45 | FullName = fullName;
46 | Index = index;
47 | }
48 |
49 | ///
50 | /// The index of this descriptor within its parent descriptor.
51 | ///
52 | ///
53 | /// This returns the index of this descriptor within its parent, for
54 | /// this descriptor's type. (There can be duplicate values for different
55 | /// types, e.g. one enum type with index 0 and one message type with index 0.)
56 | ///
57 | public int Index { get; }
58 |
59 | ///
60 | /// Returns the name of the entity (field, message etc) being described.
61 | ///
62 | public abstract string Name { get; }
63 |
64 | ///
65 | /// The fully qualified name of the descriptor's target.
66 | ///
67 | public string FullName { get; }
68 |
69 | ///
70 | /// The file this descriptor was declared in.
71 | ///
72 | public FileDescriptor File { get; }
73 |
74 | ///
75 | /// The declaration information about the descriptor, or null if no declaration information
76 | /// is available for this descriptor.
77 | ///
78 | ///
79 | /// This information is typically only available for dynamically loaded descriptors,
80 | /// for example within a protoc plugin where the full descriptors, including source info,
81 | /// are passed to the code by protoc.
82 | ///
83 | public DescriptorDeclaration Declaration => File.GetDeclaration(this);
84 |
85 | ///
86 | /// Retrieves the list of nested descriptors corresponding to the given field number, if any.
87 | /// If the field is unknown or not a nested descriptor list, return null to terminate the search.
88 | /// The default implementation returns null.
89 | ///
90 | internal virtual IReadOnlyList GetNestedDescriptorListForField(int fieldNumber) => null;
91 | }
92 | }
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WireFormat.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | namespace Google.Protobuf
34 | {
35 | ///
36 | /// This class is used internally by the Protocol Buffer Library and generated
37 | /// message implementations. It is public only for the sake of those generated
38 | /// messages. Others should not use this class directly.
39 | ///
40 | /// This class contains constants and helper functions useful for dealing with
41 | /// the Protocol Buffer wire format.
42 | ///
43 | ///
44 | public static class WireFormat
45 | {
46 | ///
47 | /// Wire types within protobuf encoding.
48 | ///
49 | public enum WireType : uint
50 | {
51 | ///
52 | /// Variable-length integer.
53 | ///
54 | Varint = 0,
55 | ///
56 | /// A fixed-length 64-bit value.
57 | ///
58 | Fixed64 = 1,
59 | ///
60 | /// A length-delimited value, i.e. a length followed by that many bytes of data.
61 | ///
62 | LengthDelimited = 2,
63 | ///
64 | /// A "start group" value
65 | ///
66 | StartGroup = 3,
67 | ///
68 | /// An "end group" value
69 | ///
70 | EndGroup = 4,
71 | ///
72 | /// A fixed-length 32-bit value.
73 | ///
74 | Fixed32 = 5
75 | }
76 |
77 | private const int TagTypeBits = 3;
78 | private const uint TagTypeMask = (1 << TagTypeBits) - 1;
79 |
80 | ///
81 | /// Given a tag value, determines the wire type (lower 3 bits).
82 | ///
83 | public static WireType GetTagWireType(uint tag)
84 | {
85 | return (WireType) (tag & TagTypeMask);
86 | }
87 |
88 | ///
89 | /// Given a tag value, determines the field number (the upper 29 bits).
90 | ///
91 | public static int GetTagFieldNumber(uint tag)
92 | {
93 | return (int) tag >> TagTypeBits;
94 | }
95 |
96 | ///
97 | /// Makes a tag value given a field number and wire type.
98 | ///
99 | public static uint MakeTag(int fieldNumber, WireType wireType)
100 | {
101 | return (uint) (fieldNumber << TagTypeBits) | (uint) wireType;
102 | }
103 | }
104 | }
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/OneofAccessor.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2015 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System;
34 | using System.Reflection;
35 | using Google.Protobuf.Compatibility;
36 |
37 | namespace Google.Protobuf.Reflection
38 | {
39 | ///
40 | /// Reflection access for a oneof, allowing clear and "get case" actions.
41 | ///
42 | public sealed class OneofAccessor
43 | {
44 | private readonly Func caseDelegate;
45 | private readonly Action clearDelegate;
46 |
47 | private OneofAccessor(OneofDescriptor descriptor, Func caseDelegate, Action clearDelegate)
48 | {
49 | Descriptor = descriptor;
50 | this.caseDelegate = caseDelegate;
51 | this.clearDelegate = clearDelegate;
52 | }
53 |
54 | internal static OneofAccessor ForRegularOneof(
55 | OneofDescriptor descriptor,
56 | PropertyInfo caseProperty,
57 | MethodInfo clearMethod) =>
58 | new OneofAccessor(
59 | descriptor,
60 | ReflectionUtil.CreateFuncIMessageInt32(caseProperty.GetGetMethod()),
61 | ReflectionUtil.CreateActionIMessage(clearMethod));
62 |
63 | internal static OneofAccessor ForSyntheticOneof(OneofDescriptor descriptor)
64 | {
65 | // Note: descriptor.Fields will be null when this method is called, because we haven't
66 | // cross-linked yet. But by the time the delegates are called by user code, all will be
67 | // well. (That's why we capture the descriptor itself rather than a field.)
68 | return new OneofAccessor(descriptor,
69 | message => descriptor.Fields[0].Accessor.HasValue(message) ? descriptor.Fields[0].FieldNumber : 0,
70 | message => descriptor.Fields[0].Accessor.Clear(message));
71 | }
72 |
73 | ///
74 | /// Gets the descriptor for this oneof.
75 | ///
76 | ///
77 | /// The descriptor of the oneof.
78 | ///
79 | public OneofDescriptor Descriptor { get; }
80 |
81 | ///
82 | /// Clears the oneof in the specified message.
83 | ///
84 | public void Clear(IMessage message) => clearDelegate(message);
85 |
86 | ///
87 | /// Indicates which field in the oneof is set for specified message
88 | ///
89 | public FieldDescriptor GetCaseFieldDescriptor(IMessage message)
90 | {
91 | int fieldNumber = caseDelegate(message);
92 | return fieldNumber > 0
93 | ? Descriptor.ContainingType.FindFieldByNumber(fieldNumber)
94 | : null;
95 | }
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/WellKnownTypes/ValuePartial.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | namespace Google.Protobuf.WellKnownTypes
34 | {
35 | public partial class Value
36 | {
37 | ///
38 | /// Convenience method to create a Value message with a string value.
39 | ///
40 | /// Value to set for the StringValue property.
41 | /// A newly-created Value message with the given value.
42 | public static Value ForString(string value)
43 | {
44 | ProtoPreconditions.CheckNotNull(value, "value");
45 | return new Value { StringValue = value };
46 | }
47 |
48 | ///
49 | /// Convenience method to create a Value message with a number value.
50 | ///
51 | /// Value to set for the NumberValue property.
52 | /// A newly-created Value message with the given value.
53 | public static Value ForNumber(double value)
54 | {
55 | return new Value { NumberValue = value };
56 | }
57 |
58 | ///
59 | /// Convenience method to create a Value message with a Boolean value.
60 | ///
61 | /// Value to set for the BoolValue property.
62 | /// A newly-created Value message with the given value.
63 | public static Value ForBool(bool value)
64 | {
65 | return new Value { BoolValue = value };
66 | }
67 |
68 | ///
69 | /// Convenience method to create a Value message with a null initial value.
70 | ///
71 | /// A newly-created Value message a null initial value.
72 | public static Value ForNull()
73 | {
74 | return new Value { NullValue = 0 };
75 | }
76 |
77 | ///
78 | /// Convenience method to create a Value message with an initial list of values.
79 | ///
80 | /// The values provided are not cloned; the references are copied directly.
81 | /// A newly-created Value message an initial list value.
82 | public static Value ForList(params Value[] values)
83 | {
84 | ProtoPreconditions.CheckNotNull(values, "values");
85 | return new Value { ListValue = new ListValue { Values = { values } } };
86 | }
87 |
88 | ///
89 | /// Convenience method to create a Value message with an initial struct value
90 | ///
91 | /// The value provided is not cloned; the reference is copied directly.
92 | /// A newly-created Value message an initial struct value.
93 | public static Value ForStruct(Struct value)
94 | {
95 | ProtoPreconditions.CheckNotNull(value, "value");
96 | return new Value { StructValue = value };
97 | }
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Collections/ReadOnlyDictionary.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System;
34 | using System.Collections;
35 | using System.Collections.Generic;
36 |
37 | namespace Google.Protobuf.Collections
38 | {
39 | ///
40 | /// Read-only wrapper around another dictionary.
41 | ///
42 | internal sealed class ReadOnlyDictionary : IDictionary
43 | {
44 | private readonly IDictionary wrapped;
45 |
46 | public ReadOnlyDictionary(IDictionary wrapped)
47 | {
48 | this.wrapped = wrapped;
49 | }
50 |
51 | public void Add(TKey key, TValue value)
52 | {
53 | throw new InvalidOperationException();
54 | }
55 |
56 | public bool ContainsKey(TKey key)
57 | {
58 | return wrapped.ContainsKey(key);
59 | }
60 |
61 | public ICollection Keys
62 | {
63 | get { return wrapped.Keys; }
64 | }
65 |
66 | public bool Remove(TKey key)
67 | {
68 | throw new InvalidOperationException();
69 | }
70 |
71 | public bool TryGetValue(TKey key, out TValue value)
72 | {
73 | return wrapped.TryGetValue(key, out value);
74 | }
75 |
76 | public ICollection Values
77 | {
78 | get { return wrapped.Values; }
79 | }
80 |
81 | public TValue this[TKey key]
82 | {
83 | get { return wrapped[key]; }
84 | set { throw new InvalidOperationException(); }
85 | }
86 |
87 | public void Add(KeyValuePair item)
88 | {
89 | throw new InvalidOperationException();
90 | }
91 |
92 | public void Clear()
93 | {
94 | throw new InvalidOperationException();
95 | }
96 |
97 | public bool Contains(KeyValuePair item)
98 | {
99 | return wrapped.Contains(item);
100 | }
101 |
102 | public void CopyTo(KeyValuePair[] array, int arrayIndex)
103 | {
104 | wrapped.CopyTo(array, arrayIndex);
105 | }
106 |
107 | public int Count
108 | {
109 | get { return wrapped.Count; }
110 | }
111 |
112 | public bool IsReadOnly
113 | {
114 | get { return true; }
115 | }
116 |
117 | public bool Remove(KeyValuePair item)
118 | {
119 | throw new InvalidOperationException();
120 | }
121 |
122 | public IEnumerator> GetEnumerator()
123 | {
124 | return wrapped.GetEnumerator();
125 | }
126 |
127 | IEnumerator IEnumerable.GetEnumerator()
128 | {
129 | return ((IEnumerable) wrapped).GetEnumerator();
130 | }
131 |
132 | public override bool Equals(object obj)
133 | {
134 | return wrapped.Equals(obj);
135 | }
136 |
137 | public override int GetHashCode()
138 | {
139 | return wrapped.GetHashCode();
140 | }
141 |
142 | public override string ToString()
143 | {
144 | return wrapped.ToString();
145 | }
146 | }
147 | }
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/EnumValueDescriptor.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using Google.Protobuf.Collections;
34 | using System;
35 |
36 | namespace Google.Protobuf.Reflection
37 | {
38 | ///
39 | /// Descriptor for a single enum value within an enum in a .proto file.
40 | ///
41 | public sealed class EnumValueDescriptor : DescriptorBase
42 | {
43 | private readonly EnumDescriptor enumDescriptor;
44 | private readonly EnumValueDescriptorProto proto;
45 |
46 | internal EnumValueDescriptor(EnumValueDescriptorProto proto, FileDescriptor file,
47 | EnumDescriptor parent, int index)
48 | : base(file, parent.FullName + "." + proto.Name, index)
49 | {
50 | this.proto = proto;
51 | enumDescriptor = parent;
52 | file.DescriptorPool.AddSymbol(this);
53 | file.DescriptorPool.AddEnumValueByNumber(this);
54 | }
55 |
56 | internal EnumValueDescriptorProto Proto { get { return proto; } }
57 |
58 | ///
59 | /// Returns the name of the enum value described by this object.
60 | ///
61 | public override string Name { get { return proto.Name; } }
62 |
63 | ///
64 | /// Returns the number associated with this enum value.
65 | ///
66 | public int Number { get { return Proto.Number; } }
67 |
68 | ///
69 | /// Returns the enum descriptor that this value is part of.
70 | ///
71 | public EnumDescriptor EnumDescriptor { get { return enumDescriptor; } }
72 |
73 | ///
74 | /// The (possibly empty) set of custom options for this enum value.
75 | ///
76 | [Obsolete("CustomOptions are obsolete. Use the GetOptions() method.")]
77 | public CustomOptions CustomOptions => new CustomOptions(Proto.Options?._extensions?.ValuesByNumber);
78 |
79 | ///
80 | /// The EnumValueOptions, defined in descriptor.proto.
81 | /// If the options message is not present (i.e. there are no options), null is returned.
82 | /// Custom options can be retrieved as extensions of the returned message.
83 | /// NOTE: A defensive copy is created each time this property is retrieved.
84 | ///
85 | public EnumValueOptions GetOptions() => Proto.Options?.Clone();
86 |
87 | ///
88 | /// Gets a single value enum value option for this descriptor
89 | ///
90 | [Obsolete("GetOption is obsolete. Use the GetOptions() method.")]
91 | public T GetOption(Extension extension)
92 | {
93 | var value = Proto.Options.GetExtension(extension);
94 | return value is IDeepCloneable ? (value as IDeepCloneable).Clone() : value;
95 | }
96 |
97 | ///
98 | /// Gets a repeated value enum value option for this descriptor
99 | ///
100 | [Obsolete("GetOption is obsolete. Use the GetOptions() method.")]
101 | public RepeatedField GetOption(RepeatedExtension extension)
102 | {
103 | return Proto.Options.GetExtension(extension).Clone();
104 | }
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/ParserInternalState.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System;
34 | using System.Buffers;
35 | using System.Buffers.Binary;
36 | using System.Collections.Generic;
37 | using System.IO;
38 | using System.Runtime.CompilerServices;
39 | using System.Runtime.InteropServices;
40 | using System.Security;
41 | using System.Text;
42 | using Google.Protobuf.Collections;
43 |
44 | namespace Google.Protobuf
45 | {
46 |
47 | // warning: this is a mutable struct, so it needs to be only passed as a ref!
48 | internal struct ParserInternalState
49 | {
50 | // NOTE: the Span representing the current buffer is kept separate so that this doesn't have to be a ref struct and so it can
51 | // be included in CodedInputStream's internal state
52 |
53 | ///
54 | /// The position within the current buffer (i.e. the next byte to read)
55 | ///
56 | internal int bufferPos;
57 |
58 | ///
59 | /// Size of the current buffer
60 | ///
61 | internal int bufferSize;
62 |
63 | ///
64 | /// If we are currently inside a length-delimited block, this is the number of
65 | /// bytes in the buffer that are still available once we leave the delimited block.
66 | ///
67 | internal int bufferSizeAfterLimit;
68 |
69 | ///
70 | /// The absolute position of the end of the current length-delimited block (including totalBytesRetired)
71 | ///
72 | internal int currentLimit;
73 |
74 | ///
75 | /// The total number of consumed before the start of the current buffer. The
76 | /// total bytes read up to the current position can be computed as
77 | /// totalBytesRetired + bufferPos.
78 | ///
79 | internal int totalBytesRetired;
80 |
81 | internal int recursionDepth; // current recursion depth
82 |
83 | internal SegmentedBufferHelper segmentedBufferHelper;
84 |
85 | ///
86 | /// The last tag we read. 0 indicates we've read to the end of the stream
87 | /// (or haven't read anything yet).
88 | ///
89 | internal uint lastTag;
90 |
91 | ///
92 | /// The next tag, used to store the value read by PeekTag.
93 | ///
94 | internal uint nextTag;
95 | internal bool hasNextTag;
96 |
97 | // these fields are configuration, they should be readonly
98 | internal int sizeLimit;
99 | internal int recursionLimit;
100 |
101 | // If non-null, the top level parse method was started with given coded input stream as an argument
102 | // which also means we can potentially fallback to calling MergeFrom(CodedInputStream cis) if needed.
103 | internal CodedInputStream CodedInputStream => segmentedBufferHelper.CodedInputStream;
104 |
105 | ///
106 | /// Internal-only property; when set to true, unknown fields will be discarded while parsing.
107 | ///
108 | internal bool DiscardUnknownFields { get; set; }
109 |
110 | ///
111 | /// Internal-only property; provides extension identifiers to compatible messages while parsing.
112 | ///
113 | internal ExtensionRegistry ExtensionRegistry { get; set; }
114 | }
115 | }
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Extension.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2008 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System;
34 |
35 | namespace Google.Protobuf
36 | {
37 | ///
38 | /// Represents a non-generic extension definition. This API is experimental and subject to change.
39 | ///
40 | public abstract class Extension
41 | {
42 | internal abstract Type TargetType { get; }
43 |
44 | ///
45 | /// Internal use. Creates a new extension with the specified field number.
46 | ///
47 | protected Extension(int fieldNumber)
48 | {
49 | FieldNumber = fieldNumber;
50 | }
51 |
52 | internal abstract IExtensionValue CreateValue();
53 |
54 | ///
55 | /// Gets the field number of this extension
56 | ///
57 | public int FieldNumber { get; }
58 |
59 | internal abstract bool IsRepeated { get; }
60 | }
61 |
62 | ///
63 | /// Represents a type-safe extension identifier used for getting and setting single extension values in instances.
64 | /// This API is experimental and subject to change.
65 | ///
66 | /// The message type this field applies to
67 | /// The field value type of this extension
68 | public sealed class Extension : Extension where TTarget : IExtendableMessage
69 | {
70 | private readonly FieldCodec codec;
71 |
72 | ///
73 | /// Creates a new extension identifier with the specified field number and codec
74 | ///
75 | public Extension(int fieldNumber, FieldCodec codec) : base(fieldNumber)
76 | {
77 | this.codec = codec;
78 | }
79 |
80 | internal TValue DefaultValue => codec.DefaultValue;
81 |
82 | internal override Type TargetType => typeof(TTarget);
83 |
84 | internal override bool IsRepeated => false;
85 |
86 | internal override IExtensionValue CreateValue()
87 | {
88 | return new ExtensionValue(codec);
89 | }
90 | }
91 |
92 | ///
93 | /// Represents a type-safe extension identifier used for getting repeated extension values in instances.
94 | /// This API is experimental and subject to change.
95 | ///
96 | /// The message type this field applies to
97 | /// The repeated field value type of this extension
98 | public sealed class RepeatedExtension : Extension where TTarget : IExtendableMessage
99 | {
100 | private readonly FieldCodec codec;
101 |
102 | ///
103 | /// Creates a new repeated extension identifier with the specified field number and codec
104 | ///
105 | public RepeatedExtension(int fieldNumber, FieldCodec codec) : base(fieldNumber)
106 | {
107 | this.codec = codec;
108 | }
109 |
110 | internal override Type TargetType => typeof(TTarget);
111 |
112 | internal override bool IsRepeated => true;
113 |
114 | internal override IExtensionValue CreateValue()
115 | {
116 | return new RepeatedExtensionValue(codec);
117 | }
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Compatibility/TypeExtensions.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2015 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System;
34 | using System.Reflection;
35 |
36 | #if !NET35
37 | namespace Google.Protobuf.Compatibility
38 | {
39 | ///
40 | /// Provides extension methods on Type that just proxy to TypeInfo.
41 | /// These are used to support the new type system from .NET 4.5, without
42 | /// having calls to GetTypeInfo all over the place. While the methods here are meant to be
43 | /// broadly compatible with the desktop framework, there are some subtle differences in behaviour - but
44 | /// they're not expected to affect our use cases. While the class is internal, that should be fine: we can
45 | /// evaluate each new use appropriately.
46 | ///
47 | internal static class TypeExtensions
48 | {
49 | ///
50 | /// See https://msdn.microsoft.com/en-us/library/system.type.isassignablefrom
51 | ///
52 | internal static bool IsAssignableFrom(this Type target, Type c)
53 | {
54 | return target.GetTypeInfo().IsAssignableFrom(c.GetTypeInfo());
55 | }
56 |
57 | ///
58 | /// Returns a representation of the public property associated with the given name in the given type,
59 | /// including inherited properties or null if there is no such public property.
60 | /// Here, "public property" means a property where either the getter, or the setter, or both, is public.
61 | ///
62 | internal static PropertyInfo GetProperty(this Type target, string name)
63 | {
64 | // GetDeclaredProperty only returns properties declared in the given type, so we need to recurse.
65 | while (target != null)
66 | {
67 | var typeInfo = target.GetTypeInfo();
68 | var ret = typeInfo.GetDeclaredProperty(name);
69 | if (ret != null && ((ret.CanRead && ret.GetMethod.IsPublic) || (ret.CanWrite && ret.SetMethod.IsPublic)))
70 | {
71 | return ret;
72 | }
73 | target = typeInfo.BaseType;
74 | }
75 | return null;
76 | }
77 |
78 | ///
79 | /// Returns a representation of the public method associated with the given name in the given type,
80 | /// including inherited methods.
81 | ///
82 | ///
83 | /// This has a few differences compared with Type.GetMethod in the desktop framework. It will throw
84 | /// if there is an ambiguous match even between a private method and a public one, but it *won't* throw
85 | /// if there are two overloads at different levels in the type hierarchy (e.g. class Base declares public void Foo(int) and
86 | /// class Child : Base declares public void Foo(long)).
87 | ///
88 | /// One type in the hierarchy declared more than one method with the same name
89 | internal static MethodInfo GetMethod(this Type target, string name)
90 | {
91 | // GetDeclaredMethod only returns methods declared in the given type, so we need to recurse.
92 | while (target != null)
93 | {
94 | var typeInfo = target.GetTypeInfo();
95 | var ret = typeInfo.GetDeclaredMethod(name);
96 | if (ret != null && ret.IsPublic)
97 | {
98 | return ret;
99 | }
100 | target = typeInfo.BaseType;
101 | }
102 | return null;
103 | }
104 | }
105 | }
106 | #endif
107 |
--------------------------------------------------------------------------------
/Runtime/Google.Protobuf/Reflection/DescriptorDeclaration.cs:
--------------------------------------------------------------------------------
1 | #region Copyright notice and license
2 | // Protocol Buffers - Google's data interchange format
3 | // Copyright 2018 Google Inc. All rights reserved.
4 | // https://developers.google.com/protocol-buffers/
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #endregion
32 |
33 | using System;
34 | using System.Collections.Generic;
35 | using System.Collections.ObjectModel;
36 | using System.Linq;
37 | using System.Text;
38 | using static Google.Protobuf.Reflection.SourceCodeInfo.Types;
39 |
40 | namespace Google.Protobuf.Reflection
41 | {
42 | ///
43 | /// Provides additional information about the declaration of a descriptor,
44 | /// such as source location and comments.
45 | ///
46 | public sealed class DescriptorDeclaration
47 | {
48 | ///
49 | /// The descriptor this declaration relates to.
50 | ///
51 | public IDescriptor Descriptor { get; }
52 |
53 | ///
54 | /// The start line of the declaration within the source file. This value is 1-based.
55 | ///
56 | public int StartLine { get; }
57 | ///
58 | /// The start column of the declaration within the source file. This value is 1-based.
59 | ///
60 | public int StartColumn { get; }
61 |
62 | ///
63 | /// // The end line of the declaration within the source file. This value is 1-based.
64 | ///
65 | public int EndLine { get; }
66 | ///
67 | /// The end column of the declaration within the source file. This value is 1-based, and
68 | /// exclusive. (The final character of the declaration is on the column before this value.)
69 | ///
70 | public int EndColumn { get; }
71 |
72 | ///
73 | /// Comments appearing before the declaration. Never null, but may be empty. Multi-line comments
74 | /// are represented as a newline-separated string. Leading whitespace and the comment marker ("//")
75 | /// are removed from each line.
76 | ///
77 | public string LeadingComments { get; }
78 |
79 | ///
80 | /// Comments appearing after the declaration. Never null, but may be empty. Multi-line comments
81 | /// are represented as a newline-separated string. Leading whitespace and the comment marker ("//")
82 | /// are removed from each line.
83 | ///
84 | public string TrailingComments { get; }
85 |
86 | ///
87 | /// Comments appearing before the declaration, but separated from it by blank
88 | /// lines. Each string represents a newline-separated paragraph of comments.
89 | /// Leading whitespace and the comment marker ("//") are removed from each line.
90 | /// The list is never null, but may be empty. Likewise each element is never null, but may be empty.
91 | ///
92 | public IReadOnlyList LeadingDetachedComments { get; }
93 |
94 | private DescriptorDeclaration(IDescriptor descriptor, Location location)
95 | {
96 | // TODO: Validation
97 | Descriptor = descriptor;
98 | bool hasEndLine = location.Span.Count == 4;
99 | // Lines and columns are 0-based in the proto.
100 | StartLine = location.Span[0] + 1;
101 | StartColumn = location.Span[1] + 1;
102 | EndLine = hasEndLine ? location.Span[2] + 1 : StartLine;
103 | EndColumn = location.Span[hasEndLine ? 3 : 2] + 1;
104 | LeadingComments = location.LeadingComments;
105 | TrailingComments = location.TrailingComments;
106 | LeadingDetachedComments = new ReadOnlyCollection(location.LeadingDetachedComments.ToList());
107 | }
108 |
109 | internal static DescriptorDeclaration FromProto(IDescriptor descriptor, Location location) =>
110 | new DescriptorDeclaration(descriptor, location);
111 | }
112 | }
113 |
--------------------------------------------------------------------------------