diff --git a/.gitattributes b/.gitattributes index 762e01718..467d6642e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -51,4 +51,5 @@ *.dylib filter=lfs diff=lfs merge=lfs -text *.bundle filter=lfs diff=lfs merge=lfs -text *.engine filter=lfs diff=lfs merge=lfs -text -*.sbsar filter=lfs diff=lfs merge=lfs -text \ No newline at end of file +*.sbsar filter=lfs diff=lfs merge=lfs -text +*.a filter=lfs diff=lfs merge=lfs -text \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 000000000..e69de29bb diff --git a/.idea/.idea.Aetheria-Economy/.idea/.gitignore b/.idea/.idea.Aetheria-Economy/.idea/.gitignore new file mode 100644 index 000000000..5c98b4288 --- /dev/null +++ b/.idea/.idea.Aetheria-Economy/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml \ No newline at end of file diff --git a/.idea/.idea.Aetheria-Economy/.idea/contentModel.xml b/.idea/.idea.Aetheria-Economy/.idea/contentModel.xml new file mode 100644 index 000000000..5c02b7a0b --- /dev/null +++ b/.idea/.idea.Aetheria-Economy/.idea/contentModel.xml @@ -0,0 +1,221 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.Aetheria-Economy/.idea/encodings.xml b/.idea/.idea.Aetheria-Economy/.idea/encodings.xml new file mode 100644 index 000000000..15a15b218 --- /dev/null +++ b/.idea/.idea.Aetheria-Economy/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.Aetheria-Economy/.idea/indexLayout.xml b/.idea/.idea.Aetheria-Economy/.idea/indexLayout.xml new file mode 100644 index 000000000..59657e7c7 --- /dev/null +++ b/.idea/.idea.Aetheria-Economy/.idea/indexLayout.xml @@ -0,0 +1,23 @@ + + + + + + Library/PackageCache/com.unity.package-manager-ui@2.0.8 + Library/PackageCache/com.unity.textmeshpro@1.4.1 + Packages + ProjectSettings + + + .git + .idea + Economy.Server + Economy.Shared + Library + Logs + Server + Temp + obj + + + \ No newline at end of file diff --git a/.idea/.idea.Aetheria-Economy/.idea/modules.xml b/.idea/.idea.Aetheria-Economy/.idea/modules.xml new file mode 100644 index 000000000..a208ed7a3 --- /dev/null +++ b/.idea/.idea.Aetheria-Economy/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.Aetheria-Economy/.idea/projectSettingsUpdater.xml b/.idea/.idea.Aetheria-Economy/.idea/projectSettingsUpdater.xml new file mode 100644 index 000000000..7515e7605 --- /dev/null +++ b/.idea/.idea.Aetheria-Economy/.idea/projectSettingsUpdater.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/.idea.Aetheria-Economy/.idea/vcs.xml b/.idea/.idea.Aetheria-Economy/.idea/vcs.xml new file mode 100644 index 000000000..94a25f7f4 --- /dev/null +++ b/.idea/.idea.Aetheria-Economy/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/.idea.Aetheria-Economy/riderModule.iml b/.idea/.idea.Aetheria-Economy/riderModule.iml new file mode 100644 index 000000000..1a4e0d95f --- /dev/null +++ b/.idea/.idea.Aetheria-Economy/riderModule.iml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.Economy/.idea/.gitignore b/.idea/.idea.Economy/.idea/.gitignore new file mode 100644 index 000000000..5c98b4288 --- /dev/null +++ b/.idea/.idea.Economy/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml \ No newline at end of file diff --git a/.idea/.idea.Economy/.idea/.name b/.idea/.idea.Economy/.idea/.name new file mode 100644 index 000000000..bc0cd0567 --- /dev/null +++ b/.idea/.idea.Economy/.idea/.name @@ -0,0 +1 @@ +Economy \ No newline at end of file diff --git a/.idea/.idea.Economy/.idea/contentModel.xml b/.idea/.idea.Economy/.idea/contentModel.xml new file mode 100644 index 000000000..0521333ab --- /dev/null +++ b/.idea/.idea.Economy/.idea/contentModel.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.Economy/.idea/encodings.xml b/.idea/.idea.Economy/.idea/encodings.xml new file mode 100644 index 000000000..15a15b218 --- /dev/null +++ b/.idea/.idea.Economy/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.Economy/.idea/indexLayout.xml b/.idea/.idea.Economy/.idea/indexLayout.xml new file mode 100644 index 000000000..2f6cd4809 --- /dev/null +++ b/.idea/.idea.Economy/.idea/indexLayout.xml @@ -0,0 +1,22 @@ + + + + + + Assets + Library/PackageCache/com.unity.package-manager-ui@2.0.8 + Library/PackageCache/com.unity.textmeshpro@1.4.1 + Packages + ProjectSettings + + + .git + .idea + Library + Logs + Server + Temp + obj + + + \ No newline at end of file diff --git a/.idea/.idea.Economy/.idea/modules.xml b/.idea/.idea.Economy/.idea/modules.xml new file mode 100644 index 000000000..b561af881 --- /dev/null +++ b/.idea/.idea.Economy/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.Economy/.idea/projectSettingsUpdater.xml b/.idea/.idea.Economy/.idea/projectSettingsUpdater.xml new file mode 100644 index 000000000..7515e7605 --- /dev/null +++ b/.idea/.idea.Economy/.idea/projectSettingsUpdater.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/.idea.Economy/.idea/vcs.xml b/.idea/.idea.Economy/.idea/vcs.xml new file mode 100644 index 000000000..94a25f7f4 --- /dev/null +++ b/.idea/.idea.Economy/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/.idea.Economy/riderModule.iml b/.idea/.idea.Economy/riderModule.iml new file mode 100644 index 000000000..1a4e0d95f --- /dev/null +++ b/.idea/.idea.Economy/riderModule.iml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Assets/Plugins.meta b/Assets/Plugins.meta new file mode 100644 index 000000000..e5bd13300 --- /dev/null +++ b/Assets/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 90833898188c49d46afaf79612689387 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Editor.meta b/Assets/Plugins/Editor.meta new file mode 100644 index 000000000..eb9c50384 --- /dev/null +++ b/Assets/Plugins/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1829d9a4a1359de47bda1a7f40ce3d04 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Google.Protobuf.meta b/Assets/Plugins/Google.Protobuf.meta new file mode 100644 index 000000000..c9d3ca96b --- /dev/null +++ b/Assets/Plugins/Google.Protobuf.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4b6ebd913ac610041b63fc847ee96302 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Google.Protobuf/lib.meta b/Assets/Plugins/Google.Protobuf/lib.meta new file mode 100644 index 000000000..d415abf6d --- /dev/null +++ b/Assets/Plugins/Google.Protobuf/lib.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e4ab5b3f8a676a84a9eb3ffcf1e8138d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Google.Protobuf/lib/net45.meta b/Assets/Plugins/Google.Protobuf/lib/net45.meta new file mode 100644 index 000000000..b7670b6f7 --- /dev/null +++ b/Assets/Plugins/Google.Protobuf/lib/net45.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4c50e24955a9a294b99ad097ae2e252a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Google.Protobuf/lib/net45/Google.Protobuf.dll b/Assets/Plugins/Google.Protobuf/lib/net45/Google.Protobuf.dll new file mode 100644 index 000000000..b378d5e93 --- /dev/null +++ b/Assets/Plugins/Google.Protobuf/lib/net45/Google.Protobuf.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd06dd3ce2930529ea2571668f91c1d42e7cb3017b4ea84a1e3350af697283ec +size 332272 diff --git a/Assets/Plugins/Google.Protobuf/lib/net45/Google.Protobuf.dll.meta b/Assets/Plugins/Google.Protobuf/lib/net45/Google.Protobuf.dll.meta new file mode 100644 index 000000000..d6a537838 --- /dev/null +++ b/Assets/Plugins/Google.Protobuf/lib/net45/Google.Protobuf.dll.meta @@ -0,0 +1,30 @@ +fileFormatVersion: 2 +guid: 286edf5aec6aae64697e5e8b7ab9b60e +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core.Api.meta b/Assets/Plugins/Grpc.Core.Api.meta new file mode 100644 index 000000000..f5d5149c2 --- /dev/null +++ b/Assets/Plugins/Grpc.Core.Api.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 9b4ba511bab164bf9a5d0db8bb681b05 +folderAsset: yes +timeCreated: 1531219385 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core.Api/lib.meta b/Assets/Plugins/Grpc.Core.Api/lib.meta new file mode 100644 index 000000000..88c1aedba --- /dev/null +++ b/Assets/Plugins/Grpc.Core.Api/lib.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 21a3894045fc74e85a09ab84c0e35c3a +folderAsset: yes +timeCreated: 1531219385 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core.Api/lib/net45.meta b/Assets/Plugins/Grpc.Core.Api/lib/net45.meta new file mode 100644 index 000000000..8012e3d58 --- /dev/null +++ b/Assets/Plugins/Grpc.Core.Api/lib/net45.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 9fd1c7cd7b6ed4d5285de90a332fb93e +folderAsset: yes +timeCreated: 1531219385 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core.Api/lib/net45/Grpc.Core.Api.dll b/Assets/Plugins/Grpc.Core.Api/lib/net45/Grpc.Core.Api.dll new file mode 100644 index 000000000..5fcdecb60 --- /dev/null +++ b/Assets/Plugins/Grpc.Core.Api/lib/net45/Grpc.Core.Api.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:16cbcec16298560353235e0362f5f9a52844cd326b6d7e0f9c58a4efb9a7807c +size 43008 diff --git a/Assets/Plugins/Grpc.Core.Api/lib/net45/Grpc.Core.Api.dll.meta b/Assets/Plugins/Grpc.Core.Api/lib/net45/Grpc.Core.Api.dll.meta new file mode 100644 index 000000000..7b939f861 --- /dev/null +++ b/Assets/Plugins/Grpc.Core.Api/lib/net45/Grpc.Core.Api.dll.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: c9bf7237d50ec4e99ba7d2c153b80e8f +timeCreated: 1531219386 +licenseType: Free +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core.Api/lib/net45/Grpc.Core.Api.xml b/Assets/Plugins/Grpc.Core.Api/lib/net45/Grpc.Core.Api.xml new file mode 100644 index 000000000..eef1ab263 --- /dev/null +++ b/Assets/Plugins/Grpc.Core.Api/lib/net45/Grpc.Core.Api.xml @@ -0,0 +1,2539 @@ + + + + Grpc.Core.Api + + + + + Asynchronous authentication interceptor for . + + The interceptor context. + Metadata to populate with entries that will be added to outgoing call's headers. + + + + + Context for an RPC being intercepted by . + + + + + Initializes a new instance of AuthInterceptorContext. + + + + + The fully qualified service URL for the RPC being called. + + + + + The method name of the RPC being called. + + + + + Provides an abstraction over the callback providers + used by AsyncUnaryCall, AsyncDuplexStreamingCall, etc + + + + + Return type for client streaming calls. + + Request message type for this call. + Response message type for this call. + + + + Creates a new AsyncClientStreamingCall object with the specified properties. + + Stream of request values. + The response of the asynchronous call. + Response headers of the asynchronous call. + Delegate returning the status of the call. + Delegate returning the trailing metadata of the call. + Delegate to invoke when Dispose is called on the call object. + + + + Creates a new AsyncClientStreamingCall object with the specified properties. + + Stream of request values. + The response of the asynchronous call. + Response headers of the asynchronous call. + Delegate returning the status of the call. + Delegate returning the trailing metadata of the call. + Delegate to invoke when Dispose is called on the call object. + State object for use with the callback parameters. + + + + Asynchronous call result. + + + + + Asynchronous access to response headers. + + + + + Async stream to send streaming requests. + + + + + Allows awaiting this object directly. + + + + + + Gets the call status if the call has already finished. + Throws InvalidOperationException otherwise. + + + + + Gets the call trailing metadata if the call has already finished. + Throws InvalidOperationException otherwise. + + + + + Provides means to cleanup after the call. + If the call has already finished normally (request stream has been completed and call result has been received), doesn't do anything. + Otherwise, requests cancellation of the call which should terminate all pending async operations associated with the call. + As a result, all resources being used by the call should be released eventually. + + + Normally, there is no need for you to dispose the call unless you want to utilize the + "Cancel" semantics of invoking Dispose. + + + + + Return type for bidirectional streaming calls. + + Request message type for this call. + Response message type for this call. + + + + Creates a new AsyncDuplexStreamingCall object with the specified properties. + + Stream of request values. + Stream of response values. + Response headers of the asynchronous call. + Delegate returning the status of the call. + Delegate returning the trailing metadata of the call. + Delegate to invoke when Dispose is called on the call object. + + + + Creates a new AsyncDuplexStreamingCall object with the specified properties. + + Stream of request values. + Stream of response values. + Response headers of the asynchronous call. + Delegate returning the status of the call. + Delegate returning the trailing metadata of the call. + Delegate to invoke when Dispose is called on the call object. + State object for use with the callback parameters. + + + + Async stream to read streaming responses. + + + + + Async stream to send streaming requests. + + + + + Asynchronous access to response headers. + + + + + Gets the call status if the call has already finished. + Throws InvalidOperationException otherwise. + + + + + Gets the call trailing metadata if the call has already finished. + Throws InvalidOperationException otherwise. + + + + + Provides means to cleanup after the call. + If the call has already finished normally (request stream has been completed and response stream has been fully read), doesn't do anything. + Otherwise, requests cancellation of the call which should terminate all pending async operations associated with the call. + As a result, all resources being used by the call should be released eventually. + + + Normally, there is no need for you to dispose the call unless you want to utilize the + "Cancel" semantics of invoking Dispose. + + + + + Return type for server streaming calls. + + Response message type for this call. + + + + Creates a new AsyncDuplexStreamingCall object with the specified properties. + + Stream of response values. + Response headers of the asynchronous call. + Delegate returning the status of the call. + Delegate returning the trailing metadata of the call. + Delegate to invoke when Dispose is called on the call object. + + + + Creates a new AsyncDuplexStreamingCall object with the specified properties. + + Stream of response values. + Response headers of the asynchronous call. + Delegate returning the status of the call. + Delegate returning the trailing metadata of the call. + Delegate to invoke when Dispose is called on the call object. + State object for use with the callback parameters. + + + + Async stream to read streaming responses. + + + + + Asynchronous access to response headers. + + + + + Gets the call status if the call has already finished. + Throws InvalidOperationException otherwise. + + + + + Gets the call trailing metadata if the call has already finished. + Throws InvalidOperationException otherwise. + + + + + Provides means to cleanup after the call. + If the call has already finished normally (response stream has been fully read), doesn't do anything. + Otherwise, requests cancellation of the call which should terminate all pending async operations associated with the call. + As a result, all resources being used by the call should be released eventually. + + + Normally, there is no need for you to dispose the call unless you want to utilize the + "Cancel" semantics of invoking Dispose. + + + + + Extension methods for . + + + + + Advances the stream reader to the next element in the sequence, returning the result asynchronously. + + The message type. + The stream reader. + + Task containing the result of the operation: true if the reader was successfully advanced + to the next element; false if the reader has passed the end of the sequence. + + + + + Return type for single request - single response call. + + Response message type for this call. + + + + Creates a new AsyncUnaryCall object with the specified properties. + + The response of the asynchronous call. + Response headers of the asynchronous call. + Delegate returning the status of the call. + Delegate returning the trailing metadata of the call. + Delegate to invoke when Dispose is called on the call object. + + + + Creates a new AsyncUnaryCall object with the specified properties. + + The response of the asynchronous call. + Response headers of the asynchronous call. + Delegate returning the status of the call. + Delegate returning the trailing metadata of the call. + Delegate to invoke when Dispose is called on the call object. + State object for use with the callback parameters. + + + + Asynchronous call result. + + + + + Asynchronous access to response headers. + + + + + Allows awaiting this object directly. + + + + + Gets the call status if the call has already finished. + Throws InvalidOperationException otherwise. + + + + + Gets the call trailing metadata if the call has already finished. + Throws InvalidOperationException otherwise. + + + + + Provides means to cleanup after the call. + If the call has already finished normally (request stream has been completed and call result has been received), doesn't do anything. + Otherwise, requests cancellation of the call which should terminate all pending async operations associated with the call. + As a result, all resources being used by the call should be released eventually. + + + Normally, there is no need for you to dispose the call unless you want to utilize the + "Cancel" semantics of invoking Dispose. + + + + + Authentication context for a call. + AuthContext is the only reliable source of truth when it comes to authenticating calls. + Using any other call/context properties for authentication purposes is wrong and inherently unsafe. + Note: experimental API that can change or be removed without any prior notice. + + + + + Initializes a new instance of the class. + + Peer identity property name. + Multimap of auth properties by name. + + + + Returns true if the peer is authenticated. + + + + + Gets the name of the property that indicates the peer identity. Returns null + if the peer is not authenticated. + + + + + Gets properties that represent the peer identity (there can be more than one). Returns an empty collection + if the peer is not authenticated. + + + + + Gets the auth properties of this context. + + + + + Returns the auth properties with given name (there can be more than one). + If no properties of given name exist, an empty collection will be returned. + + + + + A property of an . + Note: experimental API that can change or be removed without any prior notice. + + + + + Gets the name of the property. + + + + + Gets the string value of the property. + + + + + Gets the binary value of the property. + + + + + Creates an instance of AuthProperty. + + the name + the binary value of the property + + + + Gets the binary value of the property (without making a defensive copy). + + + + + Creates and instance of AuthProperty without making a defensive copy of valueBytes. + + + + + Specifies the location of the service bind method for a gRPC service. + The bind method is typically generated code and is used to register a service's + methods with the server on startup. + + The bind method signature takes a and an optional + instance of the service base class, e.g. static void BindService(ServiceBinderBase, GreeterService). + + + + + Initializes a new instance of the class. + + The type the service bind method is defined on. + The name of the service bind method. + + + + Gets the type the service bind method is defined on. + + + + + Gets the name of the service bind method. + + + + + Client-side call credentials. Provide authorization with per-call granularity. + + + + + Composes multiple multiple CallCredentials objects into + a single CallCredentials object. + + credentials to compose + The new CompositeCallCredentials + + + + Creates a new instance of CallCredentials class from an + interceptor that can attach metadata to outgoing calls. + + authentication interceptor + + + + Populates call credentials configurator with this instance's configuration. + End users never need to invoke this method as it is part of internal implementation. + + + + + Base class for objects that can consume configuration from CallCredentials objects. + Note: experimental API that can change or be removed without any prior notice. + + + + + Consumes configuration for composite call credentials. + + + + + Consumes configuration for call credentials created from AsyncAuthInterceptor + + + + + Flags to enable special call behaviors (client-side only). + + + + + The call is idempotent (retrying the call doesn't change the outcome of the operation). + + + + + If channel is in ChannelState.TransientFailure, attempt waiting for the channel to recover + instead of failing the call immediately. + + + + + The call is cacheable. gRPC is free to use GET verb */ + + + + + Call invoker that throws NotImplementedException for all requests. + + + + + Abstraction of client-side RPC invocation. + + + + + Invokes a simple remote call in a blocking fashion. + + + + + Invokes a simple remote call asynchronously. + + + + + Invokes a server streaming call asynchronously. + In server streaming scenario, client sends on request and server responds with a stream of responses. + + + + + Invokes a client streaming call asynchronously. + In client streaming scenario, client sends a stream of requests and server responds with a single response. + + + + + Invokes a duplex streaming call asynchronously. + In duplex streaming scenario, client sends a stream of requests and server responds with a stream of responses. + The response stream is completely independent and both side can be sending messages at the same time. + + + + + Options for calls made by client. + + + + + Creates a new instance of CallOptions struct. + + Headers to be sent with the call. + Deadline for the call to finish. null means no deadline. + Can be used to request cancellation of the call. + Write options that will be used for this call. + Context propagation token obtained from . + Credentials to use for this call. + + + + Headers to send at the beginning of the call. + + + + + Call deadline. + + + + + Token that can be used for cancelling the call on the client side. + Cancelling the token will request cancellation + of the remote call. Best effort will be made to deliver the cancellation + notification to the server and interaction of the call with the server side + will be terminated. Unless the call finishes before the cancellation could + happen (there is an inherent race), + the call will finish with StatusCode.Cancelled status. + + + + + Write options that will be used for this call. + + + + + Token for propagating parent call context. + + + + + Credentials to use for this call. + + + + + If true and and channel is in ChannelState.TransientFailure, the call will attempt waiting for the channel to recover + instead of failing immediately (which is the default "FailFast" semantics). + Note: experimental API that can change or be removed without any prior notice. + + + + + Flags to use for this call. + + + + + Returns new instance of with + Headers set to the value provided. Values of all other fields are preserved. + + The headers. + + + + Returns new instance of with + Deadline set to the value provided. Values of all other fields are preserved. + + The deadline. + + + + Returns new instance of with + CancellationToken set to the value provided. Values of all other fields are preserved. + + The cancellation token. + + + + Returns new instance of with + WriteOptions set to the value provided. Values of all other fields are preserved. + + The write options. + + + + Returns new instance of with + PropagationToken set to the value provided. Values of all other fields are preserved. + + The context propagation token. + + + + Returns new instance of with + Credentials set to the value provided. Values of all other fields are preserved. + + The call credentials. + + + + Returns new instance of with "WaitForReady" semantics enabled/disabled. + . + Note: experimental API that can change or be removed without any prior notice. + + + + + Returns new instance of with + Flags set to the value provided. Values of all other fields are preserved. + + The call flags. + + + + Base class for gRPC channel. Channels are an abstraction of long-lived connections to remote servers. + + + + + Initializes a new instance of class that connects to a specific host. + + Target of the channel. + + + The original target used to create the channel. + + + + Create a new for the channel. + + A new . + + + + Client-side channel credentials. Used for creation of a secure channel. + + + + + Creates a new instance of channel credentials + + + + + Returns instance of credentials that provides no security and + will result in creating an unsecure channel with no encryption whatsoever. + + + + + Creates a new instance of ChannelCredentials class by composing + given channel credentials with call credentials. + + Channel credentials. + Call credentials. + The new composite ChannelCredentials + + + + Populates channel credentials configurator with this instance's configuration. + End users never need to invoke this method as it is part of internal implementation. + + + + + Returns true if this credential type allows being composed by CompositeCredentials. + + + + + Credentials that allow composing one object and + one or more objects into a single . + + + + + Initializes a new instance of CompositeChannelCredentials class. + The resulting credentials object will be composite of all the credentials specified as parameters. + + channelCredentials to compose + channelCredentials to compose + + + + Base class for objects that can consume configuration from CallCredentials objects. + Note: experimental API that can change or be removed without any prior notice. + + + + + Configures the credentials to use insecure credentials. + + + + + Configures the credentials to use SslCredentials. + + + + + Configures the credentials to use composite channel credentials (a composite of channel credentials and call credentials). + + + + + Generic base class for client-side stubs. + + + + + Initializes a new instance of ClientBase class that + throws NotImplementedException upon invocation of any RPC. + This constructor is only provided to allow creation of test doubles + for client classes (e.g. mocking requires a parameterless constructor). + + + + + Initializes a new instance of ClientBase class. + + The configuration. + + + + Initializes a new instance of ClientBase class. + + The channel to use for remote call invocation. + + + + Initializes a new instance of ClientBase class. + + The CallInvoker for remote call invocation. + + + + Creates a new client that sets host field for calls explicitly. + gRPC supports multiple "hosts" being served by a single server. + By default (if a client was not created by calling this method), + host null with the meaning "use default host" is used. + + + + + Creates a new instance of client from given ClientBaseConfiguration. + + + + + Base class for client-side stubs. + + + + + Initializes a new instance of ClientBase class that + throws NotImplementedException upon invocation of any RPC. + This constructor is only provided to allow creation of test doubles + for client classes (e.g. mocking requires a parameterless constructor). + + + + + Initializes a new instance of ClientBase class. + + The configuration. + + + + Initializes a new instance of ClientBase class. + + The channel to use for remote call invocation. + + + + Initializes a new instance of ClientBase class. + + The CallInvoker for remote call invocation. + + + + Gets the call invoker. + + + + + Gets the configuration. + + + + + Represents configuration of ClientBase. The class itself is visible to + subclasses, but contents are marked as internal to make the instances opaque. + The verbose name of this class was chosen to make name clash in generated code + less likely. + + + + + Creates a new instance of ClientBaseConfigurationInterceptor given the specified header and host interceptor function. + + + + + Options for . + + + + + The context propagation options that will be used by default. + + + + + Creates new context propagation options. + + If set to true parent call's deadline will be propagated to the child call. + If set to true parent call's cancellation token will be propagated to the child call. + + + true if parent call's deadline should be propagated to the child call. + + + true if parent call's cancellation token should be propagated to the child call. + + + + Token for propagating context of server side handlers to child calls. + In situations when a backend is making calls to another backend, + it makes sense to propagate properties like deadline and cancellation + token of the server call to the child call. + Underlying gRPC implementation may provide other "opaque" contexts (like tracing context) that + are not explicitly accesible via the public C# API, but this token still allows propagating them. + + + + + Provides access to the payload being deserialized when deserializing messages. + + + + + Get the total length of the payload in bytes. + + + + + Gets the entire payload as a newly allocated byte array. + Once the byte array is returned, the byte array becomes owned by the caller and won't be ever accessed or reused by gRPC again. + NOTE: Obtaining the buffer as a newly allocated byte array is the simplest way of accessing the payload, + but it can have important consequences in high-performance scenarios. + In particular, using this method usually requires copying of the entire buffer one extra time. + Also, allocating a new buffer each time can put excessive pressure on GC, especially if + the payload is more than 86700 bytes large (which means the newly allocated buffer will be placed in LOH, + and LOH object can only be garbage collected via a full ("stop the world") GC run). + NOTE: Deserializers are expected not to call this method (or other payload accessor methods) more than once per received message + (as there is no practical reason for doing so) and DeserializationContext implementations are free to assume so. + + byte array containing the entire payload. + + + + Gets the entire payload as a ReadOnlySequence. + The ReadOnlySequence is only valid for the duration of the deserializer routine and the caller must not access it after the deserializer returns. + Using the read only sequence is the most efficient way to access the message payload. Where possible it allows directly + accessing the received payload without needing to perform any buffer copying or buffer allocations. + NOTE: When using this method, it is recommended to use C# 7.2 compiler to make it more useful (using Span type directly from your code requires C# 7.2)." + NOTE: Deserializers are expected not to call this method (or other payload accessor methods) more than once per received message + (as there is no practical reason for doing so) and DeserializationContext implementations are free to assume so. + + read only sequence containing the entire payload. + + + + A stream of messages to be read. + Messages can be awaited await reader.MoveNext(), that returns true + if there is a message available and false if there are no more messages + (i.e. the stream has been closed). + + On the client side, the last invocation of MoveNext() either returns false + if the call has finished successfully or throws RpcException if call finished + with an error. Once the call finishes, subsequent invocations of MoveNext() will + continue yielding the same result (returning false or throwing an exception). + + + On the server side, MoveNext() does not throw exceptions. + In case of a failure, the request stream will appear to be finished + (MoveNext will return false) and the CancellationToken + associated with the call will be cancelled to signal the failure. + + + MoveNext() operations can be cancelled via a cancellation token. Cancelling + an individual read operation has the same effect as cancelling the entire call + (which will also result in the read operation returning prematurely), but the per-read cancellation + tokens passed to MoveNext() only result in cancelling the call if the read operation haven't finished + yet. + + + The message type. + + + + Gets the current element in the iteration. + + + + + Advances the reader to the next element in the sequence, returning the result asynchronously. + + Cancellation token that can be used to cancel the operation. + + Task containing the result of the operation: true if the reader was successfully advanced + to the next element; false if the reader has passed the end of the sequence. + + + + A writable stream of messages. + + The message type. + + + + Writes a single asynchronously. Only one write can be pending at a time. + + the message to be written. Cannot be null. + + + + Write options that will be used for the next write. + If null, default options will be used. + Once set, this property maintains its value across subsequent + writes. + + + + + Client-side writable stream of messages with Close capability. + + The message type. + + + + Completes/closes the stream. Can only be called once there is no pending write. No writes should follow calling this. + + + + + Extends the CallInvoker class to provide the interceptor facility on the client side. + + + + + Returns a instance that intercepts + the invoker with the given interceptor. + + The underlying invoker to intercept. + The interceptor to intercept calls to the invoker with. + + Multiple interceptors can be added on top of each other by calling + "invoker.Intercept(a, b, c)". The order of invocation will be "a", "b", and then "c". + Interceptors can be later added to an existing intercepted CallInvoker, effectively + building a chain like "invoker.Intercept(c).Intercept(b).Intercept(a)". Note that + in this case, the last interceptor added will be the first to take control. + + + + + Returns a instance that intercepts + the invoker with the given interceptors. + + The channel to intercept. + + An array of interceptors to intercept the calls to the invoker with. + Control is passed to the interceptors in the order specified. + + + Multiple interceptors can be added on top of each other by calling + "invoker.Intercept(a, b, c)". The order of invocation will be "a", "b", and then "c". + Interceptors can be later added to an existing intercepted CallInvoker, effectively + building a chain like "invoker.Intercept(c).Intercept(b).Intercept(a)". Note that + in this case, the last interceptor added will be the first to take control. + + + + + Returns a instance that intercepts + the invoker with the given interceptor. + + The underlying invoker to intercept. + + An interceptor delegate that takes the request metadata to be sent with an outgoing call + and returns a instance that will replace the existing + invocation metadata. + + + Multiple interceptors can be added on top of each other by + building a chain like "invoker.Intercept(c).Intercept(b).Intercept(a)". Note that + in this case, the last interceptor added will be the first to take control. + + + + + Creates a new instance of MetadataInterceptor given the specified interceptor function. + + + + + Provides extension methods to make it easy to register interceptors on Channel objects. + + + + + Returns a instance that intercepts + the channel with the given interceptor. + + The channel to intercept. + The interceptor to intercept the channel with. + + Multiple interceptors can be added on top of each other by calling + "channel.Intercept(a, b, c)". The order of invocation will be "a", "b", and then "c". + Interceptors can be later added to an existing intercepted channel, effectively + building a chain like "channel.Intercept(c).Intercept(b).Intercept(a)". Note that + in this case, the last interceptor added will be the first to take control. + + + + + Returns a instance that intercepts + the channel with the given interceptors. + + The channel to intercept. + + An array of interceptors to intercept the channel with. + Control is passed to the interceptors in the order specified. + + + Multiple interceptors can be added on top of each other by calling + "channel.Intercept(a, b, c)". The order of invocation will be "a", "b", and then "c". + Interceptors can be later added to an existing intercepted channel, effectively + building a chain like "channel.Intercept(c).Intercept(b).Intercept(a)". Note that + in this case, the last interceptor added will be the first to take control. + + + + + Returns a instance that intercepts + the invoker with the given interceptor. + + The channel to intercept. + + An interceptor delegate that takes the request metadata to be sent with an outgoing call + and returns a instance that will replace the existing + invocation metadata. + + + Multiple interceptors can be added on top of each other by + building a chain like "channel.Intercept(c).Intercept(b).Intercept(a)". Note that + in this case, the last interceptor added will be the first to take control. + + + + + Carries along the context associated with intercepted invocations on the client side. + + + + + Creates a new instance of + with the specified method, host, and call options. + + A object representing the method to be invoked. + The host to dispatch the current call to. + A instance containing the call options of the current call. + + + + Gets the instance + representing the method to be invoked. + + + + + Gets the host that the currect invocation will be dispatched to. + + + + + Gets the structure representing the + call options associated with the current invocation. + + + + + Decorates an underlying to + intercept calls through a given interceptor. + + + + + Creates a new instance of + with the given underlying invoker and interceptor instances. + + + + + Intercepts a simple blocking call with the registered interceptor. + + + + + Intercepts a simple asynchronous call with the registered interceptor. + + + + + Intercepts an asynchronous server streaming call with the registered interceptor. + + + + + Intercepts an asynchronous client streaming call with the registered interceptor. + + + + + Intercepts an asynchronous duplex streaming call with the registered interceptor. + + + + + Serves as the base class for gRPC interceptors. + + + + + Represents a continuation for intercepting simple blocking invocations. + A delegate of this type is passed to the BlockingUnaryCall method + when an outgoing invocation is being intercepted and calling the + delegate will invoke the next interceptor in the chain, or the underlying + call invoker if called from the last interceptor. The interceptor is + allowed to call it zero, one, or multiple times, passing it the appropriate + context and request values as it sees fit. + + Request message type for this invocation. + Response message type for this invocation. + The request value to continue the invocation with. + + The + instance to pass to the next step in the invocation process. + + + The response value of the invocation to return to the caller. + The interceptor can choose to return the return value of the + continuation delegate or an arbitrary value as it sees fit. + + + + + Represents a continuation for intercepting simple asynchronous invocations. + A delegate of this type is passed to the AsyncUnaryCall method + when an outgoing invocation is being intercepted and calling the + delegate will invoke the next interceptor in the chain, or the underlying + call invoker if called from the last interceptor. The interceptor is + allowed to call it zero, one, or multiple times, passing it the appropriate + request value and context as it sees fit. + + Request message type for this invocation. + Response message type for this invocation. + The request value to continue the invocation with. + + The + instance to pass to the next step in the invocation process. + + + An instance of + representing an asynchronous invocation of a unary RPC. + The interceptor can choose to return the same object returned from + the continuation delegate or an arbitrarily constructed instance as it sees fit. + + + + + Represents a continuation for intercepting asynchronous server-streaming invocations. + A delegate of this type is passed to the AsyncServerStreamingCall method + when an outgoing invocation is being intercepted and calling the + delegate will invoke the next interceptor in the chain, or the underlying + call invoker if called from the last interceptor. The interceptor is + allowed to call it zero, one, or multiple times, passing it the appropriate + request value and context as it sees fit. + + Request message type for this invocation. + Response message type for this invocation. + The request value to continue the invocation with. + + The + instance to pass to the next step in the invocation process. + + + An instance of + representing an asynchronous invocation of a server-streaming RPC. + The interceptor can choose to return the same object returned from + the continuation delegate or an arbitrarily constructed instance as it sees fit. + + + + + Represents a continuation for intercepting asynchronous client-streaming invocations. + A delegate of this type is passed to the AsyncClientStreamingCall method + when an outgoing invocation is being intercepted and calling the + delegate will invoke the next interceptor in the chain, or the underlying + call invoker if called from the last interceptor. The interceptor is + allowed to call it zero, one, or multiple times, passing it the appropriate + request value and context as it sees fit. + + Request message type for this invocation. + Response message type for this invocation. + + The + instance to pass to the next step in the invocation process. + + + An instance of + representing an asynchronous invocation of a client-streaming RPC. + The interceptor can choose to return the same object returned from + the continuation delegate or an arbitrarily constructed instance as it sees fit. + + + + + Represents a continuation for intercepting asynchronous duplex invocations. + A delegate of this type is passed to the AsyncDuplexStreamingCall method + when an outgoing invocation is being intercepted and calling the + delegate will invoke the next interceptor in the chain, or the underlying + call invoker if called from the last interceptor. The interceptor is + allowed to call it zero, one, or multiple times, passing it the appropriate + request value and context as it sees fit. + + + The + instance to pass to the next step in the invocation process. + + + An instance of + representing an asynchronous invocation of a duplex-streaming RPC. + The interceptor can choose to return the same object returned from + the continuation delegate or an arbitrarily constructed instance as it sees fit. + + + + + Intercepts a blocking invocation of a simple remote call. + + The request message of the invocation. + + The + associated with the current invocation. + + + The callback that continues the invocation process. + This can be invoked zero or more times by the interceptor. + The interceptor can invoke the continuation passing the given + request value and context arguments, or substitute them as it sees fit. + + + The response message of the current invocation. + The interceptor can simply return the return value of the + continuation delegate passed to it intact, or an arbitrary + value as it sees fit. + + + + + Intercepts an asynchronous invocation of a simple remote call. + + The request message of the invocation. + + The + associated with the current invocation. + + + The callback that continues the invocation process. + This can be invoked zero or more times by the interceptor. + The interceptor can invoke the continuation passing the given + request value and context arguments, or substitute them as it sees fit. + + + An instance of + representing an asynchronous unary invocation. + The interceptor can simply return the return value of the + continuation delegate passed to it intact, or construct its + own substitute as it sees fit. + + + + + Intercepts an asynchronous invocation of a streaming remote call. + + The request message of the invocation. + + The + associated with the current invocation. + + + The callback that continues the invocation process. + This can be invoked zero or more times by the interceptor. + The interceptor can invoke the continuation passing the given + request value and context arguments, or substitute them as it sees fit. + + + An instance of + representing an asynchronous server-streaming invocation. + The interceptor can simply return the return value of the + continuation delegate passed to it intact, or construct its + own substitute as it sees fit. + + + + + Intercepts an asynchronous invocation of a client streaming call. + + + The + associated with the current invocation. + + + The callback that continues the invocation process. + This can be invoked zero or more times by the interceptor. + The interceptor can invoke the continuation passing the given + context argument, or substitute as it sees fit. + + + An instance of + representing an asynchronous client-streaming invocation. + The interceptor can simply return the return value of the + continuation delegate passed to it intact, or construct its + own substitute as it sees fit. + + + + + Intercepts an asynchronous invocation of a duplex streaming call. + + + The + associated with the current invocation. + + + The callback that continues the invocation process. + This can be invoked zero or more times by the interceptor. + The interceptor can invoke the continuation passing the given + context argument, or substitute as it sees fit. + + + An instance of + representing an asynchronous duplex-streaming invocation. + The interceptor can simply return the return value of the + continuation delegate passed to it intact, or construct its + own substitute as it sees fit. + + + + + Server-side handler for intercepting and incoming unary call. + + Request message type for this method. + Response message type for this method. + The request value of the incoming invocation. + + An instance of representing + the context of the invocation. + + + A delegate that asynchronously proceeds with the invocation, calling + the next interceptor in the chain, or the service request handler, + in case of the last interceptor and return the response value of + the RPC. The interceptor can choose to call it zero or more times + at its discretion. + + + A future representing the response value of the RPC. The interceptor + can simply return the return value from the continuation intact, + or an arbitrary response value as it sees fit. + + + + + Server-side handler for intercepting client streaming call. + + Request message type for this method. + Response message type for this method. + The request stream of the incoming invocation. + + An instance of representing + the context of the invocation. + + + A delegate that asynchronously proceeds with the invocation, calling + the next interceptor in the chain, or the service request handler, + in case of the last interceptor and return the response value of + the RPC. The interceptor can choose to call it zero or more times + at its discretion. + + + A future representing the response value of the RPC. The interceptor + can simply return the return value from the continuation intact, + or an arbitrary response value as it sees fit. The interceptor has + the ability to wrap or substitute the request stream when calling + the continuation. + + + + + Server-side handler for intercepting server streaming call. + + Request message type for this method. + Response message type for this method. + The request value of the incoming invocation. + The response stream of the incoming invocation. + + An instance of representing + the context of the invocation. + + + A delegate that asynchronously proceeds with the invocation, calling + the next interceptor in the chain, or the service request handler, + in case of the last interceptor and the interceptor can choose to + call it zero or more times at its discretion. The interceptor has + the ability to wrap or substitute the request value and the response stream + when calling the continuation. + + + + + Server-side handler for intercepting bidirectional streaming calls. + + Request message type for this method. + Response message type for this method. + The request stream of the incoming invocation. + The response stream of the incoming invocation. + + An instance of representing + the context of the invocation. + + + A delegate that asynchronously proceeds with the invocation, calling + the next interceptor in the chain, or the service request handler, + in case of the last interceptor and the interceptor can choose to + call it zero or more times at its discretion. The interceptor has + the ability to wrap or substitute the request and response streams + when calling the continuation. + + + + + A writable stream of messages that is used in server-side handlers. + + + + + Key certificate pair (in PEM encoding). + + + + + Creates a new certificate chain - private key pair. + + PEM encoded certificate chain. + PEM encoded private key. + + + + PEM encoded certificate chain. + + + + + PEM encoded private key. + + + + + Encapsulates the logic for serializing and deserializing messages. + + + + + Initializes a new marshaller from simple serialize/deserialize functions. + + Function that will be used to serialize messages. + Function that will be used to deserialize messages. + + + + Initializes a new marshaller from serialize/deserialize fuctions that can access serialization and deserialization + context. Compared to the simple serializer/deserializer functions, using the contextual version provides more + flexibility and can lead to increased efficiency (and better performance). + Note: This constructor is part of an experimental API that can change or be removed without any prior notice. + + Function that will be used to serialize messages. + Function that will be used to deserialize messages. + + + + Gets the serializer function. + + + + + Gets the deserializer function. + + + + + Gets the serializer function. + Note: experimental API that can change or be removed without any prior notice. + + + + + Gets the serializer function. + Note: experimental API that can change or be removed without any prior notice. + + + + + Utilities for creating marshallers. + + + + + Creates a marshaller from specified serializer and deserializer. + + + + + Creates a marshaller from specified contextual serializer and deserializer. + Note: This method is part of an experimental API that can change or be removed without any prior notice. + + + + + Returns a marshaller for string type. This is useful for testing. + + + + + A collection of metadata entries that can be exchanged during a call. + gRPC supports these types of metadata: + + Request headersare sent by the client at the beginning of a remote call before any request messages are sent. + Response headersare sent by the server at the beginning of a remote call handler before any response messages are sent. + Response trailersare sent by the server at the end of a remote call along with resulting call status. + + + + + + All binary headers should have this suffix. + + + + + An read-only instance of metadata containing no entries. + + + + + To be used in initial metadata to request specific compression algorithm + for given call. Direct selection of compression algorithms is an internal + feature and is not part of public API. + + + + + Initializes a new instance of Metadata. + + + + + Makes this object read-only. + + this object + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Adds a new ASCII-valued metadata entry. See Metadata.Entry constructor for params. + + + + + Adds a new binary-valued metadata entry. See Metadata.Entry constructor for params. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Metadata entry + + + + + Initializes a new instance of the struct with a binary value. + + Metadata key. Gets converted to lowercase. Needs to have suffix indicating a binary valued metadata entry. Can only contain lowercase alphanumeric characters, underscores, hyphens and dots. + Value bytes. + + + + Initializes a new instance of the struct with an ASCII value. + + Metadata key. Gets converted to lowercase. Must not use suffix indicating a binary valued metadata entry. Can only contain lowercase alphanumeric characters, underscores, hyphens and dots. + Value string. Only ASCII characters are allowed. + + + + Gets the metadata entry key. + + + + + Gets the binary value of this metadata entry. + + + + + Gets the string value of this metadata entry. + + + + + Returns true if this entry is a binary-value entry. + + + + + Returns a that represents the current . + + + + + Gets the serialized value for this entry. For binary metadata entries, this leaks + the internal valueBytes byte array and caller must not change contents of it. + + + + + Creates a binary value or ascii value metadata entry from data received from the native layer. + We trust C core to give us well-formed data, so we don't perform any checks or defensive copying. + + + + + Returns true if the key has "-bin" binary header suffix. + + + + + Method types supported by gRPC. + + + + Single request sent from client, single response received from server. + + + Stream of request sent from client, single response received from server. + + + Single request sent from client, stream of responses received from server. + + + Both server and client can stream arbitrary number of requests and responses simultaneously. + + + + A non-generic representation of a remote method. + + + + + Gets the type of the method. + + + + + Gets the name of the service to which this method belongs. + + + + + Gets the unqualified name of the method. + + + + + Gets the fully qualified name of the method. On the server side, methods are dispatched + based on this name. + + + + + A description of a remote method. + + Request message type for this method. + Response message type for this method. + + + + Initializes a new instance of the Method class. + + Type of method. + Name of service this method belongs to. + Unqualified name of the method. + Marshaller used for request messages. + Marshaller used for response messages. + + + + Gets the type of the method. + + + + + Gets the name of the service to which this method belongs. + + + + + Gets the unqualified name of the method. + + + + + Gets the marshaller used for request messages. + + + + + Gets the marshaller used for response messages. + + + + + Gets the fully qualified name of the method. On the server side, methods are dispatched + based on this name. + + + + + Gets full name of the method including the service name. + + + + + Thrown when remote procedure call fails. Every RpcException is associated with a resulting of the call. + + + + + Creates a new RpcException associated with given status. + + Resulting status of a call. + + + + Creates a new RpcException associated with given status and message. + NOTE: the exception message is not sent to the remote peer. Use status.Details to pass error + details to the peer. + + Resulting status of a call. + The exception message. + + + + Creates a new RpcException associated with given status and trailing response metadata. + + Resulting status of a call. + Response trailing metadata. + + + + Creates a new RpcException associated with given status, message and trailing response metadata. + NOTE: the exception message is not sent to the remote peer. Use status.Details to pass error + details to the peer. + + Resulting status of a call. + Response trailing metadata. + The exception message. + + + + Resulting status of the call. + + + + + Returns the status code of the call, as a convenient alternative to Status.StatusCode. + + + + + Gets the call trailing metadata. + Trailers only have meaningful content for client-side calls (in which case they represent the trailing metadata sent by the server when closing the call). + Instances of RpcException thrown by the server-side part of the stack will have trailers always set to empty. + + + + + Provides storage for payload when serializing a message. + + + + + Use the byte array as serialized form of current message and mark serialization process as complete. + Complete(byte[]) can only be called once. By calling this method the caller gives up the ownership of the + payload which must not be accessed afterwards. + + the serialized form of current message + + + + Gets buffer writer that can be used to write the serialized data. Once serialization is finished, + Complete() needs to be called. + + + + + Sets the payload length when writing serialized data into a buffer writer. If the serializer knows the full payload + length in advance, providing that information before obtaining the buffer writer using GetBufferWriter() can improve + serialization efficiency by avoiding copies. The provided payload length must be the same as the data written to the writer. + Calling this method is optional. If the payload length is not set then the length is calculated using the data written to + the buffer writer when Complete() is called. + + The total length of the payload in bytes. + + + + Complete the payload written to the buffer writer. Complete() can only be called once. + + + + + Context for a server-side call. + + + + + Creates a new instance of ServerCallContext. + + + + + Asynchronously sends response headers for the current call to the client. This method may only be invoked once for each call and needs to be invoked + before any response messages are written. Writing the first response message implicitly sends empty response headers if WriteResponseHeadersAsync haven't + been called yet. + + The response headers to send. + The task that finished once response headers have been written. + + + + Creates a propagation token to be used to propagate call context to a child call. + + + + Name of method called in this RPC. + + + Name of host called in this RPC. + + + Address of the remote endpoint in URI format. + + + Deadline for this RPC. The call will be automatically cancelled once the deadline is exceeded. + + + Initial metadata sent by client. + + + Cancellation token signals when call is cancelled. It is also triggered when the deadline is exceeeded or there was some other error (e.g. network problem). + + + Trailers to send back to client after RPC finishes. + + + Status to send back to client after RPC finishes. + + + + Allows setting write options for the following write. + For streaming response calls, this property is also exposed as on IServerStreamWriter for convenience. + Both properties are backed by the same underlying value. + + + + + Gets the AuthContext associated with this call. + Note: Access to AuthContext is an experimental API that can change without any prior notice. + + + + + Gets a dictionary that can be used by the various interceptors and handlers of this + call to store arbitrary state. + + + + Provides implementation of a non-virtual public member. + + + Provides implementation of a non-virtual public member. + + + Provides implementation of a non-virtual public member. + + + Provides implementation of a non-virtual public member. + + + Provides implementation of a non-virtual public member. + + + Provides implementation of a non-virtual public member. + + + Provides implementation of a non-virtual public member. + + + Provides implementation of a non-virtual public member. + + + Provides implementation of a non-virtual public member. + + + Provides implementation of a non-virtual public member. + + + Provides implementation of a non-virtual public member. + + + Provides implementation of a non-virtual public member. + + + Provides implementation of a non-virtual public member. + + + + Server-side handler for unary call. + + Request message type for this method. + Response message type for this method. + + + + Server-side handler for client streaming call. + + Request message type for this method. + Response message type for this method. + + + + Server-side handler for server streaming call. + + Request message type for this method. + Response message type for this method. + + + + Server-side handler for bidi streaming call. + + Request message type for this method. + Response message type for this method. + + + + Stores mapping of methods to server call handlers. + Normally, the ServerServiceDefinition objects will be created by the BindService factory method + that is part of the autogenerated code for a protocol buffers service definition. + + + + + Forwards all the previously stored AddMethod calls to the service binder. + + + + + Creates a new builder object for ServerServiceDefinition. + + The builder object. + + + + Builder class for . + + + + + Creates a new instance of builder. + + + + + Adds a definition for a single request - single response method. + + The request message class. + The response message class. + The method. + The method handler. + This builder instance. + + + + Adds a definition for a client streaming method. + + The request message class. + The response message class. + The method. + The method handler. + This builder instance. + + + + Adds a definition for a server streaming method. + + The request message class. + The response message class. + The method. + The method handler. + This builder instance. + + + + Adds a definition for a bidirectional streaming method. + + The request message class. + The response message class. + The method. + The method handler. + This builder instance. + + + + Creates an immutable ServerServiceDefinition from this builder. + + The ServerServiceDefinition object. + + + + Allows binding server-side method implementations in alternative serving stacks. + Instances of this class are usually populated by the BindService method + that is part of the autogenerated code for a protocol buffers service definition. + + + + + Adds a definition for a single request - single response method. + + The request message class. + The response message class. + The method. + The method handler. + + + + Adds a definition for a client streaming method. + + The request message class. + The response message class. + The method. + The method handler. + + + + Adds a definition for a server streaming method. + + The request message class. + The response message class. + The method. + The method handler. + + + + Adds a definition for a bidirectional streaming method. + + The request message class. + The response message class. + The method. + The method handler. + + + + Callback invoked with the expected targetHost and the peer's certificate. + If false is returned by this callback then it is treated as a + verification failure and the attempted connection will fail. + Invocation of the callback is blocking, so any + implementation should be light-weight. + Note that the callback can potentially be invoked multiple times, + concurrently from different threads (e.g. when multiple connections + are being created for the same credentials). + + The associated with the callback + true if verification succeeded, false otherwise. + Note: experimental API that can change or be removed without any prior notice. + + + + Client-side SSL credentials. + + + + + Creates client-side SSL credentials loaded from + disk file pointed to by the GRPC_DEFAULT_SSL_ROOTS_FILE_PATH environment variable. + If that fails, gets the roots certificates from a well known place on disk. + + + + + Creates client-side SSL credentials from + a string containing PEM encoded root certificates. + + + + + Creates client-side SSL credentials. + + string containing PEM encoded server root certificates. + a key certificate pair. + + + + Creates client-side SSL credentials. + + string containing PEM encoded server root certificates. + a key certificate pair. + a callback to verify peer's target name and certificate. + Note: experimental API that can change or be removed without any prior notice. + + + + PEM encoding of the server root certificates. + + + + + Client side key and certificate pair. + If null, client will not use key and certificate pair. + + + + + Populates channel credentials configurator with this instance's configuration. + End users never need to invoke this method as it is part of internal implementation. + + + + + Represents RPC result, which consists of and an optional detail string. + + + + + Default result of a successful RPC. StatusCode=OK, empty details message. + + + + + Default result of a cancelled RPC. StatusCode=Cancelled, empty details message. + + + + + Creates a new instance of Status. + + Status code. + Detail. + + + + Gets the gRPC status code. OK indicates success, all other values indicate an error. + + + + + Gets the detail. + + + + + Returns a that represents the current . + + + + + Result of a remote procedure call. + Based on grpc_status_code from grpc/status.h + + + + Not an error; returned on success. + + + The operation was cancelled (typically by the caller). + + + + Unknown error. An example of where this error may be returned is + if a Status value received from another address space belongs to + an error-space that is not known in this address space. Also + errors raised by APIs that do not return enough error information + may be converted to this error. + + + + + Client specified an invalid argument. Note that this differs + from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments + that are problematic regardless of the state of the system + (e.g., a malformed file name). + + + + + Deadline expired before operation could complete. For operations + that change the state of the system, this error may be returned + even if the operation has completed successfully. For example, a + successful response from a server could have been delayed long + enough for the deadline to expire. + + + + Some requested entity (e.g., file or directory) was not found. + + + Some entity that we attempted to create (e.g., file or directory) already exists. + + + + The caller does not have permission to execute the specified + operation. PERMISSION_DENIED must not be used for rejections + caused by exhausting some resource (use RESOURCE_EXHAUSTED + instead for those errors). PERMISSION_DENIED must not be + used if the caller can not be identified (use UNAUTHENTICATED + instead for those errors). + + + + The request does not have valid authentication credentials for the operation. + + + + Some resource has been exhausted, perhaps a per-user quota, or + perhaps the entire file system is out of space. + + + + + Operation was rejected because the system is not in a state + required for the operation's execution. For example, directory + to be deleted may be non-empty, an rmdir operation is applied to + a non-directory, etc. + + + + + The operation was aborted, typically due to a concurrency issue + like sequencer check failures, transaction aborts, etc. + + + + + Operation was attempted past the valid range. E.g., seeking or + reading past end of file. + + + + Operation is not implemented or not supported/enabled in this service. + + + + Internal errors. Means some invariants expected by underlying + system has been broken. If you see one of these errors, + something is very broken. + + + + + The service is currently unavailable. This is a most likely a + transient condition and may be corrected by retrying with + a backoff. Note that it is not always safe to retry + non-idempotent operations. + + + + Unrecoverable data loss or corruption. + + + + Converts byte* pointing to an encoded byte array to a string using the provided Encoding. + + + + + Converts IntPtr pointing to a encoded byte array to a string using the provided Encoding. + + + + + Utility methods to simplify checking preconditions in the code. + + + + + Throws if condition is false. + + The condition. + + + + Throws with given message if condition is false. + + The condition. + The error message. + + + + Throws if reference is null. + + The reference. + + + + Throws if reference is null. + + The reference. + The parameter name. + + + + Throws if condition is false. + + The condition. + + + + Throws with given message if condition is false. + + The condition. + The error message. + + + + Verification context for VerifyPeerCallback. + Note: experimental API that can change or be removed without any prior notice. + + + + + Initializes a new instance of the class. + + The target name of the peer. + The PEM encoded certificate of the peer. + + + + The target name of the peer. + + + + + The PEM encoded certificate of the peer. + + + + + Provides info about current version of gRPC. + See https://codingforsmarties.wordpress.com/2016/01/21/how-to-version-assemblies-destined-for-nuget/ + for rationale about assembly versioning. + + + + + Current AssemblyVersion attribute of gRPC C# assemblies + + + + + Current AssemblyFileVersion of gRPC C# assemblies + + + + + Current version of gRPC C# + + + + + Flags for write operations. + + + + + Hint that the write may be buffered and need not go out on the wire immediately. + gRPC is free to buffer the message until the next non-buffered + write, or until write stream completion, but it need not buffer completely or at all. + + + + + Force compression to be disabled for a particular write. + + + + + Options for write operations. + + + + + Default write options. + + + + + Initializes a new instance of WriteOptions class. + + The write flags. + + + + Gets the write flags. + + + + diff --git a/Assets/Plugins/Grpc.Core.Api/lib/net45/Grpc.Core.Api.xml.meta b/Assets/Plugins/Grpc.Core.Api/lib/net45/Grpc.Core.Api.xml.meta new file mode 100644 index 000000000..e3814dc58 --- /dev/null +++ b/Assets/Plugins/Grpc.Core.Api/lib/net45/Grpc.Core.Api.xml.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0a4fb8823a783423880c9d8c9d3b5cf4 +timeCreated: 1531219386 +licenseType: Free +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core.meta b/Assets/Plugins/Grpc.Core.meta new file mode 100644 index 000000000..47737027e --- /dev/null +++ b/Assets/Plugins/Grpc.Core.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: e28eaddc034fe664591e93e8816968aa +folderAsset: yes +timeCreated: 1531219385 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/lib.meta b/Assets/Plugins/Grpc.Core/lib.meta new file mode 100644 index 000000000..0e284f0be --- /dev/null +++ b/Assets/Plugins/Grpc.Core/lib.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 1f862d451f11a2442aeac99ad2827285 +folderAsset: yes +timeCreated: 1531219385 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/lib/net45.meta b/Assets/Plugins/Grpc.Core/lib/net45.meta new file mode 100644 index 000000000..85acb0b28 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/lib/net45.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 89bdbe2a1282d4e40ba11e96b1481d09 +folderAsset: yes +timeCreated: 1531219385 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/lib/net45/Grpc.Core.dll b/Assets/Plugins/Grpc.Core/lib/net45/Grpc.Core.dll new file mode 100644 index 000000000..2bb2d6cc8 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/lib/net45/Grpc.Core.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:802c11dc28577e1959833ac0f2eebd263cf4ca469d10948154dfe85e39913d45 +size 464384 diff --git a/Assets/Plugins/Grpc.Core/lib/net45/Grpc.Core.dll.meta b/Assets/Plugins/Grpc.Core/lib/net45/Grpc.Core.dll.meta new file mode 100644 index 000000000..f22a7c4c3 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/lib/net45/Grpc.Core.dll.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 63fdcd70d29d1dc49b4e61e22a9e96e1 +timeCreated: 1531219386 +licenseType: Free +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/lib/net45/Grpc.Core.xml b/Assets/Plugins/Grpc.Core/lib/net45/Grpc.Core.xml new file mode 100644 index 000000000..9e61bdbba --- /dev/null +++ b/Assets/Plugins/Grpc.Core/lib/net45/Grpc.Core.xml @@ -0,0 +1,2183 @@ + + + + Grpc.Core + + + + + Details about a client-side call to be invoked. + + Request message type for the call. + Response message type for the call. + + + + Initializes a new instance of the struct. + + Channel to use for this call. + Method to call. + Call options. + + + + Initializes a new instance of the struct. + + Channel to use for this call. + Method to call. + Host that contains the method. if null, default host will be used. + Call options. + + + + Initializes a new instance of the struct. + + Channel to use for this call. + Qualified method name. + Host that contains the method. + Request marshaller. + Response marshaller. + Call options. + + + + Get channel associated with this call. + + + + + Gets name of method to be called. + + + + + Get name of host. + + + + + Gets marshaller used to serialize requests. + + + + + Gets marshaller used to deserialized responses. + + + + + Gets the call options. + + + + + Returns new instance of with + Options set to the value provided. Values of all other fields are preserved. + + + + + Helper methods for generated clients to make RPC calls. + Most users will use this class only indirectly and will be + making calls using client object generated from protocol + buffer definition files. + + + + + Invokes a simple remote call in a blocking fashion. + + The response. + The call definition. + Request message. + Type of request message. + The of response message. + + + + Invokes a simple remote call asynchronously. + + An awaitable call object providing access to the response. + The call definition. + Request message. + Type of request message. + The of response message. + + + + Invokes a server streaming call asynchronously. + In server streaming scenario, client sends on request and server responds with a stream of responses. + + A call object providing access to the asynchronous response stream. + The call definition. + Request message. + Type of request message. + The of response messages. + + + + Invokes a client streaming call asynchronously. + In client streaming scenario, client sends a stream of requests and server responds with a single response. + + The call definition. + An awaitable call object providing access to the response. + Type of request messages. + The of response message. + + + + Invokes a duplex streaming call asynchronously. + In duplex streaming scenario, client sends a stream of requests and server responds with a stream of responses. + The response stream is completely independent and both side can be sending messages at the same time. + + A call object providing access to the asynchronous request and response streams. + The call definition. + Type of request messages. + Type of responsemessages. + + + + Represents a gRPC channel. Channels are an abstraction of long-lived connections to remote servers. + More client objects can reuse the same channel. Creating a channel is an expensive operation compared to invoking + a remote call so in general you should reuse a single channel for as many calls as possible. + + + + + Creates a channel that connects to a specific host. + Port will default to 80 for an unsecure channel and to 443 for a secure channel. + + Target of the channel. + Credentials to secure the channel. + + + + Creates a channel that connects to a specific host. + Port will default to 80 for an unsecure channel or to 443 for a secure channel. + + Target of the channel. + Credentials to secure the channel. + Channel options. + + + + Creates a channel that connects to a specific host and port. + + The name or IP address of the host. + The port. + Credentials to secure the channel. + + + + Creates a channel that connects to a specific host and port. + + The name or IP address of the host. + The port. + Credentials to secure the channel. + Channel options. + + + + Gets current connectivity state of this channel. + After channel has been shutdown, ChannelState.Shutdown will be returned. + + + + + Returned tasks completes once channel state has become different from + given lastObservedState. + If deadline is reached or an error occurs, returned task is cancelled. + + + + + Returned tasks completes once channel state has become different from + given lastObservedState (true is returned) or if the wait has timed out (false is returned). + + + + Resolved address of the remote endpoint in URI format. + + + + Returns a token that gets cancelled once ShutdownAsync is invoked. + + + + + Allows explicitly requesting channel to connect without starting an RPC. + Returned task completes once state Ready was seen. If the deadline is reached, + or channel enters the Shutdown state, the task is cancelled. + There is no need to call this explicitly unless your use case requires that. + Starting an RPC on a new channel will request connection implicitly. + + The deadline. null indicates no deadline. + + + + Shuts down the channel cleanly. It is strongly recommended to shutdown + all previously created channels before exiting from the process. + + + This method doesn't wait for all calls on this channel to finish (nor does + it explicitly cancel all outstanding calls). It is user's responsibility to make sure + all the calls on this channel have finished (successfully or with an error) + before shutting down the channel to ensure channel shutdown won't impact + the outcome of those remote calls. + + + + + Create a new for the channel. + + A new . + + + + Channel option specified when creating a channel. + Corresponds to grpc_channel_args from grpc/grpc.h. + Commonly used channel option names are defined in ChannelOptions, + but any of the GRPC_ARG_* channel options names defined in grpc_types.h can be used. + + + + + Type of ChannelOption. + + + + + Channel option with integer value. + + + + + Channel option with string value. + + + + + Creates a channel option with a string value. + + Name. + String value. + + + + Creates a channel option with an integer value. + + Name. + Integer value. + + + + Gets the type of the ChannelOption. + + + + + Gets the name of the ChannelOption. + + + + + Gets the integer value the ChannelOption. + + + + + Gets the string value the ChannelOption. + + + + + Determines whether the specified object is equal to the current object. + + + + + Determines whether the specified object is equal to the current object. + + + + + A hash code for the current object. + + + + + Equality operator. + + + + + Inequality operator. + + + + + Defines names of most commonly used channel options. + Other supported options names can be found in grpc_types.h (GRPC_ARG_* definitions) + + + + Override SSL target check. Only to be used for testing. + + + Enable census for tracing and stats collection + + + Maximum number of concurrent incoming streams to allow on a http2 connection + + + Maximum message length that the channel can receive + + + Maximum message length that the channel can send + + + Obsolete, for backward compatibility only. + + + Initial sequence number for http2 transports + + + Default authority for calls. + + + Primary user agent: goes at the start of the user-agent metadata + + + Secondary user agent: goes at the end of the user-agent metadata + + + If non-zero, allow the use of SO_REUSEPORT for server if it's available (default 1) + + + + Creates native object for a collection of channel options. + + The native channel arguments. + + + + Connectivity state of a channel. + Based on grpc_connectivity_state from grpc/grpc.h + + + + + Channel is idle + + + + + Channel is connecting + + + + + Channel is ready for work + + + + + Channel has seen a failure but expects to recover + + + + + Channel has seen a failure that it cannot recover from + + + + + Compression level based on grpc_compression_level from grpc/compression.h + + + + + No compression. + + + + + Low compression. + + + + + Medium compression. + + + + + High compression. + + + + + Invokes client RPCs using . + + + + + Initializes a new instance of the class. + + Channel to use. + + + + Invokes a simple remote call in a blocking fashion. + + + + + Invokes a simple remote call asynchronously. + + + + + Invokes a server streaming call asynchronously. + In server streaming scenario, client sends on request and server responds with a stream of responses. + + + + + Invokes a client streaming call asynchronously. + In client streaming scenario, client sends a stream of requests and server responds with a single response. + + + + + Invokes a duplex streaming call asynchronously. + In duplex streaming scenario, client sends a stream of requests and server responds with a stream of responses. + The response stream is completely independent and both side can be sending messages at the same time. + + + + Creates call invocation details for given method. + + + + Encapsulates initialization and shutdown of gRPC library. + + + + + Returns a reference-counted instance of initialized gRPC environment. + Subsequent invocations return the same instance unless reference count has dropped to zero previously. + + + + + Decrements the reference count for currently active environment and asynchronously shuts down the gRPC environment if reference count drops to zero. + + + + + Requests shutdown of all channels created by the current process. + + + + + Requests immediate shutdown of all servers created by the current process. + + + + + Gets application-wide logger used by gRPC. + + The logger. + + + + Sets the application-wide logger that should be used by gRPC. + + + + + Sets the number of threads in the gRPC thread pool that polls for internal RPC events. + Can be only invoked before the GrpcEnviroment is started and cannot be changed afterwards. + Setting thread pool size is an advanced setting and you should only use it if you know what you are doing. + Most users should rely on the default value provided by gRPC library. + Note: this method is part of an experimental API that can change or be removed without any prior notice. + + + + + Sets the number of completion queues in the gRPC thread pool that polls for internal RPC events. + Can be only invoked before the GrpcEnviroment is started and cannot be changed afterwards. + Setting the number of completions queues is an advanced setting and you should only use it if you know what you are doing. + Most users should rely on the default value provided by gRPC library. + Note: this method is part of an experimental API that can change or be removed without any prior notice. + + + + + By default, gRPC's internal event handlers get offloaded to .NET default thread pool thread (inlineHandlers=false). + Setting inlineHandlers to true will allow scheduling the event handlers directly to + GrpcThreadPool internal threads. That can lead to significant performance gains in some situations, + but requires user to never block in async code (incorrectly written code can easily lead to deadlocks). + Inlining handlers is an advanced setting and you should only use it if you know what you are doing. + Most users should rely on the default value provided by gRPC library. + Note: this method is part of an experimental API that can change or be removed without any prior notice. + Note: inlineHandlers=true was the default in gRPC C# v1.4.x and earlier. + + + + + Sets the parameters for a pool that caches batch context instances. Reusing batch context instances + instead of creating a new one for every C core operation helps reducing the GC pressure. + Can be only invoked before the GrpcEnviroment is started and cannot be changed afterwards. + This is an advanced setting and you should only use it if you know what you are doing. + Most users should rely on the default value provided by gRPC library. + Note: this method is part of an experimental API that can change or be removed without any prior notice. + + + + + Sets the parameters for a pool that caches request call context instances. Reusing request call context instances + instead of creating a new one for every requested call in C core helps reducing the GC pressure. + Can be only invoked before the GrpcEnviroment is started and cannot be changed afterwards. + This is an advanced setting and you should only use it if you know what you are doing. + Most users should rely on the default value provided by gRPC library. + Note: this method is part of an experimental API that can change or be removed without any prior notice. + + + + + Occurs when GrpcEnvironment is about the start the shutdown logic. + If GrpcEnvironment is later initialized and shutdown, the event will be fired again (unless unregistered first). + + + + + Creates gRPC environment. + + + + + Gets the completion queues used by this gRPC environment. + + + + + Picks a completion queue in a round-robin fashion. + Shouldn't be invoked on a per-call basis (used at per-channel basis). + + + + + Gets the completion queue used by this gRPC environment. + + + + + Gets version of gRPC C core. + + + + + Shuts down this environment. + + + + + Handler for AppDomain.DomainUnload, AppDomain.ProcessExit and AssemblyLoadContext.Unloading hooks. + + + + + Extends the ServerServiceDefinition class to add methods used to register interceptors on the server side. + + + + + Returns a instance that + intercepts incoming calls to the underlying service handler through the given interceptor. + + The instance to register interceptors on. + The interceptor to intercept the incoming invocations with. + + Multiple interceptors can be added on top of each other by calling + "serverServiceDefinition.Intercept(a, b, c)". The order of invocation will be "a", "b", and then "c". + Interceptors can be later added to an existing intercepted service definition, effectively + building a chain like "serverServiceDefinition.Intercept(c).Intercept(b).Intercept(a)". Note that + in this case, the last interceptor added will be the first to take control. + + + + + Returns a instance that + intercepts incoming calls to the underlying service handler through the given interceptors. + + The instance to register interceptors on. + + An array of interceptors to intercept the incoming invocations with. + Control is passed to the interceptors in the order specified. + + + Multiple interceptors can be added on top of each other by calling + "serverServiceDefinition.Intercept(a, b, c)". The order of invocation will be "a", "b", and then "c". + Interceptors can be later added to an existing intercepted service definition, effectively + building a chain like "serverServiceDefinition.Intercept(c).Intercept(b).Intercept(a)". Note that + in this case, the last interceptor added will be the first to take control. + + + + + Helper for creating ServerServiceDefinition with intercepted handlers. + + + + + Manages client side native call lifecycle. + + + + + This constructor should only be used for testing. + + + + + Blocking unary request - unary response call. + + + + + Starts a unary request - unary response call. + + + + + Starts a streamed request - unary response call. + Use StartSendMessage and StartSendCloseFromClient to stream requests. + + + + + Starts a unary request - streamed response call. + + + + + Starts a streaming request - streaming response call. + Use StartSendMessage and StartSendCloseFromClient to stream requests. + + + + + Sends a streaming request. Only one pending send action is allowed at any given time. + + + + + Receives a streaming response. Only one pending read action is allowed at any given time. + + + + + Sends halfclose, indicating client is done with streaming requests. + Only one pending send action is allowed at any given time. + + + + + Get the task that completes once if streaming response call finishes with ok status and throws RpcException with given status otherwise. + + + + + Get the task that completes once response headers are received. + + + + + Gets the resulting status if the call has already finished. + Throws InvalidOperationException otherwise. + + + + + Gets the trailing metadata if the call has already finished. + Throws InvalidOperationException otherwise. + + + + + Gets WriteFlags set in callDetails.Options.WriteOptions + + + + + Handles receive status completion for calls with streaming response. + + + + + Handler for unary response completion. + + + + + Handles receive status completion for calls with streaming response. + + + + + Base for handling both client side and server side calls. + Manages native call lifecycle and provides convenience methods. + + + + + Requests cancelling the call. + + + + + Requests cancelling the call with given status. + + + + + Initiates sending a message. Only one send operation can be active at a time. + + + + + Initiates reading a message. Only one read operation can be active at a time. + + + + + If there are no more pending actions and no new actions can be started, releases + the underlying native resources. + + + + + Returns an exception to throw for a failed send operation. + It is only allowed to call this method for a call that has already finished. + + + + + Checks if sending is allowed and possibly returns a Task that allows short-circuiting the send + logic by directly returning the write operation result task. Normally, null is returned. + + + + + Handles send completion (including SendCloseFromClient). + + + + + Handles send status from server completion. + + + + + Handles streaming read completion. + + + + + Manages server side native call lifecycle. + + + + + Only for testing purposes. + + + + + Starts a server side call. + + + + + Sends a streaming response. Only one pending send action is allowed at any given time. + + + + + Receives a streaming request. Only one pending read action is allowed at any given time. + + + + + Initiates sending a initial metadata. + Even though C-core allows sending metadata in parallel to sending messages, we will treat sending metadata as a send message operation + to make things simpler. + + + + + Sends call result status, indicating we are done with writes. + Sending a status different from StatusCode.OK will also implicitly cancel the call. + + + + + Gets cancellation token that gets cancelled once close completion + is received and the cancelled flag is set. + + + + + Handles the server side close completion. + + + + + grpc_auth_context + + + + + Copies contents of the native auth context into a new AuthContext instance. + + + + + grpc_auth_property + + + + + grpc_auth_property_iterator + + + + + grpcsharp_batch_context + + + + + grpc_call_credentials from grpc/grpc_security.h + + + + + grpc_call_error from grpc/grpc.h + + + + + Checks the call API invocation's result is OK. + + + + + Returns a new instance of with + all previously unset values set to their defaults and deadline and cancellation + token propagated when appropriate. + + + + + grpc_call from grpc/grpc.h + + + + + Only for testing. + + + + + grpc_channel_args from grpc/grpc.h + + + + + grpc_channel_credentials from grpc/grpc_security.h + + + + + grpc_channel from grpc/grpc.h + + + + + Writes requests asynchronously to an underlying AsyncCall object. + + + + + Status + metadata received on client side when call finishes. + (when receive_status_on_client operation finishes). + + + + + gpr_clock_type from grpc/support/time.h + + + + + grpc_event from grpc/grpc.h + + + + + grpc_completion_type from grpc/grpc.h + + + + + grpc_completion_queue from grpc/grpc.h + + + + + Create a completion queue that can only be used for Pluck operations. + + + + + Create a completion queue that can only be used for Next operations. + + + + + Creates a new usage scope for this completion queue. Once successfully created, + the completion queue won't be shutdown before scope.Dispose() is called. + + + + + Completion registry associated with this completion queue. + Doesn't need to be set if only using Pluck() operations. + + + + + For testing purposes only. NOT threadsafe. + + + + + IntPtr doesn't implement IEquatable{IntPtr} so we need to use custom comparer to avoid boxing. + + + + + Context propagation flags from grpc/grpc.h. + + + + + Implementation of ContextPropagationToken that carries + all fields needed for context propagation by C-core based implementation of gRPC. + Instances of ContextPropagationToken that are not of this + type will be recognized as "foreign" and will be silently ignored + (treated as if null). + + + + + Default propagation mask used by C core. + + + + + Default propagation mask used by C# - we want to propagate deadline + and cancellation token by our own means, everything else will be propagated + by C core automatically (according to DefaultCoreMask). + + + + + Gets the native handle of the parent call. + + + + + Gets the parent call's deadline. + + + + + Gets the parent call's cancellation token. + + + + + Get the context propagation options. + + + + + Converts given ContextPropagationToken to ContextPropagationTokenImpl + if possible or returns null. + Being able to convert means that the context propagation token is recognized as + "ours" (was created by this implementation). + + + + + Owned char* object. + + + + + Checks the debug stats and take action for any inconsistency found. + + + + + Creates native call credential objects from instances of CallCredentials. + + + + + Creates native object for the credentials. + + The native credentials. + + + + Creates native call credential objects from instances of ChannelCredentials. + + + + + Creates native object for the credentials. + + The native credentials. + + + + Pool of objects that combines a shared pool and a thread local pool. + + + + + Initializes a new instance of DefaultObjectPool with given shared capacity and thread local capacity. + Thread local capacity should be significantly smaller than the shared capacity as we don't guarantee immediately + disposing the objects in the thread local pool after this pool is disposed (they will eventually be garbage collected + after the thread that owns them has finished). + On average, the shared pool will only be accessed approx. once for every threadLocalCapacity / 2 rent or lease + operations. + + + + + Leases an item from the pool or creates a new instance if the pool is empty. + Attempts to retrieve the item from the thread local pool first. + If the thread local pool is empty, the item is taken from the shared pool + along with more items that are moved to the thread local pool to avoid + prevent acquiring the lock for shared pool too often. + The methods should not be called after the pool is disposed, but it won't + results in an error to do so (after depleting the items potentially left + in the thread local pool, it will continue returning new objects created by the factory). + + + + + Returns an item to the pool. + Attempts to add the item to the thread local pool first. + If the thread local pool is full, item is added to a shared pool, + along with half of the items for the thread local pool, which + should prevent acquiring the lock for shared pool too often. + If called after the pool is disposed, we make best effort not to + add anything to the thread local pool and we guarantee not to add + anything to the shared pool (items will be disposed instead). + + + + + Expose serializer as buffer writer + + + + + Complete the payload written so far. + + + + + Overrides the content of default SSL roots. + + + + + Overrides C core's default roots with roots.pem loaded as embedded resource. + + + + + Pool of threads polling on a set of completions queues. + + + + + Creates a thread pool threads polling on a set of completions queues. + + Environment. + Pool size. + Completion queue count. + Handler inlining. + + + + Returns true if there is at least one thread pool thread that hasn't + already stopped. + Threads can either stop because all completion queues shut down or + because all foreground threads have already shutdown and process is + going to exit. + + + + + Body of the polling thread. + + + + + Abstraction of a native call object. + + + + + Pool of objects. + + + + + An object that can be pooled in IObjectPool. + + + + + + Set the action that will be invoked to return a leased object to the pool. + + + + + Exposes non-generic members of ServerReponseStream. + + + + + Asynchronously sends response headers for the current call to the client. See ServerCallContext.WriteResponseHeadersAsync for exact semantics. + + + + + Gets or sets the write options. + + + + + Useful methods for native/managed marshalling. + + + + + Converts IntPtr pointing to a UTF-8 encoded byte array to string. + + + + + UTF-8 encodes the given string into a buffer of sufficient size + + + + + Returns the maximum number of bytes required to encode a given string. + + + + + Returns the actual number of bytes required to encode a given string. + + + + + grpc_metadata_array from grpc/grpc.h + + + + + Reads metadata from pointer to grpc_metadata_array + + + + + Use this attribute to mark methods that will be called back from P/Invoke calls. + iOS (and probably other AOT platforms) needs to have delegates registered. + Instead of depending on Xamarin.iOS for this, we can just create our own, + the iOS runtime just checks for the type name. + See: https://docs.microsoft.com/en-gb/xamarin/ios/internals/limitations#reverse-callbacks + + + + + Takes care of loading C# native extension and provides access to PInvoke calls the library exports. + + + + + Gets singleton instance of this class. + The native extension is loaded when called for the first time. + + + + + Provides access to the exported native methods. + + + + + Detects which configuration of native extension to load and load it. + + + + + Loads native extension and return native methods delegates. + + + + + Return native method delegates when running on Unity platform. + Unity does not use standard NuGet packages and the native library is treated + there as a "native plugin" which is (provided it has the right metadata) + automatically made available to [DllImport] loading logic. + WARNING: Unity support is experimental and work-in-progress. Don't expect it to work. + + + + + Return native method delegates when running on the Xamarin platform. + WARNING: Xamarin support is experimental and work-in-progress. Don't expect it to work. + + + + + Logs from gRPC C core library can get lost if your application is not a console app. + This class allows redirection of logs to gRPC logger. + + + + + Redirects logs from native gRPC C core library to a general logger. + + + + + Provides access to all native methods provided by NativeExtension. + An extra level of indirection is added to P/Invoke calls to allow intelligent loading + of the right configuration of the native extension based on current platform, architecture etc. + + + + + Gets singleton instance of this class. + + + + + Delegate types for all published native methods. Declared under inner class to prevent scope pollution. + + + + + grpc_csharp_ext used as a static library (e.g Unity iOS). + + + + + grpc_csharp_ext used a shared library (e.g on Unity Standalone and Android). + + + + + Utility methods for detecting platform and architecture. + + + + + true if running on Unity platform. + + + + + true if running on Unity iOS, false otherwise. + + + + + true if running on a Xamarin platform (either Xamarin.Android or Xamarin.iOS), + false otherwise. + + + + + true if running on Xamarin.iOS, false otherwise. + + + + + true if running on Xamarin.Android, false otherwise. + + + + + true if running on .NET Core (CoreCLR), false otherwise. + + + + + Returns UnityEngine.Application.platform as a string. + See https://docs.unity3d.com/ScriptReference/Application-platform.html for possible values. + Value is obtained via reflection to avoid compile-time dependency on Unity. + This method should only be called if IsUnity is true. + + + + + grpcsharp_request_call_context + + + + + Safe handle to wrap native objects. + + + + + Handler used for unimplemented method. + + + + + grpc_server_credentials from grpc/grpc_security.h + + + + + Writes responses asynchronously to an underlying AsyncCallServer object. + + + + + Details of a newly received RPC. + + + + + grpc_server from grpc/grpc.h + + + + + Maps methods from ServerServiceDefinition to server call handlers. + + + + + Helper for converting ServerServiceDefinition to server call handlers. + + + + + Slice of native memory. + Rough equivalent of grpc_slice (but doesn't support inlined slices, just a pointer to data and length) + + + + + Returns a that represents the current . + + + + + Represents grpc_slice_buffer with some extra utility functions to allow + writing data to it using the IBufferWriter interface. + + + + + gpr_timespec from grpc/support/time.h + + + + + Indicates whether this instance and a specified object are equal. + + + + + Returns the hash code for this instance. + + + + + Returns the full type name of this instance. + + + + + Indicates whether this instance and a specified object are equal. + + + + + Timespec a long time in the future. + + + + + Timespec a long time in the past. + + + + + Return Timespec representing the current time. + + + + + Seconds since unix epoch. + + + + + The nanoseconds part of timeval. + + + + + Converts the timespec to desired clock type. + + + + + Converts Timespec to DateTime. + Timespec needs to be of type GPRClockType.Realtime and needs to represent a legal value. + DateTime has lower resolution (100ns), so rounding can occurs. + Value are always rounded up to the nearest DateTime value in the future. + + For Timespec.InfFuture or if timespec is after the largest representable DateTime, DateTime.MaxValue is returned. + For Timespec.InfPast or if timespec is before the lowest representable DateTime, DateTime.MinValue is returned. + + Unless DateTime.MaxValue or DateTime.MinValue is returned, the resulting DateTime is always in UTC + (DateTimeKind.Utc) + + + + + Creates DateTime to Timespec. + DateTime has to be in UTC (DateTimeKind.Utc) unless it's DateTime.MaxValue or DateTime.MinValue. + For DateTime.MaxValue of date time after the largest representable Timespec, Timespec.InfFuture is returned. + For DateTime.MinValue of date time before the lowest representable Timespec, Timespec.InfPast is returned. + + The date time. + Date time. + + + + Gets current timestamp using GPRClockType.Precise. + Only available internally because core needs to be compiled with + GRPC_TIMERS_RDTSC support for this to use RDTSC. + + + + + Call invoker that throws NotImplementedException for all requests. + + + + + Represents a dynamically loaded unmanaged library in a (partially) platform independent manner. + First, the native library is loaded using dlopen (on Unix systems) or using LoadLibrary (on Windows). + dlsym or GetProcAddress are then used to obtain symbol addresses. Marshal.GetDelegateForFunctionPointer + transforms the addresses into delegates to native methods. + See http://stackoverflow.com/questions/13461989/p-invoke-to-dynamically-loaded-library-on-mono. + + + + + Loads symbol in a platform specific way. + + + + + + + Loads library in a platform specific way. + + + + + On Linux systems, using using dlopen and dlsym results in + DllNotFoundException("libdl.so not found") if libc6-dev + is not installed. As a workaround, we load symbols for + dlopen and dlsym from the current process as on Linux + Mono sure is linked against these symbols. + + + + + Similarly as for Mono on Linux, we load symbols for + dlopen and dlsym from the "libcoreclr.so", + to avoid the dependency on libc-dev Linux. + + + + + Utility type for identifying "well-known" strings (i.e. headers/keys etc that + we expect to see frequently, and don't want to allocate lots of copies of) + + + + + Test whether the provided byte sequence is recognized as a well-known string; if + so, return a shared instance of that string; otherwise, return null + + + + + Test whether the provided byte sequence is recognized as a well-known string; if + so, return a shared instance of that string; otherwise, return null + + + + + Default implementation of ServerCallContext. + + + + + Creates a new instance of ServerCallContext. + To allow reuse of ServerCallContext API by different gRPC implementations, the implementation of some members is provided externally. + To provide state, this ServerCallContext instance and extraData will be passed to the member implementations. + + + + Logger that logs to System.Console. + + + Creates a console logger not associated to any specific type. + + + Creates a console logger that logs messsage specific for given type. + + + + Returns a logger associated with the specified type. + + + + For logging messages. + + + Returns a logger associated with the specified type. + + + Logs a message with severity Debug. + + + Logs a formatted message with severity Debug. + + + Logs a message with severity Info. + + + Logs a formatted message with severity Info. + + + Logs a message with severity Warning. + + + Logs a formatted message with severity Warning. + + + Logs a message and an associated exception with severity Warning. + + + Logs a message with severity Error. + + + Logs a formatted message with severity Error. + + + Logs a message and an associated exception with severity Error. + + + Standard logging levels. + + + + Debug severity. + + + + + Info severity. + + + + + Warning severity. + + + + + Error severity. + + + + + Logging is off. + + + + Logger that filters out messages below certain log level. + + + + Creates and instance of LogLevelFilter. + + + + + Creates and instance of LogLevelFilter. + The fromEnvironmentVariable parameter allows looking up "GRPC_VERBOSITY" setting provided by C-core + and uses the same log level for C# logs. Using this setting is recommended as it can prevent unintentionally hiding + C core logs requested by "GRPC_VERBOSITY" environment variable (which could happen if C# logger's log level was set to a more restrictive value). + + the logger to forward filtered logs to. + the default log level, unless overriden by env variable. + if true, override log level with setting from environment variable. + + + + Returns a logger associated with the specified type. + + + + Logs a message with severity Debug. + + + Logs a formatted message with severity Debug. + + + Logs a message with severity Info. + + + Logs a formatted message with severity Info. + + + Logs a message with severity Warning. + + + Logs a formatted message with severity Warning. + + + Logs a message and an associated exception with severity Warning. + + + Logs a message with severity Error. + + + Logs a formatted message with severity Error. + + + Logs a message and an associated exception with severity Error. + + + Get log level based on a default and lookup of GRPC_VERBOSITY environment variable. + + + + Logger which doesn't log any information anywhere. + + + + + As with all logging calls on this logger, this method is a no-op. + + + + + As with all logging calls on this logger, this method is a no-op. + + + + + As with all logging calls on this logger, this method is a no-op. + + + + + As with all logging calls on this logger, this method is a no-op. + + + + + As with all logging calls on this logger, this method is a no-op. + + + + + Returns a reference to the instance on which the method is called, as + instances aren't associated with specific types. + + + + + As with all logging calls on this logger, this method is a no-op. + + + + + As with all logging calls on this logger, this method is a no-op. + + + + + As with all logging calls on this logger, this method is a no-op. + + + + + As with all logging calls on this logger, this method is a no-op. + + + + + As with all logging calls on this logger, this method is a no-op. + + + + Logger that logs to an arbitrary System.IO.TextWriter. + + + + Creates a console logger not associated to any specific type and writes to given System.IO.TextWriter. + User is responsible for providing an instance of TextWriter that is thread-safe. + + + + + Creates a console logger not associated to any specific type and writes to a System.IO.TextWriter obtained from given provider. + User is responsible for providing an instance of TextWriter that is thread-safe. + + + + Creates a console logger that logs messsage specific for given type. + + + + Returns a logger associated with the specified type. + + + + Logs a message with severity Debug. + + + Logs a formatted message with severity Debug. + + + Logs a message with severity Info. + + + Logs a formatted message with severity Info. + + + Logs a message with severity Warning. + + + Logs a formatted message with severity Warning. + + + Logs a message and an associated exception with severity Warning. + + + Logs a message with severity Error. + + + Logs a formatted message with severity Error. + + + Logs a message and an associated exception with severity Error. + + + Gets the type associated with this logger. + + + + gRPC server. A single server can serve an arbitrary number of services and can listen on more than one port. + + + + + Creates a new server. + + + + + Creates a new server. + + Channel options. + + + + Services that will be exported by the server once started. Register a service with this + server by adding its definition to this collection. + + + + + Ports on which the server will listen once started. Register a port with this + server by adding its definition to this collection. + + + + + To allow awaiting termination of the server. + + + + + Experimental API. Might anytime change without prior notice. + Number or calls requested via grpc_server_request_call at any given time for each completion queue. + + + + + Starts the server. + Throws IOException if not successful. + + + + + Requests server shutdown and when there are no more calls being serviced, + cleans up used resources. The returned task finishes when shutdown procedure + is complete. + + + It is strongly recommended to shutdown all previously created servers before exiting from the process. + + + + + Requests server shutdown while cancelling all the in-progress calls. + The returned task finishes when shutdown procedure is complete. + + + It is strongly recommended to shutdown all previously created servers before exiting from the process. + + + + + Shuts down the server. + + + + + In case the environment's threadpool becomes dead, the shutdown completion will + never be delivered, but we need to release the environment's handle anyway. + + + + + Adds a service definition. + + + + + Adds a listening port. + + + + + Allows one new RPC call to be received by server. + + + + + Checks that all ports have been bound successfully. + + + + + Selects corresponding handler for given call and handles the call. + + + + + Handles the native callback. + + + + + Handles native callback. + + + + + Collection of service definitions. + + + + + Adds a service definition to the server. This is how you register + handlers for a service with the server. Only call this before Start(). + + + + + Gets enumerator for this collection. + + + + + Collection of server ports. + + + + + Adds a new port on which server should listen. + Only call this before Start(). + The port on which server will be listening. + + + + + Adds a new port on which server should listen. + The port on which server will be listening. + + the host + the port. If zero, an unused port is chosen automatically. + credentials to use to secure this port. + + + + Gets enumerator for this collection. + + + + + Server side credentials. + + + + + Returns instance of credential that provides no security and + will result in creating an unsecure server port with no encryption whatsoever. + + + + + Creates native object for the credentials. + + The native credentials. + + + + Modes of requesting client's SSL certificate by the server. + Corresponds to grpc_ssl_client_certificate_request_type. + + + + + Server does not request client certificate. + The certificate presented by the client is not checked by the server at + all. (A client may present a self signed or signed certificate or not + present a certificate at all and any of those option would be accepted) + + + + + Server requests client certificate but does not enforce that the client + presents a certificate. + If the client presents a certificate, the client authentication is left to + the application (the necessary metadata will be available to the + application via authentication context properties, see grpc_auth_context). + The client's key certificate pair must be valid for the SSL connection to + be established. + + + + + Server requests client certificate but does not enforce that the client + presents a certificate. + If the client presents a certificate, the client authentication is done by + the gRPC framework. (For a successful connection the client needs to either + present a certificate that can be verified against the root certificate + configured by the server or not present a certificate at all) + The client's key certificate pair must be valid for the SSL connection to + be established. + + + + + Server requests client certificate and enforces that the client presents a + certificate. + If the client presents a certificate, the client authentication is left to + the application (the necessary metadata will be available to the + application via authentication context properties, see grpc_auth_context). + The client's key certificate pair must be valid for the SSL connection to + be established. + + + + + Server requests client certificate and enforces that the client presents a + certificate. + The certificate presented by the client is verified by the gRPC framework. + (For a successful connection the client needs to present a certificate that + can be verified against the root certificate configured by the server) + The client's key certificate pair must be valid for the SSL connection to + be established. + + + + + Server-side SSL credentials. + + + + + Creates server-side SSL credentials. + + Key-certificates to use. + PEM encoded client root certificates used to authenticate client. + Deprecated, use clientCertificateRequest overload instead. + + + + Creates server-side SSL credentials. + + Key-certificates to use. + PEM encoded client root certificates used to authenticate client. + Options for requesting and verifying client certificate. + + + + Creates server-side SSL credentials. + This constructor should be used if you do not wish to authenticate the client. + (client certificate won't be requested and checked by the server at all). + + Key-certificates to use. + + + + Key-certificate pairs. + + + + + PEM encoded client root certificates. + + + + + Deprecated. If true, the authenticity of client check will be enforced. + + + + + Mode of requesting certificate from client by the server. + + + + + A port exposed by a server. + + + + + Pass this value as port to have the server choose an unused listening port for you. + Ports added to a server will contain the bound port in their property. + + + + + Creates a new port on which server should listen. + + The port on which server will be listening. + the host + the port. If zero, an unused port is chosen automatically. + credentials to use to secure this port. + + + + Creates a port from an existing ServerPort instance and boundPort value. + + + + The host. + + + The port. + + + The server credentials. + + + + The port actually bound by the server. This is useful if you let server + pick port automatically. + + + + + Extension methods that simplify work with gRPC streaming calls. + + + + + Reads the entire stream and executes an async action for each element. + + + + + Reads the entire stream and creates a list containing all the elements read. + + + + + Writes all elements from given enumerable to the stream. + Completes the stream afterwards unless close = false. + + + + + Writes all elements from given enumerable to the stream. + + + + + Utility methods to run microbenchmarks. + + + + + Runs a simple benchmark preceded by warmup phase. + + + + + Utility methods for task parallel library. + + + + + Framework independent equivalent of Task.CompletedTask. + + + + diff --git a/Assets/Plugins/Grpc.Core/lib/net45/Grpc.Core.xml.meta b/Assets/Plugins/Grpc.Core/lib/net45/Grpc.Core.xml.meta new file mode 100644 index 000000000..2c1a53292 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/lib/net45/Grpc.Core.xml.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: ec9cf7702008ac648af0687c05064f78 +timeCreated: 1531219386 +licenseType: Free +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes.meta b/Assets/Plugins/Grpc.Core/runtimes.meta new file mode 100644 index 000000000..921669fdd --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 643bdb9ca01174f4eb77e3e15f8324b3 +folderAsset: yes +timeCreated: 1531219385 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/android.meta b/Assets/Plugins/Grpc.Core/runtimes/android.meta new file mode 100644 index 000000000..489e8ddd4 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/android.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: f7f79be62cf24a940be0211dab5d2e5e +folderAsset: yes +timeCreated: 1531220113 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/android/arm64-v8a.meta b/Assets/Plugins/Grpc.Core/runtimes/android/arm64-v8a.meta new file mode 100644 index 000000000..976b74b6e --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/android/arm64-v8a.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 47ba39f5fad6b49c5aae011940e9eea2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/android/arm64-v8a/libgrpc_csharp_ext.so b/Assets/Plugins/Grpc.Core/runtimes/android/arm64-v8a/libgrpc_csharp_ext.so new file mode 100644 index 000000000..ebe568cf4 Binary files /dev/null and b/Assets/Plugins/Grpc.Core/runtimes/android/arm64-v8a/libgrpc_csharp_ext.so differ diff --git a/Assets/Plugins/Grpc.Core/runtimes/android/arm64-v8a/libgrpc_csharp_ext.so.meta b/Assets/Plugins/Grpc.Core/runtimes/android/arm64-v8a/libgrpc_csharp_ext.so.meta new file mode 100644 index 000000000..6f9361728 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/android/arm64-v8a/libgrpc_csharp_ext.so.meta @@ -0,0 +1,102 @@ +fileFormatVersion: 2 +guid: e1f44cc7ecd4244448817ccae6de42a3 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 0 + Exclude Editor: 1 + Exclude Linux: 1 + Exclude Linux64: 1 + Exclude LinuxUniversal: 1 + Exclude OSXUniversal: 1 + Exclude Win: 1 + Exclude Win64: 1 + Exclude iOS: 1 + - first: + Android: Android + second: + enabled: 1 + settings: + CPU: ARM64 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Linux + second: + enabled: 0 + settings: + CPU: x86 + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: x86_64 + - first: + Standalone: LinuxUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + iPhone: iOS + second: + enabled: 0 + settings: + AddToEmbeddedBinaries: false + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/android/armeabi-v7a.meta b/Assets/Plugins/Grpc.Core/runtimes/android/armeabi-v7a.meta new file mode 100644 index 000000000..36a3b7e6c --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/android/armeabi-v7a.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: de2aa4d10bc38f54fb8345aca9b21195 +folderAsset: yes +timeCreated: 1531220167 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/android/armeabi-v7a/libgrpc_csharp_ext.so b/Assets/Plugins/Grpc.Core/runtimes/android/armeabi-v7a/libgrpc_csharp_ext.so new file mode 100644 index 000000000..ac173af4a Binary files /dev/null and b/Assets/Plugins/Grpc.Core/runtimes/android/armeabi-v7a/libgrpc_csharp_ext.so differ diff --git a/Assets/Plugins/Grpc.Core/runtimes/android/armeabi-v7a/libgrpc_csharp_ext.so.meta b/Assets/Plugins/Grpc.Core/runtimes/android/armeabi-v7a/libgrpc_csharp_ext.so.meta new file mode 100644 index 000000000..82578436b --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/android/armeabi-v7a/libgrpc_csharp_ext.so.meta @@ -0,0 +1,102 @@ +fileFormatVersion: 2 +guid: 04fe0e4dcf310416b991e57c99e5d55f +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 0 + Exclude Editor: 1 + Exclude Linux: 1 + Exclude Linux64: 1 + Exclude LinuxUniversal: 1 + Exclude OSXUniversal: 1 + Exclude Win: 1 + Exclude Win64: 1 + Exclude iOS: 1 + - first: + Android: Android + second: + enabled: 1 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Linux + second: + enabled: 0 + settings: + CPU: x86 + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: x86_64 + - first: + Standalone: LinuxUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + iPhone: iOS + second: + enabled: 0 + settings: + AddToEmbeddedBinaries: false + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/android/x86.meta b/Assets/Plugins/Grpc.Core/runtimes/android/x86.meta new file mode 100644 index 000000000..53032587e --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/android/x86.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 800ab3aa15d1b49b19df1caf1315bd3e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/android/x86/libgrpc_csharp_ext.so b/Assets/Plugins/Grpc.Core/runtimes/android/x86/libgrpc_csharp_ext.so new file mode 100644 index 000000000..b5c69d214 Binary files /dev/null and b/Assets/Plugins/Grpc.Core/runtimes/android/x86/libgrpc_csharp_ext.so differ diff --git a/Assets/Plugins/Grpc.Core/runtimes/android/x86/libgrpc_csharp_ext.so.meta b/Assets/Plugins/Grpc.Core/runtimes/android/x86/libgrpc_csharp_ext.so.meta new file mode 100644 index 000000000..3ebdd010e --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/android/x86/libgrpc_csharp_ext.so.meta @@ -0,0 +1,102 @@ +fileFormatVersion: 2 +guid: 245e3d515096b414fbcdd1fd4160161a +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 0 + Exclude Editor: 1 + Exclude Linux: 1 + Exclude Linux64: 1 + Exclude LinuxUniversal: 1 + Exclude OSXUniversal: 1 + Exclude Win: 1 + Exclude Win64: 1 + Exclude iOS: 1 + - first: + Android: Android + second: + enabled: 1 + settings: + CPU: x86 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Linux + second: + enabled: 0 + settings: + CPU: x86 + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: x86_64 + - first: + Standalone: LinuxUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + iPhone: iOS + second: + enabled: 0 + settings: + AddToEmbeddedBinaries: false + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/grpc_csharp_ext_dummy_stubs.c b/Assets/Plugins/Grpc.Core/runtimes/grpc_csharp_ext_dummy_stubs.c new file mode 100644 index 000000000..58a7c58e9 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/grpc_csharp_ext_dummy_stubs.c @@ -0,0 +1,436 @@ + +// Copyright 2019 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// When building for Unity Android with il2cpp backend, Unity tries to link +// the __Internal PInvoke definitions (which are required by iOS) even though +// the .so/.dll will be actually used. This file provides dummy stubs to +// make il2cpp happy. +// See https://github.com/grpc/grpc/issues/16012 + +#include +#include + +void grpcsharp_init() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_shutdown() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_version_string() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_batch_context_create() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_batch_context_recv_initial_metadata() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_batch_context_recv_message_length() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_batch_context_recv_message_next_slice_peek() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_batch_context_recv_status_on_client_status() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_batch_context_recv_status_on_client_details() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_batch_context_recv_status_on_client_trailing_metadata() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_batch_context_recv_close_on_server_cancelled() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_batch_context_reset() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_batch_context_destroy() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_request_call_context_create() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_request_call_context_call() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_request_call_context_method() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_request_call_context_host() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_request_call_context_deadline() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_request_call_context_request_metadata() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_request_call_context_reset() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_request_call_context_destroy() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_composite_call_credentials_create() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_call_credentials_release() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_call_cancel() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_call_cancel_with_status() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_call_start_unary() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_call_start_client_streaming() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_call_start_server_streaming() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_call_start_duplex_streaming() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_call_send_message() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_call_send_close_from_client() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_call_send_status_from_server() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_call_recv_message() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_call_recv_initial_metadata() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_call_start_serverside() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_call_send_initial_metadata() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_call_set_credentials() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_call_get_peer() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_call_destroy() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_channel_args_create() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_channel_args_set_string() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_channel_args_set_integer() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_channel_args_destroy() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_override_default_ssl_roots() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_ssl_credentials_create() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_composite_channel_credentials_create() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_channel_credentials_release() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_insecure_channel_create() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_secure_channel_create() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_channel_create_call() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_channel_check_connectivity_state() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_channel_watch_connectivity_state() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_channel_get_target() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_channel_destroy() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_sizeof_grpc_event() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_completion_queue_create_async() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_completion_queue_create_sync() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_completion_queue_shutdown() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_completion_queue_next() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_completion_queue_pluck() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_completion_queue_destroy() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void gprsharp_free() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_metadata_array_create() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_metadata_array_add() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_metadata_array_count() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_metadata_array_get_key() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_metadata_array_get_value() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_metadata_array_destroy_full() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_redirect_log() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_native_callback_dispatcher_init() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_metadata_credentials_create_from_plugin() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_metadata_credentials_notify_from_plugin() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_ssl_server_credentials_create() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_server_credentials_release() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_server_create() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_server_register_completion_queue() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_server_add_insecure_http2_port() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_server_add_secure_http2_port() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_server_start() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_server_request_call() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_server_cancel_all_calls() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_server_shutdown_and_notify_callback() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_server_destroy() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_call_auth_context() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_auth_context_peer_identity_property_name() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_auth_context_property_iterator() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_auth_property_iterator_next() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_auth_context_release() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_slice_buffer_create() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_slice_buffer_adjust_tail_space() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_slice_buffer_slice_count() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_slice_buffer_slice_peek() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_slice_buffer_reset_and_unref() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_slice_buffer_destroy() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void gprsharp_now() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void gprsharp_inf_future() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void gprsharp_inf_past() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void gprsharp_convert_clock_type() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void gprsharp_sizeof_timespec() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_test_callback() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_test_nop() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_test_override_method() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_test_call_start_unary_echo() { + fprintf(stderr, "Should never reach here"); + abort(); +} diff --git a/Assets/Plugins/Grpc.Core/runtimes/grpc_csharp_ext_dummy_stubs.c.meta b/Assets/Plugins/Grpc.Core/runtimes/grpc_csharp_ext_dummy_stubs.c.meta new file mode 100644 index 000000000..d93af38e4 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/grpc_csharp_ext_dummy_stubs.c.meta @@ -0,0 +1,93 @@ +fileFormatVersion: 2 +guid: 576b78662f1f8af4fa751f709b620f52 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 0 + Exclude Editor: 1 + Exclude Linux: 1 + Exclude Linux64: 1 + Exclude LinuxUniversal: 1 + Exclude OSXUniversal: 1 + Exclude Win: 0 + Exclude Win64: 0 + - first: + Android: Android + second: + enabled: 1 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Linux + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: LinuxUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + Standalone: Win64 + second: + enabled: 1 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/ios.meta b/Assets/Plugins/Grpc.Core/runtimes/ios.meta new file mode 100644 index 000000000..5d3259e20 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/ios.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: a5f54f019e6510541ac61eeec96aa82d +folderAsset: yes +timeCreated: 1531456012 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/ios/libgrpc.a b/Assets/Plugins/Grpc.Core/runtimes/ios/libgrpc.a new file mode 100644 index 000000000..593b37f95 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/ios/libgrpc.a @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b10201b3d9800fdd1430aa6e21ece4cbfc441febe3e115fb0aa75fb3ab91b982 +size 150475712 diff --git a/Assets/Plugins/Grpc.Core/runtimes/ios/libgrpc.a.meta b/Assets/Plugins/Grpc.Core/runtimes/ios/libgrpc.a.meta new file mode 100644 index 000000000..3647568a8 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/ios/libgrpc.a.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: dde9f75258bae4033a4f778fd1149ccd +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Editor: 1 + Exclude Linux: 1 + Exclude Linux64: 1 + Exclude LinuxUniversal: 1 + Exclude OSXUniversal: 1 + Exclude Win: 1 + Exclude Win64: 1 + Exclude iOS: 0 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Linux + second: + enabled: 0 + settings: + CPU: x86 + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: x86_64 + - first: + Standalone: LinuxUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + iPhone: iOS + second: + enabled: 1 + settings: + AddToEmbeddedBinaries: false + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/ios/libgrpc_csharp_ext.a b/Assets/Plugins/Grpc.Core/runtimes/ios/libgrpc_csharp_ext.a new file mode 100644 index 000000000..bb4222c2b --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/ios/libgrpc_csharp_ext.a @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3919391e766965fe334a675dce831a408212eb237fe5526363ba19a37b5cffc9 +size 233696 diff --git a/Assets/Plugins/Grpc.Core/runtimes/ios/libgrpc_csharp_ext.a.meta b/Assets/Plugins/Grpc.Core/runtimes/ios/libgrpc_csharp_ext.a.meta new file mode 100644 index 000000000..af8485851 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/ios/libgrpc_csharp_ext.a.meta @@ -0,0 +1,117 @@ +fileFormatVersion: 2 +guid: 83f99c0e7db71754ba8927bbfb83c668 +timeCreated: 1531456013 +licenseType: Pro +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 1 + Exclude Linux: 1 + Exclude Linux64: 1 + Exclude LinuxUniversal: 1 + Exclude OSXIntel: 1 + Exclude OSXIntel64: 1 + Exclude OSXUniversal: 1 + Exclude Win: 1 + Exclude Win64: 1 + Exclude iOS: 0 + - first: + Android: Android + second: + enabled: 0 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Linux + second: + enabled: 0 + settings: + CPU: x86 + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: x86_64 + - first: + Standalone: LinuxUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXIntel + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: OSXIntel64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + iPhone: iOS + second: + enabled: 1 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/linux.meta b/Assets/Plugins/Grpc.Core/runtimes/linux.meta new file mode 100644 index 000000000..9fc0e6478 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/linux.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 1ff40de7dc502c14e8893c7679e9f44a +folderAsset: yes +timeCreated: 1531219385 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/linux/x64.meta b/Assets/Plugins/Grpc.Core/runtimes/linux/x64.meta new file mode 100644 index 000000000..28d3c0fd8 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/linux/x64.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 08ccfdbfbd8d2d6458eb44d41a7b0b0a +folderAsset: yes +timeCreated: 1531219385 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/linux/x64/libgrpc_csharp_ext.so b/Assets/Plugins/Grpc.Core/runtimes/linux/x64/libgrpc_csharp_ext.so new file mode 100644 index 000000000..d16b10c54 Binary files /dev/null and b/Assets/Plugins/Grpc.Core/runtimes/linux/x64/libgrpc_csharp_ext.so differ diff --git a/Assets/Plugins/Grpc.Core/runtimes/linux/x64/libgrpc_csharp_ext.so.meta b/Assets/Plugins/Grpc.Core/runtimes/linux/x64/libgrpc_csharp_ext.so.meta new file mode 100644 index 000000000..0d639762e --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/linux/x64/libgrpc_csharp_ext.so.meta @@ -0,0 +1,117 @@ +fileFormatVersion: 2 +guid: c176dc12f2803e14bb37bcd0ba4a0718 +timeCreated: 1531219386 +licenseType: Free +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 0 + Exclude Linux: 1 + Exclude Linux64: 0 + Exclude LinuxUniversal: 0 + Exclude OSXIntel: 1 + Exclude OSXIntel64: 1 + Exclude OSXUniversal: 1 + Exclude Win: 0 + Exclude Win64: 0 + Exclude iOS: 1 + - first: + Android: Android + second: + enabled: 0 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + CPU: x86_64 + DefaultValueInitialized: true + OS: Linux + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Linux + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Linux64 + second: + enabled: 1 + settings: + CPU: x86_64 + - first: + Standalone: LinuxUniversal + second: + enabled: 1 + settings: + CPU: x86_64 + - first: + Standalone: OSXIntel + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXIntel64 + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + Standalone: Win64 + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + iPhone: iOS + second: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/linux/x86.meta b/Assets/Plugins/Grpc.Core/runtimes/linux/x86.meta new file mode 100644 index 000000000..b050a3b23 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/linux/x86.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: d62d998e3cdebd542a967743103c64b6 +folderAsset: yes +timeCreated: 1531219385 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/linux/x86/libgrpc_csharp_ext.so b/Assets/Plugins/Grpc.Core/runtimes/linux/x86/libgrpc_csharp_ext.so new file mode 100644 index 000000000..197f10d09 Binary files /dev/null and b/Assets/Plugins/Grpc.Core/runtimes/linux/x86/libgrpc_csharp_ext.so differ diff --git a/Assets/Plugins/Grpc.Core/runtimes/linux/x86/libgrpc_csharp_ext.so.meta b/Assets/Plugins/Grpc.Core/runtimes/linux/x86/libgrpc_csharp_ext.so.meta new file mode 100644 index 000000000..f597b1aa2 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/linux/x86/libgrpc_csharp_ext.so.meta @@ -0,0 +1,117 @@ +fileFormatVersion: 2 +guid: 0165d78fa73d0cc4c8984f3d4f2a6c86 +timeCreated: 1531219386 +licenseType: Free +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 0 + Exclude Linux: 0 + Exclude Linux64: 1 + Exclude LinuxUniversal: 0 + Exclude OSXIntel: 1 + Exclude OSXIntel64: 1 + Exclude OSXUniversal: 1 + Exclude Win: 0 + Exclude Win64: 0 + Exclude iOS: 1 + - first: + Android: Android + second: + enabled: 0 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + CPU: x86 + DefaultValueInitialized: true + OS: Linux + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Linux + second: + enabled: 1 + settings: + CPU: x86 + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: LinuxUniversal + second: + enabled: 1 + settings: + CPU: x86 + - first: + Standalone: OSXIntel + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXIntel64 + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + Standalone: Win64 + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + iPhone: iOS + second: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/osx.meta b/Assets/Plugins/Grpc.Core/runtimes/osx.meta new file mode 100644 index 000000000..cc9c9b60f --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/osx.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 7b1ebe888da0a174c95a712766d2558c +folderAsset: yes +timeCreated: 1531219385 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/osx/x64.meta b/Assets/Plugins/Grpc.Core/runtimes/osx/x64.meta new file mode 100644 index 000000000..d01c158c6 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/osx/x64.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: ccea531b15a71974a91329186dd65075 +folderAsset: yes +timeCreated: 1531219385 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/osx/x64/grpc_csharp_ext.bundle b/Assets/Plugins/Grpc.Core/runtimes/osx/x64/grpc_csharp_ext.bundle new file mode 100644 index 000000000..db12c02c6 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/osx/x64/grpc_csharp_ext.bundle @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c65d82793dbac7259ddfb527eae94db1cf01ee36867cf8e50788490516ef646 +size 5013732 diff --git a/Assets/Plugins/Grpc.Core/runtimes/osx/x64/grpc_csharp_ext.bundle.meta b/Assets/Plugins/Grpc.Core/runtimes/osx/x64/grpc_csharp_ext.bundle.meta new file mode 100644 index 000000000..9d192f59e --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/osx/x64/grpc_csharp_ext.bundle.meta @@ -0,0 +1,117 @@ +fileFormatVersion: 2 +guid: da53c729add26524fbecb84a7b599289 +timeCreated: 1531219386 +licenseType: Free +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 0 + Exclude Linux: 1 + Exclude Linux64: 1 + Exclude LinuxUniversal: 1 + Exclude OSXIntel: 1 + Exclude OSXIntel64: 0 + Exclude OSXUniversal: 0 + Exclude Win: 1 + Exclude Win64: 1 + Exclude iOS: 1 + - first: + Android: Android + second: + enabled: 0 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + CPU: x86_64 + DefaultValueInitialized: true + OS: OSX + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Linux + second: + enabled: 0 + settings: + CPU: x86 + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: x86_64 + - first: + Standalone: LinuxUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXIntel + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXIntel64 + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + Standalone: OSXUniversal + second: + enabled: 1 + settings: + CPU: x86_64 + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + iPhone: iOS + second: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/osx/x86.meta b/Assets/Plugins/Grpc.Core/runtimes/osx/x86.meta new file mode 100644 index 000000000..17713f8c9 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/osx/x86.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 2ee63d0ffcfa72a4fbd7ad04ba34cadb +folderAsset: yes +timeCreated: 1531219385 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/osx/x86/grpc_csharp_ext.bundle b/Assets/Plugins/Grpc.Core/runtimes/osx/x86/grpc_csharp_ext.bundle new file mode 100644 index 000000000..665c22ee8 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/osx/x86/grpc_csharp_ext.bundle @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ed5e0ec1804f47b340349b661399ee77863e2e2fe6665ce16a5b39b64f74c099 +size 4441560 diff --git a/Assets/Plugins/Grpc.Core/runtimes/osx/x86/grpc_csharp_ext.bundle.meta b/Assets/Plugins/Grpc.Core/runtimes/osx/x86/grpc_csharp_ext.bundle.meta new file mode 100644 index 000000000..53822bbe0 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/osx/x86/grpc_csharp_ext.bundle.meta @@ -0,0 +1,117 @@ +fileFormatVersion: 2 +guid: 34ec9b69f128d6d4fa3fb46bc70b547c +timeCreated: 1531219386 +licenseType: Free +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 0 + Exclude Linux: 1 + Exclude Linux64: 1 + Exclude LinuxUniversal: 1 + Exclude OSXIntel: 0 + Exclude OSXIntel64: 1 + Exclude OSXUniversal: 0 + Exclude Win: 1 + Exclude Win64: 1 + Exclude iOS: 1 + - first: + Android: Android + second: + enabled: 0 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + CPU: x86 + DefaultValueInitialized: true + OS: OSX + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Linux + second: + enabled: 0 + settings: + CPU: x86 + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: x86_64 + - first: + Standalone: LinuxUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXIntel + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + Standalone: OSXIntel64 + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXUniversal + second: + enabled: 1 + settings: + CPU: x86 + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + iPhone: iOS + second: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/win.meta b/Assets/Plugins/Grpc.Core/runtimes/win.meta new file mode 100644 index 000000000..1491ee6f0 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/win.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 928a9392668000344b70b6fd126e522c +folderAsset: yes +timeCreated: 1531219385 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/win/x64.meta b/Assets/Plugins/Grpc.Core/runtimes/win/x64.meta new file mode 100644 index 000000000..ac2a063f9 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/win/x64.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 34969b8c99d7a934eaa5e84da9fcf326 +folderAsset: yes +timeCreated: 1531219385 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/win/x64/grpc_csharp_ext.dll b/Assets/Plugins/Grpc.Core/runtimes/win/x64/grpc_csharp_ext.dll new file mode 100644 index 000000000..2f1b62785 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/win/x64/grpc_csharp_ext.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7a505fb074329d351ee5942c5f87dd08f69d6b8f098f2a43c8c557a962cd5061 +size 4323840 diff --git a/Assets/Plugins/Grpc.Core/runtimes/win/x64/grpc_csharp_ext.dll.meta b/Assets/Plugins/Grpc.Core/runtimes/win/x64/grpc_csharp_ext.dll.meta new file mode 100644 index 000000000..a42f84fc8 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/win/x64/grpc_csharp_ext.dll.meta @@ -0,0 +1,117 @@ +fileFormatVersion: 2 +guid: cb634ddbaed75c344a6b79bc91ca996e +timeCreated: 1531219386 +licenseType: Free +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 0 + Exclude Linux: 0 + Exclude Linux64: 0 + Exclude LinuxUniversal: 0 + Exclude OSXIntel: 0 + Exclude OSXIntel64: 0 + Exclude OSXUniversal: 0 + Exclude Win: 1 + Exclude Win64: 0 + Exclude iOS: 1 + - first: + Android: Android + second: + enabled: 0 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + CPU: x86_64 + DefaultValueInitialized: true + OS: Windows + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: None + - first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Linux + second: + enabled: 1 + settings: + CPU: x86 + - first: + Standalone: Linux64 + second: + enabled: 1 + settings: + CPU: x86_64 + - first: + Standalone: LinuxUniversal + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + Standalone: OSXIntel + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + Standalone: OSXIntel64 + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + Standalone: OSXUniversal + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win64 + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + iPhone: iOS + second: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/win/x86.meta b/Assets/Plugins/Grpc.Core/runtimes/win/x86.meta new file mode 100644 index 000000000..f3eb146cc --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/win/x86.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: ed5c6044f868f9a4f955b7db2d2df619 +folderAsset: yes +timeCreated: 1531219385 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Grpc.Core/runtimes/win/x86/grpc_csharp_ext.dll b/Assets/Plugins/Grpc.Core/runtimes/win/x86/grpc_csharp_ext.dll new file mode 100644 index 000000000..f6de94dc5 --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/win/x86/grpc_csharp_ext.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f689f9fd9fcf82b70eebdf0e828b0662b49307301aed66dda407378e5970dbf9 +size 3297792 diff --git a/Assets/Plugins/Grpc.Core/runtimes/win/x86/grpc_csharp_ext.dll.meta b/Assets/Plugins/Grpc.Core/runtimes/win/x86/grpc_csharp_ext.dll.meta new file mode 100644 index 000000000..bd6291eaf --- /dev/null +++ b/Assets/Plugins/Grpc.Core/runtimes/win/x86/grpc_csharp_ext.dll.meta @@ -0,0 +1,117 @@ +fileFormatVersion: 2 +guid: fe9aa1338bfc3864eb50df0f9d648316 +timeCreated: 1531219386 +licenseType: Free +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 0 + Exclude Linux: 0 + Exclude Linux64: 0 + Exclude LinuxUniversal: 0 + Exclude OSXIntel: 0 + Exclude OSXIntel64: 0 + Exclude OSXUniversal: 0 + Exclude Win: 0 + Exclude Win64: 1 + Exclude iOS: 1 + - first: + Android: Android + second: + enabled: 0 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + CPU: x86 + DefaultValueInitialized: true + OS: Windows + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Linux + second: + enabled: 1 + settings: + CPU: x86 + - first: + Standalone: Linux64 + second: + enabled: 1 + settings: + CPU: x86_64 + - first: + Standalone: LinuxUniversal + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + Standalone: OSXIntel + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + Standalone: OSXIntel64 + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + Standalone: OSXUniversal + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + Standalone: Win + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: None + - first: + iPhone: iOS + second: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/System.Buffers.dll b/Assets/Plugins/System.Buffers.dll new file mode 100644 index 000000000..a231c5a9d --- /dev/null +++ b/Assets/Plugins/System.Buffers.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9444b5a41a816b193c033bec199d74cdfc8298ed8300a3c39a4e953dec137494 +size 27992 diff --git a/Assets/Plugins/System.Buffers.dll.meta b/Assets/Plugins/System.Buffers.dll.meta new file mode 100644 index 000000000..07d59567f --- /dev/null +++ b/Assets/Plugins/System.Buffers.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: ce837d1683742b46ab956fb33360fafe +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/System.Memory.dll b/Assets/Plugins/System.Memory.dll new file mode 100644 index 000000000..0f4395de1 --- /dev/null +++ b/Assets/Plugins/System.Memory.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:41b5e1a4c59abdb1ce1467f58c3d9fd06d39dff4fc61d500a2410fece8037f4b +size 148760 diff --git a/Assets/Plugins/System.Memory.dll.meta b/Assets/Plugins/System.Memory.dll.meta new file mode 100644 index 000000000..7d2e2940f --- /dev/null +++ b/Assets/Plugins/System.Memory.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 273576731295a11c1b7fca8490ef5afd +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll b/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll new file mode 100644 index 000000000..19ad4e23b --- /dev/null +++ b/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ad2dd7225d5162a0fd3a3b337a1949448520e3130a4bc8e010ec02f76097500 +size 23600 diff --git a/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll.meta b/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll.meta new file mode 100644 index 000000000..ff4acd7c5 --- /dev/null +++ b/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: c4ad452d6724491ca843aaee0eacf0e1 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/System.Threading.Tasks.Extensions.dll b/Assets/Plugins/System.Threading.Tasks.Extensions.dll new file mode 100644 index 000000000..393652b40 --- /dev/null +++ b/Assets/Plugins/System.Threading.Tasks.Extensions.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f54718bbab6e7a649e460f5097ed444f33452b1451841f67e2e194641d5fccd +size 33048 diff --git a/Assets/Plugins/System.Threading.Tasks.Extensions.dll.meta b/Assets/Plugins/System.Threading.Tasks.Extensions.dll.meta new file mode 100644 index 000000000..fa275c098 --- /dev/null +++ b/Assets/Plugins/System.Threading.Tasks.Extensions.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 7d5fdfa6c0d89190186e8a6be326096d +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/ChatScene.unity b/Assets/Scenes/ChatScene.unity new file mode 100644 index 000000000..09c11735c --- /dev/null +++ b/Assets/Scenes/ChatScene.unity @@ -0,0 +1,3131 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074014, b: 0.3587274, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 500 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 0 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_ExportTrainingData: 0 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 1 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &164639239 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 164639240} + - component: {fileID: 164639242} + - component: {fileID: 164639241} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &164639240 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 164639239} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1634534318} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &164639241 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 164639239} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.38679248, g: 0.38679248, b: 0.38679248, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 +--- !u!222 &164639242 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 164639239} + m_CullTransparentMesh: 0 +--- !u!1 &190778106 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 190778107} + - component: {fileID: 190778110} + - component: {fileID: 190778109} + - component: {fileID: 190778108} + m_Layer: 5 + m_Name: SendReportButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &190778107 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 190778106} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 525475477} + m_Father: {fileID: 1309622324} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &190778108 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 190778106} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.11764706, g: 0.11764706, b: 0.11764706, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 190778109} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 1634534319} + m_MethodName: SendReport + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &190778109 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 190778106} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.5943396, g: 0.5747152, b: 0.5747152, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 +--- !u!222 &190778110 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 190778106} + m_CullTransparentMesh: 0 +--- !u!1 &237511814 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 237511817} + - component: {fileID: 237511816} + - component: {fileID: 237511815} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &237511815 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 237511814} + m_Enabled: 1 +--- !u!20 &237511816 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 237511814} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &237511817 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 237511814} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &247055287 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 247055288} + - component: {fileID: 247055290} + - component: {fileID: 247055289} + m_Layer: 5 + m_Name: Line + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &247055288 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 247055287} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1634534318} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.082} + m_AnchorMax: {x: 1, y: 0.086} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &247055289 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 247055287} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 +--- !u!222 &247055290 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 247055287} + m_CullTransparentMesh: 0 +--- !u!1 &330057072 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 330057073} + - component: {fileID: 330057076} + - component: {fileID: 330057075} + - component: {fileID: 330057074} + m_Layer: 5 + m_Name: InputField + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &330057073 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 330057072} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1337382646} + - {fileID: 1329709669} + m_Father: {fileID: 1634534318} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.17, y: 0.22} + m_AnchorMax: {x: 0.83, y: 0.28} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &330057074 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 330057072} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 575553740, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 330057075} + m_TextComponent: {fileID: 1329709670} + m_Placeholder: {fileID: 1337382647} + m_ContentType: 0 + m_InputType: 0 + m_AsteriskChar: 42 + m_KeyboardType: 0 + m_LineType: 0 + m_HideMobileInput: 0 + m_CharacterValidation: 0 + m_CharacterLimit: 0 + m_OnEndEdit: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.InputField+SubmitEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.InputField+OnChangeEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null + m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_CustomCaretColor: 0 + m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412} + m_Text: + m_CaretBlinkRate: 0.85 + m_CaretWidth: 1 + m_ReadOnly: 0 +--- !u!114 &330057075 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 330057072} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10911, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 +--- !u!222 &330057076 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 330057072} + m_CullTransparentMesh: 0 +--- !u!1 &525475476 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 525475477} + - component: {fileID: 525475479} + - component: {fileID: 525475478} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &525475477 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 525475476} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 190778107} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &525475478 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 525475476} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 0 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Send Report +--- !u!222 &525475479 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 525475476} + m_CullTransparentMesh: 0 +--- !u!1 &557907330 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 557907331} + - component: {fileID: 557907332} + - component: {fileID: 557907334} + m_Layer: 5 + m_Name: Buttons + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &557907331 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 557907330} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1487425764} + - {fileID: 1383832575} + m_Father: {fileID: 1634534318} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.12, y: 0.15} + m_AnchorMax: {x: 0.88, y: 0.2} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &557907332 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 557907330} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -405508275, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 4 + m_Spacing: 30 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 1 + m_ChildControlHeight: 1 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 +--- !u!222 &557907334 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 557907330} + m_CullTransparentMesh: 0 +--- !u!1 &574419691 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 574419692} + - component: {fileID: 574419694} + - component: {fileID: 574419693} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &574419692 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 574419691} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1096149280} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &574419693 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 574419691} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 0 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Disconnect Test +--- !u!222 &574419694 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 574419691} + m_CullTransparentMesh: 0 +--- !u!1 &609138041 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 609138042} + - component: {fileID: 609138044} + - component: {fileID: 609138043} + m_Layer: 5 + m_Name: Placeholder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &609138042 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 609138041} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1671399962} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -0.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &609138043 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 609138041} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.5} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 30 + m_FontStyle: 2 + m_BestFit: 1 + m_MinSize: 1 + m_MaxSize: 40 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Please enter report text... +--- !u!222 &609138044 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 609138041} + m_CullTransparentMesh: 0 +--- !u!1 &632675411 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 632675412} + - component: {fileID: 632675414} + - component: {fileID: 632675413} + m_Layer: 5 + m_Name: Buttons + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &632675412 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 632675411} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1096149280} + - {fileID: 2120537442} + - {fileID: 1868729446} + m_Father: {fileID: 1634534318} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.12, y: 0.1} + m_AnchorMax: {x: 0.88, y: 0.135} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &632675413 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 632675411} + m_CullTransparentMesh: 0 +--- !u!114 &632675414 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 632675411} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -405508275, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 4 + m_Spacing: 30 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 1 + m_ChildControlHeight: 1 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 +--- !u!1 &771375552 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 771375553} + - component: {fileID: 771375555} + - component: {fileID: 771375554} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &771375553 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 771375552} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1487425764} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &771375554 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 771375552} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 0 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Enter the room +--- !u!222 &771375555 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 771375552} + m_CullTransparentMesh: 0 +--- !u!1 &817501237 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 817501238} + - component: {fileID: 817501240} + - component: {fileID: 817501239} + m_Layer: 5 + m_Name: Handle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &817501238 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 817501237} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 963732563} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &817501239 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 817501237} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 +--- !u!222 &817501240 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 817501237} + m_CullTransparentMesh: 0 +--- !u!1 &927062024 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 927062025} + - component: {fileID: 927062027} + - component: {fileID: 927062028} + - component: {fileID: 927062026} + m_Layer: 5 + m_Name: ScrollPanel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &927062025 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 927062024} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1978894556} + - {fileID: 1799772182} + m_Father: {fileID: 1634534318} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.1, y: 0.3} + m_AnchorMax: {x: 0.9, y: 0.95} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &927062026 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 927062024} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 +--- !u!222 &927062027 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 927062024} + m_CullTransparentMesh: 0 +--- !u!114 &927062028 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 927062024} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1367256648, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Content: {fileID: 1522127878} + m_Horizontal: 0 + m_Vertical: 1 + m_MovementType: 1 + m_Elasticity: 0.1 + m_Inertia: 1 + m_DecelerationRate: 0.135 + m_ScrollSensitivity: 1 + m_Viewport: {fileID: 1978894556} + m_HorizontalScrollbar: {fileID: 0} + m_VerticalScrollbar: {fileID: 1799772183} + m_HorizontalScrollbarVisibility: 0 + m_VerticalScrollbarVisibility: 1 + m_HorizontalScrollbarSpacing: 0 + m_VerticalScrollbarSpacing: 0 + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.ScrollRect+ScrollRectEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!1 &963732562 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 963732563} + m_Layer: 5 + m_Name: Sliding Area + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &963732563 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963732562} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 817501238} + m_Father: {fileID: 1799772182} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -20, y: -20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &1040922706 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1040922707} + - component: {fileID: 1040922709} + - component: {fileID: 1040922708} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1040922707 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1040922706} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1868729446} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1040922708 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1040922706} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 0 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Generate Exception(hub) +--- !u!222 &1040922709 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1040922706} + m_CullTransparentMesh: 0 +--- !u!1 &1096149279 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1096149280} + - component: {fileID: 1096149283} + - component: {fileID: 1096149282} + - component: {fileID: 1096149281} + m_Layer: 5 + m_Name: DisconnectButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1096149280 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1096149279} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 574419692} + m_Father: {fileID: 632675412} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1096149281 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1096149279} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.11764706, g: 0.11764706, b: 0.11764706, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1096149282} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 1634534319} + m_MethodName: DisconnectServer + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &1096149282 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1096149279} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.69753474, g: 0.70003784, b: 0.7075472, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 +--- !u!222 &1096149283 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1096149279} + m_CullTransparentMesh: 0 +--- !u!1 &1309622323 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1309622324} + - component: {fileID: 1309622326} + - component: {fileID: 1309622325} + m_Layer: 5 + m_Name: Report + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1309622324 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1309622323} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1671399962} + - {fileID: 190778107} + m_Father: {fileID: 1634534318} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.08, y: 0.02} + m_AnchorMax: {x: 0.92, y: 0.07} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1309622325 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1309622323} + m_CullTransparentMesh: 0 +--- !u!114 &1309622326 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1309622323} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -405508275, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 4 + m_Spacing: 30 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 1 + m_ChildControlHeight: 1 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 +--- !u!1 &1329709668 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1329709669} + - component: {fileID: 1329709671} + - component: {fileID: 1329709670} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1329709669 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1329709668} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 330057073} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -0.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1329709670 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1329709668} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 30 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 3 + m_MaxSize: 40 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 0 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: +--- !u!222 &1329709671 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1329709668} + m_CullTransparentMesh: 0 +--- !u!1 &1337382645 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1337382646} + - component: {fileID: 1337382648} + - component: {fileID: 1337382647} + m_Layer: 5 + m_Name: Placeholder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1337382646 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1337382645} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 330057073} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -0.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1337382647 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1337382645} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.5} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 30 + m_FontStyle: 2 + m_BestFit: 1 + m_MinSize: 1 + m_MaxSize: 40 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Enter text... +--- !u!222 &1337382648 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1337382645} + m_CullTransparentMesh: 0 +--- !u!1 &1383832574 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1383832575} + - component: {fileID: 1383832578} + - component: {fileID: 1383832577} + - component: {fileID: 1383832576} + m_Layer: 5 + m_Name: AddCommentButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1383832575 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1383832574} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1420340486} + m_Father: {fileID: 557907331} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1383832576 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1383832574} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.11764706, g: 0.11764706, b: 0.11764706, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1383832577} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 1634534319} + m_MethodName: SendMessage + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &1383832577 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1383832574} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.33521715, g: 0.764151, b: 0.5044038, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 +--- !u!222 &1383832578 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1383832574} + m_CullTransparentMesh: 0 +--- !u!1 &1409526054 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1409526057} + - component: {fileID: 1409526056} + - component: {fileID: 1409526055} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1409526055 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1409526054} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1077351063, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &1409526056 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1409526054} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -619905303, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!4 &1409526057 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1409526054} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1420340485 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1420340486} + - component: {fileID: 1420340488} + - component: {fileID: 1420340487} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1420340486 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1420340485} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1383832575} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1420340487 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1420340485} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 0 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Enter a comment +--- !u!222 &1420340488 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1420340485} + m_CullTransparentMesh: 0 +--- !u!1 &1434588224 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1434588225} + - component: {fileID: 1434588227} + - component: {fileID: 1434588226} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1434588225 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1434588224} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2120537442} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1434588226 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1434588224} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 0 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Generate Exception(unary) +--- !u!222 &1434588227 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1434588224} + m_CullTransparentMesh: 0 +--- !u!1 &1487425763 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1487425764} + - component: {fileID: 1487425767} + - component: {fileID: 1487425766} + - component: {fileID: 1487425765} + m_Layer: 5 + m_Name: JoinAndLeaveRoomButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1487425764 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1487425763} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 771375553} + m_Father: {fileID: 557907331} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1487425765 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1487425763} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.11764706, g: 0.11764706, b: 0.11764706, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1487425766} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 1634534319} + m_MethodName: JoinOrLeave + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &1487425766 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1487425763} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.3137255, g: 0.5686275, b: 0.627451, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 +--- !u!222 &1487425767 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1487425763} + m_CullTransparentMesh: 0 +--- !u!1 &1522127877 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1522127878} + - component: {fileID: 1522127881} + - component: {fileID: 1522127880} + - component: {fileID: 1522127879} + m_Layer: 5 + m_Name: ChatText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1522127878 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1522127877} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1978894556} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.02, y: 0.02} + m_AnchorMax: {x: 0.98, y: 0.98} + m_AnchoredPosition: {x: 0, y: 5.530014} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 1} +--- !u!114 &1522127879 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1522127877} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1741964061, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 0 + m_VerticalFit: 2 +--- !u!114 &1522127880 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1522127877} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 0 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: Sample Text +--- !u!222 &1522127881 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1522127877} + m_CullTransparentMesh: 0 +--- !u!1 &1634534314 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1634534318} + - component: {fileID: 1634534317} + - component: {fileID: 1634534316} + - component: {fileID: 1634534315} + - component: {fileID: 1634534319} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1634534315 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1634534314} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &1634534316 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1634534314} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 1 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 900, y: 1600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!223 &1634534317 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1634534314} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &1634534318 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1634534314} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 164639240} + - {fileID: 927062025} + - {fileID: 330057073} + - {fileID: 557907331} + - {fileID: 632675412} + - {fileID: 247055288} + - {fileID: 1309622324} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!114 &1634534319 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1634534314} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7ea9e77872213814ea60ab05d1064578, type: 3} + m_Name: + m_EditorClassIdentifier: + ChatText: {fileID: 1522127880} + JoinOrLeaveButton: {fileID: 1487425765} + JoinOrLeaveButtonText: {fileID: 771375554} + SendMessageButton: {fileID: 1383832576} + Input: {fileID: 330057074} + ReportInput: {fileID: 1671399963} + SendReportButton: {fileID: 190778108} + DisconnectButon: {fileID: 1096149281} + ExceptionButton: {fileID: 1868729447} + UnaryExceptionButton: {fileID: 2120537443} +--- !u!1 &1671399961 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1671399962} + - component: {fileID: 1671399965} + - component: {fileID: 1671399964} + - component: {fileID: 1671399963} + m_Layer: 5 + m_Name: ReportInputField + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1671399962 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1671399961} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 609138042} + - {fileID: 1901126666} + m_Father: {fileID: 1309622324} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1671399963 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1671399961} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 575553740, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1671399964} + m_TextComponent: {fileID: 1901126667} + m_Placeholder: {fileID: 609138043} + m_ContentType: 0 + m_InputType: 0 + m_AsteriskChar: 42 + m_KeyboardType: 0 + m_LineType: 0 + m_HideMobileInput: 0 + m_CharacterValidation: 0 + m_CharacterLimit: 0 + m_OnEndEdit: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.InputField+SubmitEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.InputField+OnChangeEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null + m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_CustomCaretColor: 0 + m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412} + m_Text: + m_CaretBlinkRate: 0.85 + m_CaretWidth: 1 + m_ReadOnly: 0 +--- !u!114 &1671399964 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1671399961} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10911, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 +--- !u!222 &1671399965 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1671399961} + m_CullTransparentMesh: 0 +--- !u!1 &1799772181 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1799772182} + - component: {fileID: 1799772185} + - component: {fileID: 1799772184} + - component: {fileID: 1799772183} + m_Layer: 5 + m_Name: Scrollbar + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1799772182 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1799772181} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 963732563} + m_Father: {fileID: 927062025} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 0.02} + m_AnchorMax: {x: 1, y: 0.98} + m_AnchoredPosition: {x: -20, y: 0} + m_SizeDelta: {x: 20, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1799772183 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1799772181} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -2061169968, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 817501239} + m_HandleRect: {fileID: 817501238} + m_Direction: 3 + m_Value: 1 + m_Size: 1 + m_NumberOfSteps: 0 + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Scrollbar+ScrollEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &1799772184 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1799772181} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 +--- !u!222 &1799772185 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1799772181} + m_CullTransparentMesh: 0 +--- !u!1 &1868729445 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1868729446} + - component: {fileID: 1868729449} + - component: {fileID: 1868729448} + - component: {fileID: 1868729447} + m_Layer: 5 + m_Name: ExceptiontButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1868729446 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1868729445} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1040922707} + m_Father: {fileID: 632675412} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1868729447 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1868729445} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.11764706, g: 0.11764706, b: 0.11764706, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1868729448} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 1634534319} + m_MethodName: GenerateException + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &1868729448 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1868729445} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.7647059, g: 0.33333337, b: 0.3651321, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 +--- !u!222 &1868729449 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1868729445} + m_CullTransparentMesh: 0 +--- !u!1 &1901126665 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1901126666} + - component: {fileID: 1901126668} + - component: {fileID: 1901126667} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1901126666 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1901126665} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1671399962} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -0.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1901126667 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1901126665} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 30 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 3 + m_MaxSize: 40 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 0 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: +--- !u!222 &1901126668 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1901126665} + m_CullTransparentMesh: 0 +--- !u!1 &1978894555 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1978894556} + - component: {fileID: 1978894558} + - component: {fileID: 1978894559} + m_Layer: 5 + m_Name: Viewport + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1978894556 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1978894555} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1522127878} + m_Father: {fileID: 927062025} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1978894558 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1978894555} + m_CullTransparentMesh: 0 +--- !u!114 &1978894559 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1978894555} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -146154839, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &2120537441 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2120537442} + - component: {fileID: 2120537445} + - component: {fileID: 2120537444} + - component: {fileID: 2120537443} + m_Layer: 5 + m_Name: UnaryExceptiontButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2120537442 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2120537441} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1434588225} + m_Father: {fileID: 632675412} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2120537443 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2120537441} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.11764706, g: 0.11764706, b: 0.11764706, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 2120537444} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 1634534319} + m_MethodName: UnaryGenerateException + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &2120537444 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2120537441} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.7647059, g: 0.33333337, b: 0.3651321, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 +--- !u!222 &2120537445 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2120537441} + m_CullTransparentMesh: 0 diff --git a/Assets/Scenes/ChatScene.unity.meta b/Assets/Scenes/ChatScene.unity.meta new file mode 100644 index 000000000..70b3a62ca --- /dev/null +++ b/Assets/Scenes/ChatScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ea5a8dc36702b6445b34bb7c7c5eb088 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/Main.unity similarity index 100% rename from Assets/Scenes/SampleScene.unity rename to Assets/Scenes/Main.unity diff --git a/Assets/Scenes/SampleScene.unity.meta b/Assets/Scenes/Main.unity.meta similarity index 100% rename from Assets/Scenes/SampleScene.unity.meta rename to Assets/Scenes/Main.unity.meta diff --git a/Assets/Scripts.meta b/Assets/Scripts.meta new file mode 100644 index 000000000..57ab26d23 --- /dev/null +++ b/Assets/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8e21db93f5570914091daea046edc6a5 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ChatComponent.cs b/Assets/Scripts/ChatComponent.cs new file mode 100644 index 000000000..cce2fa9ed --- /dev/null +++ b/Assets/Scripts/ChatComponent.cs @@ -0,0 +1,223 @@ +using ChatApp.Shared.Hubs; +using ChatApp.Shared.MessagePackObjects; +using ChatApp.Shared.Services; +using Grpc.Core; +using MagicOnion.Client; +using System.IO; +using System.Threading.Tasks; +using UnityEngine; +using UnityEngine.UI; + +namespace Assets.Scripts +{ + public class ChatComponent : MonoBehaviour, IChatHubReceiver + { + private Channel channel; + private IChatHub streamingClient; + private IChatService client; + + private bool isJoin; + private bool isSelfDisConnected; + + public Text ChatText; + + public Button JoinOrLeaveButton; + + public Text JoinOrLeaveButtonText; + + public Button SendMessageButton; + + public InputField Input; + + public InputField ReportInput; + + public Button SendReportButton; + + public Button DisconnectButon; + public Button ExceptionButton; + public Button UnaryExceptionButton; + + + void Start() + { + this.InitializeClient(); + this.InitializeUi(); + } + + + async void OnDestroy() + { + // Clean up Hub and channel + await this.streamingClient.DisposeAsync(); + await this.channel.ShutdownAsync(); + } + + + private void InitializeClient() + { + // Initialize the Hub + this.channel = new Channel("localhost", 12345, ChannelCredentials.Insecure); + // for SSL/TLS connection + //var serverCred = new SslCredentials(File.ReadAllText(Path.Combine(Application.streamingAssetsPath, "server.crt"))); + //this.channel = new Channel("test.example.com", 12345, serverCred); + this.streamingClient = StreamingHubClient.Connect(this.channel, this); + this.RegisterDisconnectEvent(streamingClient); + this.client = MagicOnionClient.Create(this.channel); + } + + + private void InitializeUi() + { + this.isJoin = false; + + this.SendMessageButton.interactable = false; + this.ChatText.text = string.Empty; + this.Input.text = string.Empty; + this.Input.placeholder.GetComponent().text = "Please enter your name."; + this.JoinOrLeaveButtonText.text = "Enter the room"; + this.ExceptionButton.interactable = false; + } + + + private async void RegisterDisconnectEvent(IChatHub streamingClient) + { + try + { + // you can wait disconnected event + await streamingClient.WaitForDisconnect(); + } + finally + { + // try-to-reconnect? logging event? close? etc... + Debug.Log("disconnected server."); + + if (this.isSelfDisConnected) + { + // there is no particular meaning + await Task.Delay(2000); + + // reconnect + this.ReconnectServer(); + } + } + } + + + public async void DisconnectServer() + { + this.isSelfDisConnected = true; + + this.JoinOrLeaveButton.interactable = false; + this.SendMessageButton.interactable = false; + this.SendReportButton.interactable = false; + this.DisconnectButon.interactable = false; + this.ExceptionButton.interactable = false; + this.UnaryExceptionButton.interactable = false; + + if (this.isJoin) + this.JoinOrLeave(); + + await this.streamingClient.DisposeAsync(); + } + + + private void ReconnectServer() + { + this.streamingClient = StreamingHubClient.Connect(this.channel, this); + this.RegisterDisconnectEvent(streamingClient); + Debug.Log("Reconnected server."); + + this.JoinOrLeaveButton.interactable = true; + this.SendMessageButton.interactable = false; + this.SendReportButton.interactable = true; + this.DisconnectButon.interactable = true; + this.ExceptionButton.interactable = true; + this.UnaryExceptionButton.interactable = true; + + this.isSelfDisConnected = false; + } + + + #region Client -> Server (Streaming) + public async void JoinOrLeave() + { + if (this.isJoin) + { + await this.streamingClient.LeaveAsync(); + + this.InitializeUi(); + } + else + { + var request = new JoinRequest { RoomName = "SampleRoom", UserName = this.Input.text }; + await this.streamingClient.JoinAsync(request); + + this.isJoin = true; + this.SendMessageButton.interactable = true; + this.JoinOrLeaveButtonText.text = "Leave the room"; + this.Input.text = string.Empty; + this.Input.placeholder.GetComponent().text = "Please enter a comment."; + this.ExceptionButton.interactable = true; + } + } + + + public async void SendMessage() + { + if (!this.isJoin) + return; + + await this.streamingClient.SendMessageAsync(this.Input.text); + + this.Input.text = string.Empty; + } + + public async void GenerateException() + { + // hub + if (!this.isJoin) return; + await this.streamingClient.GenerateException("client exception(streaminghub)!"); + } + + public void SampleMethod() + { + throw new System.NotImplementedException(); + } + #endregion + + + #region Server -> Client (Streaming) + public void OnJoin(string name) + { + this.ChatText.text += $"\n{name} entered the room."; + } + + + public void OnLeave(string name) + { + this.ChatText.text += $"\n{name} left the room."; + } + + public void OnSendMessage(MessageResponse message) + { + this.ChatText.text += $"\n{message.UserName}:{message.Message}"; + } + #endregion + + + #region Client -> Server (Unary) + public async void SendReport() + { + await this.client.SendReportAsync(this.ReportInput.text); + + this.ReportInput.text = string.Empty; + } + + public async void UnaryGenerateException() + { + // unary + await this.client.GenerateException("client exception(unary)!"); + } + #endregion + } +} diff --git a/Assets/Scripts/ChatComponent.cs.meta b/Assets/Scripts/ChatComponent.cs.meta new file mode 100644 index 000000000..dc83ccfa4 --- /dev/null +++ b/Assets/Scripts/ChatComponent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7ea9e77872213814ea60ab05d1064578 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Generated.meta b/Assets/Scripts/Generated.meta new file mode 100644 index 000000000..203aa717a --- /dev/null +++ b/Assets/Scripts/Generated.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d7949e630c7ec6044af484bed87f78fd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Generated/MagicOnion.Generated.cs b/Assets/Scripts/Generated/MagicOnion.Generated.cs new file mode 100644 index 000000000..47b505860 --- /dev/null +++ b/Assets/Scripts/Generated/MagicOnion.Generated.cs @@ -0,0 +1,397 @@ +// +#pragma warning disable 618 +#pragma warning disable 612 +#pragma warning disable 414 +#pragma warning disable 219 +#pragma warning disable 168 + +namespace MagicOnion +{ + using global::System; + using global::System.Collections.Generic; + using global::System.Linq; + using global::MagicOnion; + using global::MagicOnion.Client; + + public static partial class MagicOnionInitializer + { + static bool isRegistered = false; + + [UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.BeforeSceneLoad)] + public static void Register() + { + if(isRegistered) return; + isRegistered = true; + + MagicOnionClientRegistry.Register((x, y, z) => new ChatApp.Shared.Services.ChatServiceClient(x, y, z)); + + StreamingHubClientRegistry.Register((a, _, b, c, d, e) => new ChatApp.Shared.Hubs.ChatHubClient(a, b, c, d, e)); + } + } +} + +#pragma warning restore 168 +#pragma warning restore 219 +#pragma warning restore 414 +#pragma warning restore 612 +#pragma warning restore 618 +#pragma warning disable 618 +#pragma warning disable 612 +#pragma warning disable 414 +#pragma warning disable 219 +#pragma warning disable 168 + +namespace MagicOnion.Resolvers +{ + using System; + using MessagePack; + + public class MagicOnionResolver : global::MessagePack.IFormatterResolver + { + public static readonly global::MessagePack.IFormatterResolver Instance = new MagicOnionResolver(); + + MagicOnionResolver() + { + + } + + public global::MessagePack.Formatters.IMessagePackFormatter GetFormatter() + { + return FormatterCache.formatter; + } + + static class FormatterCache + { + public static readonly global::MessagePack.Formatters.IMessagePackFormatter formatter; + + static FormatterCache() + { + var f = MagicOnionResolverGetFormatterHelper.GetFormatter(typeof(T)); + if (f != null) + { + formatter = (global::MessagePack.Formatters.IMessagePackFormatter)f; + } + } + } + } + + internal static class MagicOnionResolverGetFormatterHelper + { + static readonly global::System.Collections.Generic.Dictionary lookup; + + static MagicOnionResolverGetFormatterHelper() + { + lookup = new global::System.Collections.Generic.Dictionary(3) + { + {typeof(global::MagicOnion.DynamicArgumentTuple, global::System.Collections.Generic.Dictionary>), 0 }, + {typeof(global::System.Collections.Generic.Dictionary), 1 }, + {typeof(global::System.Collections.Generic.List), 2 }, + }; + } + + internal static object GetFormatter(Type t) + { + int key; + if (!lookup.TryGetValue(t, out key)) + { + return null; + } + + switch (key) + { + case 0: return new global::MagicOnion.DynamicArgumentTupleFormatter, global::System.Collections.Generic.Dictionary>(default(global::System.Collections.Generic.List), default(global::System.Collections.Generic.Dictionary)); + case 1: return new global::MessagePack.Formatters.DictionaryFormatter(); + case 2: return new global::MessagePack.Formatters.ListFormatter(); + default: return null; + } + } + } +} + +#pragma warning restore 168 +#pragma warning restore 219 +#pragma warning restore 414 +#pragma warning restore 612 +#pragma warning restore 618 +#pragma warning disable 618 +#pragma warning disable 612 +#pragma warning disable 414 +#pragma warning disable 219 +#pragma warning disable 168 + +namespace ChatApp.Shared.Services { + using System; + using MagicOnion; + using MagicOnion.Client; + using Grpc.Core; + using MessagePack; + + [Ignore] + public class ChatServiceClient : MagicOnionClientBase, global::ChatApp.Shared.Services.IChatService + { + static readonly Method GenerateExceptionMethod; + static readonly Func GenerateExceptionDelegate; + static readonly Method SendReportAsyncMethod; + static readonly Func SendReportAsyncDelegate; + + static ChatServiceClient() + { + GenerateExceptionMethod = new Method(MethodType.Unary, "IChatService", "GenerateException", MagicOnionMarshallers.ThroughMarshaller, MagicOnionMarshallers.ThroughMarshaller); + GenerateExceptionDelegate = _GenerateException; + SendReportAsyncMethod = new Method(MethodType.Unary, "IChatService", "SendReportAsync", MagicOnionMarshallers.ThroughMarshaller, MagicOnionMarshallers.ThroughMarshaller); + SendReportAsyncDelegate = _SendReportAsync; + } + + ChatServiceClient() + { + } + + public ChatServiceClient(CallInvoker callInvoker, MessagePackSerializerOptions serializerOptions, IClientFilter[] filters) + : base(callInvoker, serializerOptions, filters) + { + } + + protected override MagicOnionClientBase Clone() + { + var clone = new ChatServiceClient(); + clone.host = this.host; + clone.option = this.option; + clone.callInvoker = this.callInvoker; + clone.serializerOptions = this.serializerOptions; + clone.filters = filters; + return clone; + } + + public new IChatService WithHeaders(Metadata headers) + { + return base.WithHeaders(headers); + } + + public new IChatService WithCancellationToken(System.Threading.CancellationToken cancellationToken) + { + return base.WithCancellationToken(cancellationToken); + } + + public new IChatService WithDeadline(System.DateTime deadline) + { + return base.WithDeadline(deadline); + } + + public new IChatService WithHost(string host) + { + return base.WithHost(host); + } + + public new IChatService WithOptions(CallOptions option) + { + return base.WithOptions(option); + } + + static ResponseContext _GenerateException(RequestContext __context) + { + return CreateResponseContext(__context, GenerateExceptionMethod); + } + + public global::MagicOnion.UnaryResult GenerateException(string message) + { + return InvokeAsync("IChatService/GenerateException", message, GenerateExceptionDelegate); + } + static ResponseContext _SendReportAsync(RequestContext __context) + { + return CreateResponseContext(__context, SendReportAsyncMethod); + } + + public global::MagicOnion.UnaryResult SendReportAsync(string message) + { + return InvokeAsync("IChatService/SendReportAsync", message, SendReportAsyncDelegate); + } + } +} + +#pragma warning restore 168 +#pragma warning restore 219 +#pragma warning restore 414 +#pragma warning restore 612 +#pragma warning restore 618 +#pragma warning disable 618 +#pragma warning disable 612 +#pragma warning disable 414 +#pragma warning disable 219 +#pragma warning disable 168 + +namespace ChatApp.Shared.Hubs { + using Grpc.Core; + using Grpc.Core.Logging; + using MagicOnion; + using MagicOnion.Client; + using MessagePack; + using System; + using System.Threading.Tasks; + + [Ignore] + public class ChatHubClient : StreamingHubClientBase, global::ChatApp.Shared.Hubs.IChatHub + { + static readonly Method method = new Method(MethodType.DuplexStreaming, "IChatHub", "Connect", MagicOnionMarshallers.ThroughMarshaller, MagicOnionMarshallers.ThroughMarshaller); + + protected override Method DuplexStreamingAsyncMethod { get { return method; } } + + readonly global::ChatApp.Shared.Hubs.IChatHub __fireAndForgetClient; + + public ChatHubClient(CallInvoker callInvoker, string host, CallOptions option, MessagePackSerializerOptions serializerOptions, ILogger logger) + : base(callInvoker, host, option, serializerOptions, logger) + { + this.__fireAndForgetClient = new FireAndForgetClient(this); + } + + public global::ChatApp.Shared.Hubs.IChatHub FireAndForget() + { + return __fireAndForgetClient; + } + + protected override void OnBroadcastEvent(int methodId, ArraySegment data) + { + switch (methodId) + { + case -1297457280: // OnJoin + { + var result = MessagePackSerializer.Deserialize(data, serializerOptions); + receiver.OnJoin(result); break; + } + case 532410095: // OnLeave + { + var result = MessagePackSerializer.Deserialize(data, serializerOptions); + receiver.OnLeave(result); break; + } + case -552695459: // OnSendMessage + { + var result = MessagePackSerializer.Deserialize(data, serializerOptions); + receiver.OnSendMessage(result); break; + } + default: + break; + } + } + + protected override void OnResponseEvent(int methodId, object taskCompletionSource, ArraySegment data) + { + switch (methodId) + { + case -733403293: // JoinAsync + { + var result = MessagePackSerializer.Deserialize(data, serializerOptions); + ((TaskCompletionSource)taskCompletionSource).TrySetResult(result); + break; + } + case 1368362116: // LeaveAsync + { + var result = MessagePackSerializer.Deserialize(data, serializerOptions); + ((TaskCompletionSource)taskCompletionSource).TrySetResult(result); + break; + } + case -601690414: // SendMessageAsync + { + var result = MessagePackSerializer.Deserialize(data, serializerOptions); + ((TaskCompletionSource)taskCompletionSource).TrySetResult(result); + break; + } + case 517938971: // GenerateException + { + var result = MessagePackSerializer.Deserialize(data, serializerOptions); + ((TaskCompletionSource)taskCompletionSource).TrySetResult(result); + break; + } + case -852153394: // SampleMethod + { + var result = MessagePackSerializer.Deserialize(data, serializerOptions); + ((TaskCompletionSource)taskCompletionSource).TrySetResult(result); + break; + } + default: + break; + } + } + + public global::System.Threading.Tasks.Task JoinAsync(global::ChatApp.Shared.MessagePackObjects.JoinRequest request) + { + return WriteMessageWithResponseAsync(-733403293, request); + } + + public global::System.Threading.Tasks.Task LeaveAsync() + { + return WriteMessageWithResponseAsync(1368362116, Nil.Default); + } + + public global::System.Threading.Tasks.Task SendMessageAsync(string message) + { + return WriteMessageWithResponseAsync(-601690414, message); + } + + public global::System.Threading.Tasks.Task GenerateException(string message) + { + return WriteMessageWithResponseAsync(517938971, message); + } + + public global::System.Threading.Tasks.Task SampleMethod(global::System.Collections.Generic.List sampleList, global::System.Collections.Generic.Dictionary sampleDictionary) + { + return WriteMessageWithResponseAsync, global::System.Collections.Generic.Dictionary>, Nil>(-852153394, new DynamicArgumentTuple, global::System.Collections.Generic.Dictionary>(sampleList, sampleDictionary)); + } + + + class FireAndForgetClient : global::ChatApp.Shared.Hubs.IChatHub + { + readonly ChatHubClient __parent; + + public FireAndForgetClient(ChatHubClient parentClient) + { + this.__parent = parentClient; + } + + public global::ChatApp.Shared.Hubs.IChatHub FireAndForget() + { + throw new NotSupportedException(); + } + + public Task DisposeAsync() + { + throw new NotSupportedException(); + } + + public Task WaitForDisconnect() + { + throw new NotSupportedException(); + } + + public global::System.Threading.Tasks.Task JoinAsync(global::ChatApp.Shared.MessagePackObjects.JoinRequest request) + { + return __parent.WriteMessageAsync(-733403293, request); + } + + public global::System.Threading.Tasks.Task LeaveAsync() + { + return __parent.WriteMessageAsync(1368362116, Nil.Default); + } + + public global::System.Threading.Tasks.Task SendMessageAsync(string message) + { + return __parent.WriteMessageAsync(-601690414, message); + } + + public global::System.Threading.Tasks.Task GenerateException(string message) + { + return __parent.WriteMessageAsync(517938971, message); + } + + public global::System.Threading.Tasks.Task SampleMethod(global::System.Collections.Generic.List sampleList, global::System.Collections.Generic.Dictionary sampleDictionary) + { + return __parent.WriteMessageAsync, global::System.Collections.Generic.Dictionary>>(-852153394, new DynamicArgumentTuple, global::System.Collections.Generic.Dictionary>(sampleList, sampleDictionary)); + } + + } + } +} + +#pragma warning restore 168 +#pragma warning restore 219 +#pragma warning restore 414 +#pragma warning restore 618 +#pragma warning restore 612 diff --git a/Assets/Scripts/Generated/MagicOnion.Generated.cs.meta b/Assets/Scripts/Generated/MagicOnion.Generated.cs.meta new file mode 100644 index 000000000..cf214a934 --- /dev/null +++ b/Assets/Scripts/Generated/MagicOnion.Generated.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8101cc28afd16634bb4bbd1bff64cf99 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Generated/MessagePack.Generated.cs b/Assets/Scripts/Generated/MessagePack.Generated.cs new file mode 100644 index 000000000..f9c6de309 --- /dev/null +++ b/Assets/Scripts/Generated/MessagePack.Generated.cs @@ -0,0 +1,223 @@ +// +// THIS (.cs) FILE IS GENERATED BY MPC(MessagePack-CSharp). DO NOT CHANGE IT. +// + +#pragma warning disable 618 +#pragma warning disable 612 +#pragma warning disable 414 +#pragma warning disable 168 + +#pragma warning disable SA1200 // Using directives should be placed correctly +#pragma warning disable SA1312 // Variable names should begin with lower-case letter +#pragma warning disable SA1649 // File name should match first type name + +namespace MessagePack.Resolvers +{ + using System; + using System.Buffers; + using MessagePack; + + public class GeneratedResolver : global::MessagePack.IFormatterResolver + { + public static readonly global::MessagePack.IFormatterResolver Instance = new GeneratedResolver(); + + private GeneratedResolver() + { + } + + public global::MessagePack.Formatters.IMessagePackFormatter GetFormatter() + { + return FormatterCache.Formatter; + } + + private static class FormatterCache + { + internal static readonly global::MessagePack.Formatters.IMessagePackFormatter Formatter; + + static FormatterCache() + { + var f = GeneratedResolverGetFormatterHelper.GetFormatter(typeof(T)); + if (f != null) + { + Formatter = (global::MessagePack.Formatters.IMessagePackFormatter)f; + } + } + } + } + + internal static class GeneratedResolverGetFormatterHelper + { + private static readonly global::System.Collections.Generic.Dictionary lookup; + + static GeneratedResolverGetFormatterHelper() + { + lookup = new global::System.Collections.Generic.Dictionary(2) + { + { typeof(global::ChatApp.Shared.MessagePackObjects.JoinRequest), 0 }, + { typeof(global::ChatApp.Shared.MessagePackObjects.MessageResponse), 1 }, + }; + } + + internal static object GetFormatter(Type t) + { + int key; + if (!lookup.TryGetValue(t, out key)) + { + return null; + } + + switch (key) + { + case 0: return new MessagePack.Formatters.ChatApp.Shared.MessagePackObjects.JoinRequestFormatter(); + case 1: return new MessagePack.Formatters.ChatApp.Shared.MessagePackObjects.MessageResponseFormatter(); + default: return null; + } + } + } +} + +#pragma warning restore 168 +#pragma warning restore 414 +#pragma warning restore 618 +#pragma warning restore 612 + +#pragma warning restore SA1312 // Variable names should begin with lower-case letter +#pragma warning restore SA1200 // Using directives should be placed correctly +#pragma warning restore SA1649 // File name should match first type name + + + + +// +// THIS (.cs) FILE IS GENERATED BY MPC(MessagePack-CSharp). DO NOT CHANGE IT. +// + +#pragma warning disable 618 +#pragma warning disable 612 +#pragma warning disable 414 +#pragma warning disable 168 + +#pragma warning disable SA1129 // Do not use default value type constructor +#pragma warning disable SA1200 // Using directives should be placed correctly +#pragma warning disable SA1309 // Field names should not begin with underscore +#pragma warning disable SA1312 // Variable names should begin with lower-case letter +#pragma warning disable SA1403 // File may only contain a single namespace +#pragma warning disable SA1649 // File name should match first type name + +namespace MessagePack.Formatters.ChatApp.Shared.MessagePackObjects +{ + using System; + using System.Buffers; + using MessagePack; + + public sealed class JoinRequestFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + + + public void Serialize(ref MessagePackWriter writer, global::ChatApp.Shared.MessagePackObjects.JoinRequest value, global::MessagePack.MessagePackSerializerOptions options) + { + IFormatterResolver formatterResolver = options.Resolver; + writer.WriteArrayHeader(2); + formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.RoomName, options); + formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.UserName, options); + } + + public global::ChatApp.Shared.MessagePackObjects.JoinRequest Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + throw new InvalidOperationException("typecode is null, struct not supported"); + } + + IFormatterResolver formatterResolver = options.Resolver; + var length = reader.ReadArrayHeader(); + var __RoomName__ = default(string); + var __UserName__ = default(string); + + for (int i = 0; i < length; i++) + { + var key = i; + + switch (key) + { + case 0: + __RoomName__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + __UserName__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + var ____result = new global::ChatApp.Shared.MessagePackObjects.JoinRequest(); + ____result.RoomName = __RoomName__; + ____result.UserName = __UserName__; + return ____result; + } + } + + public sealed class MessageResponseFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + + + public void Serialize(ref MessagePackWriter writer, global::ChatApp.Shared.MessagePackObjects.MessageResponse value, global::MessagePack.MessagePackSerializerOptions options) + { + IFormatterResolver formatterResolver = options.Resolver; + writer.WriteArrayHeader(2); + formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.UserName, options); + formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Message, options); + } + + public global::ChatApp.Shared.MessagePackObjects.MessageResponse Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + throw new InvalidOperationException("typecode is null, struct not supported"); + } + + IFormatterResolver formatterResolver = options.Resolver; + var length = reader.ReadArrayHeader(); + var __UserName__ = default(string); + var __Message__ = default(string); + + for (int i = 0; i < length; i++) + { + var key = i; + + switch (key) + { + case 0: + __UserName__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + __Message__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + var ____result = new global::ChatApp.Shared.MessagePackObjects.MessageResponse(); + ____result.UserName = __UserName__; + ____result.Message = __Message__; + return ____result; + } + } +} + +#pragma warning restore 168 +#pragma warning restore 414 +#pragma warning restore 618 +#pragma warning restore 612 + +#pragma warning restore SA1129 // Do not use default value type constructor +#pragma warning restore SA1200 // Using directives should be placed correctly +#pragma warning restore SA1309 // Field names should not begin with underscore +#pragma warning restore SA1312 // Variable names should begin with lower-case letter +#pragma warning restore SA1403 // File may only contain a single namespace +#pragma warning restore SA1649 // File name should match first type name + diff --git a/Assets/Scripts/Generated/MessagePack.Generated.cs.meta b/Assets/Scripts/Generated/MessagePack.Generated.cs.meta new file mode 100644 index 000000000..1758681bd --- /dev/null +++ b/Assets/Scripts/Generated/MessagePack.Generated.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 06622dddf17e3734bb11f4133d2427d8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/InitialSettings.cs b/Assets/Scripts/InitialSettings.cs new file mode 100644 index 000000000..d6ede0e19 --- /dev/null +++ b/Assets/Scripts/InitialSettings.cs @@ -0,0 +1,24 @@ +using MessagePack; +using MessagePack.Resolvers; +using UnityEngine; + +namespace Assets.Scripts +{ + class InitialSettings + { + [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] + static void RegisterResolvers() + { + // NOTE: Currently, CompositeResolver doesn't work on Unity IL2CPP build. Use StaticCompositeResolver instead of it. + StaticCompositeResolver.Instance.Register( + MagicOnion.Resolvers.MagicOnionResolver.Instance, + MessagePack.Resolvers.GeneratedResolver.Instance, + BuiltinResolver.Instance, + PrimitiveObjectResolver.Instance + ); + + MessagePackSerializer.DefaultOptions = MessagePackSerializer.DefaultOptions + .WithResolver(StaticCompositeResolver.Instance); + } + } +} diff --git a/Assets/Scripts/InitialSettings.cs.meta b/Assets/Scripts/InitialSettings.cs.meta new file mode 100644 index 000000000..b033e9c5a --- /dev/null +++ b/Assets/Scripts/InitialSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 642627729ca40a74d865e205a6001bb1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion.Abstractions.meta b/Assets/Scripts/MagicOnion.Abstractions.meta new file mode 100644 index 000000000..4dc0b3d6f --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d10546c5ab03aee43ba1b004a61f0d8e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion.Abstractions/Client.meta b/Assets/Scripts/MagicOnion.Abstractions/Client.meta new file mode 100644 index 000000000..350a54a85 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/Client.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: aca11e9577c2fb24c9ff99ccac34dbba +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion.Abstractions/Client/IResponseContext.cs b/Assets/Scripts/MagicOnion.Abstractions/Client/IResponseContext.cs new file mode 100644 index 000000000..f839eda7b --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/Client/IResponseContext.cs @@ -0,0 +1,22 @@ +using Grpc.Core; +using MessagePack; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace MagicOnion.Client +{ + public interface IResponseContext : IDisposable + { + Task ResponseHeadersAsync { get; } + Status GetStatus(); + Metadata GetTrailers(); + Type ResponseType { get; } + } + + public interface IResponseContext : IResponseContext + { + Task ResponseAsync { get; } + } +} diff --git a/Assets/Scripts/MagicOnion.Abstractions/Client/IResponseContext.cs.meta b/Assets/Scripts/MagicOnion.Abstractions/Client/IResponseContext.cs.meta new file mode 100644 index 000000000..2d1c1af57 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/Client/IResponseContext.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d1954ea03abc7c34fba72fdd2cd9a8bf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion.Abstractions/ClientStreamingResult.cs b/Assets/Scripts/MagicOnion.Abstractions/ClientStreamingResult.cs new file mode 100644 index 000000000..91341d35b --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/ClientStreamingResult.cs @@ -0,0 +1,132 @@ +using Grpc.Core; +using MessagePack; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; + +namespace MagicOnion +{ + /// + /// Wrapped AsyncClientStreamingCall. + /// + public struct ClientStreamingResult : IDisposable + { + internal readonly TResponse rawValue; + internal readonly bool hasRawValue; + readonly AsyncClientStreamingCall inner; + readonly IClientStreamWriter requestStream; + readonly MessagePackSerializerOptions serializerOptions; + + public ClientStreamingResult(TResponse rawValue) + { + this.hasRawValue = true; + this.rawValue = rawValue; + this.inner = null; + this.requestStream = null; + this.serializerOptions = null; + } + + public ClientStreamingResult(AsyncClientStreamingCall inner, IClientStreamWriter requestStream, MessagePackSerializerOptions serializerOptions) + { + this.hasRawValue = false; + this.rawValue = default(TResponse); + this.inner = inner; + this.requestStream = requestStream; + this.serializerOptions = serializerOptions; + } + + async Task Deserialize() + { + var bytes = await inner.ResponseAsync.ConfigureAwait(false); + return MessagePackSerializer.Deserialize(bytes, serializerOptions); + } + + /// + /// Asynchronous call result. + /// + public Task ResponseAsync + { + get + { + if (hasRawValue) + { + return Task.FromResult(rawValue); + } + else + { + return Deserialize(); + } + } + } + + /// + /// Asynchronous access to response headers. + /// + public Task ResponseHeadersAsync + { + get + { + return this.inner.ResponseHeadersAsync; + } + } + + /// + /// Async stream to send streaming requests. + /// + public IClientStreamWriter RequestStream + { + get + { + return this.requestStream; + } + } + + /// + /// Allows awaiting this object directly. + /// + /// + public TaskAwaiter GetAwaiter() + { + return ResponseAsync.GetAwaiter(); + } + + /// + /// Gets the call status if the call has already finished. + /// Throws InvalidOperationException otherwise. + /// + public Status GetStatus() + { + return this.inner.GetStatus(); + } + + /// + /// Gets the call trailing metadata if the call has already finished. + /// Throws InvalidOperationException otherwise. + /// + public Metadata GetTrailers() + { + return this.inner.GetTrailers(); + } + + /// + /// Provides means to cleanup after the call. + /// If the call has already finished normally (request stream has been completed and call result has been received), doesn't do anything. + /// Otherwise, requests cancellation of the call which should terminate all pending async operations associated with the call. + /// As a result, all resources being used by the call should be released eventually. + /// + /// + /// Normally, there is no need for you to dispose the call unless you want to utilize the + /// "Cancel" semantics of invoking Dispose. + /// + public void Dispose() + { + if (this.inner != null) + { + this.inner.Dispose(); + } + } + } +} diff --git a/Assets/Scripts/MagicOnion.Abstractions/ClientStreamingResult.cs.meta b/Assets/Scripts/MagicOnion.Abstractions/ClientStreamingResult.cs.meta new file mode 100644 index 000000000..85a8dad32 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/ClientStreamingResult.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1e92d02db742a454fa25774f217806cb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion.Abstractions/CompilerServices.meta b/Assets/Scripts/MagicOnion.Abstractions/CompilerServices.meta new file mode 100644 index 000000000..8f191aa17 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/CompilerServices.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cee65f2126c31d0418b29c422566e23b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion.Abstractions/CompilerServices/AsyncUnaryResultMethodBuilder.cs b/Assets/Scripts/MagicOnion.Abstractions/CompilerServices/AsyncUnaryResultMethodBuilder.cs new file mode 100644 index 000000000..c48747975 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/CompilerServices/AsyncUnaryResultMethodBuilder.cs @@ -0,0 +1,80 @@ +using System; +using System.Runtime.CompilerServices; +using System.Security; + +namespace MagicOnion.CompilerServices +{ + public struct AsyncUnaryResultMethodBuilder + { + private AsyncTaskMethodBuilder methodBuilder; + private T result; + private bool haveResult; + private bool useBuilder; + + public static AsyncUnaryResultMethodBuilder Create() + { + return new AsyncUnaryResultMethodBuilder() { methodBuilder = AsyncTaskMethodBuilder.Create() }; + } + + public void Start(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine + { + methodBuilder.Start(ref stateMachine); // will provide the right ExecutionContext semantics + } + + public void SetStateMachine(IAsyncStateMachine stateMachine) + { + methodBuilder.SetStateMachine(stateMachine); + } + + public void SetResult(T result) + { + if (useBuilder) + { + methodBuilder.SetResult(result); + } + else + { + this.result = result; + haveResult = true; + } + } + + public void SetException(Exception exception) + { + methodBuilder.SetException(exception); + } + + public UnaryResult Task + { + get + { + if (haveResult) + { + return new UnaryResult(result); + } + else + { + useBuilder = true; + return new UnaryResult(methodBuilder.Task); + } + } + } + + public void AwaitOnCompleted(ref TAwaiter awaiter, ref TStateMachine stateMachine) + where TAwaiter : INotifyCompletion + where TStateMachine : IAsyncStateMachine + { + useBuilder = true; + methodBuilder.AwaitOnCompleted(ref awaiter, ref stateMachine); + } + + [SecuritySafeCritical] + public void AwaitUnsafeOnCompleted(ref TAwaiter awaiter, ref TStateMachine stateMachine) + where TAwaiter : ICriticalNotifyCompletion + where TStateMachine : IAsyncStateMachine + { + useBuilder = true; + methodBuilder.AwaitUnsafeOnCompleted(ref awaiter, ref stateMachine); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion.Abstractions/CompilerServices/AsyncUnaryResultMethodBuilder.cs.meta b/Assets/Scripts/MagicOnion.Abstractions/CompilerServices/AsyncUnaryResultMethodBuilder.cs.meta new file mode 100644 index 000000000..936f44948 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/CompilerServices/AsyncUnaryResultMethodBuilder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 975c42469777f414fae46186971f0dc8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion.Abstractions/DuplexStreamingResult.cs b/Assets/Scripts/MagicOnion.Abstractions/DuplexStreamingResult.cs new file mode 100644 index 000000000..1d831c81a --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/DuplexStreamingResult.cs @@ -0,0 +1,95 @@ +using Grpc.Core; +using MessagePack; +using System; +using System.Threading.Tasks; + +namespace MagicOnion +{ + /// + /// Wrapped AsyncDuplexStreamingCall. + /// + public struct DuplexStreamingResult : IDisposable + { + readonly AsyncDuplexStreamingCall inner; + readonly IClientStreamWriter requestStream; + readonly IAsyncStreamReader responseStream; + + public DuplexStreamingResult(AsyncDuplexStreamingCall inner, IClientStreamWriter requestStream, IAsyncStreamReader responseStream, MessagePackSerializerOptions serializerOptions) + { + this.inner = inner; + this.requestStream = requestStream; + this.responseStream = responseStream; + } + + public AsyncDuplexStreamingCall RawStreamingCall => inner; + + /// + /// Async stream to read streaming responses. + /// + public IAsyncStreamReader ResponseStream + { + get + { + return responseStream; + } + } + + /// + /// Async stream to send streaming requests. + /// + public IClientStreamWriter RequestStream + { + get + { + return requestStream; + } + } + + /// + /// Asynchronous access to response headers. + /// + public Task ResponseHeadersAsync + { + get + { + return this.inner.ResponseHeadersAsync; + } + } + + /// + /// Gets the call status if the call has already finished. + /// Throws InvalidOperationException otherwise. + /// + public Status GetStatus() + { + return this.inner.GetStatus(); + } + + /// + /// Gets the call trailing metadata if the call has already finished. + /// Throws InvalidOperationException otherwise. + /// + public Metadata GetTrailers() + { + return this.inner.GetTrailers(); + } + + /// + /// Provides means to cleanup after the call. + /// If the call has already finished normally (request stream has been completed and response stream has been fully read), doesn't do anything. + /// Otherwise, requests cancellation of the call which should terminate all pending async operations associated with the call. + /// As a result, all resources being used by the call should be released eventually. + /// + /// + /// Normally, there is no need for you to dispose the call unless you want to utilize the + /// "Cancel" semantics of invoking Dispose. + /// + public void Dispose() + { + if (this.inner != null) + { + this.inner.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion.Abstractions/DuplexStreamingResult.cs.meta b/Assets/Scripts/MagicOnion.Abstractions/DuplexStreamingResult.cs.meta new file mode 100644 index 000000000..e1960e3c4 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/DuplexStreamingResult.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 383e96f82d4d6244b951f0fc83d49b63 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion.Abstractions/GenerateDefineDebugAttribute.cs b/Assets/Scripts/MagicOnion.Abstractions/GenerateDefineDebugAttribute.cs new file mode 100644 index 000000000..233d5f4c2 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/GenerateDefineDebugAttribute.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MagicOnion +{ + /// + /// instruction for moc.exe, surround #if symbol with output code. + /// + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Interface, AllowMultiple = false, Inherited = false)] + public class GenerateDefineDebugAttribute : Attribute + { + public GenerateDefineDebugAttribute() + { + } + } +} diff --git a/Assets/Scripts/MagicOnion.Abstractions/GenerateDefineDebugAttribute.cs.meta b/Assets/Scripts/MagicOnion.Abstractions/GenerateDefineDebugAttribute.cs.meta new file mode 100644 index 000000000..0b318ca66 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/GenerateDefineDebugAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ab20e13a7e0b6b644a42dbfa3b44afd3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion.Abstractions/IService.cs b/Assets/Scripts/MagicOnion.Abstractions/IService.cs new file mode 100644 index 000000000..a2e5a3bfb --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/IService.cs @@ -0,0 +1,21 @@ +using Grpc.Core; +using System; +using System.Threading; + +namespace MagicOnion +{ + // used for MagicOnionEngine assembly scan for boostup analyze speed. + public interface IServiceMarker + { + + } + + public interface IService : IServiceMarker + { + TSelf WithOptions(CallOptions option); + TSelf WithHeaders(Metadata headers); + TSelf WithDeadline(DateTime deadline); + TSelf WithCancellationToken(CancellationToken cancellationToken); + TSelf WithHost(string host); + } +} diff --git a/Assets/Scripts/MagicOnion.Abstractions/IService.cs.meta b/Assets/Scripts/MagicOnion.Abstractions/IService.cs.meta new file mode 100644 index 000000000..beefef708 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/IService.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 56677a2edb7ea644faf4846ad283b007 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion.Abstractions/IStreamingHub.cs b/Assets/Scripts/MagicOnion.Abstractions/IStreamingHub.cs new file mode 100644 index 000000000..abca4c5d9 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/IStreamingHub.cs @@ -0,0 +1,15 @@ +using System.Threading.Tasks; + +namespace MagicOnion +{ + public interface IStreamingHubMarker + { + } + + public interface IStreamingHub : IStreamingHubMarker, IServiceMarker + { + TSelf FireAndForget(); // if changed to get-only property, intellisense does not work on VS2017. + Task DisposeAsync(); + Task WaitForDisconnect(); + } +} diff --git a/Assets/Scripts/MagicOnion.Abstractions/IStreamingHub.cs.meta b/Assets/Scripts/MagicOnion.Abstractions/IStreamingHub.cs.meta new file mode 100644 index 000000000..ccd0a48a8 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/IStreamingHub.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5d0a5fcfa0834b84ea6ff4d77e478fb9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion.Abstractions/IgnoreAttribute.cs b/Assets/Scripts/MagicOnion.Abstractions/IgnoreAttribute.cs new file mode 100644 index 000000000..51d77d7b9 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/IgnoreAttribute.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MagicOnion +{ + /// + /// Don't register on MagicOnionEngine. + /// + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class,AllowMultiple = false,Inherited = false)] + public class IgnoreAttribute : Attribute + { + } +} diff --git a/Assets/Scripts/MagicOnion.Abstractions/IgnoreAttribute.cs.meta b/Assets/Scripts/MagicOnion.Abstractions/IgnoreAttribute.cs.meta new file mode 100644 index 000000000..01d3c6263 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/IgnoreAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0d13f2ed066fd874b8749ca248f42c51 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion.Abstractions/MagicOnion.Abstractions.asmdef b/Assets/Scripts/MagicOnion.Abstractions/MagicOnion.Abstractions.asmdef new file mode 100644 index 000000000..994b587b0 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/MagicOnion.Abstractions.asmdef @@ -0,0 +1,14 @@ +{ + "name": "MagicOnion.Abstractions", + "references": [ + "MessagePack" + ], + "optionalUnityReferences": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [] +} \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion.Abstractions/MagicOnion.Abstractions.asmdef.meta b/Assets/Scripts/MagicOnion.Abstractions/MagicOnion.Abstractions.asmdef.meta new file mode 100644 index 000000000..9c158d77e --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/MagicOnion.Abstractions.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 62b9d94cd08d5d047b266d42e8684cb8 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion.Abstractions/Server.meta b/Assets/Scripts/MagicOnion.Abstractions/Server.meta new file mode 100644 index 000000000..b806c9bca --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/Server.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c1f828ada0daa0843bfef8cc6ebda1bf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion.Abstractions/Server/Hubs.meta b/Assets/Scripts/MagicOnion.Abstractions/Server/Hubs.meta new file mode 100644 index 000000000..137710ef6 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/Server/Hubs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 33588a48f556fba45b238f907a8ebc38 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion.Abstractions/Server/Hubs/MethodIdAttribute.cs b/Assets/Scripts/MagicOnion.Abstractions/Server/Hubs/MethodIdAttribute.cs new file mode 100644 index 000000000..0eb685db5 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/Server/Hubs/MethodIdAttribute.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace MagicOnion.Server.Hubs +{ + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)] + public class MethodIdAttribute : Attribute + { + public readonly int MethodId; + + public MethodIdAttribute(int methodId) + { + MethodId = methodId; + } + } +} diff --git a/Assets/Scripts/MagicOnion.Abstractions/Server/Hubs/MethodIdAttribute.cs.meta b/Assets/Scripts/MagicOnion.Abstractions/Server/Hubs/MethodIdAttribute.cs.meta new file mode 100644 index 000000000..8377387c0 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/Server/Hubs/MethodIdAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1752261f18dd5f749b27216b7cbe81e3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion.Abstractions/ServerStreamingResult.cs b/Assets/Scripts/MagicOnion.Abstractions/ServerStreamingResult.cs new file mode 100644 index 000000000..668201239 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/ServerStreamingResult.cs @@ -0,0 +1,80 @@ +using Grpc.Core; +using MessagePack; +using System; +using System.Threading.Tasks; + +namespace MagicOnion +{ + /// + /// Wrapped AsyncServerStreamingCall. + /// + public struct ServerStreamingResult : IDisposable + { + readonly AsyncServerStreamingCall inner; + readonly IAsyncStreamReader responseStream; + + public ServerStreamingResult(AsyncServerStreamingCall inner, IAsyncStreamReader responseStream, MessagePackSerializerOptions serializerOptions) + { + this.inner = inner; + this.responseStream = responseStream; + } + + /// + /// Async stream to read streaming responses. + /// + public IAsyncStreamReader ResponseStream + { + get + { + return responseStream; + } + } + + /// + /// Asynchronous access to response headers. + /// + public Task ResponseHeadersAsync + { + get + { + return this.inner.ResponseHeadersAsync; + } + } + + /// + /// Gets the call status if the call has already finished. + /// Throws InvalidOperationException otherwise. + /// + public Status GetStatus() + { + return this.inner.GetStatus(); + } + + /// + /// Gets the call trailing metadata if the call has already finished. + /// Throws InvalidOperationException otherwise. + /// + public Metadata GetTrailers() + { + return this.inner.GetTrailers(); + } + + /// + /// Provides means to cleanup after the call. + /// If the call has already finished normally (response stream has been fully read), doesn't do anything. + /// Otherwise, requests cancellation of the call which should terminate all pending async operations associated with the call. + /// As a result, all resources being used by the call should be released eventually. + /// + /// + /// Normally, there is no need for you to dispose the call unless you want to utilize the + /// "Cancel" semantics of invoking Dispose. + /// + public void Dispose() + { + if (this.inner != null) + { + this.inner.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion.Abstractions/ServerStreamingResult.cs.meta b/Assets/Scripts/MagicOnion.Abstractions/ServerStreamingResult.cs.meta new file mode 100644 index 000000000..720b34519 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/ServerStreamingResult.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 46a21c751ab9a4f4caf74e806bfe2bea +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion.Abstractions/UnaryResult.cs b/Assets/Scripts/MagicOnion.Abstractions/UnaryResult.cs new file mode 100644 index 000000000..1dee9f3f3 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/UnaryResult.cs @@ -0,0 +1,163 @@ +using Grpc.Core; +using MagicOnion.Client; +using MagicOnion.CompilerServices; // require this using in AsyncMethodBuilder +using System; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +namespace MagicOnion +{ + /// + /// Wrapped AsyncUnaryCall. + /// +#if NON_UNITY || (CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6))) + [AsyncMethodBuilder(typeof(AsyncUnaryResultMethodBuilder<>))] +#endif + public struct UnaryResult + { + internal readonly bool hasRawValue; // internal + internal readonly TResponse rawValue; // internal + internal readonly Task rawTaskValue; // internal + + readonly Task> response; + + public UnaryResult(TResponse rawValue) + { + this.hasRawValue = true; + this.rawValue = rawValue; + this.rawTaskValue = null; + this.response = null; + } + + public UnaryResult(Task rawTaskValue) + { + this.hasRawValue = true; + this.rawValue = default(TResponse); + this.rawTaskValue = rawTaskValue; + this.response = null; + } + + public UnaryResult(Task> response) + { + this.hasRawValue = false; + this.rawValue = default(TResponse); + this.rawTaskValue = null; + this.response = response; + } + + /// + /// Asynchronous call result. + /// + public Task ResponseAsync + { + get + { + if (!hasRawValue) + { + return UnwrapResponse(); + } + else if (rawTaskValue != null) + { + return rawTaskValue; + } + else + { + return Task.FromResult(rawValue); + } + } + } + + /// + /// Asynchronous access to response headers. + /// + public Task ResponseHeadersAsync + { + get + { + return UnwrapResponseHeaders(); + } + } + + async Task UnwrapResponse() + { + var ctx = await response.ConfigureAwait(false); + return await ctx.ResponseAsync.ConfigureAwait(false); + } + + async Task UnwrapResponseHeaders() + { + var ctx = await response.ConfigureAwait(false); + return await ctx.ResponseHeadersAsync.ConfigureAwait(false); + } + + async void UnwrapDispose() + { + try + { + var ctx = await response.ConfigureAwait(false); + ctx.Dispose(); + } + catch + { + } + } + + IResponseContext TryUnwrap() + { + if (!response.IsCompleted) + { + throw new InvalidOperationException("UnaryResult request is not yet completed, please await before call this."); + } + + return response.Result; + } + + /// + /// Allows awaiting this object directly. + /// + public TaskAwaiter GetAwaiter() + { + return ResponseAsync.GetAwaiter(); + } + + /// + /// Gets the call status if the call has already finished. + /// Throws InvalidOperationException otherwise. + /// + public Status GetStatus() + { + return TryUnwrap().GetStatus(); + } + + /// + /// Gets the call trailing metadata if the call has already finished. + /// Throws InvalidOperationException otherwise. + /// + public Metadata GetTrailers() + { + return TryUnwrap().GetTrailers(); + } + + /// + /// Provides means to cleanup after the call. + /// If the call has already finished normally (request stream has been completed and call result has been received), doesn't do anything. + /// Otherwise, requests cancellation of the call which should terminate all pending async operations associated with the call. + /// As a result, all resources being used by the call should be released eventually. + /// + /// + /// Normally, there is no need for you to dispose the call unless you want to utilize the + /// "Cancel" semantics of invoking Dispose. + /// + public void Dispose() + { + if (!response.IsCompleted) + { + UnwrapDispose(); + } + else + { + response.Result.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion.Abstractions/UnaryResult.cs.meta b/Assets/Scripts/MagicOnion.Abstractions/UnaryResult.cs.meta new file mode 100644 index 000000000..74faf56bd --- /dev/null +++ b/Assets/Scripts/MagicOnion.Abstractions/UnaryResult.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cc0fe0c16ad63fd489a131a76e925b08 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion.Unity.meta b/Assets/Scripts/MagicOnion.Unity.meta new file mode 100644 index 000000000..b29f3eee6 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5ae2da7b7f80f014d9b6b4a9fd333eb1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion.Unity/ChannelExtensions.cs b/Assets/Scripts/MagicOnion.Unity/ChannelExtensions.cs new file mode 100644 index 000000000..0a79e520f --- /dev/null +++ b/Assets/Scripts/MagicOnion.Unity/ChannelExtensions.cs @@ -0,0 +1,19 @@ +using Grpc.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace MagicOnion +{ + public static class ChannelExtensions + { + /// + /// Safety way for subscribe streaming events. + /// + public static void RegisterStreamingSubscription(this Channel channel, IDisposable subscription) + { + channel.ShutdownToken.Register(() => subscription.Dispose()); + } + } +} diff --git a/Assets/Scripts/MagicOnion.Unity/ChannelExtensions.cs.meta b/Assets/Scripts/MagicOnion.Unity/ChannelExtensions.cs.meta new file mode 100644 index 000000000..5f149ce92 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Unity/ChannelExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 88d6659672dcc9e408775f1fcaa6dea3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion.Unity/MagicOnion.Unity.asmdef b/Assets/Scripts/MagicOnion.Unity/MagicOnion.Unity.asmdef new file mode 100644 index 000000000..22efeb994 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Unity/MagicOnion.Unity.asmdef @@ -0,0 +1,15 @@ +{ + "name": "MagicOnion.Unity", + "references": [ + "MagicOnion.Abstractions", + "MagicOnion" + ], + "optionalUnityReferences": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [] +} \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion.Unity/MagicOnion.Unity.asmdef.meta b/Assets/Scripts/MagicOnion.Unity/MagicOnion.Unity.asmdef.meta new file mode 100644 index 000000000..54059868b --- /dev/null +++ b/Assets/Scripts/MagicOnion.Unity/MagicOnion.Unity.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 350d0af80fb7b7947a59de66ab477547 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion.Unity/UnityDebugLogger.cs b/Assets/Scripts/MagicOnion.Unity/UnityDebugLogger.cs new file mode 100644 index 000000000..5b17c4ca5 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Unity/UnityDebugLogger.cs @@ -0,0 +1,157 @@ +using Grpc.Core.Logging; +using System; + +namespace MagicOnion +{ + public class UnityDebugLogger : ILogger + { + readonly Type forType; + readonly string forTypeString; + readonly bool errorToWarn = true; // default is true(gRPC internal log show to warn) + + public UnityDebugLogger() + : this(null) + { + } + + public UnityDebugLogger(bool errorToWarn) + : this(null) + { + this.errorToWarn = errorToWarn; + } + + protected UnityDebugLogger(Type forType) + { + this.forType = forType; + if (forType != null) + { + var namespaceStr = forType.Namespace ?? ""; + if (namespaceStr.Length > 0) + { + namespaceStr += "."; + } + this.forTypeString = namespaceStr + forType.Name + " "; + } + else + { + this.forTypeString = ""; + } + } + + /// + /// Returns a logger associated with the specified type. + /// + public virtual ILogger ForType() + { + if (typeof(T) == forType) + { + return this; + } + return new UnityDebugLogger(typeof(T)); + } + + /// Logs a message with severity Debug. + public void Debug(string message) + { + UnityEngine.Debug.Log(BuildMessage(message)); + } + + /// Logs a formatted message with severity Debug. + public void Debug(string format, params object[] formatArgs) + { + UnityEngine.Debug.Log(BuildMessage(format, formatArgs)); + } + + /// Logs a message with severity Info. + public void Info(string message) + { + UnityEngine.Debug.Log(BuildMessage(message)); + } + + /// Logs a formatted message with severity Info. + public void Info(string format, params object[] formatArgs) + { + UnityEngine.Debug.Log(BuildMessage(format, formatArgs)); + } + + /// Logs a message with severity Warning. + public void Warning(string message) + { + UnityEngine.Debug.LogWarning(BuildMessage(message)); + } + + /// Logs a formatted message with severity Warning. + public void Warning(string format, params object[] formatArgs) + { + UnityEngine.Debug.LogWarning(BuildMessage(format, formatArgs)); + } + + /// Logs a message and an associated exception with severity Warning. + public void Warning(Exception exception, string message) + { + Warning(message + " " + exception); + } + + /// Logs a message with severity Error. + public void Error(string message) + { + if (errorToWarn) + { + UnityEngine.Debug.LogWarning(BuildMessage(message)); + } + else + { + UnityEngine.Debug.LogError(BuildMessage(message)); + } + } + + /// Logs a formatted message with severity Error. + public void Error(string format, params object[] formatArgs) + { + if (errorToWarn) + { + UnityEngine.Debug.LogWarning(BuildMessage(format, formatArgs)); + } + else + { + UnityEngine.Debug.LogError(BuildMessage(format, formatArgs)); + } + } + + /// Logs a message and an associated exception with severity Error. + public void Error(Exception exception, string message) + { + Error(message + " " + exception); + } + + /// Gets the type associated with this logger. + protected Type AssociatedType + { + get { return forType; } + } + + string BuildMessage(string message) + { + if (forType != null) + { + return forTypeString + message; + } + else + { + return message; + } + } + + string BuildMessage(string format, object[] args) + { + if (forType != null) + { + return forTypeString + string.Format(format, args); + } + else + { + return string.Format(format, args); + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion.Unity/UnityDebugLogger.cs.meta b/Assets/Scripts/MagicOnion.Unity/UnityDebugLogger.cs.meta new file mode 100644 index 000000000..728e9ab29 --- /dev/null +++ b/Assets/Scripts/MagicOnion.Unity/UnityDebugLogger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5a9b20988ba163244a107c806f58c14f +timeCreated: 1482380673 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion.meta b/Assets/Scripts/MagicOnion.meta new file mode 100644 index 000000000..ac68c5c69 --- /dev/null +++ b/Assets/Scripts/MagicOnion.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f6943e9ecc1ad0b40a72d928039e3205 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/AsyncLock.cs b/Assets/Scripts/MagicOnion/AsyncLock.cs new file mode 100644 index 000000000..67aae46b5 --- /dev/null +++ b/Assets/Scripts/MagicOnion/AsyncLock.cs @@ -0,0 +1,45 @@ +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace MagicOnion +{ + public class AsyncLock + { + readonly SemaphoreSlim semaphore; + +#if NON_UNITY + public static readonly ValueTask EmptyLock = new ValueTask(new LockReleaser(null)); +#endif + + public AsyncLock() + { + this.semaphore = new SemaphoreSlim(1, 1); + } + +#if NON_UNITY + public async ValueTask LockAsync() +#else + public async Task LockAsync() +#endif + { + await semaphore.WaitAsync().ConfigureAwait(false); + return new LockReleaser(semaphore); + } + + public struct LockReleaser : IDisposable + { + readonly SemaphoreSlim semaphore; + + public LockReleaser(SemaphoreSlim semaphore) + { + this.semaphore = semaphore; + } + + public void Dispose() + { + semaphore?.Release(); + } + } + } +} diff --git a/Assets/Scripts/MagicOnion/AsyncLock.cs.meta b/Assets/Scripts/MagicOnion/AsyncLock.cs.meta new file mode 100644 index 000000000..c550f033d --- /dev/null +++ b/Assets/Scripts/MagicOnion/AsyncLock.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9a1fdda349d00b84596da99fbda0426d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/AsyncStreamReaderExtensions.cs b/Assets/Scripts/MagicOnion/AsyncStreamReaderExtensions.cs new file mode 100644 index 000000000..b5e519973 --- /dev/null +++ b/Assets/Scripts/MagicOnion/AsyncStreamReaderExtensions.cs @@ -0,0 +1,35 @@ +using Grpc.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace MagicOnion +{ + public static class AsyncStreamReaderExtensions + { + public static async Task ForEachAsync(this IAsyncStreamReader stream, Action action, CancellationToken cancellation = default(CancellationToken)) + { + using (stream as IDisposable) + { + while (!cancellation.IsCancellationRequested && await stream.MoveNext(cancellation)) + { + action(stream.Current); + } + } + } + + public static async Task ForEachAsync(this IAsyncStreamReader stream, Func asyncAction, CancellationToken cancellation = default(CancellationToken)) + { + using (stream as IDisposable) + { + while (!cancellation.IsCancellationRequested && await stream.MoveNext(cancellation)) + { + await asyncAction(stream.Current); + } + } + } + } +} diff --git a/Assets/Scripts/MagicOnion/AsyncStreamReaderExtensions.cs.meta b/Assets/Scripts/MagicOnion/AsyncStreamReaderExtensions.cs.meta new file mode 100644 index 000000000..174ca9deb --- /dev/null +++ b/Assets/Scripts/MagicOnion/AsyncStreamReaderExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: eccd314ac5c4f71499ebad65fd6d3ecf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/Client.meta b/Assets/Scripts/MagicOnion/Client.meta new file mode 100644 index 000000000..577dc994f --- /dev/null +++ b/Assets/Scripts/MagicOnion/Client.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f41f5b00e235ac44d8d3aaea561952a3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/Client/ClientFilter.cs b/Assets/Scripts/MagicOnion/Client/ClientFilter.cs new file mode 100644 index 000000000..8559a04d2 --- /dev/null +++ b/Assets/Scripts/MagicOnion/Client/ClientFilter.cs @@ -0,0 +1,213 @@ +using Grpc.Core; +using MessagePack; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace MagicOnion.Client +{ + public interface IClientFilter + { + ValueTask SendAsync(RequestContext context, Func> next); + } + + public abstract class RequestContext + { + static readonly Func DefaultMutator = xs => xs; + + public string MethodPath { get; } + public CallOptions CallOptions { get; } + public Type ResponseType { get; } + public abstract Type RequestType { get; } + public Func RequestMutator { get; private set; } + public Func ResponseMutator { get; private set; } + + Dictionary items; + public IDictionary Items + { + get + { + if (items == null) + { + items = new Dictionary(); + } + return items; + } + } + + // internal use to avoid lambda capture. + internal MagicOnionClientBase Client { get; } + internal IClientFilter[] Filters { get; } + internal Func RequestMethod { get; } + + internal RequestContext(MagicOnionClientBase client, string methodPath, CallOptions callOptions, Type responseType, IClientFilter[] filters, Func requestMethod) + { + this.Client = client; + this.MethodPath = methodPath; + this.CallOptions = callOptions; + this.ResponseType = responseType; + this.Filters = filters; + this.RequestMethod = requestMethod; + this.RequestMutator = DefaultMutator; + this.ResponseMutator = DefaultMutator; + } + + public void SetRequestMutator(Func mutator) + { + this.RequestMutator = mutator; + } + + public void SetResponseMutator(Func mutator) + { + this.ResponseMutator = mutator; + } + } + + public class RequestContext : RequestContext + { + public T Request { get; } + public override Type RequestType => typeof(T); + + public RequestContext(T request, MagicOnionClientBase client, string methodPath, CallOptions callOptions, Type responseType, IClientFilter[] filters, Func requestMethod) + : base(client, methodPath, callOptions, responseType, filters, requestMethod) + { + this.Request = request; + } + } + + public abstract class ResponseContext : IResponseContext + { + static readonly Func DefaultMutator = xs => xs; + + public abstract Task ResponseHeadersAsync { get; } + public abstract Status GetStatus(); + public abstract Metadata GetTrailers(); + public abstract void Dispose(); + public abstract Type ResponseType { get; } + public Func ResponseMutator { get; private set; } + + public abstract Task WaitResponseAsync(); + + public ResponseContext As() + { + return this as ResponseContext; + } + + public Task GetResponseAs() + { + var t = this as ResponseContext; + if (t == null) return Task.FromResult(default(T)); + + return t.ResponseAsync; + } + + public ResponseContext() + { + this.ResponseMutator = DefaultMutator; + } + + public void SetResponseMutator(Func mutator) + { + this.ResponseMutator = mutator; + } + } + + public sealed class ResponseContext : ResponseContext, IResponseContext + { + readonly AsyncUnaryCall inner; + readonly MessagePackSerializerOptions serializerOptions; + readonly bool isMock; + bool deserialized; + + T responseObject; // cache value. + + // mock + readonly Metadata trailers; + readonly Metadata responseHeaders; + readonly Status status; + + public ResponseContext(AsyncUnaryCall inner, MessagePackSerializerOptions serializerOptions) + : base() + { + this.isMock = false; + this.inner = inner; + this.serializerOptions = serializerOptions; + } + + public ResponseContext(T responseObject) + : this(responseObject, new Metadata(), new Metadata(), Status.DefaultSuccess) + { + } + + public ResponseContext(T responseObject, Metadata trailers, Metadata responseHeaders, Status status) + : base() + { + this.isMock = true; + this.responseObject = responseObject; + this.trailers = trailers; + this.responseHeaders = responseHeaders; + this.status = status; + } + + async Task Deserialize() + { + if (deserialized) + { + return responseObject; + } + else + { + var bytes = await inner.ResponseAsync.ConfigureAwait(false); + responseObject = MessagePackSerializer.Deserialize(this.ResponseMutator(bytes), serializerOptions); + deserialized = true; + return responseObject; + } + } + + public Task ResponseAsync => !isMock ? Deserialize() : Task.FromResult(responseObject); + + public override async Task WaitResponseAsync() + { + await ResponseAsync; + return this; + } + + public override Type ResponseType => typeof(T); + + public override Task ResponseHeadersAsync => !isMock ? inner.ResponseHeadersAsync : Task.FromResult(responseHeaders); + + public override void Dispose() + { + if (!isMock) + { + inner.Dispose(); + } + } + + public override Status GetStatus() + { + return !isMock ? inner.GetStatus() : status; + } + + public override Metadata GetTrailers() + { + return !isMock ? inner.GetTrailers() : trailers; + } + + public ResponseContext WithNewResult(T result) + { + if (isMock) + { + return new ResponseContext(result, trailers, responseHeaders, status); + } + else + { + var newContext = new ResponseContext(inner, serializerOptions); + newContext.deserialized = true; + newContext.responseObject = result; + return newContext; + } + } + } +} diff --git a/Assets/Scripts/MagicOnion/Client/ClientFilter.cs.meta b/Assets/Scripts/MagicOnion/Client/ClientFilter.cs.meta new file mode 100644 index 000000000..043460c04 --- /dev/null +++ b/Assets/Scripts/MagicOnion/Client/ClientFilter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d0190394f8c415b4b84aa1b95b993369 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/Client/DynamicClientBuilder.cs b/Assets/Scripts/MagicOnion/Client/DynamicClientBuilder.cs new file mode 100644 index 000000000..aac28db06 --- /dev/null +++ b/Assets/Scripts/MagicOnion/Client/DynamicClientBuilder.cs @@ -0,0 +1,628 @@ +#if NON_UNITY || !NET_STANDARD_2_0 + +using Grpc.Core; +using MagicOnion.Utils; +using MessagePack; +using System; +using System.Linq; +using System.Reflection; +using System.Reflection.Emit; +using System.Threading; +using System.Threading.Tasks; + +namespace MagicOnion.Client +{ +#if ENABLE_SAVE_ASSEMBLY + public +#else + internal +#endif + static class DynamicClientAssemblyHolder + { + public const string ModuleName = "MagicOnion.Client.DynamicClient"; + + readonly static DynamicAssembly assembly; + public static DynamicAssembly Assembly { get { return assembly; } } + + static DynamicClientAssemblyHolder() + { + assembly = new DynamicAssembly(ModuleName); + } + +#if ENABLE_SAVE_ASSEMBLY + + public static AssemblyBuilder Save() + { + return assembly.Save(); + } + +#endif + } + +#if ENABLE_SAVE_ASSEMBLY + public +#else + internal +#endif + static class DynamicClientBuilder + where T : IService + { + public static readonly Type ClientType; + static readonly Type bytesMethod = typeof(Method<,>).MakeGenericType(new[] { typeof(byte[]), typeof(byte[]) }); + static readonly FieldInfo throughMarshaller = typeof(MagicOnionMarshallers).GetField("ThroughMarshaller", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); + static readonly FieldInfo nilBytes = typeof(MagicOnionMarshallers).GetField("UnsafeNilBytes", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); + static readonly MethodInfo callMessagePackSerialize = typeof(MessagePackSerializer).GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static) + .First(x => x.Name == "Serialize" && x.GetParameters().Length == 3 && x.ReturnType == typeof(byte[])); + static readonly MethodInfo callCancellationTokenNone = typeof(CancellationToken).GetProperty("None", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static).GetGetMethod(); + + static DynamicClientBuilder() + { + var t = typeof(T); + var ti = t.GetTypeInfo(); + if (!ti.IsInterface) throw new Exception("Client Proxy only allows interface. Type:" + ti.Name); + + var asm = DynamicClientAssemblyHolder.Assembly; + var methodDefinitions = SearchDefinitions(t); + + var parentType = typeof(MagicOnionClientBase<>).MakeGenericType(t); + var typeBuilder = asm.DefineType($"{DynamicClientAssemblyHolder.ModuleName}.{ti.FullName}Client", TypeAttributes.Public, parentType, new Type[] { t }); + + // Set `IgnoreAttribute` to the generated client type. Hides generated-types from building MagicOnion service definitions. + typeBuilder.SetCustomAttribute(new CustomAttributeBuilder(typeof(IgnoreAttribute).GetConstructor(Array.Empty()), Array.Empty())); + + DefineStaticFields(typeBuilder, methodDefinitions); + DefineStaticConstructor(typeBuilder, t, methodDefinitions); + var emptyCtor = DefineConstructors(typeBuilder, methodDefinitions); + DefineMethods(typeBuilder, t, methodDefinitions, emptyCtor); + + ClientType = typeBuilder.CreateTypeInfo().AsType(); + } + + static MethodDefinition[] SearchDefinitions(Type interfaceType) + { + return interfaceType + .GetInterfaces() + .Concat(new[] { interfaceType }) + .SelectMany(x => x.GetMethods()) + .Where(x => + { + var methodInfo = x; + if (methodInfo.IsSpecialName && (methodInfo.Name.StartsWith("set_") || methodInfo.Name.StartsWith("get_"))) return false; + if (methodInfo.GetCustomAttribute(false) != null) return false; // ignore + + var methodName = methodInfo.Name; + if (methodName == "Equals" + || methodName == "GetHashCode" + || methodName == "GetType" + || methodName == "ToString" + || methodName == "WithOptions" + || methodName == "WithHeaders" + || methodName == "WithDeadline" + || methodName == "WithCancellationToken" + || methodName == "WithHost" + ) + { + return false; + } + return true; + }) + .Where(x => !x.IsSpecialName) + .Select(x => new MethodDefinition + { + ServiceType = interfaceType, + MethodInfo = x, + }) + .ToArray(); + } + + static void DefineStaticFields(TypeBuilder typeBuilder, MethodDefinition[] definitions) + { + foreach (var item in definitions) + { + item.FieldMethod = typeBuilder.DefineField(item.MethodInfo.Name + "Method", bytesMethod, FieldAttributes.Private | FieldAttributes.Static); + item.ResponseType = UnwrapResponseType(item, out item.MethodType, out item.ResponseIsTask, out item.RequestType); + + if (item.RequestType == null) + { + item.RequestType = MagicOnionMarshallers.CreateRequestType(item.MethodInfo.GetParameters()); + } + } + } + + static void DefineStaticConstructor(TypeBuilder typeBuilder, Type interfaceType, MethodDefinition[] definitions) + { + var cctor = typeBuilder.DefineConstructor(MethodAttributes.Static, CallingConventions.Standard, Type.EmptyTypes); + var il = cctor.GetILGenerator(); + + for (int i = 0; i < definitions.Length; i++) + { + var def = definitions[i]; + + il.EmitLdc_I4((int)def.MethodType); + il.Emit(OpCodes.Ldstr, def.ServiceType.Name); + il.Emit(OpCodes.Ldstr, def.MethodInfo.Name); + il.Emit(OpCodes.Ldsfld, throughMarshaller); + il.Emit(OpCodes.Ldsfld, throughMarshaller); + il.Emit(OpCodes.Newobj, bytesMethod.GetConstructors()[0]); + il.Emit(OpCodes.Stsfld, def.FieldMethod); + + if (def.MethodType == MethodType.Unary) + { + DefineUnaryRequestDelegate(il, typeBuilder, interfaceType, def); + } + } + + il.Emit(OpCodes.Ret); + } + + static void DefineUnaryRequestDelegate(ILGenerator staticContructorGenerator, TypeBuilder typeBuilder, Type interfaceType, MethodDefinition definition) + { + // static ResponseContext _Method(RequestContext context); + MethodBuilder method; + { + method = typeBuilder.DefineMethod("_" + definition.MethodInfo.Name, MethodAttributes.Private | MethodAttributes.Static, + typeof(ResponseContext), + new[] { typeof(RequestContext) }); + var il = method.GetILGenerator(); + + // CreateResponseContext(Context, Method); + var createMethod = typeof(MagicOnionClientBase) + .GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static) + .Where(x => x.Name == "CreateResponseContext") + .OrderByDescending(x => x.GetGenericArguments().Length) + .First() + .MakeGenericMethod(definition.RequestType, definition.ResponseType); + + il.Emit(OpCodes.Ldarg_0); // context + il.Emit(OpCodes.Ldsfld, definition.FieldMethod); // method + il.Emit(OpCodes.Call, createMethod); + il.Emit(OpCodes.Ret); + } + + // static readonly Func methodDelegate = _Method; + { + definition.UnaryRequestDelegate = typeBuilder.DefineField(definition.MethodInfo.Name + "Delegate", typeof(Func), FieldAttributes.Private | FieldAttributes.Static); + + var il = staticContructorGenerator; + il.Emit(OpCodes.Ldnull); + il.Emit(OpCodes.Ldftn, method); + il.Emit(OpCodes.Newobj, typeof(Func).GetConstructors()[0]); + il.Emit(OpCodes.Stsfld, definition.UnaryRequestDelegate); + } + } + + static ConstructorInfo DefineConstructors(TypeBuilder typeBuilder, MethodDefinition[] definitions) + { + ConstructorInfo emptyCtor; + // .ctor() + { + var ctor = typeBuilder.DefineConstructor(MethodAttributes.Private, CallingConventions.Standard, Type.EmptyTypes); + var il = ctor.GetILGenerator(); + + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Call, typeBuilder.BaseType.GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, Type.EmptyTypes, null)); + il.Emit(OpCodes.Ret); + + emptyCtor = ctor; + } + + // .ctor(CallInvoker, MessagePackSerializerOptions, IClientFilter[]):base(callInvoker, resolver, clientFilters) + { + var ctor = typeBuilder.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, new[] { typeof(CallInvoker), typeof(MessagePackSerializerOptions), typeof(IClientFilter[]) }); + var il = ctor.GetILGenerator(); + + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldarg_1); + il.Emit(OpCodes.Ldarg_2); + il.Emit(OpCodes.Ldarg_3); + il.Emit(OpCodes.Call, typeBuilder.BaseType.GetConstructor(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, null, new[] { typeof(CallInvoker), typeof(MessagePackSerializerOptions), typeof(IClientFilter[]) }, null)); + il.Emit(OpCodes.Ret); + } + + return emptyCtor; + } + + static void DefineMethods(TypeBuilder typeBuilder, Type interfaceType, MethodDefinition[] definitions, ConstructorInfo emptyCtor) + { + var filedHolderType = typeof(MagicOnionClientBase); + var baseType = typeof(MagicOnionClientBase<>).MakeGenericType(interfaceType); + var hostField = filedHolderType.GetField("host", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); + var optionField = filedHolderType.GetField("option", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); + var invokerField = filedHolderType.GetField("callInvoker", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); + var serializerOptionsField = filedHolderType.GetField("serializerOptions", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); + var filtersField = filedHolderType.GetField("filters", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); + + // Clone + { + var method = typeBuilder.DefineMethod("Clone", MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual, + typeof(MagicOnionClientBase<>).MakeGenericType(interfaceType), + Type.EmptyTypes); + var il = method.GetILGenerator(); + + il.Emit(OpCodes.Newobj, emptyCtor); + + il.Emit(OpCodes.Dup); + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, hostField); + il.Emit(OpCodes.Stfld, hostField); + + il.Emit(OpCodes.Dup); + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, optionField); + il.Emit(OpCodes.Stfld, optionField); + + il.Emit(OpCodes.Dup); + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, invokerField); + il.Emit(OpCodes.Stfld, invokerField); + + il.Emit(OpCodes.Dup); + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, serializerOptionsField); + il.Emit(OpCodes.Stfld, serializerOptionsField); + + il.Emit(OpCodes.Dup); + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, filtersField); + il.Emit(OpCodes.Stfld, filtersField); + + il.Emit(OpCodes.Ret); + } + // Overrides + { + // TSelf WithOption(CallOptions option) + { + var method = typeBuilder.DefineMethod("WithOptions", MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual, + interfaceType, + new[] { typeof(CallOptions) }); + var il = method.GetILGenerator(); + + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldarg_1); + il.Emit(OpCodes.Call, baseType.GetMethod("WithOptions", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)); + il.Emit(OpCodes.Ret); + } + // TSelf WithHeaders(Metadata headers); + { + var method = typeBuilder.DefineMethod("WithHeaders", MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual, + interfaceType, + new[] { typeof(Metadata) }); + var il = method.GetILGenerator(); + + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldarg_1); + il.Emit(OpCodes.Call, baseType.GetMethod("WithHeaders", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)); + il.Emit(OpCodes.Ret); + } + // TSelf WithDeadline(DateTime deadline); + { + var method = typeBuilder.DefineMethod("WithDeadline", MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual, + interfaceType, + new[] { typeof(DateTime) }); + var il = method.GetILGenerator(); + + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldarg_1); + il.Emit(OpCodes.Call, baseType.GetMethod("WithDeadline", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)); + il.Emit(OpCodes.Ret); + } + // TSelf WithCancellationToken(CancellationToken cancellationToken); + { + var method = typeBuilder.DefineMethod("WithCancellationToken", MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual, + interfaceType, + new[] { typeof(CancellationToken) }); + var il = method.GetILGenerator(); + + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldarg_1); + il.Emit(OpCodes.Call, baseType.GetMethod("WithCancellationToken", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)); + il.Emit(OpCodes.Ret); + } + // TSelf WithHost(string host); + { + var method = typeBuilder.DefineMethod("WithHost", MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual, + interfaceType, + new[] { typeof(string) }); + var il = method.GetILGenerator(); + + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldarg_1); + il.Emit(OpCodes.Call, baseType.GetMethod("WithHost", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)); + il.Emit(OpCodes.Ret); + } + } + // Proxy Methods + for (int i = 0; i < definitions.Length; i++) + { + var def = definitions[i]; + var parameters = def.MethodInfo.GetParameters().Select(x => x.ParameterType).ToArray(); + + var method = typeBuilder.DefineMethod(def.MethodInfo.Name, MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual, + def.MethodInfo.ReturnType, + parameters); + var il = method.GetILGenerator(); + + switch (def.MethodType) + { + case MethodType.Unary: + { + // base.InvokeAsync/InvokeTaskAsync(string path, TRequest request, Func requestMethod) + + // this. + il.Emit(OpCodes.Ldarg_0); + + // path + il.Emit(OpCodes.Ldstr, def.Path); + + // create request + for (int j = 0; j < parameters.Length; j++) + { + il.Emit(OpCodes.Ldarg, j + 1); + } + if (parameters.Length == 0) + { + // use empty byte[0] + il.Emit(OpCodes.Ldsfld, nilBytes); + } + else if (parameters.Length == 1) + { + // already loaded parameter. + } + else + { + // call new DynamicArgumentTuple + il.Emit(OpCodes.Newobj, def.RequestType.GetConstructors()[0]); + } + + // requestMethod + il.Emit(OpCodes.Ldsfld, def.UnaryRequestDelegate); + + // InvokeAsync/InvokeTaskAsync + var invokeMethod = def.ResponseIsTask + ? baseType.GetMethod("InvokeTaskAsync", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy | BindingFlags.Instance) + : baseType.GetMethod("InvokeAsync", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy | BindingFlags.Instance); + invokeMethod = invokeMethod.MakeGenericMethod(def.RequestType, def.ResponseType); + il.Emit(OpCodes.Callvirt, invokeMethod); + } + + break; + case MethodType.ServerStreaming: + { + il.DeclareLocal(typeof(byte[])); // request + il.DeclareLocal(typeof(AsyncServerStreamingCall)); + + // create request + for (int j = 0; j < parameters.Length; j++) + { + il.Emit(OpCodes.Ldarg, j + 1); + } + if (parameters.Length == 0) + { + // use empty byte[0] + il.Emit(OpCodes.Ldsfld, nilBytes); + } + else if (parameters.Length == 1) + { + // already loaded parameter. + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, serializerOptionsField); + il.Emit(OpCodes.Call, callCancellationTokenNone); + il.Emit(OpCodes.Call, callMessagePackSerialize.MakeGenericMethod(def.RequestType)); + } + else + { + // call new DynamicArgumentTuple + il.Emit(OpCodes.Newobj, def.RequestType.GetConstructors()[0]); + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, serializerOptionsField); + il.Emit(OpCodes.Call, callCancellationTokenNone); + il.Emit(OpCodes.Call, callMessagePackSerialize.MakeGenericMethod(def.RequestType)); + } + il.Emit(OpCodes.Stloc_0); + + // create ***Result + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, invokerField); + il.Emit(OpCodes.Ldsfld, def.FieldMethod); + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, hostField); + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, optionField); + il.Emit(OpCodes.Ldloc_0); + il.Emit(OpCodes.Callvirt, typeof(CallInvoker).GetMethod("AsyncServerStreamingCall").MakeGenericMethod(typeof(byte[]), typeof(byte[]))); + il.Emit(OpCodes.Stloc_1); + + // create return result + // new ServerStreamingResult( + + // inner, + il.Emit(OpCodes.Ldloc_1); + + // new MarshallingAsyncStreamReader(inner.ResponseStream, this.resolver), + il.Emit(OpCodes.Ldloc_1); + il.Emit(OpCodes.Call, typeof(AsyncServerStreamingCall).GetProperty("ResponseStream").GetMethod); + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, serializerOptionsField); + il.Emit(OpCodes.Newobj, typeof(MarshallingAsyncStreamReader<>).MakeGenericType(def.ResponseType).GetConstructors().Single()); + + // this.resolver + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, serializerOptionsField); + + // ); + + var resultType = typeof(ServerStreamingResult<>).MakeGenericType(def.ResponseType); + il.Emit(OpCodes.Newobj, resultType.GetConstructors()[0]); + if (def.ResponseIsTask) + { + il.Emit(OpCodes.Call, typeof(Task).GetMethod("FromResult").MakeGenericMethod(resultType)); + } + } + break; + case MethodType.ClientStreaming: + case MethodType.DuplexStreaming: + if (def.MethodType == MethodType.ClientStreaming) + { + il.DeclareLocal(typeof(AsyncClientStreamingCall)); // callResult + } + else + { + il.DeclareLocal(typeof(AsyncDuplexStreamingCall)); // callResult + } + + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, invokerField); + il.Emit(OpCodes.Ldsfld, def.FieldMethod); + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, hostField); + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, optionField); + if (def.MethodType == MethodType.ClientStreaming) + { + il.Emit(OpCodes.Callvirt, typeof(CallInvoker).GetMethod("AsyncClientStreamingCall").MakeGenericMethod(typeof(byte[]), typeof(byte[]))); + } + else + { + il.Emit(OpCodes.Callvirt, typeof(CallInvoker).GetMethod("AsyncDuplexStreamingCall").MakeGenericMethod(typeof(byte[]), typeof(byte[]))); + } + il.Emit(OpCodes.Stloc_0); + + // create return result + Type resultType2; + if (def.MethodType == MethodType.ClientStreaming) + { + // new ClientStreamingResult( + // inner, + il.Emit(OpCodes.Ldloc_0); + + // new MarshallingClientStreamWriter()(inner.RequestStream, this.resolver), + il.Emit(OpCodes.Ldloc_0); + il.Emit(OpCodes.Call, typeof(AsyncClientStreamingCall).GetProperty("RequestStream").GetMethod); + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, serializerOptionsField); + il.Emit(OpCodes.Newobj, (typeof(MarshallingClientStreamWriter<>).MakeGenericType(def.RequestType).GetConstructors().Single())); + + // this.resolver + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, serializerOptionsField); + + // ); + resultType2 = typeof(ClientStreamingResult<,>).MakeGenericType(def.RequestType, def.ResponseType); + il.Emit(OpCodes.Newobj, resultType2.GetConstructors().OrderBy(x => x.GetParameters().Length).Last()); + } + else + { + // new DuplexStreamingResult( + // inner, + il.Emit(OpCodes.Ldloc_0); + + // new MarshallingClientStreamWriter()(inner.RequestStream, this.resolver), + il.Emit(OpCodes.Ldloc_0); + il.Emit(OpCodes.Call, typeof(AsyncDuplexStreamingCall).GetProperty("RequestStream").GetMethod); + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, serializerOptionsField); + il.Emit(OpCodes.Newobj, (typeof(MarshallingClientStreamWriter<>).MakeGenericType(def.RequestType).GetConstructors().Single())); + + // new MarshallingAsyncStreamReader()(inner.ResponseStream, this.resolver), + il.Emit(OpCodes.Ldloc_0); + il.Emit(OpCodes.Call, typeof(AsyncDuplexStreamingCall).GetProperty("ResponseStream").GetMethod); + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, serializerOptionsField); + il.Emit(OpCodes.Newobj, (typeof(MarshallingAsyncStreamReader<>).MakeGenericType(def.ResponseType).GetConstructors().Single())); + + // this.resolver + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, serializerOptionsField); + + // ); + resultType2 = typeof(DuplexStreamingResult<,>).MakeGenericType(def.RequestType, def.ResponseType); + il.Emit(OpCodes.Newobj, resultType2.GetConstructors()[0]); + } + + if (def.ResponseIsTask) + { + il.Emit(OpCodes.Call, typeof(Task).GetMethod("FromResult").MakeGenericMethod(resultType2)); + } + break; + default: + throw new InvalidOperationException("Not supported method type:" + def.MethodType); + } + + il.Emit(OpCodes.Ret); + } + } + + static Type UnwrapResponseType(MethodDefinition def, out MethodType methodType, out bool responseIsTask, out Type requestTypeIfExists) + { + //if (!t.IsGenericType) throw new Exception($"Invalid ResponseType, Path:{def.Path} Type:{t.Name}"); + + var t = def.MethodInfo.ReturnType; + if (!t.GetTypeInfo().IsGenericType) throw new Exception($"Invalid return type, path:{def.Path} type:{t.Name}"); + + // Task> + if (t.GetGenericTypeDefinition() == typeof(Task<>)) + { + responseIsTask = true; + t = t.GetGenericArguments()[0]; + } + else + { + responseIsTask = false; + } + + // Unary + var returnType = t.GetGenericTypeDefinition(); + if (returnType == typeof(UnaryResult<>)) + { + methodType = MethodType.Unary; + requestTypeIfExists = null; + return t.GetGenericArguments()[0]; + } + else if (returnType == typeof(ClientStreamingResult<,>)) + { + methodType = MethodType.ClientStreaming; + var genArgs = t.GetGenericArguments(); + requestTypeIfExists = genArgs[0]; + return genArgs[1]; + } + else if (returnType == typeof(ServerStreamingResult<>)) + { + methodType = MethodType.ServerStreaming; + requestTypeIfExists = null; + return t.GetGenericArguments()[0]; + } + else if (returnType == typeof(DuplexStreamingResult<,>)) + { + methodType = MethodType.DuplexStreaming; + var genArgs = t.GetGenericArguments(); + requestTypeIfExists = genArgs[0]; + return genArgs[1]; + } + else + { + throw new Exception($"Invalid return type, path:{def.Path} type:{t.Name}"); + } + } + + class MethodDefinition + { + public string Path => ServiceType.Name + "/" + MethodInfo.Name; + + // set after search definitions + public Type ServiceType; + public MethodInfo MethodInfo; + public MethodType MethodType; + + // set after define static fields + public bool ResponseIsTask; + public FieldInfo FieldMethod; + public Type RequestType; + public Type ResponseType; + + // unary only, set after define static fields + public FieldInfo UnaryRequestDelegate; + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion/Client/DynamicClientBuilder.cs.meta b/Assets/Scripts/MagicOnion/Client/DynamicClientBuilder.cs.meta new file mode 100644 index 000000000..32eb010cf --- /dev/null +++ b/Assets/Scripts/MagicOnion/Client/DynamicClientBuilder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4756b0967dbdbae4fb4cb2afb87f4101 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/Client/InterceptInvokeHelper.cs b/Assets/Scripts/MagicOnion/Client/InterceptInvokeHelper.cs new file mode 100644 index 000000000..870155e54 --- /dev/null +++ b/Assets/Scripts/MagicOnion/Client/InterceptInvokeHelper.cs @@ -0,0 +1,158 @@ +using System.Threading.Tasks; + +namespace MagicOnion.Client +{ + internal static class InterceptInvokeHelper + { + public static ValueTask InvokeWithFilter(RequestContext context) + { + switch (context.Filters.Length) + { + case 0: + return new ValueTask(context.RequestMethod(context)); + case 1: + return InvokeWithFilter1(context); + case 2: + return InvokeWithFilter2(context); + case 3: + return InvokeWithFilter3(context); + case 4: + return InvokeWithFilter4(context); + case 5: + return InvokeWithFilter5(context); + case 6: + return InvokeWithFilter6(context); + case 7: + return InvokeWithFilter7(context); + case 8: + return InvokeWithFilter8(context); + case 9: + return InvokeWithFilter9(context); + case 10: + return InvokeWithFilter10(context); + default: + return InvokeRecursive(-1, context); + } + } + + static ValueTask InvokeWithFilter1(RequestContext context) + { + return context.Filters[0].SendAsync(context, + ctx => new ValueTask(ctx.RequestMethod(ctx).WaitResponseAsync())); + } + + static ValueTask InvokeWithFilter2(RequestContext context) + { + return context.Filters[0].SendAsync(context, + x1 => x1.Filters[1].SendAsync(x1, + ctx => new ValueTask(ctx.RequestMethod(ctx).WaitResponseAsync()))); + } + + static ValueTask InvokeWithFilter3(RequestContext context) + { + return context.Filters[0].SendAsync(context, + x1 => x1.Filters[1].SendAsync(x1, + x2 => x2.Filters[2].SendAsync(x2, + ctx => new ValueTask(ctx.RequestMethod(ctx).WaitResponseAsync())))); + } + + static ValueTask InvokeWithFilter4(RequestContext context) + { + return context.Filters[0].SendAsync(context, + x1 => x1.Filters[1].SendAsync(x1, + x2 => x2.Filters[2].SendAsync(x2, + x3 => x3.Filters[3].SendAsync(x3, + ctx => new ValueTask(ctx.RequestMethod(ctx).WaitResponseAsync()))))); + } + + static ValueTask InvokeWithFilter5(RequestContext context) + { + return context.Filters[0].SendAsync(context, + x1 => x1.Filters[1].SendAsync(x1, + x2 => x2.Filters[2].SendAsync(x2, + x3 => x3.Filters[3].SendAsync(x3, + x4 => x4.Filters[4].SendAsync(x4, + ctx => new ValueTask(ctx.RequestMethod(ctx).WaitResponseAsync())))))); + } + + static ValueTask InvokeWithFilter6(RequestContext context) + { + return context.Filters[0].SendAsync(context, + x1 => x1.Filters[1].SendAsync(x1, + x2 => x2.Filters[2].SendAsync(x2, + x3 => x3.Filters[3].SendAsync(x3, + x4 => x4.Filters[4].SendAsync(x4, + x5 => x5.Filters[5].SendAsync(x5, + ctx => new ValueTask(ctx.RequestMethod(ctx).WaitResponseAsync()))))))); + } + + static ValueTask InvokeWithFilter7(RequestContext context) + { + return context.Filters[0].SendAsync(context, + x1 => x1.Filters[1].SendAsync(x1, + x2 => x2.Filters[2].SendAsync(x2, + x3 => x3.Filters[3].SendAsync(x3, + x4 => x4.Filters[4].SendAsync(x4, + x5 => x5.Filters[5].SendAsync(x5, + x6 => x6.Filters[6].SendAsync(x6, + ctx => new ValueTask(ctx.RequestMethod(ctx).WaitResponseAsync())))))))); + } + + static ValueTask InvokeWithFilter8(RequestContext context) + { + return context.Filters[0].SendAsync(context, + x1 => x1.Filters[1].SendAsync(x1, + x2 => x2.Filters[2].SendAsync(x2, + x3 => x3.Filters[3].SendAsync(x3, + x4 => x4.Filters[4].SendAsync(x4, + x5 => x5.Filters[5].SendAsync(x5, + x6 => x6.Filters[6].SendAsync(x6, + x7 => x7.Filters[7].SendAsync(x7, + ctx => new ValueTask(ctx.RequestMethod(ctx).WaitResponseAsync()))))))))); + } + + static ValueTask InvokeWithFilter9(RequestContext context) + { + return context.Filters[0].SendAsync(context, + x1 => x1.Filters[1].SendAsync(x1, + x2 => x2.Filters[2].SendAsync(x2, + x3 => x3.Filters[3].SendAsync(x3, + x4 => x4.Filters[4].SendAsync(x4, + x5 => x5.Filters[5].SendAsync(x5, + x6 => x6.Filters[6].SendAsync(x6, + x7 => x7.Filters[7].SendAsync(x7, + x8 => x8.Filters[8].SendAsync(x8, + ctx => new ValueTask(ctx.RequestMethod(ctx).WaitResponseAsync())))))))))); + } + + static ValueTask InvokeWithFilter10(RequestContext context) + { + return context.Filters[0].SendAsync(context, + x1 => x1.Filters[1].SendAsync(x1, + x2 => x2.Filters[2].SendAsync(x2, + x3 => x3.Filters[3].SendAsync(x3, + x4 => x4.Filters[4].SendAsync(x4, + x5 => x5.Filters[5].SendAsync(x5, + x6 => x6.Filters[6].SendAsync(x6, + x7 => x7.Filters[7].SendAsync(x7, + x8 => x8.Filters[8].SendAsync(x8, + x9 => x9.Filters[9].SendAsync(x9, + ctx => new ValueTask(ctx.RequestMethod(ctx).WaitResponseAsync()))))))))))); + } + + // for invoke N filters(slow path). + + static ValueTask InvokeRecursive(int index, RequestContext context) + { + index += 1; // start from -1 + if (index != context.Filters.Length) + { + return context.Filters[index].SendAsync(context, ctx => InvokeRecursive(index, ctx)); + } + else + { + return new ValueTask(context.RequestMethod(context).WaitResponseAsync()); + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion/Client/InterceptInvokeHelper.cs.meta b/Assets/Scripts/MagicOnion/Client/InterceptInvokeHelper.cs.meta new file mode 100644 index 000000000..e1c983c5b --- /dev/null +++ b/Assets/Scripts/MagicOnion/Client/InterceptInvokeHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4a428b894e3ddac4a80496efd076633c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/Client/MagicOnionClient.cs b/Assets/Scripts/MagicOnion/Client/MagicOnionClient.cs new file mode 100644 index 000000000..c120db5fc --- /dev/null +++ b/Assets/Scripts/MagicOnion/Client/MagicOnionClient.cs @@ -0,0 +1,79 @@ +using Grpc.Core; +using MessagePack; +using System; + +namespace MagicOnion.Client +{ + public static class MagicOnionClient + { + static readonly IClientFilter[] emptyFilters = Array.Empty(); + + public static T Create(Channel channel) + where T : IService + { + return Create(new DefaultCallInvoker(channel), MessagePackSerializer.DefaultOptions, emptyFilters); + } + + public static T Create(CallInvoker invoker) + where T : IService + { + return Create(invoker, MessagePackSerializer.DefaultOptions, emptyFilters); + } + + public static T Create(Channel channel, IClientFilter[] clientFilters) + where T : IService + { + return Create(new DefaultCallInvoker(channel), MessagePackSerializer.DefaultOptions, clientFilters); + } + + public static T Create(CallInvoker invoker, IClientFilter[] clientFilters) + where T : IService + { + return Create(invoker, MessagePackSerializer.DefaultOptions, clientFilters); + } + + public static T Create(Channel channel, MessagePackSerializerOptions serializerOptions) + where T : IService + { + return Create(new DefaultCallInvoker(channel), serializerOptions, emptyFilters); + } + + public static T Create(CallInvoker invoker, MessagePackSerializerOptions serializerOptions) + where T : IService + { + return Create(invoker, serializerOptions, emptyFilters); + } + + public static T Create(CallInvoker invoker, MessagePackSerializerOptions serializerOptions, IClientFilter[] clientFilters) + where T : IService + { + if (invoker == null) throw new ArgumentNullException(nameof(invoker)); + + var ctor = MagicOnionClientRegistry.consturtor; + if (ctor == null) + { +#if ((ENABLE_IL2CPP && !UNITY_EDITOR) || NET_STANDARD_2_0) + throw new InvalidOperationException("Does not registered client factory, dynamic code generation is not supported on IL2CPP. Please use code generator(moc)."); +#else + var t = DynamicClientBuilder.ClientType; + return (T)Activator.CreateInstance(t, invoker, serializerOptions, clientFilters); +#endif + } + else + { + return ctor(invoker, serializerOptions, clientFilters); + } + } + } + + public static class MagicOnionClientRegistry + where T : IService + { + public static Func consturtor; + + public static void Register(Func ctor) + { + consturtor = ctor; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion/Client/MagicOnionClient.cs.meta b/Assets/Scripts/MagicOnion/Client/MagicOnionClient.cs.meta new file mode 100644 index 000000000..42a80eef1 --- /dev/null +++ b/Assets/Scripts/MagicOnion/Client/MagicOnionClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5cd0a981f86ef1843bf6b375b2d9b5dd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/Client/MagicOnionClientBase.cs b/Assets/Scripts/MagicOnion/Client/MagicOnionClientBase.cs new file mode 100644 index 000000000..efa8e70e1 --- /dev/null +++ b/Assets/Scripts/MagicOnion/Client/MagicOnionClientBase.cs @@ -0,0 +1,130 @@ +using Grpc.Core; +using MessagePack; +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace MagicOnion.Client +{ + public abstract class MagicOnionClientBase + { + protected string host; + protected CallOptions option; + protected CallInvoker callInvoker; + protected MessagePackSerializerOptions serializerOptions; + protected IClientFilter[] filters; + + static protected ResponseContext CreateResponseContext(RequestContext context, Method method) + { + var self = context.Client; + var callResult = self.callInvoker.AsyncUnaryCall(method, self.host, context.CallOptions, context.RequestMutator(MagicOnionMarshallers.UnsafeNilBytes)); + var response = new ResponseContext(callResult, self.serializerOptions); + response.SetResponseMutator(context.ResponseMutator); + return response; + } + + static protected ResponseContext CreateResponseContext(RequestContext context, Method method) + { + var self = context.Client; + var message = MessagePackSerializer.Serialize(((RequestContext)context).Request, self.serializerOptions); + var callResult = self.callInvoker.AsyncUnaryCall(method, self.host, context.CallOptions, context.RequestMutator(message)); + var response = new ResponseContext(callResult, self.serializerOptions); + response.SetResponseMutator(context.ResponseMutator); + return response; + } + } + + public abstract class MagicOnionClientBase : MagicOnionClientBase + where T : IService + { + protected MagicOnionClientBase() + { + } + + protected MagicOnionClientBase(CallInvoker callInvoker, MessagePackSerializerOptions serializerOptions, IClientFilter[] filters) + { + this.callInvoker = callInvoker; + this.serializerOptions = serializerOptions; + this.filters = filters; + } + + protected UnaryResult InvokeAsync(string path, TRequest request, Func requestMethod) + { + var future = InvokeAsyncCore(path, request, requestMethod); + return new UnaryResult(future); + } + + async Task> InvokeAsyncCore(string path, TRequest request, Func requestMethod) + { + if (this.option.Headers == null && filters.Length != 0) + { + // always creating new Metadata is bad manner for performance + this.option = this.option.WithHeaders(new Metadata()); + } + + var requestContext = new RequestContext(request, this, path, option, typeof(TResponse), filters, requestMethod); + var response = await InterceptInvokeHelper.InvokeWithFilter(requestContext); + var result = response as IResponseContext; + if (result != null) + { + return result; + } + else + { + throw new InvalidOperationException("ResponseContext is null."); + } + } + + protected async Task> InvokeTaskAsync(string path, TRequest request, Func requestMethod) + { + if (this.option.Headers == null && filters.Length != 0) + { + // always creating new Metadata is bad manner for performance + this.option = this.option.WithHeaders(new Metadata()); + } + + var requestContext = new RequestContext(request, this, path, option, typeof(TResponse), filters, requestMethod); + var response = await InterceptInvokeHelper.InvokeWithFilter(requestContext); + var result = response as IResponseContext; + if (result != null) + { + return new UnaryResult(Task.FromResult(result)); + } + else + { + throw new InvalidOperationException("ResponseContext is null."); + } + } + + protected abstract MagicOnionClientBase Clone(); + + public virtual T WithCancellationToken(CancellationToken cancellationToken) + { + return WithOptions(this.option.WithCancellationToken(cancellationToken)); + } + + public virtual T WithDeadline(DateTime deadline) + { + return WithOptions(this.option.WithDeadline(deadline)); + } + + public virtual T WithHeaders(Metadata headers) + { + return WithOptions(this.option.WithHeaders(headers)); + } + + public virtual T WithHost(string host) + { + var newInstance = Clone(); + newInstance.host = host; + return (T)(object)newInstance; + } + + public virtual T WithOptions(CallOptions option) + { + var newInstance = Clone(); + newInstance.option = option; + return (T)(object)newInstance; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion/Client/MagicOnionClientBase.cs.meta b/Assets/Scripts/MagicOnion/Client/MagicOnionClientBase.cs.meta new file mode 100644 index 000000000..0a4bed78f --- /dev/null +++ b/Assets/Scripts/MagicOnion/Client/MagicOnionClientBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d469b4f1a615e4f4f8bf51459e9e5d50 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/Client/StreamingHubClient.cs b/Assets/Scripts/MagicOnion/Client/StreamingHubClient.cs new file mode 100644 index 000000000..7c9745c0b --- /dev/null +++ b/Assets/Scripts/MagicOnion/Client/StreamingHubClient.cs @@ -0,0 +1,50 @@ +using Grpc.Core; +using Grpc.Core.Logging; +using MessagePack; +using System; + +namespace MagicOnion.Client +{ + public static class StreamingHubClient + { + public static TStreamingHub Connect(Channel channel, TReceiver receiver, string host = null, CallOptions option = default(CallOptions), MessagePackSerializerOptions serializerOptions = null, ILogger logger = null) + where TStreamingHub : IStreamingHub + { + return Connect(new DefaultCallInvoker(channel), receiver, host, option, serializerOptions, logger); + } + + public static TStreamingHub Connect(CallInvoker callInvoker, TReceiver receiver, string host = null, CallOptions option = default(CallOptions), MessagePackSerializerOptions serializerOptions = null, ILogger logger = null) + where TStreamingHub : IStreamingHub + { + var ctor = StreamingHubClientRegistry.consturtor; + StreamingHubClientBase client = null; + if (ctor == null) + { +#if ((ENABLE_IL2CPP && !UNITY_EDITOR) || NET_STANDARD_2_0) + throw new InvalidOperationException("Does not registered client factory, dynamic code generation is not supported on IL2CPP. Please use code generator(moc)."); +#else + var type = StreamingHubClientBuilder.ClientType; + client = (StreamingHubClientBase)Activator.CreateInstance(type, new object[] { callInvoker, host, option, serializerOptions, logger }); +#endif + } + else + { + client = (StreamingHubClientBase)(object)ctor(callInvoker, receiver, host, option, serializerOptions, logger); + } + + client.__ConnectAndSubscribe(receiver); + return (TStreamingHub)(object)client; + } + } + + public static class StreamingHubClientRegistry + where TStreamingHub : IStreamingHub + { + public static Func consturtor; + + public static void Register(Func ctor) + { + consturtor = ctor; + } + } +} diff --git a/Assets/Scripts/MagicOnion/Client/StreamingHubClient.cs.meta b/Assets/Scripts/MagicOnion/Client/StreamingHubClient.cs.meta new file mode 100644 index 000000000..b7c2a041c --- /dev/null +++ b/Assets/Scripts/MagicOnion/Client/StreamingHubClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d74d1bafd22f5794fa60ad8963e9be64 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/Client/StreamingHubClientBase.cs b/Assets/Scripts/MagicOnion/Client/StreamingHubClientBase.cs new file mode 100644 index 000000000..e2113910c --- /dev/null +++ b/Assets/Scripts/MagicOnion/Client/StreamingHubClientBase.cs @@ -0,0 +1,332 @@ +using Grpc.Core; +using Grpc.Core.Logging; +using MessagePack; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Text; +using MagicOnion.Utils; +using System.Threading; +using System.Threading.Tasks; +using MagicOnion.Server; +using System.Buffers; + +namespace MagicOnion.Client +{ + public abstract class StreamingHubClientBase + where TStreamingHub : IStreamingHub + { + readonly string host; + readonly CallOptions option; + readonly CallInvoker callInvoker; + readonly ILogger logger; + + protected readonly MessagePackSerializerOptions serializerOptions; + readonly AsyncLock asyncLock = new AsyncLock(); + + DuplexStreamingResult connection; + protected TReceiver receiver; + Task subscription; + TaskCompletionSource waitForDisconnect = new TaskCompletionSource(); + + // {messageId, TaskCompletionSource} + ConcurrentDictionary responseFutures = new ConcurrentDictionary(); + protected CancellationTokenSource cts = new CancellationTokenSource(); + int messageId = 0; + bool disposed; + + protected StreamingHubClientBase(CallInvoker callInvoker, string host, CallOptions option, MessagePackSerializerOptions serializerOptions, ILogger logger) + { + this.callInvoker = callInvoker; + this.host = host; + this.option = option; + this.serializerOptions = serializerOptions; + this.logger = logger ?? GrpcEnvironment.Logger; + } + + protected abstract Method DuplexStreamingAsyncMethod { get; } + + // call immediately after create. + public void __ConnectAndSubscribe(TReceiver receiver) + { + var callResult = callInvoker.AsyncDuplexStreamingCall(DuplexStreamingAsyncMethod, host, option); + var streamingResult = new DuplexStreamingResult( + callResult, + new MarshallingClientStreamWriter(callResult.RequestStream, serializerOptions), + new MarshallingAsyncStreamReader(callResult.ResponseStream, serializerOptions), + serializerOptions + ); + + this.connection = streamingResult; + this.receiver = receiver; + this.subscription = StartSubscribe(); + } + + protected abstract void OnResponseEvent(int methodId, object taskCompletionSource, ArraySegment data); + protected abstract void OnBroadcastEvent(int methodId, ArraySegment data); + + async Task StartSubscribe() + { + var syncContext = SynchronizationContext.Current; // capture SynchronizationContext. + var reader = connection.RawStreamingCall.ResponseStream; + try + { + while (await reader.MoveNext(cts.Token).ConfigureAwait(false)) // avoid Post to SyncContext(it losts one-frame per operation) + { + try + { + // MessageFormat: + // broadcast: [methodId, [argument]] + // response: [messageId, methodId, response] + // error-response: [messageId, statusCode, detail, StringMessage] + void ConsumeData(byte[] data) + { + var messagePackReader = new MessagePackReader(data); + var arrayLength = messagePackReader.ReadArrayHeader(); + if (arrayLength == 3) + { + var messageId = messagePackReader.ReadInt32(); + object future; + if (responseFutures.TryRemove(messageId, out future)) + { + var methodId = messagePackReader.ReadInt32(); + try + { + var offset = (int)messagePackReader.Consumed; + var rest = new ArraySegment(data, offset, data.Length - offset); + OnResponseEvent(methodId, future, rest); + } + catch (Exception ex) + { + if (!(future as ITaskCompletion).TrySetException(ex)) + { + throw; + } + } + } + } + else if (arrayLength == 4) + { + var messageId = messagePackReader.ReadInt32(); + object future; + if (responseFutures.TryRemove(messageId, out future)) + { + var statusCode = messagePackReader.ReadInt32(); + var detail = messagePackReader.ReadString(); + var offset = (int)messagePackReader.Consumed; + var rest = new ArraySegment(data, offset, data.Length - offset); + var error = MessagePackSerializer.Deserialize(rest, serializerOptions); + (future as ITaskCompletion).TrySetException(new RpcException(new Status((StatusCode)statusCode, detail), error)); + } + } + else + { + var methodId = messagePackReader.ReadInt32(); + var offset = (int)messagePackReader.Consumed; + if (syncContext != null) + { + var tuple = Tuple.Create(methodId, data, offset, data.Length - offset); + syncContext.Post(state => + { + var t = (Tuple)state; + OnBroadcastEvent(t.Item1, new ArraySegment(t.Item2, t.Item3, t.Item4)); + }, tuple); + } + else + { + OnBroadcastEvent(methodId, new ArraySegment(data, offset, data.Length - offset)); + } + } + } + + ConsumeData(reader.Current); + } + catch (Exception ex) + { + const string msg = "Error on consume received message, but keep subscribe."; + // log post on main thread. + if (syncContext != null) + { + syncContext.Post(state => logger.Error((Exception)state, msg), ex); + } + else + { + logger.Error(ex, msg); + } + } + } + } + catch (Exception ex) + { + if (ex is OperationCanceledException) + { + return; + } + const string msg = "Error on subscribing message."; + // log post on main thread. + if (syncContext != null) + { + syncContext.Post(state => logger.Error((Exception)state, msg), ex); + } + else + { + logger.Error(ex, msg); + } + } + finally + { + try + { + // set syncContext before await + if (syncContext != null && SynchronizationContext.Current == null) + { + SynchronizationContext.SetSynchronizationContext(syncContext); + } + await DisposeAsyncCore(false); + } + finally + { + waitForDisconnect.TrySetResult(null); + } + } + } + + + protected async Task WriteMessageAsync(int methodId, T message) + { + ThrowIfDisposed(); + + byte[] BuildMessage() + { + using (var buffer = ArrayPoolBufferWriter.RentThreadStaticWriter()) + { + var writer = new MessagePackWriter(buffer); + writer.WriteArrayHeader(2); + writer.Write(methodId); + MessagePackSerializer.Serialize(ref writer, message, serializerOptions); + writer.Flush(); + return buffer.WrittenSpan.ToArray(); + } + } + + var v = BuildMessage(); + using (await asyncLock.LockAsync()) + { + await connection.RawStreamingCall.RequestStream.WriteAsync(v).ConfigureAwait(false); + } + } + + protected async Task WriteMessageAsyncFireAndForget(int methodId, TRequest message) + { + await WriteMessageAsync(methodId, message).ConfigureAwait(false); + return default(TResponse); + } + + protected async Task WriteMessageWithResponseAsync(int methodId, TRequest message) + { + ThrowIfDisposed(); + + var mid = Interlocked.Increment(ref messageId); + var tcs = new TaskCompletionSourceEx(); // use Ex + responseFutures[mid] = (object)tcs; + + byte[] BuildMessage() + { + using (var buffer = ArrayPoolBufferWriter.RentThreadStaticWriter()) + { + var writer = new MessagePackWriter(buffer); + writer.WriteArrayHeader(3); + writer.Write(mid); + writer.Write(methodId); + MessagePackSerializer.Serialize(ref writer, message, serializerOptions); + writer.Flush(); + return buffer.WrittenSpan.ToArray(); + } + } + + var v = BuildMessage(); + using (await asyncLock.LockAsync().ConfigureAwait(false)) + { + await connection.RawStreamingCall.RequestStream.WriteAsync(v).ConfigureAwait(false); + } + + return await tcs.Task; // wait until server return response(or error). if connection was closed, throws cancellation from DisposeAsyncCore. + } + + void ThrowIfDisposed() + { + if (disposed) throw new ObjectDisposedException("StreamingHubClient"); + } + + public Task WaitForDisconnect() + { + return waitForDisconnect.Task; + } + + public Task DisposeAsync() + { + return DisposeAsyncCore(true); + } + + async Task DisposeAsyncCore(bool waitSubscription) + { + if (disposed) return; + if (connection.RawStreamingCall == null) return; + + disposed = true; + + try + { + await connection.RequestStream.CompleteAsync(); + } + catch { } // ignore error? + finally + { + cts.Cancel(); + cts.Dispose(); + try + { + if (waitSubscription) + { + if (subscription != null) + { + await subscription; + } + } + + // cleanup completion + List aggregateException = null; + foreach (var item in responseFutures) + { + try + { + (item.Value as ITaskCompletion).TrySetCanceled(); + } + catch (Exception ex) + { + if (!(ex is OperationCanceledException)) + { + if (aggregateException != null) + { + aggregateException = new List(); + aggregateException.Add(ex); + } + } + } + } + if (aggregateException != null) + { + throw new AggregateException(aggregateException); + } + } + catch (Exception ex) + { + if (!(ex is OperationCanceledException)) + { + throw; + } + } + } + } + } +} diff --git a/Assets/Scripts/MagicOnion/Client/StreamingHubClientBase.cs.meta b/Assets/Scripts/MagicOnion/Client/StreamingHubClientBase.cs.meta new file mode 100644 index 000000000..466360cca --- /dev/null +++ b/Assets/Scripts/MagicOnion/Client/StreamingHubClientBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d3ca190a4e3a9184ea0ba8b8c5e88b2f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/Client/StreamingHubClientBuilder.cs b/Assets/Scripts/MagicOnion/Client/StreamingHubClientBuilder.cs new file mode 100644 index 000000000..2dab4b16f --- /dev/null +++ b/Assets/Scripts/MagicOnion/Client/StreamingHubClientBuilder.cs @@ -0,0 +1,584 @@ +#if NON_UNITY || !NET_STANDARD_2_0 + +using Grpc.Core; +using Grpc.Core.Logging; +using MagicOnion.Server.Hubs; +using MagicOnion.Utils; +using MessagePack; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Reflection.Emit; +using System.Threading; +using System.Threading.Tasks; + +namespace MagicOnion.Client +{ +#if ENABLE_SAVE_ASSEMBLY + public +#else + internal +#endif + static class StreamingHubClientAssemblyHolder + { + public const string ModuleName = "MagicOnion.Client.StreamingHubClient"; + + readonly static DynamicAssembly assembly; + internal static DynamicAssembly Assembly { get { return assembly; } } + + static StreamingHubClientAssemblyHolder() + { + assembly = new DynamicAssembly(ModuleName); + } + +#if ENABLE_SAVE_ASSEMBLY + + public static AssemblyBuilder Save() + { + return assembly.Save(); + } + +#endif + } + +#if ENABLE_SAVE_ASSEMBLY + public +#else + internal +#endif + static class StreamingHubClientBuilder + { + public static readonly Type ClientType; + // static readonly Type ClientFireAndForgetType; + + static readonly Type bytesMethod = typeof(Method<,>).MakeGenericType(new[] { typeof(byte[]), typeof(byte[]) }); + static readonly FieldInfo throughMarshaller = typeof(MagicOnionMarshallers).GetField("ThroughMarshaller", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); + + static readonly ConstructorInfo notSupportedException = typeof(NotSupportedException).GetConstructor(Type.EmptyTypes); + + static readonly MethodInfo callMessagePackDesrialize = typeof(MessagePackSerializer).GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static) + .First(x => x.Name == "Deserialize" && x.GetParameters().Length == 3 && x.GetParameters()[0].ParameterType == typeof(ReadOnlyMemory) && x.GetParameters()[1].ParameterType == typeof(MessagePackSerializerOptions)); + static readonly MethodInfo callCancellationTokenNone = typeof(CancellationToken).GetProperty("None", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static).GetGetMethod(); + static readonly PropertyInfo completedTask = typeof(Task).GetProperty("CompletedTask", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); + + static StreamingHubClientBuilder() + { + var t = typeof(TStreamingHub); + var ti = t.GetTypeInfo(); + if (!ti.IsInterface) throw new Exception("Client Proxy only allows interface. Type:" + ti.Name); + var asm = StreamingHubClientAssemblyHolder.Assembly; + var methodDefinitions = SearchDefinitions(t); + + var parentType = typeof(StreamingHubClientBase<,>).MakeGenericType(typeof(TStreamingHub), typeof(TReceiver)); + var typeBuilder = asm.DefineType($"{DynamicClientAssemblyHolder.ModuleName}.{ti.FullName}StreamingHubClient_{Guid.NewGuid().ToString()}", TypeAttributes.Public, parentType, new Type[] { t }); + + VerifyMethodDefinitions(methodDefinitions); + + { + // Create FireAndForgetType first as nested type. + var typeBuilderEx = typeBuilder.DefineNestedType($"FireAndForgetClient", TypeAttributes.NestedPrivate, typeof(object), new Type[] { t }); + var tuple = DefineFireAndForgetConstructor(typeBuilderEx, typeBuilder); + var fireAndForgetClientCtor = tuple.Item1; + var fireAndForgetField = tuple.Item2; + + DefineMethodsFireAndForget(typeBuilderEx, t, fireAndForgetField, typeBuilder, methodDefinitions); + typeBuilderEx.CreateTypeInfo(); // ok to create nested type. + + var methodField = DefineStaticConstructor(typeBuilder, t); + var clientField = DefineConstructor(typeBuilder, t, typeof(TReceiver), fireAndForgetClientCtor); + DefineMethods(typeBuilder, t, typeof(TReceiver), methodField, clientField, methodDefinitions); + } + + ClientType = typeBuilder.CreateTypeInfo().AsType(); + } + + static MethodDefinition[] SearchDefinitions(Type interfaceType) + { + return interfaceType + .GetInterfaces() + .Concat(new[] { interfaceType }) + .SelectMany(x => x.GetMethods()) + .Where(x => + { + var methodInfo = x; + if (methodInfo.IsSpecialName && (methodInfo.Name.StartsWith("set_") || methodInfo.Name.StartsWith("get_"))) return false; + if (methodInfo.GetCustomAttribute(false) != null) return false; // ignore + + var methodName = methodInfo.Name; + if (methodName == "Equals" + || methodName == "GetHashCode" + || methodName == "GetType" + || methodName == "ToString" + || methodName == "DisposeAsync" + || methodName == "WaitForDisconnect" + || methodName == "FireAndForget" + ) + { + return false; + } + return true; + }) + .Where(x => !x.IsSpecialName) + .Select(x => new MethodDefinition + { + ServiceType = interfaceType, + MethodInfo = x, + }) + .ToArray(); + } + + static void VerifyMethodDefinitions(MethodDefinition[] definitions) + { + var map = new Dictionary(definitions.Length); + foreach (var item in definitions) + { + var methodId = item.MethodInfo.GetCustomAttribute()?.MethodId ?? FNV1A32.GetHashCode(item.MethodInfo.Name); + if (map.ContainsKey(methodId)) + { + throw new Exception($"TStreamingHub does not allows duplicate methodId(hash code). Please change name or use MethodIdAttribute. {map[methodId].MethodInfo.Name} and {item.MethodInfo.Name}"); + } + map.Add(methodId, item); + + if (!(item.MethodInfo.ReturnType.IsGenericType && item.MethodInfo.ReturnType.GetGenericTypeDefinition() == typeof(Task<>)) + && item.MethodInfo.ReturnType != typeof(Task)) + { + throw new Exception($"Invalid definition, TStreamingHub's return type must only be `Task` or `Task`. {item.MethodInfo.Name}."); + } + + item.MethodId = methodId; + if (item.RequestType == null) + { + item.RequestType = MagicOnionMarshallers.CreateRequestType(item.MethodInfo.GetParameters()); + } + } + } + + static FieldInfo DefineStaticConstructor(TypeBuilder typeBuilder, Type interfaceType) + { + // static readonly Method method = new Method(MethodType.DuplexStreaming, "IFoo", "Connect", MagicOnionMarshallers.ThroughMarshaller, MagicOnionMarshallers.ThroughMarshaller); + var field = typeBuilder.DefineField("method", bytesMethod, FieldAttributes.Private | FieldAttributes.Static); + + var cctor = typeBuilder.DefineConstructor(MethodAttributes.Static, CallingConventions.Standard, Type.EmptyTypes); + var il = cctor.GetILGenerator(); + + il.EmitLdc_I4((int)MethodType.DuplexStreaming); + il.Emit(OpCodes.Ldstr, interfaceType.Name); + il.Emit(OpCodes.Ldstr, "Connect"); + il.Emit(OpCodes.Ldsfld, throughMarshaller); + il.Emit(OpCodes.Ldsfld, throughMarshaller); + il.Emit(OpCodes.Newobj, bytesMethod.GetConstructors()[0]); + il.Emit(OpCodes.Stsfld, field); + + il.Emit(OpCodes.Ret); + + return field; + } + + static FieldInfo DefineConstructor(TypeBuilder typeBuilder, Type interfaceType, Type receiverType, ConstructorInfo fireAndForgetClientCtor) + { + // .ctor(CallInvoker callInvoker, string host, CallOptions option, MessagePackSerializerOptions resolver, ILogger logger) :base(...) + { + var argTypes = new[] { typeof(CallInvoker), typeof(string), typeof(CallOptions), typeof(MessagePackSerializerOptions), typeof(ILogger) }; + var ctor = typeBuilder.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, argTypes); + var il = ctor.GetILGenerator(); + + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldarg_1); + il.Emit(OpCodes.Ldarg_2); + il.Emit(OpCodes.Ldarg_3); + il.Emit(OpCodes.Ldarg_S, (byte)4); + il.Emit(OpCodes.Ldarg_S, (byte)5); + il.Emit(OpCodes.Call, typeBuilder.BaseType + .GetConstructors(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).First()); + + // { this.fireAndForgetClient = new FireAndForgetClient(this); } + var clientField = typeBuilder.DefineField("fireAndForgetClient", fireAndForgetClientCtor.DeclaringType, FieldAttributes.Private); + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Newobj, fireAndForgetClientCtor); + il.Emit(OpCodes.Stfld, clientField); + + il.Emit(OpCodes.Ret); + + return clientField; + } + } + + static Tuple DefineFireAndForgetConstructor(TypeBuilder typeBuilder, Type parentClientType) + { + // .ctor(Parent client) { this.client = client } + { + var argTypes = new[] { parentClientType }; + var ctor = typeBuilder.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, argTypes); + var clientField = typeBuilder.DefineField("client", parentClientType, FieldAttributes.Private); + var il = ctor.GetILGenerator(); + + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Call, typeof(object).GetConstructors().First()); + + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldarg_1); + il.Emit(OpCodes.Stfld, clientField); + + il.Emit(OpCodes.Ret); + + return Tuple.Create(ctor, clientField); + } + } + + static void DefineMethods(TypeBuilder typeBuilder, Type interfaceType, Type receiverType, FieldInfo methodField, FieldInfo clientField, MethodDefinition[] definitions) + { + var baseType = typeof(StreamingHubClientBase<,>).MakeGenericType(interfaceType, receiverType); + var serializerOptionsField = baseType.GetField("serializerOptions", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); + var receiverField = baseType.GetField("receiver", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); + + // protected abstract Method DuplexStreamingAsyncMethod { get; } + { + var method = typeBuilder.DefineMethod("get_DuplexStreamingAsyncMethod", MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual, + bytesMethod, + Type.EmptyTypes); + var il = method.GetILGenerator(); + + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, methodField); + il.Emit(OpCodes.Ret); + } + { + // Task DisposeAsync(); + { + var method = typeBuilder.DefineMethod("DisposeAsync", MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual, + typeof(Task), Type.EmptyTypes); + var il = method.GetILGenerator(); + + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Call, baseType.GetMethod("DisposeAsync", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)); + il.Emit(OpCodes.Ret); + } + // Task WaitForDisconnect(); + { + var method = typeBuilder.DefineMethod("WaitForDisconnect", MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual, + typeof(Task), Type.EmptyTypes); + var il = method.GetILGenerator(); + + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Call, baseType.GetMethod("WaitForDisconnect", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)); + il.Emit(OpCodes.Ret); + } + // TSelf FireAndForget(); + { + var method = typeBuilder.DefineMethod("FireAndForget", MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual, + interfaceType, Type.EmptyTypes); + var il = method.GetILGenerator(); + + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, clientField); + il.Emit(OpCodes.Ret); + } + } + + // receiver types borrow from DynamicBroadcastBuilder + { + // protected abstract void OnResponseEvent(int methodId, object taskCompletionSource, ArraySegment data); + { + var method = typeBuilder.DefineMethod("OnResponseEvent", MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual, + null, new[] { typeof(int), typeof(object), typeof(ArraySegment) }); + var il = method.GetILGenerator(); + + var labels = definitions + .Select(x => new { def = x, label = il.DefineLabel() }) + .ToArray(); + + foreach (var item in labels) + { + // if( == ) goto ... + il.Emit(OpCodes.Ldarg_1); + il.EmitLdc_I4(item.def.MethodId); + il.Emit(OpCodes.Beq, item.label); + } + // else + il.Emit(OpCodes.Ret); + + foreach (var item in labels) + { + // var result = LZ4MessagePackSerializer.Deserialize(data, resolver); + // ((TaskCompletionSource)taskCompletionSource).TrySetResult(result); + + // => ((TaskCompletionSource)taskCompletionSource).TrySetResult(LZ4MessagePackSerializer.Deserialize(data, resolver)); + + Type responseType; + Type tcsType; + if (item.def.MethodInfo.ReturnType == typeof(Task)) + { + // Task methods uses TaskCompletionSource + responseType = typeof(Nil); + tcsType = typeof(TaskCompletionSource); + } + else + { + responseType = item.def.MethodInfo.ReturnType.GetGenericArguments()[0]; + tcsType = typeof(TaskCompletionSource<>).MakeGenericType(responseType); + } + + il.MarkLabel(item.label); + + il.Emit(OpCodes.Ldarg_2); + il.Emit(OpCodes.Castclass, tcsType); + il.Emit(OpCodes.Ldarg_3); + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, serializerOptionsField); + il.Emit(OpCodes.Call, callCancellationTokenNone); + il.Emit(OpCodes.Call, callMessagePackDesrialize.MakeGenericMethod(responseType)); + + il.Emit(OpCodes.Callvirt, tcsType.GetMethod("TrySetResult")); + il.Emit(OpCodes.Pop); + + il.Emit(OpCodes.Ret); + } + } + // protected abstract void OnBroadcastEvent(int methodId, ArraySegment data); + { + var methodDefinitions = BroadcasterHelper.SearchDefinitions(receiverType); + BroadcasterHelper.VerifyMethodDefinitions(methodDefinitions); + + var method = typeBuilder.DefineMethod("OnBroadcastEvent", MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual, + typeof(void), new[] { typeof(int), typeof(ArraySegment) }); + var il = method.GetILGenerator(); + + var labels = methodDefinitions + .Select(x => new { def = x, label = il.DefineLabel() }) + .ToArray(); + + foreach (var item in labels) + { + // if( == ) goto ... + il.Emit(OpCodes.Ldarg_1); + il.EmitLdc_I4(item.def.MethodId); + il.Emit(OpCodes.Beq, item.label); + } + // else + il.Emit(OpCodes.Ret); + + foreach (var item in labels) + { + il.MarkLabel(item.label); + + // var result = LZ4MessagePackSerializer.Deserialize>(data, resolver); + // return receiver.OnReceiveMessage(result.Item1, result.Item2); + + var parameters = item.def.MethodInfo.GetParameters(); + if (parameters.Length == 0) + { + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, receiverField); + il.Emit(OpCodes.Callvirt, item.def.MethodInfo); + il.Emit(OpCodes.Ret); + } + else if (parameters.Length == 1) + { + // TODO:fix emit + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, receiverField); + il.Emit(OpCodes.Ldarg_2); + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, serializerOptionsField); + il.Emit(OpCodes.Call, callCancellationTokenNone); + il.Emit(OpCodes.Call, callMessagePackDesrialize.MakeGenericMethod(parameters[0].ParameterType)); + il.Emit(OpCodes.Callvirt, item.def.MethodInfo); + il.Emit(OpCodes.Ret); + } + else + { + // TODO:fix emit + var deserializeType = BroadcasterHelper.dynamicArgumentTupleTypes[parameters.Length - 2] + .MakeGenericType(parameters.Select(x => x.ParameterType).ToArray()); + var lc = il.DeclareLocal(deserializeType); + il.Emit(OpCodes.Ldarg_2); + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, serializerOptionsField); + il.Emit(OpCodes.Call, callCancellationTokenNone); + il.Emit(OpCodes.Call, callMessagePackDesrialize.MakeGenericMethod(deserializeType)); + il.Emit(OpCodes.Stloc, lc); + + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, receiverField); + for (int i = 0; i < parameters.Length; i++) + { + il.Emit(OpCodes.Ldloc, lc); + il.Emit(OpCodes.Ldfld, deserializeType.GetField("Item" + (i + 1))); + } + + il.Emit(OpCodes.Callvirt, item.def.MethodInfo); + il.Emit(OpCodes.Ret); + } + } + } + } + + // Proxy Methods + for (int i = 0; i < definitions.Length; i++) + { + var def = definitions[i]; + var parameters = def.MethodInfo.GetParameters().Select(x => x.ParameterType).ToArray(); + + var method = typeBuilder.DefineMethod(def.MethodInfo.Name, MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual, + def.MethodInfo.ReturnType, + parameters); + var il = method.GetILGenerator(); + + // return WriteMessageAsync(methodId, message); + // return WriteMessageWithResponseAsync(methodId, message); + + // this.*** + il.Emit(OpCodes.Ldarg_0); + + // arg1 + il.EmitLdc_I4(def.MethodId); + + // create request for arg2 + for (int j = 0; j < parameters.Length; j++) + { + il.Emit(OpCodes.Ldarg, j + 1); + } + + Type callType = null; + if (parameters.Length == 0) + { + // use Nil. + callType = typeof(Nil); + il.Emit(OpCodes.Ldsfld, typeof(Nil).GetField("Default")); + } + else if (parameters.Length == 1) + { + // already loaded parameter. + callType = parameters[0]; + } + else + { + // call new DynamicArgumentTuple + callType = def.RequestType; + il.Emit(OpCodes.Newobj, callType.GetConstructors().First()); + } + + if (def.MethodInfo.ReturnType == typeof(Task)) + { + var mInfo = baseType.GetMethod("WriteMessageWithResponseAsync", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); + il.Emit(OpCodes.Callvirt, mInfo.MakeGenericMethod(callType, typeof(Nil))); + } + else + { + var mInfo = baseType.GetMethod("WriteMessageWithResponseAsync", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); + il.Emit(OpCodes.Callvirt, mInfo.MakeGenericMethod(callType, def.MethodInfo.ReturnType.GetGenericArguments()[0])); + } + + il.Emit(OpCodes.Ret); + } + } + + static void DefineMethodsFireAndForget(TypeBuilder typeBuilder, Type interfaceType, FieldInfo clientField, Type parentNestedType, MethodDefinition[] definitions) + { + { + // Task DisposeAsync(); + { + var method = typeBuilder.DefineMethod("DisposeAsync", MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual, + typeof(Task), Type.EmptyTypes); + var il = method.GetILGenerator(); + + il.Emit(OpCodes.Newobj, notSupportedException); + il.Emit(OpCodes.Throw); + } + // Task WaitForDisconnect(); + { + var method = typeBuilder.DefineMethod("WaitForDisconnect", MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual, + typeof(Task), Type.EmptyTypes); + var il = method.GetILGenerator(); + + il.Emit(OpCodes.Newobj, notSupportedException); + il.Emit(OpCodes.Throw); + } + // TSelf FireAndForget(); + { + var method = typeBuilder.DefineMethod("FireAndForget", MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual, + interfaceType, Type.EmptyTypes); + var il = method.GetILGenerator(); + + il.Emit(OpCodes.Newobj, notSupportedException); + il.Emit(OpCodes.Throw); + } + } + + // Proxy Methods + for (int i = 0; i < definitions.Length; i++) + { + var def = definitions[i]; + var parameters = def.MethodInfo.GetParameters().Select(x => x.ParameterType).ToArray(); + + var method = typeBuilder.DefineMethod(def.MethodInfo.Name, MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual, + def.MethodInfo.ReturnType, + parameters); + var il = method.GetILGenerator(); + + // return client.WriteMessage***(methodId, message); + + // this.client.*** + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, clientField); + + // arg1 + il.EmitLdc_I4(def.MethodId); + + // create request for arg2 + for (int j = 0; j < parameters.Length; j++) + { + il.Emit(OpCodes.Ldarg, j + 1); + } + + Type callType = null; + if (parameters.Length == 0) + { + // use Nil. + callType = typeof(Nil); + il.Emit(OpCodes.Ldsfld, typeof(Nil).GetField("Default")); + } + else if (parameters.Length == 1) + { + // already loaded parameter. + callType = parameters[0]; + } + else + { + // call new DynamicArgumentTuple + callType = def.RequestType; + il.Emit(OpCodes.Newobj, callType.GetConstructors().First()); + } + + if (def.MethodInfo.ReturnType == typeof(Task)) + { + var mInfo = parentNestedType.BaseType.GetMethod("WriteMessageAsync", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); + il.Emit(OpCodes.Callvirt, mInfo.MakeGenericMethod(callType)); + } + else + { + var mInfo = parentNestedType.BaseType.GetMethod("WriteMessageAsyncFireAndForget", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); + il.Emit(OpCodes.Callvirt, mInfo.MakeGenericMethod(callType, def.MethodInfo.ReturnType.GetGenericArguments()[0])); + } + + il.Emit(OpCodes.Ret); + } + } + + + class MethodDefinition + { + public string Path => ServiceType.Name + "/" + MethodInfo.Name; + + public Type ServiceType; + public MethodInfo MethodInfo; + public int MethodId; + + public Type RequestType; + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion/Client/StreamingHubClientBuilder.cs.meta b/Assets/Scripts/MagicOnion/Client/StreamingHubClientBuilder.cs.meta new file mode 100644 index 000000000..d24d573a4 --- /dev/null +++ b/Assets/Scripts/MagicOnion/Client/StreamingHubClientBuilder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 88e3748798a988c4482dafe8624b1400 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/DynamicArgumentTuple.cs b/Assets/Scripts/MagicOnion/DynamicArgumentTuple.cs new file mode 100644 index 000000000..92f0ec57c --- /dev/null +++ b/Assets/Scripts/MagicOnion/DynamicArgumentTuple.cs @@ -0,0 +1,2917 @@ + +using System; +using MessagePack; +using MessagePack.Formatters; + +namespace MagicOnion +{ + // T2 ~ T20 + + + [MessagePackObject] + public struct DynamicArgumentTuple + { + [Key(0)] + public readonly T1 Item1; + [Key(1)] + public readonly T2 Item2; + + [SerializationConstructor] + public DynamicArgumentTuple(T1 item1, T2 item2) + { + Item1 = item1; + Item2 = item2; + } + } + + public class DynamicArgumentTupleFormatter : IMessagePackFormatter> + { + readonly T1 default1; + readonly T2 default2; + + public DynamicArgumentTupleFormatter(T1 default1, T2 default2) + { + this.default1 = default1; + this.default2 = default2; + } + + public void Serialize(ref MessagePackWriter writer, DynamicArgumentTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(2); + var resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + } + + public DynamicArgumentTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var resolver = options.Resolver; + var length = reader.ReadArrayHeader(); + + var item1 = default1; + var item2 = default2; + + for (var i = 0; i < length; i++) + { + switch (i) + { + case 0: + item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + return new DynamicArgumentTuple(item1, item2); + } + } + + [MessagePackObject] + public struct DynamicArgumentTuple + { + [Key(0)] + public readonly T1 Item1; + [Key(1)] + public readonly T2 Item2; + [Key(2)] + public readonly T3 Item3; + + [SerializationConstructor] + public DynamicArgumentTuple(T1 item1, T2 item2, T3 item3) + { + Item1 = item1; + Item2 = item2; + Item3 = item3; + } + } + + public class DynamicArgumentTupleFormatter : IMessagePackFormatter> + { + readonly T1 default1; + readonly T2 default2; + readonly T3 default3; + + public DynamicArgumentTupleFormatter(T1 default1, T2 default2, T3 default3) + { + this.default1 = default1; + this.default2 = default2; + this.default3 = default3; + } + + public void Serialize(ref MessagePackWriter writer, DynamicArgumentTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(3); + var resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + } + + public DynamicArgumentTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var resolver = options.Resolver; + var length = reader.ReadArrayHeader(); + + var item1 = default1; + var item2 = default2; + var item3 = default3; + + for (var i = 0; i < length; i++) + { + switch (i) + { + case 0: + item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 2: + item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + return new DynamicArgumentTuple(item1, item2, item3); + } + } + + [MessagePackObject] + public struct DynamicArgumentTuple + { + [Key(0)] + public readonly T1 Item1; + [Key(1)] + public readonly T2 Item2; + [Key(2)] + public readonly T3 Item3; + [Key(3)] + public readonly T4 Item4; + + [SerializationConstructor] + public DynamicArgumentTuple(T1 item1, T2 item2, T3 item3, T4 item4) + { + Item1 = item1; + Item2 = item2; + Item3 = item3; + Item4 = item4; + } + } + + public class DynamicArgumentTupleFormatter : IMessagePackFormatter> + { + readonly T1 default1; + readonly T2 default2; + readonly T3 default3; + readonly T4 default4; + + public DynamicArgumentTupleFormatter(T1 default1, T2 default2, T3 default3, T4 default4) + { + this.default1 = default1; + this.default2 = default2; + this.default3 = default3; + this.default4 = default4; + } + + public void Serialize(ref MessagePackWriter writer, DynamicArgumentTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(4); + var resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + } + + public DynamicArgumentTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var resolver = options.Resolver; + var length = reader.ReadArrayHeader(); + + var item1 = default1; + var item2 = default2; + var item3 = default3; + var item4 = default4; + + for (var i = 0; i < length; i++) + { + switch (i) + { + case 0: + item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 2: + item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 3: + item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + return new DynamicArgumentTuple(item1, item2, item3, item4); + } + } + + [MessagePackObject] + public struct DynamicArgumentTuple + { + [Key(0)] + public readonly T1 Item1; + [Key(1)] + public readonly T2 Item2; + [Key(2)] + public readonly T3 Item3; + [Key(3)] + public readonly T4 Item4; + [Key(4)] + public readonly T5 Item5; + + [SerializationConstructor] + public DynamicArgumentTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5) + { + Item1 = item1; + Item2 = item2; + Item3 = item3; + Item4 = item4; + Item5 = item5; + } + } + + public class DynamicArgumentTupleFormatter : IMessagePackFormatter> + { + readonly T1 default1; + readonly T2 default2; + readonly T3 default3; + readonly T4 default4; + readonly T5 default5; + + public DynamicArgumentTupleFormatter(T1 default1, T2 default2, T3 default3, T4 default4, T5 default5) + { + this.default1 = default1; + this.default2 = default2; + this.default3 = default3; + this.default4 = default4; + this.default5 = default5; + } + + public void Serialize(ref MessagePackWriter writer, DynamicArgumentTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(5); + var resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + } + + public DynamicArgumentTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var resolver = options.Resolver; + var length = reader.ReadArrayHeader(); + + var item1 = default1; + var item2 = default2; + var item3 = default3; + var item4 = default4; + var item5 = default5; + + for (var i = 0; i < length; i++) + { + switch (i) + { + case 0: + item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 2: + item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 3: + item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 4: + item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + return new DynamicArgumentTuple(item1, item2, item3, item4, item5); + } + } + + [MessagePackObject] + public struct DynamicArgumentTuple + { + [Key(0)] + public readonly T1 Item1; + [Key(1)] + public readonly T2 Item2; + [Key(2)] + public readonly T3 Item3; + [Key(3)] + public readonly T4 Item4; + [Key(4)] + public readonly T5 Item5; + [Key(5)] + public readonly T6 Item6; + + [SerializationConstructor] + public DynamicArgumentTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6) + { + Item1 = item1; + Item2 = item2; + Item3 = item3; + Item4 = item4; + Item5 = item5; + Item6 = item6; + } + } + + public class DynamicArgumentTupleFormatter : IMessagePackFormatter> + { + readonly T1 default1; + readonly T2 default2; + readonly T3 default3; + readonly T4 default4; + readonly T5 default5; + readonly T6 default6; + + public DynamicArgumentTupleFormatter(T1 default1, T2 default2, T3 default3, T4 default4, T5 default5, T6 default6) + { + this.default1 = default1; + this.default2 = default2; + this.default3 = default3; + this.default4 = default4; + this.default5 = default5; + this.default6 = default6; + } + + public void Serialize(ref MessagePackWriter writer, DynamicArgumentTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(6); + var resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); + } + + public DynamicArgumentTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var resolver = options.Resolver; + var length = reader.ReadArrayHeader(); + + var item1 = default1; + var item2 = default2; + var item3 = default3; + var item4 = default4; + var item5 = default5; + var item6 = default6; + + for (var i = 0; i < length; i++) + { + switch (i) + { + case 0: + item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 2: + item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 3: + item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 4: + item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 5: + item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + return new DynamicArgumentTuple(item1, item2, item3, item4, item5, item6); + } + } + + [MessagePackObject] + public struct DynamicArgumentTuple + { + [Key(0)] + public readonly T1 Item1; + [Key(1)] + public readonly T2 Item2; + [Key(2)] + public readonly T3 Item3; + [Key(3)] + public readonly T4 Item4; + [Key(4)] + public readonly T5 Item5; + [Key(5)] + public readonly T6 Item6; + [Key(6)] + public readonly T7 Item7; + + [SerializationConstructor] + public DynamicArgumentTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7) + { + Item1 = item1; + Item2 = item2; + Item3 = item3; + Item4 = item4; + Item5 = item5; + Item6 = item6; + Item7 = item7; + } + } + + public class DynamicArgumentTupleFormatter : IMessagePackFormatter> + { + readonly T1 default1; + readonly T2 default2; + readonly T3 default3; + readonly T4 default4; + readonly T5 default5; + readonly T6 default6; + readonly T7 default7; + + public DynamicArgumentTupleFormatter(T1 default1, T2 default2, T3 default3, T4 default4, T5 default5, T6 default6, T7 default7) + { + this.default1 = default1; + this.default2 = default2; + this.default3 = default3; + this.default4 = default4; + this.default5 = default5; + this.default6 = default6; + this.default7 = default7; + } + + public void Serialize(ref MessagePackWriter writer, DynamicArgumentTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(7); + var resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item7, options); + } + + public DynamicArgumentTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var resolver = options.Resolver; + var length = reader.ReadArrayHeader(); + + var item1 = default1; + var item2 = default2; + var item3 = default3; + var item4 = default4; + var item5 = default5; + var item6 = default6; + var item7 = default7; + + for (var i = 0; i < length; i++) + { + switch (i) + { + case 0: + item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 2: + item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 3: + item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 4: + item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 5: + item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 6: + item7 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + return new DynamicArgumentTuple(item1, item2, item3, item4, item5, item6, item7); + } + } + + [MessagePackObject] + public struct DynamicArgumentTuple + { + [Key(0)] + public readonly T1 Item1; + [Key(1)] + public readonly T2 Item2; + [Key(2)] + public readonly T3 Item3; + [Key(3)] + public readonly T4 Item4; + [Key(4)] + public readonly T5 Item5; + [Key(5)] + public readonly T6 Item6; + [Key(6)] + public readonly T7 Item7; + [Key(7)] + public readonly T8 Item8; + + [SerializationConstructor] + public DynamicArgumentTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8) + { + Item1 = item1; + Item2 = item2; + Item3 = item3; + Item4 = item4; + Item5 = item5; + Item6 = item6; + Item7 = item7; + Item8 = item8; + } + } + + public class DynamicArgumentTupleFormatter : IMessagePackFormatter> + { + readonly T1 default1; + readonly T2 default2; + readonly T3 default3; + readonly T4 default4; + readonly T5 default5; + readonly T6 default6; + readonly T7 default7; + readonly T8 default8; + + public DynamicArgumentTupleFormatter(T1 default1, T2 default2, T3 default3, T4 default4, T5 default5, T6 default6, T7 default7, T8 default8) + { + this.default1 = default1; + this.default2 = default2; + this.default3 = default3; + this.default4 = default4; + this.default5 = default5; + this.default6 = default6; + this.default7 = default7; + this.default8 = default8; + } + + public void Serialize(ref MessagePackWriter writer, DynamicArgumentTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(8); + var resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item7, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item8, options); + } + + public DynamicArgumentTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var resolver = options.Resolver; + var length = reader.ReadArrayHeader(); + + var item1 = default1; + var item2 = default2; + var item3 = default3; + var item4 = default4; + var item5 = default5; + var item6 = default6; + var item7 = default7; + var item8 = default8; + + for (var i = 0; i < length; i++) + { + switch (i) + { + case 0: + item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 2: + item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 3: + item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 4: + item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 5: + item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 6: + item7 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 7: + item8 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + return new DynamicArgumentTuple(item1, item2, item3, item4, item5, item6, item7, item8); + } + } + + [MessagePackObject] + public struct DynamicArgumentTuple + { + [Key(0)] + public readonly T1 Item1; + [Key(1)] + public readonly T2 Item2; + [Key(2)] + public readonly T3 Item3; + [Key(3)] + public readonly T4 Item4; + [Key(4)] + public readonly T5 Item5; + [Key(5)] + public readonly T6 Item6; + [Key(6)] + public readonly T7 Item7; + [Key(7)] + public readonly T8 Item8; + [Key(8)] + public readonly T9 Item9; + + [SerializationConstructor] + public DynamicArgumentTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8, T9 item9) + { + Item1 = item1; + Item2 = item2; + Item3 = item3; + Item4 = item4; + Item5 = item5; + Item6 = item6; + Item7 = item7; + Item8 = item8; + Item9 = item9; + } + } + + public class DynamicArgumentTupleFormatter : IMessagePackFormatter> + { + readonly T1 default1; + readonly T2 default2; + readonly T3 default3; + readonly T4 default4; + readonly T5 default5; + readonly T6 default6; + readonly T7 default7; + readonly T8 default8; + readonly T9 default9; + + public DynamicArgumentTupleFormatter(T1 default1, T2 default2, T3 default3, T4 default4, T5 default5, T6 default6, T7 default7, T8 default8, T9 default9) + { + this.default1 = default1; + this.default2 = default2; + this.default3 = default3; + this.default4 = default4; + this.default5 = default5; + this.default6 = default6; + this.default7 = default7; + this.default8 = default8; + this.default9 = default9; + } + + public void Serialize(ref MessagePackWriter writer, DynamicArgumentTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(9); + var resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item7, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item8, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item9, options); + } + + public DynamicArgumentTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var resolver = options.Resolver; + var length = reader.ReadArrayHeader(); + + var item1 = default1; + var item2 = default2; + var item3 = default3; + var item4 = default4; + var item5 = default5; + var item6 = default6; + var item7 = default7; + var item8 = default8; + var item9 = default9; + + for (var i = 0; i < length; i++) + { + switch (i) + { + case 0: + item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 2: + item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 3: + item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 4: + item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 5: + item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 6: + item7 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 7: + item8 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 8: + item9 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + return new DynamicArgumentTuple(item1, item2, item3, item4, item5, item6, item7, item8, item9); + } + } + + [MessagePackObject] + public struct DynamicArgumentTuple + { + [Key(0)] + public readonly T1 Item1; + [Key(1)] + public readonly T2 Item2; + [Key(2)] + public readonly T3 Item3; + [Key(3)] + public readonly T4 Item4; + [Key(4)] + public readonly T5 Item5; + [Key(5)] + public readonly T6 Item6; + [Key(6)] + public readonly T7 Item7; + [Key(7)] + public readonly T8 Item8; + [Key(8)] + public readonly T9 Item9; + [Key(9)] + public readonly T10 Item10; + + [SerializationConstructor] + public DynamicArgumentTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8, T9 item9, T10 item10) + { + Item1 = item1; + Item2 = item2; + Item3 = item3; + Item4 = item4; + Item5 = item5; + Item6 = item6; + Item7 = item7; + Item8 = item8; + Item9 = item9; + Item10 = item10; + } + } + + public class DynamicArgumentTupleFormatter : IMessagePackFormatter> + { + readonly T1 default1; + readonly T2 default2; + readonly T3 default3; + readonly T4 default4; + readonly T5 default5; + readonly T6 default6; + readonly T7 default7; + readonly T8 default8; + readonly T9 default9; + readonly T10 default10; + + public DynamicArgumentTupleFormatter(T1 default1, T2 default2, T3 default3, T4 default4, T5 default5, T6 default6, T7 default7, T8 default8, T9 default9, T10 default10) + { + this.default1 = default1; + this.default2 = default2; + this.default3 = default3; + this.default4 = default4; + this.default5 = default5; + this.default6 = default6; + this.default7 = default7; + this.default8 = default8; + this.default9 = default9; + this.default10 = default10; + } + + public void Serialize(ref MessagePackWriter writer, DynamicArgumentTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(10); + var resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item7, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item8, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item9, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item10, options); + } + + public DynamicArgumentTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var resolver = options.Resolver; + var length = reader.ReadArrayHeader(); + + var item1 = default1; + var item2 = default2; + var item3 = default3; + var item4 = default4; + var item5 = default5; + var item6 = default6; + var item7 = default7; + var item8 = default8; + var item9 = default9; + var item10 = default10; + + for (var i = 0; i < length; i++) + { + switch (i) + { + case 0: + item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 2: + item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 3: + item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 4: + item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 5: + item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 6: + item7 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 7: + item8 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 8: + item9 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 9: + item10 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + return new DynamicArgumentTuple(item1, item2, item3, item4, item5, item6, item7, item8, item9, item10); + } + } + + [MessagePackObject] + public struct DynamicArgumentTuple + { + [Key(0)] + public readonly T1 Item1; + [Key(1)] + public readonly T2 Item2; + [Key(2)] + public readonly T3 Item3; + [Key(3)] + public readonly T4 Item4; + [Key(4)] + public readonly T5 Item5; + [Key(5)] + public readonly T6 Item6; + [Key(6)] + public readonly T7 Item7; + [Key(7)] + public readonly T8 Item8; + [Key(8)] + public readonly T9 Item9; + [Key(9)] + public readonly T10 Item10; + [Key(10)] + public readonly T11 Item11; + + [SerializationConstructor] + public DynamicArgumentTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8, T9 item9, T10 item10, T11 item11) + { + Item1 = item1; + Item2 = item2; + Item3 = item3; + Item4 = item4; + Item5 = item5; + Item6 = item6; + Item7 = item7; + Item8 = item8; + Item9 = item9; + Item10 = item10; + Item11 = item11; + } + } + + public class DynamicArgumentTupleFormatter : IMessagePackFormatter> + { + readonly T1 default1; + readonly T2 default2; + readonly T3 default3; + readonly T4 default4; + readonly T5 default5; + readonly T6 default6; + readonly T7 default7; + readonly T8 default8; + readonly T9 default9; + readonly T10 default10; + readonly T11 default11; + + public DynamicArgumentTupleFormatter(T1 default1, T2 default2, T3 default3, T4 default4, T5 default5, T6 default6, T7 default7, T8 default8, T9 default9, T10 default10, T11 default11) + { + this.default1 = default1; + this.default2 = default2; + this.default3 = default3; + this.default4 = default4; + this.default5 = default5; + this.default6 = default6; + this.default7 = default7; + this.default8 = default8; + this.default9 = default9; + this.default10 = default10; + this.default11 = default11; + } + + public void Serialize(ref MessagePackWriter writer, DynamicArgumentTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(11); + var resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item7, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item8, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item9, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item10, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item11, options); + } + + public DynamicArgumentTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var resolver = options.Resolver; + var length = reader.ReadArrayHeader(); + + var item1 = default1; + var item2 = default2; + var item3 = default3; + var item4 = default4; + var item5 = default5; + var item6 = default6; + var item7 = default7; + var item8 = default8; + var item9 = default9; + var item10 = default10; + var item11 = default11; + + for (var i = 0; i < length; i++) + { + switch (i) + { + case 0: + item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 2: + item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 3: + item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 4: + item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 5: + item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 6: + item7 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 7: + item8 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 8: + item9 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 9: + item10 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 10: + item11 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + return new DynamicArgumentTuple(item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11); + } + } + + [MessagePackObject] + public struct DynamicArgumentTuple + { + [Key(0)] + public readonly T1 Item1; + [Key(1)] + public readonly T2 Item2; + [Key(2)] + public readonly T3 Item3; + [Key(3)] + public readonly T4 Item4; + [Key(4)] + public readonly T5 Item5; + [Key(5)] + public readonly T6 Item6; + [Key(6)] + public readonly T7 Item7; + [Key(7)] + public readonly T8 Item8; + [Key(8)] + public readonly T9 Item9; + [Key(9)] + public readonly T10 Item10; + [Key(10)] + public readonly T11 Item11; + [Key(11)] + public readonly T12 Item12; + + [SerializationConstructor] + public DynamicArgumentTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8, T9 item9, T10 item10, T11 item11, T12 item12) + { + Item1 = item1; + Item2 = item2; + Item3 = item3; + Item4 = item4; + Item5 = item5; + Item6 = item6; + Item7 = item7; + Item8 = item8; + Item9 = item9; + Item10 = item10; + Item11 = item11; + Item12 = item12; + } + } + + public class DynamicArgumentTupleFormatter : IMessagePackFormatter> + { + readonly T1 default1; + readonly T2 default2; + readonly T3 default3; + readonly T4 default4; + readonly T5 default5; + readonly T6 default6; + readonly T7 default7; + readonly T8 default8; + readonly T9 default9; + readonly T10 default10; + readonly T11 default11; + readonly T12 default12; + + public DynamicArgumentTupleFormatter(T1 default1, T2 default2, T3 default3, T4 default4, T5 default5, T6 default6, T7 default7, T8 default8, T9 default9, T10 default10, T11 default11, T12 default12) + { + this.default1 = default1; + this.default2 = default2; + this.default3 = default3; + this.default4 = default4; + this.default5 = default5; + this.default6 = default6; + this.default7 = default7; + this.default8 = default8; + this.default9 = default9; + this.default10 = default10; + this.default11 = default11; + this.default12 = default12; + } + + public void Serialize(ref MessagePackWriter writer, DynamicArgumentTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(12); + var resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item7, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item8, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item9, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item10, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item11, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item12, options); + } + + public DynamicArgumentTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var resolver = options.Resolver; + var length = reader.ReadArrayHeader(); + + var item1 = default1; + var item2 = default2; + var item3 = default3; + var item4 = default4; + var item5 = default5; + var item6 = default6; + var item7 = default7; + var item8 = default8; + var item9 = default9; + var item10 = default10; + var item11 = default11; + var item12 = default12; + + for (var i = 0; i < length; i++) + { + switch (i) + { + case 0: + item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 2: + item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 3: + item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 4: + item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 5: + item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 6: + item7 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 7: + item8 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 8: + item9 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 9: + item10 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 10: + item11 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 11: + item12 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + return new DynamicArgumentTuple(item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12); + } + } + + [MessagePackObject] + public struct DynamicArgumentTuple + { + [Key(0)] + public readonly T1 Item1; + [Key(1)] + public readonly T2 Item2; + [Key(2)] + public readonly T3 Item3; + [Key(3)] + public readonly T4 Item4; + [Key(4)] + public readonly T5 Item5; + [Key(5)] + public readonly T6 Item6; + [Key(6)] + public readonly T7 Item7; + [Key(7)] + public readonly T8 Item8; + [Key(8)] + public readonly T9 Item9; + [Key(9)] + public readonly T10 Item10; + [Key(10)] + public readonly T11 Item11; + [Key(11)] + public readonly T12 Item12; + [Key(12)] + public readonly T13 Item13; + + [SerializationConstructor] + public DynamicArgumentTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8, T9 item9, T10 item10, T11 item11, T12 item12, T13 item13) + { + Item1 = item1; + Item2 = item2; + Item3 = item3; + Item4 = item4; + Item5 = item5; + Item6 = item6; + Item7 = item7; + Item8 = item8; + Item9 = item9; + Item10 = item10; + Item11 = item11; + Item12 = item12; + Item13 = item13; + } + } + + public class DynamicArgumentTupleFormatter : IMessagePackFormatter> + { + readonly T1 default1; + readonly T2 default2; + readonly T3 default3; + readonly T4 default4; + readonly T5 default5; + readonly T6 default6; + readonly T7 default7; + readonly T8 default8; + readonly T9 default9; + readonly T10 default10; + readonly T11 default11; + readonly T12 default12; + readonly T13 default13; + + public DynamicArgumentTupleFormatter(T1 default1, T2 default2, T3 default3, T4 default4, T5 default5, T6 default6, T7 default7, T8 default8, T9 default9, T10 default10, T11 default11, T12 default12, T13 default13) + { + this.default1 = default1; + this.default2 = default2; + this.default3 = default3; + this.default4 = default4; + this.default5 = default5; + this.default6 = default6; + this.default7 = default7; + this.default8 = default8; + this.default9 = default9; + this.default10 = default10; + this.default11 = default11; + this.default12 = default12; + this.default13 = default13; + } + + public void Serialize(ref MessagePackWriter writer, DynamicArgumentTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(13); + var resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item7, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item8, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item9, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item10, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item11, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item12, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item13, options); + } + + public DynamicArgumentTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var resolver = options.Resolver; + var length = reader.ReadArrayHeader(); + + var item1 = default1; + var item2 = default2; + var item3 = default3; + var item4 = default4; + var item5 = default5; + var item6 = default6; + var item7 = default7; + var item8 = default8; + var item9 = default9; + var item10 = default10; + var item11 = default11; + var item12 = default12; + var item13 = default13; + + for (var i = 0; i < length; i++) + { + switch (i) + { + case 0: + item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 2: + item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 3: + item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 4: + item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 5: + item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 6: + item7 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 7: + item8 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 8: + item9 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 9: + item10 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 10: + item11 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 11: + item12 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 12: + item13 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + return new DynamicArgumentTuple(item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13); + } + } + + [MessagePackObject] + public struct DynamicArgumentTuple + { + [Key(0)] + public readonly T1 Item1; + [Key(1)] + public readonly T2 Item2; + [Key(2)] + public readonly T3 Item3; + [Key(3)] + public readonly T4 Item4; + [Key(4)] + public readonly T5 Item5; + [Key(5)] + public readonly T6 Item6; + [Key(6)] + public readonly T7 Item7; + [Key(7)] + public readonly T8 Item8; + [Key(8)] + public readonly T9 Item9; + [Key(9)] + public readonly T10 Item10; + [Key(10)] + public readonly T11 Item11; + [Key(11)] + public readonly T12 Item12; + [Key(12)] + public readonly T13 Item13; + [Key(13)] + public readonly T14 Item14; + + [SerializationConstructor] + public DynamicArgumentTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8, T9 item9, T10 item10, T11 item11, T12 item12, T13 item13, T14 item14) + { + Item1 = item1; + Item2 = item2; + Item3 = item3; + Item4 = item4; + Item5 = item5; + Item6 = item6; + Item7 = item7; + Item8 = item8; + Item9 = item9; + Item10 = item10; + Item11 = item11; + Item12 = item12; + Item13 = item13; + Item14 = item14; + } + } + + public class DynamicArgumentTupleFormatter : IMessagePackFormatter> + { + readonly T1 default1; + readonly T2 default2; + readonly T3 default3; + readonly T4 default4; + readonly T5 default5; + readonly T6 default6; + readonly T7 default7; + readonly T8 default8; + readonly T9 default9; + readonly T10 default10; + readonly T11 default11; + readonly T12 default12; + readonly T13 default13; + readonly T14 default14; + + public DynamicArgumentTupleFormatter(T1 default1, T2 default2, T3 default3, T4 default4, T5 default5, T6 default6, T7 default7, T8 default8, T9 default9, T10 default10, T11 default11, T12 default12, T13 default13, T14 default14) + { + this.default1 = default1; + this.default2 = default2; + this.default3 = default3; + this.default4 = default4; + this.default5 = default5; + this.default6 = default6; + this.default7 = default7; + this.default8 = default8; + this.default9 = default9; + this.default10 = default10; + this.default11 = default11; + this.default12 = default12; + this.default13 = default13; + this.default14 = default14; + } + + public void Serialize(ref MessagePackWriter writer, DynamicArgumentTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(14); + var resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item7, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item8, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item9, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item10, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item11, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item12, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item13, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item14, options); + } + + public DynamicArgumentTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var resolver = options.Resolver; + var length = reader.ReadArrayHeader(); + + var item1 = default1; + var item2 = default2; + var item3 = default3; + var item4 = default4; + var item5 = default5; + var item6 = default6; + var item7 = default7; + var item8 = default8; + var item9 = default9; + var item10 = default10; + var item11 = default11; + var item12 = default12; + var item13 = default13; + var item14 = default14; + + for (var i = 0; i < length; i++) + { + switch (i) + { + case 0: + item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 2: + item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 3: + item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 4: + item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 5: + item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 6: + item7 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 7: + item8 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 8: + item9 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 9: + item10 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 10: + item11 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 11: + item12 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 12: + item13 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 13: + item14 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + return new DynamicArgumentTuple(item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14); + } + } + + [MessagePackObject] + public struct DynamicArgumentTuple + { + [Key(0)] + public readonly T1 Item1; + [Key(1)] + public readonly T2 Item2; + [Key(2)] + public readonly T3 Item3; + [Key(3)] + public readonly T4 Item4; + [Key(4)] + public readonly T5 Item5; + [Key(5)] + public readonly T6 Item6; + [Key(6)] + public readonly T7 Item7; + [Key(7)] + public readonly T8 Item8; + [Key(8)] + public readonly T9 Item9; + [Key(9)] + public readonly T10 Item10; + [Key(10)] + public readonly T11 Item11; + [Key(11)] + public readonly T12 Item12; + [Key(12)] + public readonly T13 Item13; + [Key(13)] + public readonly T14 Item14; + [Key(14)] + public readonly T15 Item15; + + [SerializationConstructor] + public DynamicArgumentTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8, T9 item9, T10 item10, T11 item11, T12 item12, T13 item13, T14 item14, T15 item15) + { + Item1 = item1; + Item2 = item2; + Item3 = item3; + Item4 = item4; + Item5 = item5; + Item6 = item6; + Item7 = item7; + Item8 = item8; + Item9 = item9; + Item10 = item10; + Item11 = item11; + Item12 = item12; + Item13 = item13; + Item14 = item14; + Item15 = item15; + } + } + + public class DynamicArgumentTupleFormatter : IMessagePackFormatter> + { + readonly T1 default1; + readonly T2 default2; + readonly T3 default3; + readonly T4 default4; + readonly T5 default5; + readonly T6 default6; + readonly T7 default7; + readonly T8 default8; + readonly T9 default9; + readonly T10 default10; + readonly T11 default11; + readonly T12 default12; + readonly T13 default13; + readonly T14 default14; + readonly T15 default15; + + public DynamicArgumentTupleFormatter(T1 default1, T2 default2, T3 default3, T4 default4, T5 default5, T6 default6, T7 default7, T8 default8, T9 default9, T10 default10, T11 default11, T12 default12, T13 default13, T14 default14, T15 default15) + { + this.default1 = default1; + this.default2 = default2; + this.default3 = default3; + this.default4 = default4; + this.default5 = default5; + this.default6 = default6; + this.default7 = default7; + this.default8 = default8; + this.default9 = default9; + this.default10 = default10; + this.default11 = default11; + this.default12 = default12; + this.default13 = default13; + this.default14 = default14; + this.default15 = default15; + } + + public void Serialize(ref MessagePackWriter writer, DynamicArgumentTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(15); + var resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item7, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item8, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item9, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item10, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item11, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item12, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item13, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item14, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item15, options); + } + + public DynamicArgumentTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var resolver = options.Resolver; + var length = reader.ReadArrayHeader(); + + var item1 = default1; + var item2 = default2; + var item3 = default3; + var item4 = default4; + var item5 = default5; + var item6 = default6; + var item7 = default7; + var item8 = default8; + var item9 = default9; + var item10 = default10; + var item11 = default11; + var item12 = default12; + var item13 = default13; + var item14 = default14; + var item15 = default15; + + for (var i = 0; i < length; i++) + { + switch (i) + { + case 0: + item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 2: + item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 3: + item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 4: + item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 5: + item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 6: + item7 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 7: + item8 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 8: + item9 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 9: + item10 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 10: + item11 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 11: + item12 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 12: + item13 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 13: + item14 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 14: + item15 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + return new DynamicArgumentTuple(item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15); + } + } + + [MessagePackObject] + public struct DynamicArgumentTuple + { + [Key(0)] + public readonly T1 Item1; + [Key(1)] + public readonly T2 Item2; + [Key(2)] + public readonly T3 Item3; + [Key(3)] + public readonly T4 Item4; + [Key(4)] + public readonly T5 Item5; + [Key(5)] + public readonly T6 Item6; + [Key(6)] + public readonly T7 Item7; + [Key(7)] + public readonly T8 Item8; + [Key(8)] + public readonly T9 Item9; + [Key(9)] + public readonly T10 Item10; + [Key(10)] + public readonly T11 Item11; + [Key(11)] + public readonly T12 Item12; + [Key(12)] + public readonly T13 Item13; + [Key(13)] + public readonly T14 Item14; + [Key(14)] + public readonly T15 Item15; + [Key(15)] + public readonly T16 Item16; + + [SerializationConstructor] + public DynamicArgumentTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8, T9 item9, T10 item10, T11 item11, T12 item12, T13 item13, T14 item14, T15 item15, T16 item16) + { + Item1 = item1; + Item2 = item2; + Item3 = item3; + Item4 = item4; + Item5 = item5; + Item6 = item6; + Item7 = item7; + Item8 = item8; + Item9 = item9; + Item10 = item10; + Item11 = item11; + Item12 = item12; + Item13 = item13; + Item14 = item14; + Item15 = item15; + Item16 = item16; + } + } + + public class DynamicArgumentTupleFormatter : IMessagePackFormatter> + { + readonly T1 default1; + readonly T2 default2; + readonly T3 default3; + readonly T4 default4; + readonly T5 default5; + readonly T6 default6; + readonly T7 default7; + readonly T8 default8; + readonly T9 default9; + readonly T10 default10; + readonly T11 default11; + readonly T12 default12; + readonly T13 default13; + readonly T14 default14; + readonly T15 default15; + readonly T16 default16; + + public DynamicArgumentTupleFormatter(T1 default1, T2 default2, T3 default3, T4 default4, T5 default5, T6 default6, T7 default7, T8 default8, T9 default9, T10 default10, T11 default11, T12 default12, T13 default13, T14 default14, T15 default15, T16 default16) + { + this.default1 = default1; + this.default2 = default2; + this.default3 = default3; + this.default4 = default4; + this.default5 = default5; + this.default6 = default6; + this.default7 = default7; + this.default8 = default8; + this.default9 = default9; + this.default10 = default10; + this.default11 = default11; + this.default12 = default12; + this.default13 = default13; + this.default14 = default14; + this.default15 = default15; + this.default16 = default16; + } + + public void Serialize(ref MessagePackWriter writer, DynamicArgumentTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(16); + var resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item7, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item8, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item9, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item10, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item11, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item12, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item13, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item14, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item15, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item16, options); + } + + public DynamicArgumentTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var resolver = options.Resolver; + var length = reader.ReadArrayHeader(); + + var item1 = default1; + var item2 = default2; + var item3 = default3; + var item4 = default4; + var item5 = default5; + var item6 = default6; + var item7 = default7; + var item8 = default8; + var item9 = default9; + var item10 = default10; + var item11 = default11; + var item12 = default12; + var item13 = default13; + var item14 = default14; + var item15 = default15; + var item16 = default16; + + for (var i = 0; i < length; i++) + { + switch (i) + { + case 0: + item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 2: + item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 3: + item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 4: + item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 5: + item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 6: + item7 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 7: + item8 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 8: + item9 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 9: + item10 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 10: + item11 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 11: + item12 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 12: + item13 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 13: + item14 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 14: + item15 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 15: + item16 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + return new DynamicArgumentTuple(item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16); + } + } + + [MessagePackObject] + public struct DynamicArgumentTuple + { + [Key(0)] + public readonly T1 Item1; + [Key(1)] + public readonly T2 Item2; + [Key(2)] + public readonly T3 Item3; + [Key(3)] + public readonly T4 Item4; + [Key(4)] + public readonly T5 Item5; + [Key(5)] + public readonly T6 Item6; + [Key(6)] + public readonly T7 Item7; + [Key(7)] + public readonly T8 Item8; + [Key(8)] + public readonly T9 Item9; + [Key(9)] + public readonly T10 Item10; + [Key(10)] + public readonly T11 Item11; + [Key(11)] + public readonly T12 Item12; + [Key(12)] + public readonly T13 Item13; + [Key(13)] + public readonly T14 Item14; + [Key(14)] + public readonly T15 Item15; + [Key(15)] + public readonly T16 Item16; + [Key(16)] + public readonly T17 Item17; + + [SerializationConstructor] + public DynamicArgumentTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8, T9 item9, T10 item10, T11 item11, T12 item12, T13 item13, T14 item14, T15 item15, T16 item16, T17 item17) + { + Item1 = item1; + Item2 = item2; + Item3 = item3; + Item4 = item4; + Item5 = item5; + Item6 = item6; + Item7 = item7; + Item8 = item8; + Item9 = item9; + Item10 = item10; + Item11 = item11; + Item12 = item12; + Item13 = item13; + Item14 = item14; + Item15 = item15; + Item16 = item16; + Item17 = item17; + } + } + + public class DynamicArgumentTupleFormatter : IMessagePackFormatter> + { + readonly T1 default1; + readonly T2 default2; + readonly T3 default3; + readonly T4 default4; + readonly T5 default5; + readonly T6 default6; + readonly T7 default7; + readonly T8 default8; + readonly T9 default9; + readonly T10 default10; + readonly T11 default11; + readonly T12 default12; + readonly T13 default13; + readonly T14 default14; + readonly T15 default15; + readonly T16 default16; + readonly T17 default17; + + public DynamicArgumentTupleFormatter(T1 default1, T2 default2, T3 default3, T4 default4, T5 default5, T6 default6, T7 default7, T8 default8, T9 default9, T10 default10, T11 default11, T12 default12, T13 default13, T14 default14, T15 default15, T16 default16, T17 default17) + { + this.default1 = default1; + this.default2 = default2; + this.default3 = default3; + this.default4 = default4; + this.default5 = default5; + this.default6 = default6; + this.default7 = default7; + this.default8 = default8; + this.default9 = default9; + this.default10 = default10; + this.default11 = default11; + this.default12 = default12; + this.default13 = default13; + this.default14 = default14; + this.default15 = default15; + this.default16 = default16; + this.default17 = default17; + } + + public void Serialize(ref MessagePackWriter writer, DynamicArgumentTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(17); + var resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item7, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item8, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item9, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item10, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item11, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item12, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item13, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item14, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item15, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item16, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item17, options); + } + + public DynamicArgumentTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var resolver = options.Resolver; + var length = reader.ReadArrayHeader(); + + var item1 = default1; + var item2 = default2; + var item3 = default3; + var item4 = default4; + var item5 = default5; + var item6 = default6; + var item7 = default7; + var item8 = default8; + var item9 = default9; + var item10 = default10; + var item11 = default11; + var item12 = default12; + var item13 = default13; + var item14 = default14; + var item15 = default15; + var item16 = default16; + var item17 = default17; + + for (var i = 0; i < length; i++) + { + switch (i) + { + case 0: + item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 2: + item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 3: + item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 4: + item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 5: + item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 6: + item7 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 7: + item8 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 8: + item9 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 9: + item10 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 10: + item11 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 11: + item12 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 12: + item13 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 13: + item14 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 14: + item15 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 15: + item16 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 16: + item17 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + return new DynamicArgumentTuple(item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17); + } + } + + [MessagePackObject] + public struct DynamicArgumentTuple + { + [Key(0)] + public readonly T1 Item1; + [Key(1)] + public readonly T2 Item2; + [Key(2)] + public readonly T3 Item3; + [Key(3)] + public readonly T4 Item4; + [Key(4)] + public readonly T5 Item5; + [Key(5)] + public readonly T6 Item6; + [Key(6)] + public readonly T7 Item7; + [Key(7)] + public readonly T8 Item8; + [Key(8)] + public readonly T9 Item9; + [Key(9)] + public readonly T10 Item10; + [Key(10)] + public readonly T11 Item11; + [Key(11)] + public readonly T12 Item12; + [Key(12)] + public readonly T13 Item13; + [Key(13)] + public readonly T14 Item14; + [Key(14)] + public readonly T15 Item15; + [Key(15)] + public readonly T16 Item16; + [Key(16)] + public readonly T17 Item17; + [Key(17)] + public readonly T18 Item18; + + [SerializationConstructor] + public DynamicArgumentTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8, T9 item9, T10 item10, T11 item11, T12 item12, T13 item13, T14 item14, T15 item15, T16 item16, T17 item17, T18 item18) + { + Item1 = item1; + Item2 = item2; + Item3 = item3; + Item4 = item4; + Item5 = item5; + Item6 = item6; + Item7 = item7; + Item8 = item8; + Item9 = item9; + Item10 = item10; + Item11 = item11; + Item12 = item12; + Item13 = item13; + Item14 = item14; + Item15 = item15; + Item16 = item16; + Item17 = item17; + Item18 = item18; + } + } + + public class DynamicArgumentTupleFormatter : IMessagePackFormatter> + { + readonly T1 default1; + readonly T2 default2; + readonly T3 default3; + readonly T4 default4; + readonly T5 default5; + readonly T6 default6; + readonly T7 default7; + readonly T8 default8; + readonly T9 default9; + readonly T10 default10; + readonly T11 default11; + readonly T12 default12; + readonly T13 default13; + readonly T14 default14; + readonly T15 default15; + readonly T16 default16; + readonly T17 default17; + readonly T18 default18; + + public DynamicArgumentTupleFormatter(T1 default1, T2 default2, T3 default3, T4 default4, T5 default5, T6 default6, T7 default7, T8 default8, T9 default9, T10 default10, T11 default11, T12 default12, T13 default13, T14 default14, T15 default15, T16 default16, T17 default17, T18 default18) + { + this.default1 = default1; + this.default2 = default2; + this.default3 = default3; + this.default4 = default4; + this.default5 = default5; + this.default6 = default6; + this.default7 = default7; + this.default8 = default8; + this.default9 = default9; + this.default10 = default10; + this.default11 = default11; + this.default12 = default12; + this.default13 = default13; + this.default14 = default14; + this.default15 = default15; + this.default16 = default16; + this.default17 = default17; + this.default18 = default18; + } + + public void Serialize(ref MessagePackWriter writer, DynamicArgumentTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(18); + var resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item7, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item8, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item9, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item10, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item11, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item12, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item13, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item14, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item15, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item16, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item17, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item18, options); + } + + public DynamicArgumentTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var resolver = options.Resolver; + var length = reader.ReadArrayHeader(); + + var item1 = default1; + var item2 = default2; + var item3 = default3; + var item4 = default4; + var item5 = default5; + var item6 = default6; + var item7 = default7; + var item8 = default8; + var item9 = default9; + var item10 = default10; + var item11 = default11; + var item12 = default12; + var item13 = default13; + var item14 = default14; + var item15 = default15; + var item16 = default16; + var item17 = default17; + var item18 = default18; + + for (var i = 0; i < length; i++) + { + switch (i) + { + case 0: + item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 2: + item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 3: + item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 4: + item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 5: + item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 6: + item7 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 7: + item8 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 8: + item9 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 9: + item10 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 10: + item11 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 11: + item12 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 12: + item13 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 13: + item14 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 14: + item15 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 15: + item16 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 16: + item17 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 17: + item18 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + return new DynamicArgumentTuple(item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18); + } + } + + [MessagePackObject] + public struct DynamicArgumentTuple + { + [Key(0)] + public readonly T1 Item1; + [Key(1)] + public readonly T2 Item2; + [Key(2)] + public readonly T3 Item3; + [Key(3)] + public readonly T4 Item4; + [Key(4)] + public readonly T5 Item5; + [Key(5)] + public readonly T6 Item6; + [Key(6)] + public readonly T7 Item7; + [Key(7)] + public readonly T8 Item8; + [Key(8)] + public readonly T9 Item9; + [Key(9)] + public readonly T10 Item10; + [Key(10)] + public readonly T11 Item11; + [Key(11)] + public readonly T12 Item12; + [Key(12)] + public readonly T13 Item13; + [Key(13)] + public readonly T14 Item14; + [Key(14)] + public readonly T15 Item15; + [Key(15)] + public readonly T16 Item16; + [Key(16)] + public readonly T17 Item17; + [Key(17)] + public readonly T18 Item18; + [Key(18)] + public readonly T19 Item19; + + [SerializationConstructor] + public DynamicArgumentTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8, T9 item9, T10 item10, T11 item11, T12 item12, T13 item13, T14 item14, T15 item15, T16 item16, T17 item17, T18 item18, T19 item19) + { + Item1 = item1; + Item2 = item2; + Item3 = item3; + Item4 = item4; + Item5 = item5; + Item6 = item6; + Item7 = item7; + Item8 = item8; + Item9 = item9; + Item10 = item10; + Item11 = item11; + Item12 = item12; + Item13 = item13; + Item14 = item14; + Item15 = item15; + Item16 = item16; + Item17 = item17; + Item18 = item18; + Item19 = item19; + } + } + + public class DynamicArgumentTupleFormatter : IMessagePackFormatter> + { + readonly T1 default1; + readonly T2 default2; + readonly T3 default3; + readonly T4 default4; + readonly T5 default5; + readonly T6 default6; + readonly T7 default7; + readonly T8 default8; + readonly T9 default9; + readonly T10 default10; + readonly T11 default11; + readonly T12 default12; + readonly T13 default13; + readonly T14 default14; + readonly T15 default15; + readonly T16 default16; + readonly T17 default17; + readonly T18 default18; + readonly T19 default19; + + public DynamicArgumentTupleFormatter(T1 default1, T2 default2, T3 default3, T4 default4, T5 default5, T6 default6, T7 default7, T8 default8, T9 default9, T10 default10, T11 default11, T12 default12, T13 default13, T14 default14, T15 default15, T16 default16, T17 default17, T18 default18, T19 default19) + { + this.default1 = default1; + this.default2 = default2; + this.default3 = default3; + this.default4 = default4; + this.default5 = default5; + this.default6 = default6; + this.default7 = default7; + this.default8 = default8; + this.default9 = default9; + this.default10 = default10; + this.default11 = default11; + this.default12 = default12; + this.default13 = default13; + this.default14 = default14; + this.default15 = default15; + this.default16 = default16; + this.default17 = default17; + this.default18 = default18; + this.default19 = default19; + } + + public void Serialize(ref MessagePackWriter writer, DynamicArgumentTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(19); + var resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item7, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item8, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item9, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item10, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item11, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item12, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item13, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item14, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item15, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item16, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item17, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item18, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item19, options); + } + + public DynamicArgumentTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var resolver = options.Resolver; + var length = reader.ReadArrayHeader(); + + var item1 = default1; + var item2 = default2; + var item3 = default3; + var item4 = default4; + var item5 = default5; + var item6 = default6; + var item7 = default7; + var item8 = default8; + var item9 = default9; + var item10 = default10; + var item11 = default11; + var item12 = default12; + var item13 = default13; + var item14 = default14; + var item15 = default15; + var item16 = default16; + var item17 = default17; + var item18 = default18; + var item19 = default19; + + for (var i = 0; i < length; i++) + { + switch (i) + { + case 0: + item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 2: + item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 3: + item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 4: + item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 5: + item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 6: + item7 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 7: + item8 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 8: + item9 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 9: + item10 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 10: + item11 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 11: + item12 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 12: + item13 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 13: + item14 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 14: + item15 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 15: + item16 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 16: + item17 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 17: + item18 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 18: + item19 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + return new DynamicArgumentTuple(item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18, item19); + } + } + + [MessagePackObject] + public struct DynamicArgumentTuple + { + [Key(0)] + public readonly T1 Item1; + [Key(1)] + public readonly T2 Item2; + [Key(2)] + public readonly T3 Item3; + [Key(3)] + public readonly T4 Item4; + [Key(4)] + public readonly T5 Item5; + [Key(5)] + public readonly T6 Item6; + [Key(6)] + public readonly T7 Item7; + [Key(7)] + public readonly T8 Item8; + [Key(8)] + public readonly T9 Item9; + [Key(9)] + public readonly T10 Item10; + [Key(10)] + public readonly T11 Item11; + [Key(11)] + public readonly T12 Item12; + [Key(12)] + public readonly T13 Item13; + [Key(13)] + public readonly T14 Item14; + [Key(14)] + public readonly T15 Item15; + [Key(15)] + public readonly T16 Item16; + [Key(16)] + public readonly T17 Item17; + [Key(17)] + public readonly T18 Item18; + [Key(18)] + public readonly T19 Item19; + [Key(19)] + public readonly T20 Item20; + + [SerializationConstructor] + public DynamicArgumentTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8, T9 item9, T10 item10, T11 item11, T12 item12, T13 item13, T14 item14, T15 item15, T16 item16, T17 item17, T18 item18, T19 item19, T20 item20) + { + Item1 = item1; + Item2 = item2; + Item3 = item3; + Item4 = item4; + Item5 = item5; + Item6 = item6; + Item7 = item7; + Item8 = item8; + Item9 = item9; + Item10 = item10; + Item11 = item11; + Item12 = item12; + Item13 = item13; + Item14 = item14; + Item15 = item15; + Item16 = item16; + Item17 = item17; + Item18 = item18; + Item19 = item19; + Item20 = item20; + } + } + + public class DynamicArgumentTupleFormatter : IMessagePackFormatter> + { + readonly T1 default1; + readonly T2 default2; + readonly T3 default3; + readonly T4 default4; + readonly T5 default5; + readonly T6 default6; + readonly T7 default7; + readonly T8 default8; + readonly T9 default9; + readonly T10 default10; + readonly T11 default11; + readonly T12 default12; + readonly T13 default13; + readonly T14 default14; + readonly T15 default15; + readonly T16 default16; + readonly T17 default17; + readonly T18 default18; + readonly T19 default19; + readonly T20 default20; + + public DynamicArgumentTupleFormatter(T1 default1, T2 default2, T3 default3, T4 default4, T5 default5, T6 default6, T7 default7, T8 default8, T9 default9, T10 default10, T11 default11, T12 default12, T13 default13, T14 default14, T15 default15, T16 default16, T17 default17, T18 default18, T19 default19, T20 default20) + { + this.default1 = default1; + this.default2 = default2; + this.default3 = default3; + this.default4 = default4; + this.default5 = default5; + this.default6 = default6; + this.default7 = default7; + this.default8 = default8; + this.default9 = default9; + this.default10 = default10; + this.default11 = default11; + this.default12 = default12; + this.default13 = default13; + this.default14 = default14; + this.default15 = default15; + this.default16 = default16; + this.default17 = default17; + this.default18 = default18; + this.default19 = default19; + this.default20 = default20; + } + + public void Serialize(ref MessagePackWriter writer, DynamicArgumentTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(20); + var resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item7, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item8, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item9, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item10, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item11, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item12, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item13, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item14, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item15, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item16, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item17, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item18, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item19, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item20, options); + } + + public DynamicArgumentTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var resolver = options.Resolver; + var length = reader.ReadArrayHeader(); + + var item1 = default1; + var item2 = default2; + var item3 = default3; + var item4 = default4; + var item5 = default5; + var item6 = default6; + var item7 = default7; + var item8 = default8; + var item9 = default9; + var item10 = default10; + var item11 = default11; + var item12 = default12; + var item13 = default13; + var item14 = default14; + var item15 = default15; + var item16 = default16; + var item17 = default17; + var item18 = default18; + var item19 = default19; + var item20 = default20; + + for (var i = 0; i < length; i++) + { + switch (i) + { + case 0: + item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 2: + item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 3: + item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 4: + item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 5: + item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 6: + item7 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 7: + item8 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 8: + item9 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 9: + item10 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 10: + item11 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 11: + item12 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 12: + item13 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 13: + item14 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 14: + item15 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 15: + item16 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 16: + item17 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 17: + item18 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 18: + item19 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 19: + item20 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + return new DynamicArgumentTuple(item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18, item19, item20); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion/DynamicArgumentTuple.cs.meta b/Assets/Scripts/MagicOnion/DynamicArgumentTuple.cs.meta new file mode 100644 index 000000000..7a6b5d9dc --- /dev/null +++ b/Assets/Scripts/MagicOnion/DynamicArgumentTuple.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cf5ef5626f3854c41ae7c68935ada7c1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/MagicOnion.asmdef b/Assets/Scripts/MagicOnion/MagicOnion.asmdef new file mode 100644 index 000000000..d20a32e3d --- /dev/null +++ b/Assets/Scripts/MagicOnion/MagicOnion.asmdef @@ -0,0 +1,15 @@ +{ + "name": "MagicOnion", + "references": [ + "MessagePack", + "MagicOnion.Abstractions" + ], + "optionalUnityReferences": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [] +} \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion/MagicOnion.asmdef.meta b/Assets/Scripts/MagicOnion/MagicOnion.asmdef.meta new file mode 100644 index 000000000..58523f05f --- /dev/null +++ b/Assets/Scripts/MagicOnion/MagicOnion.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 204215817eaff0c4eaa0f2b9cdd2df52 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/MagicOnionMarshallers.cs b/Assets/Scripts/MagicOnion/MagicOnionMarshallers.cs new file mode 100644 index 000000000..15e724d48 --- /dev/null +++ b/Assets/Scripts/MagicOnion/MagicOnionMarshallers.cs @@ -0,0 +1,207 @@ +using Grpc.Core; +using MessagePack; +using MessagePack.Formatters; +using System; +using System.Linq; +using System.Reflection; +using System.Threading; +using System.Threading.Tasks; + +namespace MagicOnion +{ + internal class MarshallingAsyncStreamReader : IAsyncStreamReader, IDisposable + { + readonly IAsyncStreamReader inner; + readonly MessagePackSerializerOptions options; + + public MarshallingAsyncStreamReader(IAsyncStreamReader inner, MessagePackSerializerOptions options) + { + this.inner = inner; + this.options = options; + } + + public T Current { get; private set; } + + public async Task MoveNext(CancellationToken cancellationToken) + { + if (await inner.MoveNext(cancellationToken)) + { + this.Current = MessagePackSerializer.Deserialize(inner.Current, options); + return true; + } + else + { + return false; + } + } + + public void Dispose() + { + (inner as IDisposable)?.Dispose(); + } + } + + internal class MarshallingClientStreamWriter : IClientStreamWriter + { + readonly IClientStreamWriter inner; + readonly MessagePackSerializerOptions options; + + public MarshallingClientStreamWriter(IClientStreamWriter inner, MessagePackSerializerOptions options) + { + this.inner = inner; + this.options = options; + } + + public WriteOptions WriteOptions + { + get + { + return inner.WriteOptions; + } + + set + { + inner.WriteOptions = value; + } + } + + public Task CompleteAsync() + { + return inner.CompleteAsync(); + } + + public Task WriteAsync(T message) + { + var bytes = MessagePackSerializer.Serialize(message, options); + return inner.WriteAsync(bytes); + } + } + + // invoke from dynamic methods so must be public + public static class MagicOnionMarshallers + { + static readonly Type[] dynamicArgumentTupleTypes = typeof(DynamicArgumentTuple<,>).GetTypeInfo().Assembly + .GetTypes() + .Where(x => x.Name.StartsWith("DynamicArgumentTuple") && !x.Name.Contains("Formatter")) + .OrderBy(x => x.GetGenericArguments().Length) + .ToArray(); + + static readonly Type[] dynamicArgumentTupleFormatterTypes = typeof(DynamicArgumentTupleFormatter<,,>).GetTypeInfo().Assembly + .GetTypes() + .Where(x => x.Name.StartsWith("DynamicArgumentTupleFormatter")) + .OrderBy(x => x.GetGenericArguments().Length) + .ToArray(); + + public static readonly byte[] UnsafeNilBytes = new byte[] { MessagePackCode.Nil }; + + public static readonly Marshaller ThroughMarshaller = new Marshaller(x => x, x => x); + + internal static Type CreateRequestType(ParameterInfo[] parameters) + { + if (parameters.Length == 0) + { + return typeof(byte[]); + } + else if (parameters.Length == 1) + { + var t = parameters[0].ParameterType; + return t; + } + else if (parameters.Length > 20) + { + throw new InvalidOperationException($"Parameter length must be <= 20, length:{parameters.Length}"); + } + else + { + // start from T2 + var tupleTypeBase = dynamicArgumentTupleTypes[parameters.Length - 2]; + var t = tupleTypeBase.MakeGenericType(parameters.Select(x => x.ParameterType).ToArray()); + return t; + } + } + + public static Type CreateRequestTypeAndSetResolver(string path, ParameterInfo[] parameters, ref IFormatterResolver resolver) + { + if (parameters.Length == 0) + { + return typeof(byte[]); + } + else if (parameters.Length == 1) + { + return parameters[0].ParameterType; + } + else if (parameters.Length > 20) + { + throw new InvalidOperationException($"Parameter length must be <= 20, path:{path} length:{parameters.Length}"); + } + else + { + // start from T2 + var tupleTypeBase = dynamicArgumentTupleTypes[parameters.Length - 2]; + var formatterTypeBase = dynamicArgumentTupleFormatterTypes[parameters.Length - 2]; + + var t = tupleTypeBase.MakeGenericType(parameters.Select(x => x.ParameterType).ToArray()); + var formatterType = formatterTypeBase.MakeGenericType(parameters.Select(x => x.ParameterType).ToArray()); + + var defaultValues = parameters + .Select(x => + { + if (x.HasDefaultValue) + { + return x.DefaultValue; + } + else if (x.ParameterType.GetTypeInfo().IsValueType) + { + return Activator.CreateInstance(x.ParameterType); + } + else + { + return null; + } + }).ToArray(); + + var formatter = Activator.CreateInstance(formatterType, defaultValues); + + resolver = new PriorityResolver(t, formatter, resolver); + return t; + } + } + + public static object InstantiateDynamicArgumentTuple(Type[] typeParameters, object[] arguments) + { + // start from T2 + var tupleTypeBase = dynamicArgumentTupleTypes[arguments.Length - 2]; + return Activator.CreateInstance(tupleTypeBase.MakeGenericType(typeParameters), arguments); + } + } + + internal class PriorityResolver : IFormatterResolver + { + readonly Type formatterType; + readonly object formatter; + readonly IFormatterResolver innerResolver; + + public PriorityResolver(Type formatterType, object formatter, IFormatterResolver innerResolver) + { + this.formatterType = formatterType; + this.formatter = formatter; + this.innerResolver = innerResolver; + } + + public IMessagePackFormatter GetFormatter() + { + if (typeof(T) == formatterType) + { + return (IMessagePackFormatter)formatter; + } + else if (innerResolver == null) + { + return MessagePackSerializer.DefaultOptions.Resolver.GetFormatterWithVerify(); + } + else + { + return innerResolver.GetFormatterWithVerify(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion/MagicOnionMarshallers.cs.meta b/Assets/Scripts/MagicOnion/MagicOnionMarshallers.cs.meta new file mode 100644 index 000000000..b76cefbe8 --- /dev/null +++ b/Assets/Scripts/MagicOnion/MagicOnionMarshallers.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 667fe11f4c8014340bbde4521d337330 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/MetadataExtensions.cs b/Assets/Scripts/MagicOnion/MetadataExtensions.cs new file mode 100644 index 000000000..40373dc55 --- /dev/null +++ b/Assets/Scripts/MagicOnion/MetadataExtensions.cs @@ -0,0 +1,62 @@ +using Grpc.Core; +using System; + +namespace MagicOnion +{ + public static class MetadataExtensions + { + public const string BinarySuffix = "-bin"; + + /// + /// Get metdata entry. If does not exists, return null. + /// + public static Metadata.Entry Get(this Metadata metadata, string key, bool ignoreCase = true) + { + for (int i = 0; i < metadata.Count; i++) + { + var entry = metadata[i]; + if (ignoreCase) + { + if (entry.Key.Equals(key, StringComparison.OrdinalIgnoreCase)) + { + return entry; + } + } + else + { + if (entry.Key == key) + { + return entry; + } + } + } + return null; + } + + /// + /// Get metdata string value. If does not exists, return null. + /// + public static string GetValue(this Metadata metadata, string key, bool ignoreCase = true) + { + for (int i = 0; i < metadata.Count; i++) + { + var entry = metadata[i]; + if (ignoreCase) + { + if (entry.Key.Equals(key, StringComparison.OrdinalIgnoreCase)) + { + return entry.Value; + } + } + else + { + if (entry.Key == key) + { + return entry.Value; + } + } + } + return null; + } + } +} diff --git a/Assets/Scripts/MagicOnion/MetadataExtensions.cs.meta b/Assets/Scripts/MagicOnion/MetadataExtensions.cs.meta new file mode 100644 index 000000000..848747836 --- /dev/null +++ b/Assets/Scripts/MagicOnion/MetadataExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ad9313e64fc51ed44a50cb156e479929 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/ReturnStatusException.cs b/Assets/Scripts/MagicOnion/ReturnStatusException.cs new file mode 100644 index 000000000..b310e61fd --- /dev/null +++ b/Assets/Scripts/MagicOnion/ReturnStatusException.cs @@ -0,0 +1,22 @@ +using Grpc.Core; +using System; + +namespace MagicOnion +{ + public class ReturnStatusException : Exception + { + public StatusCode StatusCode { get; private set; } + public string Detail { get; private set; } + + public ReturnStatusException(StatusCode statusCode, string detail) + { + this.StatusCode = statusCode; + this.Detail = detail; + } + + public Status ToStatus() + { + return new Status(StatusCode, Detail ?? ""); + } + } +} diff --git a/Assets/Scripts/MagicOnion/ReturnStatusException.cs.meta b/Assets/Scripts/MagicOnion/ReturnStatusException.cs.meta new file mode 100644 index 000000000..676745c11 --- /dev/null +++ b/Assets/Scripts/MagicOnion/ReturnStatusException.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b4c3bb3dea67c86419674cd758cfa7ea +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/Server.meta b/Assets/Scripts/MagicOnion/Server.meta new file mode 100644 index 000000000..e21b086d0 --- /dev/null +++ b/Assets/Scripts/MagicOnion/Server.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e463862d96bbe2e4c8060ea4f8256eff +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/Server/Hubs.meta b/Assets/Scripts/MagicOnion/Server/Hubs.meta new file mode 100644 index 000000000..64e61757b --- /dev/null +++ b/Assets/Scripts/MagicOnion/Server/Hubs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5c9aa9fba89d3404eb2292310360d574 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/Server/Hubs/BroadcasterHelper.cs b/Assets/Scripts/MagicOnion/Server/Hubs/BroadcasterHelper.cs new file mode 100644 index 000000000..6afcc563d --- /dev/null +++ b/Assets/Scripts/MagicOnion/Server/Hubs/BroadcasterHelper.cs @@ -0,0 +1,94 @@ +using MagicOnion.Utils; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Threading.Tasks; + +namespace MagicOnion.Server.Hubs +{ + public static class BroadcasterHelper + { + internal static readonly Type[] dynamicArgumentTupleTypes = typeof(DynamicArgumentTuple<,>).GetTypeInfo().Assembly + .GetTypes() + .Where(x => x.Name.StartsWith("DynamicArgumentTuple") && !x.Name.Contains("Formatter")) + .OrderBy(x => x.GetGenericArguments().Length) + .ToArray(); + + internal static MethodDefinition[] SearchDefinitions(Type interfaceType) + { + return interfaceType + .GetInterfaces() + .Concat(new[] { interfaceType }) + .SelectMany(x => x.GetMethods()) + .Where(x => + { + var methodInfo = x; + if (methodInfo.IsSpecialName && (methodInfo.Name.StartsWith("set_") || methodInfo.Name.StartsWith("get_"))) return false; + if (methodInfo.GetCustomAttribute(false) != null) return false; // ignore + + var methodName = methodInfo.Name; + if (methodName == "Equals" + || methodName == "GetHashCode" + || methodName == "GetType" + || methodName == "ToString" + ) + { + return false; + } + + return true; + }) + .Where(x => !x.IsSpecialName) + .Select(x => new MethodDefinition + { + ReceiverType = interfaceType, + MethodInfo = x, + }) + .ToArray(); + } + + internal static void VerifyMethodDefinitions(MethodDefinition[] definitions) + { + // define and set. + var map = new Dictionary(definitions.Length); + foreach (var item in definitions) + { + var methodId = item.MethodInfo.GetCustomAttribute()?.MethodId ?? FNV1A32.GetHashCode(item.MethodInfo.Name); + if (map.ContainsKey(methodId)) + { + throw new Exception($"TReceiver does not allows duplicate methodId(hash code). Please change name or use MethodIdAttribute. {map[methodId].MethodInfo.Name} and {item.MethodInfo.Name}"); + } + map.Add(methodId, item); + + if (!(item.MethodInfo.ReturnType == typeof(void))) + { + throw new Exception($"Invalid definition, TReceiver's return type must only be `void`. {item.MethodInfo.Name}."); + } + + item.MethodId = methodId; + } + } + + public static async void FireAndForget(Task task) + { + try + { + await task.ConfigureAwait(false); + } + catch(Exception ex) + { + Grpc.Core.GrpcEnvironment.Logger?.Error(ex, "exception occured in client broadcast."); + } + } + + internal class MethodDefinition + { + public string Path => ReceiverType.Name + "/" + MethodInfo.Name; + + public Type ReceiverType; + public MethodInfo MethodInfo; + public int MethodId; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion/Server/Hubs/BroadcasterHelper.cs.meta b/Assets/Scripts/MagicOnion/Server/Hubs/BroadcasterHelper.cs.meta new file mode 100644 index 000000000..920f3a4ee --- /dev/null +++ b/Assets/Scripts/MagicOnion/Server/Hubs/BroadcasterHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a482aff8c25287942af22c031e219f8d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/UnsafeDirectBlitResolver.cs b/Assets/Scripts/MagicOnion/UnsafeDirectBlitResolver.cs new file mode 100644 index 000000000..34f020490 --- /dev/null +++ b/Assets/Scripts/MagicOnion/UnsafeDirectBlitResolver.cs @@ -0,0 +1,207 @@ +using MessagePack; +using System.Buffers; +using MessagePack.Formatters; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace MagicOnion +{ + public class UnsafeDirectBlitResolver : IFormatterResolver + { + public static readonly UnsafeDirectBlitResolver Instance = new UnsafeDirectBlitResolver(); + + bool isFreezed = false; + Dictionary formatters = new Dictionary(); + + UnsafeDirectBlitResolver() + { + } + + public void Register() + where T : unmanaged + { + if (isFreezed) + { + throw new InvalidOperationException("Register must call on startup(before use GetFormatter)."); + } + + formatters.Add(typeof(T), new UnsafeDirectBlitFormatter()); + formatters.Add(typeof(T[]), new UnsafeDirectBlitArrayFormatter()); + } + + public IMessagePackFormatter GetFormatter() + { + return FormatterCache.formatter; + } + + static class FormatterCache + { + public static readonly IMessagePackFormatter formatter; + + static FormatterCache() + { + Instance.isFreezed = true; + + var t = typeof(T); + + object formatterObject; + if (Instance.formatters.TryGetValue(t, out formatterObject)) + { + formatter = (IMessagePackFormatter)formatterObject; + } + } + } + } + + public class UnsafeDirectBlitArrayFormatter : IMessagePackFormatter + where T : unmanaged + { + const int TypeCode = 45; + + // use ext instead of ArrayFormatter for extremely boostup performance. + // Layout: [extHeader, isLittlEendian(bool), bytes()] + + readonly int StructLength; + + public UnsafeDirectBlitArrayFormatter() + { + this.StructLength = Unsafe.SizeOf(); + } + + public void Serialize(ref MessagePackWriter writer, T[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + return; + } + + var byteLen = value.Length * StructLength; + writer.WriteExtensionFormatHeader(new ExtensionHeader(TypeCode, byteLen + 1)); + writer.Write(BitConverter.IsLittleEndian); + + /* + Span span = writer.GetSpan(); + Unsafe.CopyBlockUnaligned(ref span[0], ref Unsafe.As(ref value[0]), (uint)byteLen); + writer.Advance(byteLen); + */ + + // currently can not write directly, wait msgpack update. + var span = System.Buffers.ArrayPool.Shared.Rent(byteLen); + try + { + Unsafe.CopyBlockUnaligned(ref span[0], ref Unsafe.As(ref value[0]), (uint)byteLen); + writer.WriteRaw(span.AsSpan().Slice(0, byteLen)); + } + finally + { + System.Buffers.ArrayPool.Shared.Return(span); + } + } + + public T[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + return null; + } + + var ext = reader.ReadExtensionFormat(); + if (ext.Header.TypeCode != TypeCode) throw new InvalidOperationException("Invalid typeCode."); + + var extReader = new MessagePackReader(ext.Data); + var isLittleEndian = extReader.ReadBoolean(); + + // extReader.read + byte[] rentMemory = default; + ReadOnlySpan span = default; + { + var seqSlice = extReader.Sequence.Slice(extReader.Position); + if (isLittleEndian != BitConverter.IsLittleEndian) + { + rentMemory = ArrayPool.Shared.Rent((int)seqSlice.Length); + seqSlice.CopyTo(rentMemory); + Array.Reverse(rentMemory); + span = rentMemory; + } + else + { + if (seqSlice.IsSingleSegment) + { + span = seqSlice.First.Span; + } + else + { + rentMemory = ArrayPool.Shared.Rent((int)seqSlice.Length); + seqSlice.CopyTo(rentMemory); + span = rentMemory; + } + } + } + + var result = new T[span.Length / StructLength]; + Unsafe.CopyBlockUnaligned(ref Unsafe.As(ref result[0]), ref MemoryMarshal.GetReference(span), (uint)span.Length); + return result; + } + } + + public class UnsafeDirectBlitFormatter : IMessagePackFormatter + where T : unmanaged + { + readonly int size; + + public UnsafeDirectBlitFormatter() + { + // Note: check is T blittable? + this.size = Unsafe.SizeOf(); + } + + public void Serialize(ref MessagePackWriter writer, T value, MessagePackSerializerOptions options) + { + // fix to v2.0-stable + byte[] rentMemory = ArrayPool.Shared.Rent(size); + try + { + var span = rentMemory.AsSpan().Slice(size); + Unsafe.WriteUnaligned(ref span[0], value); + writer.Write(span); + } + finally + { + ArrayPool.Shared.Return(rentMemory); + } + } + + public T Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var segment = reader.ReadBytes(); + if (segment == null) + { + throw new InvalidOperationException("data is null"); + } + + ValidateRead(segment.Value.Length); + + if (segment.Value.IsSingleSegment) + { + var firstMemory = segment.Value.First; + return Unsafe.ReadUnaligned(ref MemoryMarshal.GetReference(firstMemory.Span)); + } + else + { + var memory = segment.Value.ToArray(); + return Unsafe.ReadUnaligned(ref memory[0]); + } + } + + void ValidateRead(long length) + { + if (length < size) + { + throw new InvalidOperationException("Overflow"); + } + } + } +} diff --git a/Assets/Scripts/MagicOnion/UnsafeDirectBlitResolver.cs.meta b/Assets/Scripts/MagicOnion/UnsafeDirectBlitResolver.cs.meta new file mode 100644 index 000000000..44c0fc5eb --- /dev/null +++ b/Assets/Scripts/MagicOnion/UnsafeDirectBlitResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 02eef94aae0af164983a0d182274bc8d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/Utils.meta b/Assets/Scripts/MagicOnion/Utils.meta new file mode 100644 index 000000000..22e9d1313 --- /dev/null +++ b/Assets/Scripts/MagicOnion/Utils.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cdcce6ca202dd2843abe07f3c5b13d32 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/Utils/ArrayPoolBufferWriter.cs b/Assets/Scripts/MagicOnion/Utils/ArrayPoolBufferWriter.cs new file mode 100644 index 000000000..acf6209c9 --- /dev/null +++ b/Assets/Scripts/MagicOnion/Utils/ArrayPoolBufferWriter.cs @@ -0,0 +1,100 @@ +using System; +using System.Buffers; + +namespace MagicOnion.Utils +{ + internal sealed class ArrayPoolBufferWriter : IBufferWriter, IDisposable + { + [ThreadStatic] + static ArrayPoolBufferWriter staticInstance; + + public static ArrayPoolBufferWriter RentThreadStaticWriter() + { + if (staticInstance == null) + { + staticInstance = new ArrayPoolBufferWriter(); + } + staticInstance.Prepare(); + return staticInstance; + } + + const int MinimumBufferSize = 32767; // use 32k buffer. + + byte[] buffer; + int index; + + void Prepare() + { + if (buffer == null) + { + buffer = ArrayPool.Shared.Rent(MinimumBufferSize); + } + index = 0; + } + + public ReadOnlyMemory WrittenMemory => buffer.AsMemory(0, index); + public ReadOnlySpan WrittenSpan => buffer.AsSpan(0, index); + + public int WrittenCount => index; + + public int Capacity => buffer.Length; + + public int FreeCapacity => buffer.Length - index; + + public void Advance(int count) + { + if (count < 0) throw new ArgumentException(nameof(count)); + index += count; + } + + public Memory GetMemory(int sizeHint = 0) + { + CheckAndResizeBuffer(sizeHint); + return buffer.AsMemory(index); + } + + public Span GetSpan(int sizeHint = 0) + { + CheckAndResizeBuffer(sizeHint); + return buffer.AsSpan(index); + } + + void CheckAndResizeBuffer(int sizeHint) + { + if (sizeHint < 0) throw new ArgumentException(nameof(sizeHint)); + + if (sizeHint == 0) + { + sizeHint = MinimumBufferSize; + } + + int availableSpace = buffer.Length - index; + + if (sizeHint > availableSpace) + { + int growBy = Math.Max(sizeHint, buffer.Length); + + int newSize = checked(buffer.Length + growBy); + + byte[] oldBuffer = buffer; + + buffer = ArrayPool.Shared.Rent(newSize); + + Span previousBuffer = oldBuffer.AsSpan(0, index); + previousBuffer.CopyTo(buffer); + ArrayPool.Shared.Return(oldBuffer); + } + } + + public void Dispose() + { + if (buffer == null) + { + return; + } + + ArrayPool.Shared.Return(buffer); + buffer = null; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion/Utils/ArrayPoolBufferWriter.cs.meta b/Assets/Scripts/MagicOnion/Utils/ArrayPoolBufferWriter.cs.meta new file mode 100644 index 000000000..59e2873cc --- /dev/null +++ b/Assets/Scripts/MagicOnion/Utils/ArrayPoolBufferWriter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3c3adb89f0d51ea448be279645a9c04c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/Utils/AsyncLocalShim.cs b/Assets/Scripts/MagicOnion/Utils/AsyncLocalShim.cs new file mode 100644 index 000000000..4101c75cb --- /dev/null +++ b/Assets/Scripts/MagicOnion/Utils/AsyncLocalShim.cs @@ -0,0 +1,109 @@ +#if net45 +using System.Collections; +using System.Runtime.Remoting; +using System.Runtime.Remoting.Messaging; +using System.Linq.Expressions; +using System.Reflection; + +namespace System.Threading +{ + /// + /// Polyfill for AsyncLocal functionality added in NETSTANDARD1.3 and .NET 4.6 + /// + /// + /// The type of the value to encapsulate and follow. + /// + internal class AsyncLocal + { + private readonly string _name = Guid.NewGuid().ToString("N"); + + /// + /// Gets or set the value to flow with . + /// + public T Value + { + get + { + if (CallContext.LogicalGetData(_name) is ObjectHandle slot) + return (T)slot.Unwrap(); + return default(T); + } + set + { + // Mimic the implementation of AsyncLocal + var executionContext = Thread.CurrentThread.GetMutableExecutionContext(); + var logicalCallContext = executionContext.GetLogicalCallContext(); + var datastore = logicalCallContext.GetDatastore(); + var datastoreCopy = datastore == null ? new Hashtable() : new Hashtable(datastore); + var slot = new ObjectHandle(value); + datastoreCopy[_name] = slot; + logicalCallContext.SetDatastore(datastoreCopy); + } + } + } + + internal static class ThreadExtensions + { + private static readonly Func _getMutableExecutionContextFunc; + + static ThreadExtensions() + { + var getMutableExecutionContextMethodInfo = typeof(Thread).GetMethod("GetMutableExecutionContext", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + var instanceParameterExpression = Expression.Parameter(typeof(Thread)); + var functionCallExpression = Expression.Call(instanceParameterExpression, getMutableExecutionContextMethodInfo); + var lambdaExpression = Expression.Lambda>(functionCallExpression, instanceParameterExpression); + _getMutableExecutionContextFunc = lambdaExpression.Compile(); + } + + private static MethodInfo GetMutableExecutionContextMethodInfo = + typeof(Thread).GetMethod("GetMutableExecutionContext", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + + public static ExecutionContext GetMutableExecutionContext(this Thread thread) + => _getMutableExecutionContextFunc(thread); + } + + internal static class LogicalCallContextExtensions + { + private static readonly Func _getDatastoreFunc; + private static readonly Func _setDatastoreFunc; + + static LogicalCallContextExtensions() + { + var datastoreFieldInfo = typeof(LogicalCallContext).GetField("m_Datastore", BindingFlags.Instance | BindingFlags.NonPublic); + var instanceParameterExpression = Expression.Parameter(typeof(LogicalCallContext)); + var memberAccessExpression = Expression.MakeMemberAccess(instanceParameterExpression, datastoreFieldInfo); + var getLambdaExpression = Expression.Lambda>(memberAccessExpression, instanceParameterExpression); + _getDatastoreFunc = getLambdaExpression.Compile(); + var valueParameterExpression = Expression.Parameter(typeof(Hashtable)); + var assignmentExpression = Expression.Assign(memberAccessExpression, valueParameterExpression); + var setFunctionBody = Expression.Block(assignmentExpression, Expression.Constant(true)); + var setLambdaExpression = Expression.Lambda>(setFunctionBody, instanceParameterExpression, valueParameterExpression); + _setDatastoreFunc = setLambdaExpression.Compile(); + } + + public static Hashtable GetDatastore(this LogicalCallContext context) + => _getDatastoreFunc(context); + + public static void SetDatastore(this LogicalCallContext context, Hashtable datastore) + => _setDatastoreFunc(context, datastore); + } + + internal static class ExecutionContextExtensions + { + private static readonly Func _getLogicalCallContextFunc; + + static ExecutionContextExtensions() + { + var logicalCallContextPropertyInfo = typeof(ExecutionContext).GetProperty("LogicalCallContext", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + var instanceParameterExpression = Expression.Parameter(typeof(ExecutionContext)); + var memberAccessExpression = Expression.MakeMemberAccess(instanceParameterExpression, logicalCallContextPropertyInfo); + var lambdaExpression = Expression.Lambda>(memberAccessExpression, instanceParameterExpression); + _getLogicalCallContextFunc = lambdaExpression.Compile(); + } + + public static LogicalCallContext GetLogicalCallContext(this ExecutionContext executionContext) + => _getLogicalCallContextFunc(executionContext); + } +} + +#endif \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion/Utils/AsyncLocalShim.cs.meta b/Assets/Scripts/MagicOnion/Utils/AsyncLocalShim.cs.meta new file mode 100644 index 000000000..74978c567 --- /dev/null +++ b/Assets/Scripts/MagicOnion/Utils/AsyncLocalShim.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dca9e0a0d2088cd47b918c6f54739b95 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/Utils/DynamicAssembly.cs b/Assets/Scripts/MagicOnion/Utils/DynamicAssembly.cs new file mode 100644 index 000000000..418d708fc --- /dev/null +++ b/Assets/Scripts/MagicOnion/Utils/DynamicAssembly.cs @@ -0,0 +1,98 @@ +#if NON_UNITY || !NET_STANDARD_2_0 + +using System; +using System.Reflection; +using System.Reflection.Emit; +using System.Runtime.CompilerServices; + +namespace MagicOnion.Utils +{ +#if ENABLE_SAVE_ASSEMBLY + public +#else + internal +#endif + class DynamicAssembly + { + readonly object gate = new object(); + +#if ENABLE_SAVE_ASSEMBLY + readonly string moduleName; +#endif + readonly AssemblyBuilder assemblyBuilder; + readonly ModuleBuilder moduleBuilder; + + // don't expose ModuleBuilder(should use lock) + // public ModuleBuilder ModuleBuilder { get { return moduleBuilder; } } + + public DynamicAssembly(string moduleName) + { +#if ENABLE_SAVE_ASSEMBLY + this.moduleName = moduleName; + this.assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName(moduleName), AssemblyBuilderAccess.RunAndSave); + this.moduleBuilder = assemblyBuilder.DefineDynamicModule(moduleName, moduleName + ".dll"); +#else + this.assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName(moduleName), AssemblyBuilderAccess.Run); + this.moduleBuilder = assemblyBuilder.DefineDynamicModule(moduleName); +#endif + + // HACK: Allow access to `internal` classes from dynamically generated assembly. + // https://www.strathweb.com/2018/10/no-internalvisibleto-no-problem-bypassing-c-visibility-rules-with-roslyn/ + var ignoreAccessChecksTo = new CustomAttributeBuilder(typeof(IgnoresAccessChecksToAttribute).GetConstructor(new[] {typeof(string)}), new []{ "MagicOnion" }); + this.assemblyBuilder.SetCustomAttribute(ignoreAccessChecksTo); + } + + // requires lock on mono environment(for example, UnityEditor). see: https://github.com/neuecc/MessagePack-CSharp/issues/161 + + public TypeBuilder DefineType(string name, TypeAttributes attr) + { + lock (gate) + { + return moduleBuilder.DefineType(name, attr); + } + } + + public TypeBuilder DefineType(string name, TypeAttributes attr, Type parent) + { + lock (gate) + { + return moduleBuilder.DefineType(name, attr, parent); + } + } + + public TypeBuilder DefineType(string name, TypeAttributes attr, Type parent, Type[] interfaces) + { + lock (gate) + { + return moduleBuilder.DefineType(name, attr, parent, interfaces); + } + } + +#if ENABLE_SAVE_ASSEMBLY + + public AssemblyBuilder Save() + { + assemblyBuilder.Save(moduleName + ".dll"); + return assemblyBuilder; + } + +#endif + } +} + + +namespace System.Runtime.CompilerServices +{ + [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] + internal class IgnoresAccessChecksToAttribute : Attribute + { + public IgnoresAccessChecksToAttribute(string assemblyName) + { + AssemblyName = assemblyName; + } + + public string AssemblyName { get; } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion/Utils/DynamicAssembly.cs.meta b/Assets/Scripts/MagicOnion/Utils/DynamicAssembly.cs.meta new file mode 100644 index 000000000..d39cd5f93 --- /dev/null +++ b/Assets/Scripts/MagicOnion/Utils/DynamicAssembly.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9d0b2ee1dc31faa43811b3a203a3fc16 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/Utils/FNV1A32.cs b/Assets/Scripts/MagicOnion/Utils/FNV1A32.cs new file mode 100644 index 000000000..86bc69449 --- /dev/null +++ b/Assets/Scripts/MagicOnion/Utils/FNV1A32.cs @@ -0,0 +1,27 @@ +using System.Text; + +namespace MagicOnion.Utils +{ + public static class FNV1A32 + { + public static int GetHashCode(string str) + { + return GetHashCode(Encoding.UTF8.GetBytes(str)); + } + + public static int GetHashCode(byte[] obj) + { + uint hash = 0; + if (obj != null) + { + hash = 2166136261; + for (int i = 0; i < obj.Length; i++) + { + hash = unchecked((obj[i] ^ hash) * 16777619); + } + } + + return unchecked((int)hash); + } + } +} diff --git a/Assets/Scripts/MagicOnion/Utils/FNV1A32.cs.meta b/Assets/Scripts/MagicOnion/Utils/FNV1A32.cs.meta new file mode 100644 index 000000000..81f53b141 --- /dev/null +++ b/Assets/Scripts/MagicOnion/Utils/FNV1A32.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4257d32e13eee874493c07bf4d4bfc8f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/Utils/ILGeneratorExtensions.cs b/Assets/Scripts/MagicOnion/Utils/ILGeneratorExtensions.cs new file mode 100644 index 000000000..fc08c7f87 --- /dev/null +++ b/Assets/Scripts/MagicOnion/Utils/ILGeneratorExtensions.cs @@ -0,0 +1,170 @@ +#if NON_UNITY || !NET_STANDARD_2_0 + +using System; +using System.Reflection; +using System.Reflection.Emit; + +namespace MagicOnion.Utils +{ + // full list of can create optimize helper -> https://github.com/kevin-montrose/Sigil#automated-opcode-choice + + /// + /// Provides optimized generation code and helpers. + /// + internal static class ILGeneratorExtensions + { + /// + /// Loads the local variable at a specific index onto the evaluation stack. + /// + public static void EmitLdloc(this ILGenerator il, int index) + { + switch (index) + { + case 0: + il.Emit(OpCodes.Ldloc_0); + break; + case 1: + il.Emit(OpCodes.Ldloc_1); + break; + case 2: + il.Emit(OpCodes.Ldloc_2); + break; + case 3: + il.Emit(OpCodes.Ldloc_3); + break; + default: + if (index <= 255) + { + il.Emit(OpCodes.Ldloc_S, (byte)index); + } + else + { + il.Emit(OpCodes.Ldloc, (short)index); + } + break; + } + } + + /// + /// Pops the current value from the top of the evaluation stack and stores it in a the local variable list at a specified index. + /// + public static void EmitStloc(this ILGenerator il, int index) + { + switch (index) + { + case 0: + il.Emit(OpCodes.Stloc_0); + break; + case 1: + il.Emit(OpCodes.Stloc_1); + break; + case 2: + il.Emit(OpCodes.Stloc_2); + break; + case 3: + il.Emit(OpCodes.Stloc_3); + break; + default: + if (index <= 255) + { + il.Emit(OpCodes.Stloc_S, (byte)index); + } + else + { + il.Emit(OpCodes.Stloc, (short)index); + } + break; + } + } + + /// + /// Loads the address of the local variable at a specific index onto the evaluation statck. + /// + public static void EmitLdloca(this ILGenerator il, int index) + { + if (index <= 255) + { + il.Emit(OpCodes.Ldloca_S, (byte)index); + } + else + { + il.Emit(OpCodes.Ldloca, (short)index); + } + } + + /// + /// Pushes a supplied value of type int32 onto the evaluation stack as an int32. + /// + public static void EmitLdc_I4(this ILGenerator il, int value) + { + switch (value) + { + case -1: + il.Emit(OpCodes.Ldc_I4_M1); + break; + case 0: + il.Emit(OpCodes.Ldc_I4_0); + break; + case 1: + il.Emit(OpCodes.Ldc_I4_1); + break; + case 2: + il.Emit(OpCodes.Ldc_I4_2); + break; + case 3: + il.Emit(OpCodes.Ldc_I4_3); + break; + case 4: + il.Emit(OpCodes.Ldc_I4_4); + break; + case 5: + il.Emit(OpCodes.Ldc_I4_5); + break; + case 6: + il.Emit(OpCodes.Ldc_I4_6); + break; + case 7: + il.Emit(OpCodes.Ldc_I4_7); + break; + case 8: + il.Emit(OpCodes.Ldc_I4_8); + break; + default: + if (value >= -128 && value <= 127) + { + il.Emit(OpCodes.Ldc_I4_S, (sbyte)value); + } + else + { + il.Emit(OpCodes.Ldc_I4, value); + } + break; + } + } + + /// + /// Helper for Pop op. + /// + public static void EmitPop(this ILGenerator il, int count) + { + for (int i = 0; i < count; i++) + { + il.Emit(OpCodes.Pop); + } + } + + public static void EmitNullReturn(this ILGenerator il) + { + il.Emit(OpCodes.Ldnull); + il.Emit(OpCodes.Ret); + } + + public static void EmitThrowNotimplemented(this ILGenerator il) + { + il.Emit(OpCodes.Newobj, typeof(System.NotImplementedException).GetConstructor(Type.EmptyTypes)); + il.Emit(OpCodes.Throw); + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion/Utils/ILGeneratorExtensions.cs.meta b/Assets/Scripts/MagicOnion/Utils/ILGeneratorExtensions.cs.meta new file mode 100644 index 000000000..259c9140b --- /dev/null +++ b/Assets/Scripts/MagicOnion/Utils/ILGeneratorExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8d05c89a473ec164b8dc9a918d5c57d5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/Utils/ReflectionExtensions.cs b/Assets/Scripts/MagicOnion/Utils/ReflectionExtensions.cs new file mode 100644 index 000000000..cf707edc4 --- /dev/null +++ b/Assets/Scripts/MagicOnion/Utils/ReflectionExtensions.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Linq; +using System.Text; + +// Internal, Global. +internal static class ReflectionExtensions +{ + public static bool IsNullable(this System.Reflection.TypeInfo type) + { + return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(System.Nullable<>); + } + + public static bool IsPublic(this System.Reflection.TypeInfo type) + { + return type.IsPublic; + } + +} \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion/Utils/ReflectionExtensions.cs.meta b/Assets/Scripts/MagicOnion/Utils/ReflectionExtensions.cs.meta new file mode 100644 index 000000000..8a7359719 --- /dev/null +++ b/Assets/Scripts/MagicOnion/Utils/ReflectionExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 251abd13d00009a44979847381ea168f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/Utils/ReservedWhenAllPromise.cs b/Assets/Scripts/MagicOnion/Utils/ReservedWhenAllPromise.cs new file mode 100644 index 000000000..761253ab6 --- /dev/null +++ b/Assets/Scripts/MagicOnion/Utils/ReservedWhenAllPromise.cs @@ -0,0 +1,185 @@ +#if NON_UNITY + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.ExceptionServices; +using System.Threading; +using System.Threading.Tasks; +using System.Threading.Tasks.Sources; + +namespace MagicOnion.Utils +{ + public class ReservedWhenAllPromise : IValueTaskSource + { + static class ContinuationSentinel + { + public static readonly Action AvailableContinuation = _ => { }; + public static readonly Action CompletedContinuation = _ => { }; + } + + static readonly ContextCallback execContextCallback = ExecutionContextCallback; + static readonly SendOrPostCallback syncContextCallback = SynchronizationContextCallback; + + int completedCount; + readonly int resultCount; + + ExceptionDispatchInfo exception; + Action continuation = ContinuationSentinel.AvailableContinuation; + object state; + SynchronizationContext syncContext; + ExecutionContext execContext; + + public ReservedWhenAllPromise(int reserveCount) + { + this.resultCount = reserveCount; + } + + public ValueTask AsValueTask() => new ValueTask(this, 0); + + public void Add(ValueTask task) + { + var awaiter = task.GetAwaiter(); + if (awaiter.IsCompleted) + { + try + { + awaiter.GetResult(); + } + catch (Exception ex) + { + exception = ExceptionDispatchInfo.Capture(ex); + return; + } + TryInvokeContinuationWithIncrement(); + } + else + { + RegisterUnsafeOnCompleted(awaiter); + } + } + + void RegisterUnsafeOnCompleted(ValueTaskAwaiter awaiter) + { + awaiter.UnsafeOnCompleted(() => ContinuationWithCapture(awaiter)); + } + + void ContinuationWithCapture(ValueTaskAwaiter awaiter) + { + try + { + awaiter.GetResult(); + } + catch (Exception ex) + { + exception = ExceptionDispatchInfo.Capture(ex); + TryInvokeContinuation(); + return; + } + TryInvokeContinuationWithIncrement(); + } + + void TryInvokeContinuationWithIncrement() + { + if (Interlocked.Increment(ref completedCount) == resultCount) + { + TryInvokeContinuation(); + } + } + + void TryInvokeContinuation() + { + var c = Interlocked.Exchange(ref continuation, ContinuationSentinel.CompletedContinuation); + if (c != ContinuationSentinel.AvailableContinuation && c != ContinuationSentinel.CompletedContinuation) + { + var spinWait = new SpinWait(); + while (state == null) // worst case, state is not set yet so wait. + { + spinWait.SpinOnce(); + } + + if (execContext != null) + { + ExecutionContext.Run(execContext, execContextCallback, Tuple.Create(c, this)); + } + else if (syncContext != null) + { + syncContext.Post(syncContextCallback, Tuple.Create(c, this)); + } + else + { + c(state); + } + } + } + + public void GetResult(short token) + { + if (exception != null) + { + exception.Throw(); + } + } + + public ValueTaskSourceStatus GetStatus(short token) + { + return (completedCount == resultCount) ? ValueTaskSourceStatus.Succeeded + : (exception != null) ? ((exception.SourceException is OperationCanceledException) ? ValueTaskSourceStatus.Canceled : ValueTaskSourceStatus.Faulted) + : ValueTaskSourceStatus.Pending; + } + + public void OnCompleted(Action continuation, object state, short token, ValueTaskSourceOnCompletedFlags flags) + { + if (Interlocked.CompareExchange(ref this.continuation, continuation, ContinuationSentinel.AvailableContinuation) != ContinuationSentinel.AvailableContinuation) + { + if (this.continuation == ContinuationSentinel.CompletedContinuation) + { + continuation(state); + return; + } + throw new InvalidOperationException("does not allow multiple await."); + } + + this.state = state; + if ((flags & ValueTaskSourceOnCompletedFlags.FlowExecutionContext) == ValueTaskSourceOnCompletedFlags.FlowExecutionContext) + { + execContext = ExecutionContext.Capture(); + } + if ((flags & ValueTaskSourceOnCompletedFlags.UseSchedulingContext) == ValueTaskSourceOnCompletedFlags.UseSchedulingContext) + { + syncContext = SynchronizationContext.Current; + } + + if (GetStatus(token) != ValueTaskSourceStatus.Pending) + { + TryInvokeContinuation(); + } + } + + static void ExecutionContextCallback(object state) + { + var t = (Tuple, ReservedWhenAllPromise>)state; + var self = t.Item2; + if (self.syncContext != null) + { + SynchronizationContextCallback(state); + } + else + { + var invokeState = self.state; + self.state = null; + t.Item1.Invoke(invokeState); + } + } + + static void SynchronizationContextCallback(object state) + { + var t = (Tuple, ReservedWhenAllPromise>)state; + var self = t.Item2; + var invokeState = self.state; + self.state = null; + t.Item1.Invoke(invokeState); + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion/Utils/ReservedWhenAllPromise.cs.meta b/Assets/Scripts/MagicOnion/Utils/ReservedWhenAllPromise.cs.meta new file mode 100644 index 000000000..3a2d39e67 --- /dev/null +++ b/Assets/Scripts/MagicOnion/Utils/ReservedWhenAllPromise.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9446850abcb2fa44e9499655da1e0cbb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/Utils/TaskCompletionSourceEx.cs b/Assets/Scripts/MagicOnion/Utils/TaskCompletionSourceEx.cs new file mode 100644 index 000000000..c8677ad05 --- /dev/null +++ b/Assets/Scripts/MagicOnion/Utils/TaskCompletionSourceEx.cs @@ -0,0 +1,24 @@ +using System; +using System.Threading.Tasks; + +namespace MagicOnion.Utils +{ + internal interface ITaskCompletion + { + bool TrySetException(Exception ex); + bool TrySetCanceled(); + } + + internal class TaskCompletionSourceEx : TaskCompletionSource, ITaskCompletion + { + bool ITaskCompletion.TrySetCanceled() + { + return this.TrySetCanceled(); + } + + bool ITaskCompletion.TrySetException(Exception ex) + { + return this.TrySetException(ex); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion/Utils/TaskCompletionSourceEx.cs.meta b/Assets/Scripts/MagicOnion/Utils/TaskCompletionSourceEx.cs.meta new file mode 100644 index 000000000..d186f7d1c --- /dev/null +++ b/Assets/Scripts/MagicOnion/Utils/TaskCompletionSourceEx.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1035ff4255061dd45be4535ae9d8931f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/Utils/TaskEx.cs b/Assets/Scripts/MagicOnion/Utils/TaskEx.cs new file mode 100644 index 000000000..c23d335ae --- /dev/null +++ b/Assets/Scripts/MagicOnion/Utils/TaskEx.cs @@ -0,0 +1,15 @@ +using System.Threading.Tasks; + +namespace MagicOnion +{ + internal static class TaskEx + { + public static readonly Task CompletedTask = +#if net45 + Task.FromResult(0); +#else + Task.CompletedTask; +#endif + + } +} diff --git a/Assets/Scripts/MagicOnion/Utils/TaskEx.cs.meta b/Assets/Scripts/MagicOnion/Utils/TaskEx.cs.meta new file mode 100644 index 000000000..32560da4b --- /dev/null +++ b/Assets/Scripts/MagicOnion/Utils/TaskEx.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 536fcbe91a4c2dc4a81b84a43e4b3bab +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MagicOnion/Utils/UniqueHashDictionary.cs b/Assets/Scripts/MagicOnion/Utils/UniqueHashDictionary.cs new file mode 100644 index 000000000..4dcbcac17 --- /dev/null +++ b/Assets/Scripts/MagicOnion/Utils/UniqueHashDictionary.cs @@ -0,0 +1,158 @@ +#if NON_UNITY + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace MagicOnion.Utils +{ + public class DuplicateKeyException : Exception + { + public int HashCode { get; } + + public DuplicateKeyException(int hashCode) + : base("Duplicated. HashCode:" + hashCode) + { + HashCode = hashCode; + } + } + + /* + < 10000 String.GetHashCode is almost unique. + For example, Class/Methods lookup can avoid raw string lookup. + */ + public class UniqueHashDictionary + { + (int hash, T value)[][] table; + int indexFor; + int count; + int maxConflict; // debugging for perf. + + public int Count => count; + public int MaxConflict => maxConflict; + + public UniqueHashDictionary(params (int hashCode, T value)[] values) + { + CreateTable(values); + } + + void CreateTable((int hashCode, T value)[] values) + { + var capacity = CalculateCapacity(values.Length, 0.72f); + + table = new (int, T)[capacity][]; + indexFor = table.Length - 1; + count = values.Length; + + for (int i = 0; i < values.Length; i++) + { + ref var v = ref values[i]; + + var index = v.hashCode & indexFor; + if (table[index] == null) + { + // first case. + table[index] = new (int, T)[1] { v }; + continue; + } + else + { + ref var t = ref table[index]; + + // check duplicate + foreach (var item in t) + { + if (item.hash == v.hashCode) + { + throw new DuplicateKeyException(v.hashCode); + } + } + + // add last + Array.Resize(ref t, t.Length + 1); + t[t.Length - 1] = v; + + maxConflict = Math.Max(maxConflict, t.Length); + } + } + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public bool TryGetValue(int hashCode, out T value) + { + ref var array = ref table[hashCode & indexFor]; + if (array == null) + { + value = default(T); + return false; + } + + ref var v = ref array[0]; + if (v.hash == hashCode) + { + value = v.value; + return true; + } + + return TryGetValueSlow(ref array, hashCode, out value); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + bool TryGetValueSlow(ref (int, T)[] array, int hashCode, out T value) + { + for (int i = 1; i < array.Length; i++) // 0 is already checked. + { + ref var v = ref array[i]; + if (v.Item1 == hashCode) + { + value = v.Item2; + return true; + } + } + + value = default(T); + return false; + } + + public IEnumerable AllValues() + { + foreach (var item in table) + { + if (item != null) + { + foreach (var item2 in item) + { + yield return item2.value; + } + } + } + } + + static int CalculateCapacity(int collectionSize, float loadFactor) + { + var size = (int)(((float)collectionSize) / loadFactor); + + size--; + size |= size >> 1; + size |= size >> 2; + size |= size >> 4; + size |= size >> 8; + size |= size >> 16; + size += 1; + + // specialize adjust + if (size < 128) + { + size = 128; + } + return size; + } + + public override string ToString() + { + return $"Count:{Count} MaxConflict:{MaxConflict}"; + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Scripts/MagicOnion/Utils/UniqueHashDictionary.cs.meta b/Assets/Scripts/MagicOnion/Utils/UniqueHashDictionary.cs.meta new file mode 100644 index 000000000..ae113b201 --- /dev/null +++ b/Assets/Scripts/MagicOnion/Utils/UniqueHashDictionary.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ea92a6bb508a8d744897743fe5741f4b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack.meta b/Assets/Scripts/MessagePack.meta new file mode 100644 index 000000000..a08064028 --- /dev/null +++ b/Assets/Scripts/MessagePack.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fd3b81528828b9d45bd5f381db0441dd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Annotations.meta b/Assets/Scripts/MessagePack/Annotations.meta new file mode 100644 index 000000000..aa53ddd27 --- /dev/null +++ b/Assets/Scripts/MessagePack/Annotations.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 258cef354b8273b4ca696ab53c01327a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Annotations/Attributes.cs b/Assets/Scripts/MessagePack/Annotations/Attributes.cs new file mode 100644 index 000000000..a30280823 --- /dev/null +++ b/Assets/Scripts/MessagePack/Annotations/Attributes.cs @@ -0,0 +1,81 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; + +#pragma warning disable SA1649 // File name should match first type name + +namespace MessagePack +{ + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = true)] + public class MessagePackObjectAttribute : Attribute + { + public bool KeyAsPropertyName { get; private set; } + + public MessagePackObjectAttribute(bool keyAsPropertyName = false) + { + this.KeyAsPropertyName = keyAsPropertyName; + } + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class KeyAttribute : Attribute + { + public int? IntKey { get; private set; } + + public string StringKey { get; private set; } + + public KeyAttribute(int x) + { + this.IntKey = x; + } + + public KeyAttribute(string x) + { + this.StringKey = x; + } + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class IgnoreMemberAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class, AllowMultiple = true, Inherited = false)] + public class UnionAttribute : Attribute + { + public int Key { get; private set; } + + public Type SubType { get; private set; } + + public UnionAttribute(int key, Type subType) + { + this.Key = key; + this.SubType = subType; + } + } + + [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = true)] + public class SerializationConstructorAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface | AttributeTargets.Enum | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = true)] + public class MessagePackFormatterAttribute : Attribute + { + public Type FormatterType { get; private set; } + + public object[] Arguments { get; private set; } + + public MessagePackFormatterAttribute(Type formatterType) + { + this.FormatterType = formatterType; + } + + public MessagePackFormatterAttribute(Type formatterType, params object[] arguments) + { + this.FormatterType = formatterType; + this.Arguments = arguments; + } + } +} diff --git a/Assets/Scripts/MessagePack/Annotations/Attributes.cs.meta b/Assets/Scripts/MessagePack/Annotations/Attributes.cs.meta new file mode 100644 index 000000000..44ea4ea1e --- /dev/null +++ b/Assets/Scripts/MessagePack/Annotations/Attributes.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: db21d74c4f54408a9acd69873192155c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Annotations/IMessagePackSerializationCallbackReceiver.cs b/Assets/Scripts/MessagePack/Annotations/IMessagePackSerializationCallbackReceiver.cs new file mode 100644 index 000000000..3b1daf4cc --- /dev/null +++ b/Assets/Scripts/MessagePack/Annotations/IMessagePackSerializationCallbackReceiver.cs @@ -0,0 +1,12 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace MessagePack +{ + public interface IMessagePackSerializationCallbackReceiver + { + void OnBeforeSerialize(); + + void OnAfterDeserialize(); + } +} diff --git a/Assets/Scripts/MessagePack/Annotations/IMessagePackSerializationCallbackReceiver.cs.meta b/Assets/Scripts/MessagePack/Annotations/IMessagePackSerializationCallbackReceiver.cs.meta new file mode 100644 index 000000000..c770043be --- /dev/null +++ b/Assets/Scripts/MessagePack/Annotations/IMessagePackSerializationCallbackReceiver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ef32599edd0f43366891b8da5d4aed1e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/BitOperations.cs b/Assets/Scripts/MessagePack/BitOperations.cs new file mode 100644 index 000000000..09b2ca0dc --- /dev/null +++ b/Assets/Scripts/MessagePack/BitOperations.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +// + +#if !NETCOREAPP + +using System.Runtime.CompilerServices; + +// Some routines inspired by the Stanford Bit Twiddling Hacks by Sean Eron Anderson: +// http://graphics.stanford.edu/~seander/bithacks.html + +namespace System.Numerics +{ + /// + /// Utility methods for intrinsic bit-twiddling operations. + /// The methods use hardware intrinsics when available on the underlying platform, + /// otherwise they use optimized software fallbacks. + /// + internal static class BitOperations + { + /// + /// Rotates the specified value left by the specified number of bits. + /// Similar in behavior to the x86 instruction ROL. + /// + /// The value to rotate. + /// The number of bits to rotate by. + /// Any value outside the range [0..31] is treated as congruent mod 32. + /// The rotated value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint RotateLeft(uint value, int offset) + => (value << offset) | (value >> (32 - offset)); + } +} + +#endif diff --git a/Assets/Scripts/MessagePack/BitOperations.cs.meta b/Assets/Scripts/MessagePack/BitOperations.cs.meta new file mode 100644 index 000000000..589ad79c1 --- /dev/null +++ b/Assets/Scripts/MessagePack/BitOperations.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3c1e411a42f526567af32d094a9de348 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/BufferWriter.cs b/Assets/Scripts/MessagePack/BufferWriter.cs new file mode 100644 index 000000000..eba48fb11 --- /dev/null +++ b/Assets/Scripts/MessagePack/BufferWriter.cs @@ -0,0 +1,260 @@ +// // We want to keep this file as-is since it's shared with other repos. + +// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) Andrew Arnott. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Buffers; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace MessagePack +{ + /// + /// A fast access struct that wraps . + /// + internal ref struct BufferWriter + { + /// + /// The underlying . + /// + private IBufferWriter _output; + + /// + /// The result of the last call to , less any bytes already "consumed" with . + /// Backing field for the property. + /// + private Span _span; + + /// + /// The result of the last call to , less any bytes already "consumed" with . + /// + private ArraySegment _segment; + + /// + /// The number of uncommitted bytes (all the calls to since the last call to ). + /// + private int _buffered; + + /// + /// The total number of bytes written with this writer. + /// Backing field for the property. + /// + private long _bytesCommitted; + + private SequencePool _sequencePool; + + private SequencePool.Rental _rental; + + /// + /// Initializes a new instance of the struct. + /// + /// The to be wrapped. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public BufferWriter(IBufferWriter output) + { + _buffered = 0; + _bytesCommitted = 0; + _output = output ?? throw new ArgumentNullException(nameof(output)); + + _sequencePool = default; + _rental = default; + + var memory = _output.GetMemoryCheckResult(); + MemoryMarshal.TryGetArray(memory, out _segment); + _span = memory.Span; + } + + /// + /// Initializes a new instance of the struct. + /// + /// The pool from which to draw an if required.. + /// An array to start with so we can avoid accessing the if possible. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal BufferWriter(SequencePool sequencePool, byte[] array) + { + _buffered = 0; + _bytesCommitted = 0; + _sequencePool = sequencePool ?? throw new ArgumentNullException(nameof(sequencePool)); + _rental = default; + _output = null; + + _segment = new ArraySegment(array); + _span = _segment.AsSpan(); + } + + /// + /// Gets the result of the last call to . + /// + public Span Span => _span; + + /// + /// Gets the total number of bytes written with this writer. + /// + public long BytesCommitted => _bytesCommitted; + + /// + /// Gets the underlying this instance. + /// + internal IBufferWriter UnderlyingWriter => _output; + + internal SequencePool.Rental SequenceRental => _rental; + + public Span GetSpan(int sizeHint) + { + Ensure(sizeHint); + return this.Span; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public ref byte GetPointer(int sizeHint) + { + Ensure(sizeHint); + + if (_segment.Array != null) + { + return ref _segment.Array[_segment.Offset + _buffered]; + } + else + { + return ref _span.GetPinnableReference(); + } + } + + /// + /// Calls on the underlying writer + /// with the number of uncommitted bytes. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void Commit() + { + var buffered = _buffered; + if (buffered > 0) + { + this.MigrateToSequence(); + + _bytesCommitted += buffered; + _buffered = 0; + _output.Advance(buffered); + _span = default; + } + } + + /// + /// Used to indicate that part of the buffer has been written to. + /// + /// The number of bytes written to. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void Advance(int count) + { + _buffered += count; + _span = _span.Slice(count); + } + + /// + /// Copies the caller's buffer into this writer and calls with the length of the source buffer. + /// + /// The buffer to copy in. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void Write(ReadOnlySpan source) + { + if (_span.Length >= source.Length) + { + source.CopyTo(_span); + Advance(source.Length); + } + else + { + WriteMultiBuffer(source); + } + } + + /// + /// Acquires a new buffer if necessary to ensure that some given number of bytes can be written to a single buffer. + /// + /// The number of bytes that must be allocated in a single buffer. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void Ensure(int count = 1) + { + if (_span.Length < count) + { + EnsureMore(count); + } + } + + /// + /// Gets the span to the bytes written if they were never committed to the underlying buffer writer. + /// + /// + /// + internal bool TryGetUncommittedSpan(out ReadOnlySpan span) + { + if (this._sequencePool != null) + { + span = _segment.AsSpan(0, _buffered); + return true; + } + + span = default; + return false; + } + + /// + /// Gets a fresh span to write to, with an optional minimum size. + /// + /// The minimum size for the next requested buffer. + [MethodImpl(MethodImplOptions.NoInlining)] + private void EnsureMore(int count = 0) + { + if (_buffered > 0) + { + Commit(); + } + else + { + this.MigrateToSequence(); + } + + var memory = _output.GetMemoryCheckResult(count); + MemoryMarshal.TryGetArray(memory, out _segment); + _span = memory.Span; + } + + /// + /// Copies the caller's buffer into this writer, potentially across multiple buffers from the underlying writer. + /// + /// The buffer to copy into this writer. + private void WriteMultiBuffer(ReadOnlySpan source) + { + int copiedBytes = 0; + int bytesLeftToCopy = source.Length; + while (bytesLeftToCopy > 0) + { + if (_span.Length == 0) + { + EnsureMore(); + } + + var writable = Math.Min(bytesLeftToCopy, _span.Length); + source.Slice(copiedBytes, writable).CopyTo(_span); + copiedBytes += writable; + bytesLeftToCopy -= writable; + Advance(writable); + } + } + + private void MigrateToSequence() + { + if (this._sequencePool != null) + { + // We were writing to our private scratch memory, so we have to copy it into the actual writer. + _rental = _sequencePool.Rent(); + _output = _rental.Value; + var realSpan = _output.GetSpan(_buffered); + _segment.AsSpan(0, _buffered).CopyTo(realSpan); + _sequencePool = null; + } + } + } +} diff --git a/Assets/Scripts/MessagePack/BufferWriter.cs.meta b/Assets/Scripts/MessagePack/BufferWriter.cs.meta new file mode 100644 index 000000000..a709cf6ca --- /dev/null +++ b/Assets/Scripts/MessagePack/BufferWriter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 91a2222860edec5ff9ee6e4fe1af7668 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/ExtensionHeader.cs b/Assets/Scripts/MessagePack/ExtensionHeader.cs new file mode 100644 index 000000000..833e7299e --- /dev/null +++ b/Assets/Scripts/MessagePack/ExtensionHeader.cs @@ -0,0 +1,33 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; + +namespace MessagePack +{ +#if MESSAGEPACK_INTERNAL + internal +#else + public +#endif + struct ExtensionHeader : IEquatable + { + public sbyte TypeCode { get; private set; } + + public uint Length { get; private set; } + + public ExtensionHeader(sbyte typeCode, uint length) + { + this.TypeCode = typeCode; + this.Length = length; + } + + public ExtensionHeader(sbyte typeCode, int length) + { + this.TypeCode = typeCode; + this.Length = (uint)length; + } + + public bool Equals(ExtensionHeader other) => this.TypeCode == other.TypeCode && this.Length == other.Length; + } +} diff --git a/Assets/Scripts/MessagePack/ExtensionHeader.cs.meta b/Assets/Scripts/MessagePack/ExtensionHeader.cs.meta new file mode 100644 index 000000000..b5af89635 --- /dev/null +++ b/Assets/Scripts/MessagePack/ExtensionHeader.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 92a76851178ab369fbc386556cb866ce +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/ExtensionResult.cs b/Assets/Scripts/MessagePack/ExtensionResult.cs new file mode 100644 index 000000000..780d9bbbc --- /dev/null +++ b/Assets/Scripts/MessagePack/ExtensionResult.cs @@ -0,0 +1,34 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; + +namespace MessagePack +{ +#if MESSAGEPACK_INTERNAL + internal +#else + public +#endif + struct ExtensionResult + { + public ExtensionResult(sbyte typeCode, Memory data) + { + this.TypeCode = typeCode; + this.Data = new ReadOnlySequence(data); + } + + public ExtensionResult(sbyte typeCode, ReadOnlySequence data) + { + this.TypeCode = typeCode; + this.Data = data; + } + + public sbyte TypeCode { get; private set; } + + public ReadOnlySequence Data { get; private set; } + + public ExtensionHeader Header => new ExtensionHeader(this.TypeCode, (uint)this.Data.Length); + } +} diff --git a/Assets/Scripts/MessagePack/ExtensionResult.cs.meta b/Assets/Scripts/MessagePack/ExtensionResult.cs.meta new file mode 100644 index 000000000..cf5d492b8 --- /dev/null +++ b/Assets/Scripts/MessagePack/ExtensionResult.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 153f71ac242b4218d9debb5971c7b5d4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Formatters.meta b/Assets/Scripts/MessagePack/Formatters.meta new file mode 100644 index 000000000..541f0d57c --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4e7629820f4485c4790dbe9265bb2830 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Formatters/CollectionFormatter.cs b/Assets/Scripts/MessagePack/Formatters/CollectionFormatter.cs new file mode 100644 index 000000000..550c7f312 --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/CollectionFormatter.cs @@ -0,0 +1,1074 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Linq; +using System.Runtime.InteropServices; + +#pragma warning disable SA1649 // File name should match first type name + +namespace MessagePack.Formatters +{ + public sealed class ArrayFormatter : IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, T[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + IMessagePackFormatter formatter = options.Resolver.GetFormatterWithVerify(); + + writer.WriteArrayHeader(value.Length); + + for (int i = 0; i < value.Length; i++) + { + writer.CancellationToken.ThrowIfCancellationRequested(); + formatter.Serialize(ref writer, value[i], options); + } + } + } + + public T[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + IMessagePackFormatter formatter = options.Resolver.GetFormatterWithVerify(); + + var len = reader.ReadArrayHeader(); + var array = new T[len]; + options.Security.DepthStep(ref reader); + try + { + for (int i = 0; i < array.Length; i++) + { + reader.CancellationToken.ThrowIfCancellationRequested(); + array[i] = formatter.Deserialize(ref reader, options); + } + } + finally + { + reader.Depth--; + } + + return array; + } + } + } + + public sealed class ByteArraySegmentFormatter : IMessagePackFormatter> + { + public static readonly ByteArraySegmentFormatter Instance = new ByteArraySegmentFormatter(); + + private ByteArraySegmentFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, ArraySegment value, MessagePackSerializerOptions options) + { + if (value.Array == null) + { + writer.WriteNil(); + } + else + { + writer.Write(value); + } + } + + public ArraySegment Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadBytes() is ReadOnlySequence bytes ? new ArraySegment(bytes.ToArray()) : default; + } + } + + public sealed class ArraySegmentFormatter : IMessagePackFormatter> + { + public void Serialize(ref MessagePackWriter writer, ArraySegment value, MessagePackSerializerOptions options) + { + if (value.Array == null) + { + writer.WriteNil(); + } + else + { + IMessagePackFormatter formatter = options.Resolver.GetFormatterWithVerify(); + + writer.WriteArrayHeader(value.Count); + + T[] array = value.Array; + for (int i = 0; i < value.Count; i++) + { + writer.CancellationToken.ThrowIfCancellationRequested(); + T item = array[value.Offset + i]; + formatter.Serialize(ref writer, item, options); + } + } + } + + public ArraySegment Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + T[] array = options.Resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + return new ArraySegment(array); + } + } + } + + // List is popular format, should avoid abstraction. + public sealed class ListFormatter : IMessagePackFormatter> + { + public void Serialize(ref MessagePackWriter writer, List value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + IMessagePackFormatter formatter = options.Resolver.GetFormatterWithVerify(); + + var c = value.Count; + writer.WriteArrayHeader(c); + + for (int i = 0; i < c; i++) + { + writer.CancellationToken.ThrowIfCancellationRequested(); + formatter.Serialize(ref writer, value[i], options); + } + } + } + + public List Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + IMessagePackFormatter formatter = options.Resolver.GetFormatterWithVerify(); + + var len = reader.ReadArrayHeader(); + var list = new List((int)len); + options.Security.DepthStep(ref reader); + try + { + for (int i = 0; i < len; i++) + { + reader.CancellationToken.ThrowIfCancellationRequested(); + list.Add(formatter.Deserialize(ref reader, options)); + } + } + finally + { + reader.Depth--; + } + + return list; + } + } + } + + public abstract class CollectionFormatterBase : IMessagePackFormatter + where TCollection : IEnumerable + where TEnumerator : IEnumerator + { + public void Serialize(ref MessagePackWriter writer, TCollection value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + IMessagePackFormatter formatter = options.Resolver.GetFormatterWithVerify(); + + // Optimize iteration(array is fastest) + if (value is TElement[] array) + { + writer.WriteArrayHeader(array.Length); + + foreach (TElement item in array) + { + writer.CancellationToken.ThrowIfCancellationRequested(); + formatter.Serialize(ref writer, item, options); + } + } + else + { + // knows count or not. + var seqCount = this.GetCount(value); + if (seqCount != null) + { + writer.WriteArrayHeader(seqCount.Value); + + // Unity's foreach struct enumerator causes boxing so iterate manually. + using (var e = this.GetSourceEnumerator(value)) + { + while (e.MoveNext()) + { + writer.CancellationToken.ThrowIfCancellationRequested(); + formatter.Serialize(ref writer, e.Current, options); + } + } + } + else + { + using (var scratchRental = SequencePool.Shared.Rent()) + { + var scratch = scratchRental.Value; + MessagePackWriter scratchWriter = writer.Clone(scratch); + var count = 0; + using (var e = this.GetSourceEnumerator(value)) + { + while (e.MoveNext()) + { + writer.CancellationToken.ThrowIfCancellationRequested(); + count++; + formatter.Serialize(ref scratchWriter, e.Current, options); + } + } + + scratchWriter.Flush(); + writer.WriteArrayHeader(count); + writer.WriteRaw(scratch.AsReadOnlySequence); + } + } + } + } + } + + public TCollection Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default(TCollection); + } + else + { + IMessagePackFormatter formatter = options.Resolver.GetFormatterWithVerify(); + + var len = reader.ReadArrayHeader(); + + TIntermediate list = this.Create(len, options); + options.Security.DepthStep(ref reader); + try + { + for (int i = 0; i < len; i++) + { + reader.CancellationToken.ThrowIfCancellationRequested(); + this.Add(list, i, formatter.Deserialize(ref reader, options), options); + } + } + finally + { + reader.Depth--; + } + + return this.Complete(list); + } + } + + // abstraction for serialize + protected virtual int? GetCount(TCollection sequence) + { + var collection = sequence as ICollection; + if (collection != null) + { + return collection.Count; + } + else + { + var c2 = sequence as IReadOnlyCollection; + if (c2 != null) + { + return c2.Count; + } + } + + return null; + } + + // Some collections can use struct iterator, this is optimization path + protected abstract TEnumerator GetSourceEnumerator(TCollection source); + + // abstraction for deserialize + protected abstract TIntermediate Create(int count, MessagePackSerializerOptions options); + + protected abstract void Add(TIntermediate collection, int index, TElement value, MessagePackSerializerOptions options); + + protected abstract TCollection Complete(TIntermediate intermediateCollection); + } + + public abstract class CollectionFormatterBase : CollectionFormatterBase, TCollection> + where TCollection : IEnumerable + { + protected override IEnumerator GetSourceEnumerator(TCollection source) + { + return source.GetEnumerator(); + } + } + + public abstract class CollectionFormatterBase : CollectionFormatterBase + where TCollection : IEnumerable + { + protected sealed override TCollection Complete(TCollection intermediateCollection) + { + return intermediateCollection; + } + } + + public sealed class GenericCollectionFormatter : CollectionFormatterBase + where TCollection : ICollection, new() + { + protected override TCollection Create(int count, MessagePackSerializerOptions options) + { + return new TCollection(); + } + + protected override void Add(TCollection collection, int index, TElement value, MessagePackSerializerOptions options) + { + collection.Add(value); + } + } + + public sealed class LinkedListFormatter : CollectionFormatterBase, LinkedList.Enumerator, LinkedList> + { + protected override void Add(LinkedList collection, int index, T value, MessagePackSerializerOptions options) + { + collection.AddLast(value); + } + + protected override LinkedList Complete(LinkedList intermediateCollection) + { + return intermediateCollection; + } + + protected override LinkedList Create(int count, MessagePackSerializerOptions options) + { + return new LinkedList(); + } + + protected override LinkedList.Enumerator GetSourceEnumerator(LinkedList source) + { + return source.GetEnumerator(); + } + } + + public sealed class QueueFormatter : CollectionFormatterBase, Queue.Enumerator, Queue> + { + protected override int? GetCount(Queue sequence) + { + return sequence.Count; + } + + protected override void Add(Queue collection, int index, T value, MessagePackSerializerOptions options) + { + collection.Enqueue(value); + } + + protected override Queue Create(int count, MessagePackSerializerOptions options) + { + return new Queue(count); + } + + protected override Queue.Enumerator GetSourceEnumerator(Queue source) + { + return source.GetEnumerator(); + } + + protected override Queue Complete(Queue intermediateCollection) + { + return intermediateCollection; + } + } + + // should deserialize reverse order. + public sealed class StackFormatter : CollectionFormatterBase.Enumerator, Stack> + { + protected override int? GetCount(Stack sequence) + { + return sequence.Count; + } + + protected override void Add(T[] collection, int index, T value, MessagePackSerializerOptions options) + { + // add reverse + collection[collection.Length - 1 - index] = value; + } + + protected override T[] Create(int count, MessagePackSerializerOptions options) + { + return new T[count]; + } + + protected override Stack.Enumerator GetSourceEnumerator(Stack source) + { + return source.GetEnumerator(); + } + + protected override Stack Complete(T[] intermediateCollection) + { + return new Stack(intermediateCollection); + } + } + + public sealed class HashSetFormatter : CollectionFormatterBase, HashSet.Enumerator, HashSet> + { + protected override int? GetCount(HashSet sequence) + { + return sequence.Count; + } + + protected override void Add(HashSet collection, int index, T value, MessagePackSerializerOptions options) + { + collection.Add(value); + } + + protected override HashSet Complete(HashSet intermediateCollection) + { + return intermediateCollection; + } + + protected override HashSet Create(int count, MessagePackSerializerOptions options) + { + return new HashSet(options.Security.GetEqualityComparer()); + } + + protected override HashSet.Enumerator GetSourceEnumerator(HashSet source) + { + return source.GetEnumerator(); + } + } + + public sealed class ReadOnlyCollectionFormatter : CollectionFormatterBase> + { + protected override void Add(T[] collection, int index, T value, MessagePackSerializerOptions options) + { + collection[index] = value; + } + + protected override ReadOnlyCollection Complete(T[] intermediateCollection) + { + return new ReadOnlyCollection(intermediateCollection); + } + + protected override T[] Create(int count, MessagePackSerializerOptions options) + { + return new T[count]; + } + } + + [Obsolete("Use " + nameof(InterfaceListFormatter2) + " instead.")] + public sealed class InterfaceListFormatter : CollectionFormatterBase> + { + protected override void Add(T[] collection, int index, T value, MessagePackSerializerOptions options) + { + collection[index] = value; + } + + protected override T[] Create(int count, MessagePackSerializerOptions options) + { + return new T[count]; + } + + protected override IList Complete(T[] intermediateCollection) + { + return intermediateCollection; + } + } + + [Obsolete("Use " + nameof(InterfaceCollectionFormatter2) + " instead.")] + public sealed class InterfaceCollectionFormatter : CollectionFormatterBase> + { + protected override void Add(T[] collection, int index, T value, MessagePackSerializerOptions options) + { + collection[index] = value; + } + + protected override T[] Create(int count, MessagePackSerializerOptions options) + { + return new T[count]; + } + + protected override ICollection Complete(T[] intermediateCollection) + { + return intermediateCollection; + } + } + + public sealed class InterfaceListFormatter2 : CollectionFormatterBase, IList> + { + protected override void Add(List collection, int index, T value, MessagePackSerializerOptions options) + { + collection.Add(value); + } + + protected override List Create(int count, MessagePackSerializerOptions options) + { + return new List(count); + } + + protected override IList Complete(List intermediateCollection) + { + return intermediateCollection; + } + } + + public sealed class InterfaceCollectionFormatter2 : CollectionFormatterBase, ICollection> + { + protected override void Add(List collection, int index, T value, MessagePackSerializerOptions options) + { + collection.Add(value); + } + + protected override List Create(int count, MessagePackSerializerOptions options) + { + return new List(count); + } + + protected override ICollection Complete(List intermediateCollection) + { + return intermediateCollection; + } + } + + public sealed class InterfaceEnumerableFormatter : CollectionFormatterBase> + { + protected override void Add(T[] collection, int index, T value, MessagePackSerializerOptions options) + { + collection[index] = value; + } + + protected override T[] Create(int count, MessagePackSerializerOptions options) + { + return new T[count]; + } + + protected override IEnumerable Complete(T[] intermediateCollection) + { + return intermediateCollection; + } + } + + // [Key, [Array]] + public sealed class InterfaceGroupingFormatter : IMessagePackFormatter> + { + public void Serialize(ref MessagePackWriter writer, IGrouping value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(2); + options.Resolver.GetFormatterWithVerify().Serialize(ref writer, value.Key, options); + options.Resolver.GetFormatterWithVerify>().Serialize(ref writer, value, options); + } + } + + public IGrouping Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return null; + } + else + { + var count = reader.ReadArrayHeader(); + + if (count != 2) + { + throw new MessagePackSerializationException("Invalid Grouping format."); + } + + options.Security.DepthStep(ref reader); + try + { + TKey key = options.Resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + IEnumerable value = options.Resolver.GetFormatterWithVerify>().Deserialize(ref reader, options); + return new Grouping(key, value); + } + finally + { + reader.Depth--; + } + } + } + } + + public sealed class InterfaceLookupFormatter : CollectionFormatterBase, Dictionary>, ILookup> + { + protected override void Add(Dictionary> collection, int index, IGrouping value, MessagePackSerializerOptions options) + { + collection.Add(value.Key, value); + } + + protected override ILookup Complete(Dictionary> intermediateCollection) + { + return new Lookup(intermediateCollection); + } + + protected override Dictionary> Create(int count, MessagePackSerializerOptions options) + { + return new Dictionary>(count); + } + } + + internal class Grouping : IGrouping + { + private readonly TKey key; + private readonly IEnumerable elements; + + public Grouping(TKey key, IEnumerable elements) + { + this.key = key; + this.elements = elements; + } + + public TKey Key + { + get + { + return this.key; + } + } + + public IEnumerator GetEnumerator() + { + return this.elements.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return this.elements.GetEnumerator(); + } + } + + internal class Lookup : ILookup + { + private readonly Dictionary> groupings; + + public Lookup(Dictionary> groupings) + { + this.groupings = groupings; + } + + public IEnumerable this[TKey key] + { + get + { + return this.groupings[key]; + } + } + + public int Count + { + get + { + return this.groupings.Count; + } + } + + public bool Contains(TKey key) + { + return this.groupings.ContainsKey(key); + } + + public IEnumerator> GetEnumerator() + { + return this.groupings.Values.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return this.groupings.Values.GetEnumerator(); + } + } + + /* NonGenerics */ + + public sealed class NonGenericListFormatter : IMessagePackFormatter + where T : class, IList, new() + { + public void Serialize(ref MessagePackWriter writer, T value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + return; + } + + IMessagePackFormatter formatter = options.Resolver.GetFormatterWithVerify(); + + writer.WriteArrayHeader(value.Count); + foreach (var item in value) + { + writer.CancellationToken.ThrowIfCancellationRequested(); + formatter.Serialize(ref writer, item, options); + } + } + + public T Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default(T); + } + + IMessagePackFormatter formatter = options.Resolver.GetFormatterWithVerify(); + + var count = reader.ReadArrayHeader(); + + var list = new T(); + options.Security.DepthStep(ref reader); + try + { + for (int i = 0; i < count; i++) + { + reader.CancellationToken.ThrowIfCancellationRequested(); + list.Add(formatter.Deserialize(ref reader, options)); + } + } + finally + { + reader.Depth--; + } + + return list; + } + } + + public sealed class NonGenericInterfaceListFormatter : IMessagePackFormatter + { + public static readonly IMessagePackFormatter Instance = new NonGenericInterfaceListFormatter(); + + private NonGenericInterfaceListFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, IList value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + return; + } + + IMessagePackFormatter formatter = options.Resolver.GetFormatterWithVerify(); + + writer.WriteArrayHeader(value.Count); + foreach (var item in value) + { + writer.CancellationToken.ThrowIfCancellationRequested(); + formatter.Serialize(ref writer, item, options); + } + } + + public IList Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default(IList); + } + + IMessagePackFormatter formatter = options.Resolver.GetFormatterWithVerify(); + + var count = reader.ReadArrayHeader(); + + var list = new object[count]; + options.Security.DepthStep(ref reader); + try + { + for (int i = 0; i < count; i++) + { + reader.CancellationToken.ThrowIfCancellationRequested(); + list[i] = formatter.Deserialize(ref reader, options); + } + } + finally + { + reader.Depth--; + } + + return list; + } + } + + public sealed class NonGenericDictionaryFormatter : IMessagePackFormatter + where T : class, IDictionary, new() + { + public void Serialize(ref MessagePackWriter writer, T value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + return; + } + + IMessagePackFormatter formatter = options.Resolver.GetFormatterWithVerify(); + + writer.WriteMapHeader(value.Count); + foreach (DictionaryEntry item in value) + { + writer.CancellationToken.ThrowIfCancellationRequested(); + formatter.Serialize(ref writer, item.Key, options); + formatter.Serialize(ref writer, item.Value, options); + } + } + + public T Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return null; + } + + IMessagePackFormatter formatter = options.Resolver.GetFormatterWithVerify(); + + var count = reader.ReadMapHeader(); + + var dict = CollectionHelpers.CreateHashCollection(count, options.Security.GetEqualityComparer()); + options.Security.DepthStep(ref reader); + try + { + for (int i = 0; i < count; i++) + { + reader.CancellationToken.ThrowIfCancellationRequested(); + var key = formatter.Deserialize(ref reader, options); + var value = formatter.Deserialize(ref reader, options); + dict.Add(key, value); + } + } + finally + { + reader.Depth--; + } + + return dict; + } + } + + public sealed class NonGenericInterfaceDictionaryFormatter : IMessagePackFormatter + { + public static readonly IMessagePackFormatter Instance = new NonGenericInterfaceDictionaryFormatter(); + + private NonGenericInterfaceDictionaryFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, IDictionary value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + return; + } + + IMessagePackFormatter formatter = options.Resolver.GetFormatterWithVerify(); + + writer.WriteMapHeader(value.Count); + foreach (DictionaryEntry item in value) + { + writer.CancellationToken.ThrowIfCancellationRequested(); + formatter.Serialize(ref writer, item.Key, options); + formatter.Serialize(ref writer, item.Value, options); + } + } + + public IDictionary Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return null; + } + + IMessagePackFormatter formatter = options.Resolver.GetFormatterWithVerify(); + + var count = reader.ReadMapHeader(); + + var dict = new Dictionary(count, options.Security.GetEqualityComparer()); + options.Security.DepthStep(ref reader); + try + { + for (int i = 0; i < count; i++) + { + reader.CancellationToken.ThrowIfCancellationRequested(); + var key = formatter.Deserialize(ref reader, options); + var value = formatter.Deserialize(ref reader, options); + dict.Add(key, value); + } + } + finally + { + reader.Depth--; + } + + return dict; + } + } + + public sealed class ObservableCollectionFormatter : CollectionFormatterBase> + { + protected override void Add(ObservableCollection collection, int index, T value, MessagePackSerializerOptions options) + { + collection.Add(value); + } + + protected override ObservableCollection Create(int count, MessagePackSerializerOptions options) + { + return new ObservableCollection(); + } + } + + public sealed class ReadOnlyObservableCollectionFormatter : CollectionFormatterBase, ReadOnlyObservableCollection> + { + protected override void Add(ObservableCollection collection, int index, T value, MessagePackSerializerOptions options) + { + collection.Add(value); + } + + protected override ObservableCollection Create(int count, MessagePackSerializerOptions options) + { + return new ObservableCollection(); + } + + protected override ReadOnlyObservableCollection Complete(ObservableCollection intermediateCollection) + { + return new ReadOnlyObservableCollection(intermediateCollection); + } + } + + public sealed class InterfaceReadOnlyListFormatter : CollectionFormatterBase> + { + protected override void Add(T[] collection, int index, T value, MessagePackSerializerOptions options) + { + collection[index] = value; + } + + protected override T[] Create(int count, MessagePackSerializerOptions options) + { + return new T[count]; + } + + protected override IReadOnlyList Complete(T[] intermediateCollection) + { + return intermediateCollection; + } + } + + public sealed class InterfaceReadOnlyCollectionFormatter : CollectionFormatterBase> + { + protected override void Add(T[] collection, int index, T value, MessagePackSerializerOptions options) + { + collection[index] = value; + } + + protected override T[] Create(int count, MessagePackSerializerOptions options) + { + return new T[count]; + } + + protected override IReadOnlyCollection Complete(T[] intermediateCollection) + { + return intermediateCollection; + } + } + + public sealed class InterfaceSetFormatter : CollectionFormatterBase, ISet> + { + protected override void Add(HashSet collection, int index, T value, MessagePackSerializerOptions options) + { + collection.Add(value); + } + + protected override ISet Complete(HashSet intermediateCollection) + { + return intermediateCollection; + } + + protected override HashSet Create(int count, MessagePackSerializerOptions options) + { + return new HashSet(options.Security.GetEqualityComparer()); + } + } + + public sealed class ConcurrentBagFormatter : CollectionFormatterBase> + { + protected override int? GetCount(ConcurrentBag sequence) + { + return sequence.Count; + } + + protected override void Add(ConcurrentBag collection, int index, T value, MessagePackSerializerOptions options) + { + collection.Add(value); + } + + protected override ConcurrentBag Create(int count, MessagePackSerializerOptions options) + { + return new ConcurrentBag(); + } + } + + public sealed class ConcurrentQueueFormatter : CollectionFormatterBase> + { + protected override int? GetCount(ConcurrentQueue sequence) + { + return sequence.Count; + } + + protected override void Add(ConcurrentQueue collection, int index, T value, MessagePackSerializerOptions options) + { + collection.Enqueue(value); + } + + protected override ConcurrentQueue Create(int count, MessagePackSerializerOptions options) + { + return new ConcurrentQueue(); + } + } + + public sealed class ConcurrentStackFormatter : CollectionFormatterBase> + { + protected override int? GetCount(ConcurrentStack sequence) + { + return sequence.Count; + } + + protected override void Add(T[] collection, int index, T value, MessagePackSerializerOptions options) + { + // add reverse + collection[collection.Length - 1 - index] = value; + } + + protected override T[] Create(int count, MessagePackSerializerOptions options) + { + return new T[count]; + } + + protected override ConcurrentStack Complete(T[] intermediateCollection) + { + return new ConcurrentStack(intermediateCollection); + } + } +} diff --git a/Assets/Scripts/MessagePack/Formatters/CollectionFormatter.cs.meta b/Assets/Scripts/MessagePack/Formatters/CollectionFormatter.cs.meta new file mode 100644 index 000000000..7254af620 --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/CollectionFormatter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f92b8946eec0ab476a689a0dfa8c2498 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Formatters/CollectionHelpers`2.cs b/Assets/Scripts/MessagePack/Formatters/CollectionHelpers`2.cs new file mode 100644 index 000000000..bb1a3c6d1 --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/CollectionHelpers`2.cs @@ -0,0 +1,52 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Linq.Expressions; + +namespace MessagePack.Formatters +{ + /// + /// Provides general helpers for creating collections (including dictionaries). + /// + /// The concrete type of collection to create. + /// The type of equality comparer that we would hope to pass into the collection's constructor. + internal static class CollectionHelpers + where TCollection : new() + { + /// + /// The delegate that will create the collection, if the typical (int count, IEqualityComparer{T} equalityComparer) constructor was found. + /// + private static Func collectionCreator; + + /// + /// Initializes static members of the class. + /// + /// + /// Initializes a delegate that is optimized to create a collection of a given size and using the given equality comparer, if possible. + /// + static CollectionHelpers() + { + var ctor = typeof(TCollection).GetConstructor(new Type[] { typeof(int), typeof(TEqualityComparer) }); + if (ctor != null) + { + ParameterExpression param1 = Expression.Parameter(typeof(int), "count"); + ParameterExpression param2 = Expression.Parameter(typeof(TEqualityComparer), "equalityComparer"); + NewExpression body = Expression.New(ctor, param1, param2); + collectionCreator = Expression.Lambda>(body, param1, param2).Compile(); + } + } + + /// + /// Initializes a new instance of the collection. + /// + /// The number of elements the collection should be prepared to receive. + /// The equality comparer to initialize the collection with. + /// The newly initialized collection. + /// + /// Use of the and are a best effort. + /// If we can't find a constructor on the collection in the expected shape, we'll just instantiate the collection with its default constructor. + /// + internal static TCollection CreateHashCollection(int count, TEqualityComparer equalityComparer) => collectionCreator != null ? collectionCreator.Invoke(count, equalityComparer) : new TCollection(); + } +} diff --git a/Assets/Scripts/MessagePack/Formatters/CollectionHelpers`2.cs.meta b/Assets/Scripts/MessagePack/Formatters/CollectionHelpers`2.cs.meta new file mode 100644 index 000000000..d61034b79 --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/CollectionHelpers`2.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 25f9fe82ddb369c8f9600901293b80f8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Formatters/DateTimeFormatters.cs b/Assets/Scripts/MessagePack/Formatters/DateTimeFormatters.cs new file mode 100644 index 000000000..e7d948109 --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/DateTimeFormatters.cs @@ -0,0 +1,70 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; + +#pragma warning disable SA1649 // File name should match first type name + +namespace MessagePack.Formatters +{ + /// + /// Serialize by .NET native DateTime binary format. + /// + public sealed class NativeDateTimeFormatter : IMessagePackFormatter + { + public static readonly NativeDateTimeFormatter Instance = new NativeDateTimeFormatter(); + + public void Serialize(ref MessagePackWriter writer, DateTime value, MessagePackSerializerOptions options) + { + var dateData = value.ToBinary(); + writer.Write(dateData); + } + + public DateTime Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var dateData = reader.ReadInt64(); + return DateTime.FromBinary(dateData); + } + } + + public sealed class NativeDateTimeArrayFormatter : IMessagePackFormatter + { + public static readonly NativeDateTimeArrayFormatter Instance = new NativeDateTimeArrayFormatter(); + + public void Serialize(ref MessagePackWriter writer, DateTime[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(value.Length); + for (int i = 0; i < value.Length; i++) + { + writer.Write(value[i].ToBinary()); + } + } + } + + public DateTime[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return null; + } + else + { + var len = reader.ReadArrayHeader(); + var array = new DateTime[len]; + for (int i = 0; i < array.Length; i++) + { + var dateData = reader.ReadInt64(); + array[i] = DateTime.FromBinary(dateData); + } + + return array; + } + } + } +} diff --git a/Assets/Scripts/MessagePack/Formatters/DateTimeFormatters.cs.meta b/Assets/Scripts/MessagePack/Formatters/DateTimeFormatters.cs.meta new file mode 100644 index 000000000..6dfbe36a6 --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/DateTimeFormatters.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e28b94bd9483c36efae78067f97c65cb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Formatters/DictionaryFormatter.cs b/Assets/Scripts/MessagePack/Formatters/DictionaryFormatter.cs new file mode 100644 index 000000000..4b9347a14 --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/DictionaryFormatter.cs @@ -0,0 +1,280 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Reflection; + +#pragma warning disable SA1649 // File name should match first type name + +namespace MessagePack.Formatters +{ + // unfortunately, can't use IDictionary because supports IReadOnlyDictionary. + public abstract class DictionaryFormatterBase : IMessagePackFormatter + where TDictionary : IEnumerable> + where TEnumerator : IEnumerator> + { + public void Serialize(ref MessagePackWriter writer, TDictionary value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + IFormatterResolver resolver = options.Resolver; + IMessagePackFormatter keyFormatter = resolver.GetFormatterWithVerify(); + IMessagePackFormatter valueFormatter = resolver.GetFormatterWithVerify(); + + int count; + { + var col = value as ICollection>; + if (col != null) + { + count = col.Count; + } + else + { + var col2 = value as IReadOnlyCollection>; + if (col2 != null) + { + count = col2.Count; + } + else + { + throw new MessagePackSerializationException("DictionaryFormatterBase's TDictionary supports only ICollection or IReadOnlyCollection"); + } + } + } + + writer.WriteMapHeader(count); + + TEnumerator e = this.GetSourceEnumerator(value); + try + { + while (e.MoveNext()) + { + writer.CancellationToken.ThrowIfCancellationRequested(); + KeyValuePair item = e.Current; + keyFormatter.Serialize(ref writer, item.Key, options); + valueFormatter.Serialize(ref writer, item.Value, options); + } + } + finally + { + e.Dispose(); + } + } + } + + public TDictionary Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default(TDictionary); + } + else + { + IFormatterResolver resolver = options.Resolver; + IMessagePackFormatter keyFormatter = resolver.GetFormatterWithVerify(); + IMessagePackFormatter valueFormatter = resolver.GetFormatterWithVerify(); + + var len = reader.ReadMapHeader(); + + TIntermediate dict = this.Create(len, options); + options.Security.DepthStep(ref reader); + try + { + for (int i = 0; i < len; i++) + { + reader.CancellationToken.ThrowIfCancellationRequested(); + TKey key = keyFormatter.Deserialize(ref reader, options); + + TValue value = valueFormatter.Deserialize(ref reader, options); + + this.Add(dict, i, key, value, options); + } + } + finally + { + reader.Depth--; + } + + return this.Complete(dict); + } + } + + // abstraction for serialize + + // Some collections can use struct iterator, this is optimization path + protected abstract TEnumerator GetSourceEnumerator(TDictionary source); + + // abstraction for deserialize + protected abstract TIntermediate Create(int count, MessagePackSerializerOptions options); + + protected abstract void Add(TIntermediate collection, int index, TKey key, TValue value, MessagePackSerializerOptions options); + + protected abstract TDictionary Complete(TIntermediate intermediateCollection); + } + + public abstract class DictionaryFormatterBase : DictionaryFormatterBase>, TDictionary> + where TDictionary : IEnumerable> + { + protected override IEnumerator> GetSourceEnumerator(TDictionary source) + { + return source.GetEnumerator(); + } + } + + public abstract class DictionaryFormatterBase : DictionaryFormatterBase + where TDictionary : IDictionary + { + protected override TDictionary Complete(TDictionary intermediateCollection) + { + return intermediateCollection; + } + } + + public sealed class DictionaryFormatter : DictionaryFormatterBase, Dictionary.Enumerator, Dictionary> + { + protected override void Add(Dictionary collection, int index, TKey key, TValue value, MessagePackSerializerOptions options) + { + collection.Add(key, value); + } + + protected override Dictionary Complete(Dictionary intermediateCollection) + { + return intermediateCollection; + } + + protected override Dictionary Create(int count, MessagePackSerializerOptions options) + { + return new Dictionary(count, options.Security.GetEqualityComparer()); + } + + protected override Dictionary.Enumerator GetSourceEnumerator(Dictionary source) + { + return source.GetEnumerator(); + } + } + + public sealed class GenericDictionaryFormatter : DictionaryFormatterBase + where TDictionary : IDictionary, new() + { + protected override void Add(TDictionary collection, int index, TKey key, TValue value, MessagePackSerializerOptions options) + { + collection.Add(key, value); + } + + protected override TDictionary Create(int count, MessagePackSerializerOptions options) + { + return CollectionHelpers>.CreateHashCollection(count, options.Security.GetEqualityComparer()); + } + } + + public sealed class InterfaceDictionaryFormatter : DictionaryFormatterBase, IDictionary> + { + protected override void Add(Dictionary collection, int index, TKey key, TValue value, MessagePackSerializerOptions options) + { + collection.Add(key, value); + } + + protected override Dictionary Create(int count, MessagePackSerializerOptions options) + { + return new Dictionary(count, options.Security.GetEqualityComparer()); + } + + protected override IDictionary Complete(Dictionary intermediateCollection) + { + return intermediateCollection; + } + } + + public sealed class SortedListFormatter : DictionaryFormatterBase> + { + protected override void Add(SortedList collection, int index, TKey key, TValue value, MessagePackSerializerOptions options) + { + collection.Add(key, value); + } + + protected override SortedList Create(int count, MessagePackSerializerOptions options) + { + return new SortedList(count); + } + } + + public sealed class SortedDictionaryFormatter : DictionaryFormatterBase, SortedDictionary.Enumerator, SortedDictionary> + { + protected override void Add(SortedDictionary collection, int index, TKey key, TValue value, MessagePackSerializerOptions options) + { + collection.Add(key, value); + } + + protected override SortedDictionary Complete(SortedDictionary intermediateCollection) + { + return intermediateCollection; + } + + protected override SortedDictionary Create(int count, MessagePackSerializerOptions options) + { + return new SortedDictionary(); + } + + protected override SortedDictionary.Enumerator GetSourceEnumerator(SortedDictionary source) + { + return source.GetEnumerator(); + } + } + + public sealed class ReadOnlyDictionaryFormatter : DictionaryFormatterBase, ReadOnlyDictionary> + { + protected override void Add(Dictionary collection, int index, TKey key, TValue value, MessagePackSerializerOptions options) + { + collection.Add(key, value); + } + + protected override ReadOnlyDictionary Complete(Dictionary intermediateCollection) + { + return new ReadOnlyDictionary(intermediateCollection); + } + + protected override Dictionary Create(int count, MessagePackSerializerOptions options) + { + return new Dictionary(count, options.Security.GetEqualityComparer()); + } + } + + public sealed class InterfaceReadOnlyDictionaryFormatter : DictionaryFormatterBase, IReadOnlyDictionary> + { + protected override void Add(Dictionary collection, int index, TKey key, TValue value, MessagePackSerializerOptions options) + { + collection.Add(key, value); + } + + protected override IReadOnlyDictionary Complete(Dictionary intermediateCollection) + { + return intermediateCollection; + } + + protected override Dictionary Create(int count, MessagePackSerializerOptions options) + { + return new Dictionary(count, options.Security.GetEqualityComparer()); + } + } + + public sealed class ConcurrentDictionaryFormatter : DictionaryFormatterBase> + { + protected override void Add(ConcurrentDictionary collection, int index, TKey key, TValue value, MessagePackSerializerOptions options) + { + collection.TryAdd(key, value); + } + + protected override ConcurrentDictionary Create(int count, MessagePackSerializerOptions options) + { + // concurrent dictionary can't access defaultConcurrecyLevel so does not use count overload. + return new ConcurrentDictionary(options.Security.GetEqualityComparer()); + } + } +} diff --git a/Assets/Scripts/MessagePack/Formatters/DictionaryFormatter.cs.meta b/Assets/Scripts/MessagePack/Formatters/DictionaryFormatter.cs.meta new file mode 100644 index 000000000..c78f568e9 --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/DictionaryFormatter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3f0984a238b11bd2c97eb781371bb121 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Formatters/DynamicObjectTypeFallbackFormatter.cs b/Assets/Scripts/MessagePack/Formatters/DynamicObjectTypeFallbackFormatter.cs new file mode 100644 index 000000000..5bd6d77df --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/DynamicObjectTypeFallbackFormatter.cs @@ -0,0 +1,82 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Linq.Expressions; +using System.Reflection; + +namespace MessagePack.Formatters +{ + /// + /// This formatter can serialize any value whose static type is + /// for which another resolver can provide a formatter for the runtime type. + /// Its deserialization is limited to forwarding all calls to the . + /// + public sealed class DynamicObjectTypeFallbackFormatter : IMessagePackFormatter + { + public static readonly IMessagePackFormatter Instance = new DynamicObjectTypeFallbackFormatter(); + + private delegate void SerializeMethod(object dynamicFormatter, ref MessagePackWriter writer, object value, MessagePackSerializerOptions options); + + private static readonly Internal.ThreadsafeTypeKeyHashTable SerializerDelegates = new Internal.ThreadsafeTypeKeyHashTable(); + + private DynamicObjectTypeFallbackFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, object value, MessagePackSerializerOptions options) + { + if (value is null) + { + writer.WriteNil(); + return; + } + + Type type = value.GetType(); + TypeInfo ti = type.GetTypeInfo(); + + if (type == typeof(object)) + { + // serialize to empty map + writer.WriteMapHeader(0); + return; + } + + object formatter = options.Resolver.GetFormatterDynamicWithVerify(type); + if (!SerializerDelegates.TryGetValue(type, out SerializeMethod serializerDelegate)) + { + lock (SerializerDelegates) + { + if (!SerializerDelegates.TryGetValue(type, out serializerDelegate)) + { + Type formatterType = typeof(IMessagePackFormatter<>).MakeGenericType(type); + ParameterExpression param0 = Expression.Parameter(typeof(object), "formatter"); + ParameterExpression param1 = Expression.Parameter(typeof(MessagePackWriter).MakeByRefType(), "writer"); + ParameterExpression param2 = Expression.Parameter(typeof(object), "value"); + ParameterExpression param3 = Expression.Parameter(typeof(MessagePackSerializerOptions), "options"); + + MethodInfo serializeMethodInfo = formatterType.GetRuntimeMethod("Serialize", new[] { typeof(MessagePackWriter).MakeByRefType(), type, typeof(MessagePackSerializerOptions) }); + + MethodCallExpression body = Expression.Call( + Expression.Convert(param0, formatterType), + serializeMethodInfo, + param1, + ti.IsValueType ? Expression.Unbox(param2, type) : Expression.Convert(param2, type), + param3); + + serializerDelegate = Expression.Lambda(body, param0, param1, param2, param3).Compile(); + + SerializerDelegates.TryAdd(type, serializerDelegate); + } + } + } + + serializerDelegate(formatter, ref writer, value, options); + } + + public object Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return PrimitiveObjectFormatter.Instance.Deserialize(ref reader, options); + } + } +} diff --git a/Assets/Scripts/MessagePack/Formatters/DynamicObjectTypeFallbackFormatter.cs.meta b/Assets/Scripts/MessagePack/Formatters/DynamicObjectTypeFallbackFormatter.cs.meta new file mode 100644 index 000000000..a5400f97b --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/DynamicObjectTypeFallbackFormatter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bc47abc7cd51279d9ac40fe1da6ffa1d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Formatters/EnumAsStringFormatter`1.cs b/Assets/Scripts/MessagePack/Formatters/EnumAsStringFormatter`1.cs new file mode 100644 index 000000000..933396618 --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/EnumAsStringFormatter`1.cs @@ -0,0 +1,128 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Runtime.Serialization; + +namespace MessagePack.Formatters +{ + // Note:This implementation is 'not' fastest, should more improve. + public sealed class EnumAsStringFormatter : IMessagePackFormatter + { + private readonly IReadOnlyDictionary nameValueMapping; + private readonly IReadOnlyDictionary valueNameMapping; + private readonly IReadOnlyDictionary clrToSerializationName; + private readonly IReadOnlyDictionary serializationToClrName; + private readonly bool enumMemberOverridesPresent; + private readonly bool isFlags; + + public EnumAsStringFormatter() + { + this.isFlags = typeof(T).GetCustomAttribute() is object; + + var fields = typeof(T).GetFields(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Static); + var nameValueMapping = new Dictionary(fields.Length); + var valueNameMapping = new Dictionary(); + Dictionary clrToSerializationName = null; + Dictionary serializationToClrName = null; + + foreach (FieldInfo enumValueMember in fields) + { + string name = enumValueMember.Name; + T value = (T)enumValueMember.GetValue(null); + + // Consider the case where the serialized form of the enum value is overridden via an attribute. + var attribute = enumValueMember.GetCustomAttribute(); + if (attribute?.IsValueSetExplicitly ?? false) + { + clrToSerializationName = clrToSerializationName ?? new Dictionary(); + serializationToClrName = serializationToClrName ?? new Dictionary(); + + clrToSerializationName.Add(name, attribute.Value); + serializationToClrName.Add(attribute.Value, name); + + name = attribute.Value; + this.enumMemberOverridesPresent = true; + } + + nameValueMapping[name] = value; + valueNameMapping[value] = name; + } + + this.nameValueMapping = nameValueMapping; + this.valueNameMapping = valueNameMapping; + this.clrToSerializationName = clrToSerializationName; + this.serializationToClrName = serializationToClrName; + } + + public void Serialize(ref MessagePackWriter writer, T value, MessagePackSerializerOptions options) + { + // Enum.ToString() is slow, so avoid it when we can. + if (!this.valueNameMapping.TryGetValue(value, out string valueString)) + { + // fallback for flags, values with no name, etc + valueString = this.GetSerializedNames(value.ToString()); + } + + writer.Write(valueString); + } + + public T Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + string name = reader.ReadString(); + + // Avoid Enum.Parse when we can because it is too slow. + if (!this.nameValueMapping.TryGetValue(name, out T value)) + { + value = (T)Enum.Parse(typeof(T), this.GetClrNames(name)); + } + + return value; + } + + private string GetClrNames(string serializedNames) + { + if (this.enumMemberOverridesPresent && this.isFlags && serializedNames.IndexOf(", ", StringComparison.Ordinal) >= 0) + { + return Translate(serializedNames, this.serializationToClrName); + } + + // We don't need to consider the trivial case of no commas because our caller would have found that in the lookup table and not called us. + return serializedNames; + } + + private string GetSerializedNames(string clrNames) + { + if (this.enumMemberOverridesPresent && this.isFlags && clrNames.IndexOf(", ", StringComparison.Ordinal) >= 0) + { + return Translate(clrNames, this.clrToSerializationName); + } + + // We don't need to consider the trivial case of no commas because our caller would have found that in the lookup table and not called us. + return clrNames; + } + + private static string Translate(string items, IReadOnlyDictionary mapping) + { + string[] elements = items.Split(','); + + for (int i = 0; i < elements.Length; i++) + { + // Trim the leading space if there is one (due to the delimiter being ", "). + if (i > 0 && elements[i].Length > 0 && elements[i][0] == ' ') + { + elements[i] = elements[i].Substring(1); + } + + if (mapping.TryGetValue(elements[i], out string substituteValue)) + { + elements[i] = substituteValue; + } + } + + return string.Join(", ", elements); + } + } +} diff --git a/Assets/Scripts/MessagePack/Formatters/EnumAsStringFormatter`1.cs.meta b/Assets/Scripts/MessagePack/Formatters/EnumAsStringFormatter`1.cs.meta new file mode 100644 index 000000000..8c34d09c4 --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/EnumAsStringFormatter`1.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f7cdc1e759af9873989648baa08f0350 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Formatters/GenericEnumFormatter`1.cs b/Assets/Scripts/MessagePack/Formatters/GenericEnumFormatter`1.cs new file mode 100644 index 000000000..02c64fa33 --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/GenericEnumFormatter`1.cs @@ -0,0 +1,73 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Runtime.CompilerServices; + +namespace MessagePack.Formatters +{ + public sealed class GenericEnumFormatter : IMessagePackFormatter + where T : Enum + { + private delegate void EnumSerialize(ref MessagePackWriter writer, ref T value); + + private delegate T EnumDeserialize(ref MessagePackReader reader); + + private readonly EnumSerialize serializer; + private readonly EnumDeserialize deserializer; + + public GenericEnumFormatter() + { + var underlyingType = typeof(T).GetEnumUnderlyingType(); + switch (Type.GetTypeCode(underlyingType)) + { +#pragma warning disable SA1107 // Avoid multiple statements on same line. + case TypeCode.Byte: + serializer = (ref MessagePackWriter writer, ref T value) => writer.Write(Unsafe.As(ref value)); + deserializer = (ref MessagePackReader reader) => { var v = reader.ReadByte(); return Unsafe.As(ref v); }; + break; + case TypeCode.Int16: + serializer = (ref MessagePackWriter writer, ref T value) => writer.Write(Unsafe.As(ref value)); + deserializer = (ref MessagePackReader reader) => { var v = reader.ReadInt16(); return Unsafe.As(ref v); }; + break; + case TypeCode.Int32: + serializer = (ref MessagePackWriter writer, ref T value) => writer.Write(Unsafe.As(ref value)); + deserializer = (ref MessagePackReader reader) => { var v = reader.ReadInt32(); return Unsafe.As(ref v); }; + break; + case TypeCode.Int64: + serializer = (ref MessagePackWriter writer, ref T value) => writer.Write(Unsafe.As(ref value)); + deserializer = (ref MessagePackReader reader) => { var v = reader.ReadInt64(); return Unsafe.As(ref v); }; + break; + case TypeCode.SByte: + serializer = (ref MessagePackWriter writer, ref T value) => writer.Write(Unsafe.As(ref value)); + deserializer = (ref MessagePackReader reader) => { var v = reader.ReadSByte(); return Unsafe.As(ref v); }; + break; + case TypeCode.UInt16: + serializer = (ref MessagePackWriter writer, ref T value) => writer.Write(Unsafe.As(ref value)); + deserializer = (ref MessagePackReader reader) => { var v = reader.ReadUInt16(); return Unsafe.As(ref v); }; + break; + case TypeCode.UInt32: + serializer = (ref MessagePackWriter writer, ref T value) => writer.Write(Unsafe.As(ref value)); + deserializer = (ref MessagePackReader reader) => { var v = reader.ReadUInt32(); return Unsafe.As(ref v); }; + break; + case TypeCode.UInt64: + serializer = (ref MessagePackWriter writer, ref T value) => writer.Write(Unsafe.As(ref value)); + deserializer = (ref MessagePackReader reader) => { var v = reader.ReadUInt64(); return Unsafe.As(ref v); }; + break; + default: + break; +#pragma warning restore SA1107 // Avoid multiple statements on same line. + } + } + + public void Serialize(ref MessagePackWriter writer, T value, MessagePackSerializerOptions options) + { + serializer(ref writer, ref value); + } + + public T Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return deserializer(ref reader); + } + } +} diff --git a/Assets/Scripts/MessagePack/Formatters/GenericEnumFormatter`1.cs.meta b/Assets/Scripts/MessagePack/Formatters/GenericEnumFormatter`1.cs.meta new file mode 100644 index 000000000..8b435a6bd --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/GenericEnumFormatter`1.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7f3275d9a9f3275ec9cc43d6859964fe +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Formatters/IMessagePackFormatter`1.cs b/Assets/Scripts/MessagePack/Formatters/IMessagePackFormatter`1.cs new file mode 100644 index 000000000..510d2d143 --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/IMessagePackFormatter`1.cs @@ -0,0 +1,42 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Buffers; +using System.ComponentModel; + +namespace MessagePack.Formatters +{ +#pragma warning disable SA1649 // File name should match first type name + /// + /// A base interface for so that all generic implementations + /// can be detected by a common base type. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public interface IMessagePackFormatter + { + } +#pragma warning restore SA1649 // File name should match first type name + + /// + /// The contract for serialization of some specific type. + /// + /// The type to be serialized or deserialized. + public interface IMessagePackFormatter : IMessagePackFormatter + { + /// + /// Serializes a value. + /// + /// The writer to use when serializing the value. + /// The value to be serialized. + /// The serialization settings to use, including the resolver to use to obtain formatters for types that make up the composite type . + void Serialize(ref MessagePackWriter writer, T value, MessagePackSerializerOptions options); + + /// + /// Deserializes a value. + /// + /// The reader to deserialize from. + /// The serialization settings to use, including the resolver to use to obtain formatters for types that make up the composite type . + /// The deserialized value. + T Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options); + } +} diff --git a/Assets/Scripts/MessagePack/Formatters/IMessagePackFormatter`1.cs.meta b/Assets/Scripts/MessagePack/Formatters/IMessagePackFormatter`1.cs.meta new file mode 100644 index 000000000..e7cf1e01e --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/IMessagePackFormatter`1.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cd75a2bcccf20dfb6824d447ec99a1fa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Formatters/IgnoreFormatter`1.cs b/Assets/Scripts/MessagePack/Formatters/IgnoreFormatter`1.cs new file mode 100644 index 000000000..12e3857cb --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/IgnoreFormatter`1.cs @@ -0,0 +1,21 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Buffers; + +namespace MessagePack.Formatters +{ + public sealed class IgnoreFormatter : IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, T value, MessagePackSerializerOptions options) + { + writer.WriteNil(); + } + + public T Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + reader.Skip(); + return default(T); + } + } +} diff --git a/Assets/Scripts/MessagePack/Formatters/IgnoreFormatter`1.cs.meta b/Assets/Scripts/MessagePack/Formatters/IgnoreFormatter`1.cs.meta new file mode 100644 index 000000000..9864e3b11 --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/IgnoreFormatter`1.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 64fa7163708478803a466c61cdb596d6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Formatters/MultiDimensionalArrayFormatter.cs b/Assets/Scripts/MessagePack/Formatters/MultiDimensionalArrayFormatter.cs new file mode 100644 index 000000000..dfeb9d908 --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/MultiDimensionalArrayFormatter.cs @@ -0,0 +1,293 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; +using System.Collections.Generic; +using System.Text; + +#pragma warning disable SA1649 // File name should match first type name + +namespace MessagePack.Formatters +{ + /* multi dimensional array serialize to [i, j, [seq]] */ + + public sealed class TwoDimensionalArrayFormatter : IMessagePackFormatter + { + private const int ArrayLength = 3; + + public void Serialize(ref MessagePackWriter writer, T[,] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + var i = value.GetLength(0); + var j = value.GetLength(1); + + IMessagePackFormatter formatter = options.Resolver.GetFormatterWithVerify(); + + writer.WriteArrayHeader(ArrayLength); + writer.Write(i); + writer.Write(j); + + writer.WriteArrayHeader(value.Length); + foreach (T item in value) + { + writer.CancellationToken.ThrowIfCancellationRequested(); + formatter.Serialize(ref writer, item, options); + } + } + } + + public T[,] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return null; + } + else + { + IMessagePackFormatter formatter = options.Resolver.GetFormatterWithVerify(); + + var len = reader.ReadArrayHeader(); + if (len != ArrayLength) + { + throw new MessagePackSerializationException("Invalid T[,] format"); + } + + var iLength = reader.ReadInt32(); + var jLength = reader.ReadInt32(); + var maxLen = reader.ReadArrayHeader(); + + var array = new T[iLength, jLength]; + + var i = 0; + var j = -1; + options.Security.DepthStep(ref reader); + try + { + for (int loop = 0; loop < maxLen; loop++) + { + reader.CancellationToken.ThrowIfCancellationRequested(); + if (j < jLength - 1) + { + j++; + } + else + { + j = 0; + i++; + } + + array[i, j] = formatter.Deserialize(ref reader, options); + } + } + finally + { + reader.Depth--; + } + + return array; + } + } + } + + public sealed class ThreeDimensionalArrayFormatter : IMessagePackFormatter + { + private const int ArrayLength = 4; + + public void Serialize(ref MessagePackWriter writer, T[,,] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + var i = value.GetLength(0); + var j = value.GetLength(1); + var k = value.GetLength(2); + + IMessagePackFormatter formatter = options.Resolver.GetFormatterWithVerify(); + + writer.WriteArrayHeader(ArrayLength); + writer.Write(i); + writer.Write(j); + writer.Write(k); + + writer.WriteArrayHeader(value.Length); + foreach (T item in value) + { + writer.CancellationToken.ThrowIfCancellationRequested(); + formatter.Serialize(ref writer, item, options); + } + } + } + + public T[,,] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return null; + } + else + { + IMessagePackFormatter formatter = options.Resolver.GetFormatterWithVerify(); + + var len = reader.ReadArrayHeader(); + if (len != ArrayLength) + { + throw new MessagePackSerializationException("Invalid T[,,] format"); + } + + var iLength = reader.ReadInt32(); + var jLength = reader.ReadInt32(); + var kLength = reader.ReadInt32(); + var maxLen = reader.ReadArrayHeader(); + + var array = new T[iLength, jLength, kLength]; + + var i = 0; + var j = 0; + var k = -1; + options.Security.DepthStep(ref reader); + try + { + for (int loop = 0; loop < maxLen; loop++) + { + reader.CancellationToken.ThrowIfCancellationRequested(); + if (k < kLength - 1) + { + k++; + } + else if (j < jLength - 1) + { + k = 0; + j++; + } + else + { + k = 0; + j = 0; + i++; + } + + array[i, j, k] = formatter.Deserialize(ref reader, options); + } + } + finally + { + reader.Depth--; + } + + return array; + } + } + } + + public sealed class FourDimensionalArrayFormatter : IMessagePackFormatter + { + private const int ArrayLength = 5; + + public void Serialize(ref MessagePackWriter writer, T[,,,] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + var i = value.GetLength(0); + var j = value.GetLength(1); + var k = value.GetLength(2); + var l = value.GetLength(3); + + IMessagePackFormatter formatter = options.Resolver.GetFormatterWithVerify(); + + writer.WriteArrayHeader(ArrayLength); + writer.Write(i); + writer.Write(j); + writer.Write(k); + writer.Write(l); + + writer.WriteArrayHeader(value.Length); + foreach (T item in value) + { + writer.CancellationToken.ThrowIfCancellationRequested(); + formatter.Serialize(ref writer, item, options); + } + } + } + + public T[,,,] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return null; + } + else + { + IMessagePackFormatter formatter = options.Resolver.GetFormatterWithVerify(); + + var len = reader.ReadArrayHeader(); + if (len != ArrayLength) + { + throw new MessagePackSerializationException("Invalid T[,,,] format"); + } + + var iLength = reader.ReadInt32(); + var jLength = reader.ReadInt32(); + var kLength = reader.ReadInt32(); + var lLength = reader.ReadInt32(); + var maxLen = reader.ReadArrayHeader(); + var array = new T[iLength, jLength, kLength, lLength]; + + var i = 0; + var j = 0; + var k = 0; + var l = -1; + options.Security.DepthStep(ref reader); + try + { + for (int loop = 0; loop < maxLen; loop++) + { + reader.CancellationToken.ThrowIfCancellationRequested(); + if (l < lLength - 1) + { + l++; + } + else if (k < kLength - 1) + { + l = 0; + k++; + } + else if (j < jLength - 1) + { + l = 0; + k = 0; + j++; + } + else + { + l = 0; + k = 0; + j = 0; + i++; + } + + array[i, j, k, l] = formatter.Deserialize(ref reader, options); + } + } + finally + { + reader.Depth--; + } + + return array; + } + } + } +} diff --git a/Assets/Scripts/MessagePack/Formatters/MultiDimensionalArrayFormatter.cs.meta b/Assets/Scripts/MessagePack/Formatters/MultiDimensionalArrayFormatter.cs.meta new file mode 100644 index 000000000..1c33d133d --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/MultiDimensionalArrayFormatter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8a4af86ee0f0a74de9e88b1fe8c9826d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Formatters/NilFormatter.cs b/Assets/Scripts/MessagePack/Formatters/NilFormatter.cs new file mode 100644 index 000000000..61aad63fe --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/NilFormatter.cs @@ -0,0 +1,44 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace MessagePack.Formatters +{ + public class NilFormatter : IMessagePackFormatter + { + public static readonly IMessagePackFormatter Instance = new NilFormatter(); + + private NilFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Nil value, MessagePackSerializerOptions options) + { + writer.WriteNil(); + } + + public Nil Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadNil(); + } + } + + // NullableNil is same as Nil. + public class NullableNilFormatter : IMessagePackFormatter + { + public static readonly IMessagePackFormatter Instance = new NullableNilFormatter(); + + private NullableNilFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Nil? value, MessagePackSerializerOptions options) + { + writer.WriteNil(); + } + + public Nil? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadNil(); + } + } +} diff --git a/Assets/Scripts/MessagePack/Formatters/NilFormatter.cs.meta b/Assets/Scripts/MessagePack/Formatters/NilFormatter.cs.meta new file mode 100644 index 000000000..dfaeb7f32 --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/NilFormatter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 708c91d45dcbf19469504ec78aa2abee +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Formatters/NullableFormatter.cs b/Assets/Scripts/MessagePack/Formatters/NullableFormatter.cs new file mode 100644 index 000000000..bba535aea --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/NullableFormatter.cs @@ -0,0 +1,73 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Buffers; + +#pragma warning disable SA1649 // File name should match first type name + +namespace MessagePack.Formatters +{ + public sealed class NullableFormatter : IMessagePackFormatter + where T : struct + { + public void Serialize(ref MessagePackWriter writer, T? value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + options.Resolver.GetFormatterWithVerify().Serialize(ref writer, value.Value, options); + } + } + + public T? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + reader.ReadNil(); + return null; + } + else + { + return options.Resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + } + } + } + + public sealed class StaticNullableFormatter : IMessagePackFormatter + where T : struct + { + private readonly IMessagePackFormatter underlyingFormatter; + + public StaticNullableFormatter(IMessagePackFormatter underlyingFormatter) + { + this.underlyingFormatter = underlyingFormatter; + } + + public void Serialize(ref MessagePackWriter writer, T? value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + this.underlyingFormatter.Serialize(ref writer, value.Value, options); + } + } + + public T? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return null; + } + else + { + return this.underlyingFormatter.Deserialize(ref reader, options); + } + } + } +} diff --git a/Assets/Scripts/MessagePack/Formatters/NullableFormatter.cs.meta b/Assets/Scripts/MessagePack/Formatters/NullableFormatter.cs.meta new file mode 100644 index 000000000..35681b6c6 --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/NullableFormatter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 88e906d65ee7d29d3ae1fb5865b8f6ab +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Formatters/PrimitiveObjectFormatter.cs b/Assets/Scripts/MessagePack/Formatters/PrimitiveObjectFormatter.cs new file mode 100644 index 000000000..4534bd9d2 --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/PrimitiveObjectFormatter.cs @@ -0,0 +1,337 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; +using System.Collections.Generic; +using System.Reflection; + +namespace MessagePack.Formatters +{ + public sealed class PrimitiveObjectFormatter : IMessagePackFormatter + { + public static readonly IMessagePackFormatter Instance = new PrimitiveObjectFormatter(); + + private static readonly Dictionary TypeToJumpCode = new Dictionary() + { + // When adding types whose size exceeds 32-bits, add support in MessagePackSecurity.GetHashCollisionResistantEqualityComparer() + { typeof(Boolean), 0 }, + { typeof(Char), 1 }, + { typeof(SByte), 2 }, + { typeof(Byte), 3 }, + { typeof(Int16), 4 }, + { typeof(UInt16), 5 }, + { typeof(Int32), 6 }, + { typeof(UInt32), 7 }, + { typeof(Int64), 8 }, + { typeof(UInt64), 9 }, + { typeof(Single), 10 }, + { typeof(Double), 11 }, + { typeof(DateTime), 12 }, + { typeof(string), 13 }, + { typeof(byte[]), 14 }, + }; + + private PrimitiveObjectFormatter() + { + } + +#if !UNITY_2018_3_OR_NEWER + + public static bool IsSupportedType(Type type, TypeInfo typeInfo, object value) + { + if (value == null) + { + return true; + } + + if (TypeToJumpCode.ContainsKey(type)) + { + return true; + } + + if (typeInfo.IsEnum) + { + return true; + } + + if (value is System.Collections.IDictionary) + { + return true; + } + + if (value is System.Collections.ICollection) + { + return true; + } + + return false; + } + +#endif + + public void Serialize(ref MessagePackWriter writer, object value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + return; + } + + Type t = value.GetType(); + + int code; + if (TypeToJumpCode.TryGetValue(t, out code)) + { + switch (code) + { + case 0: + writer.Write((bool)value); + return; + case 1: + writer.Write((char)value); + return; + case 2: + writer.WriteInt8((sbyte)value); + return; + case 3: + writer.WriteUInt8((byte)value); + return; + case 4: + writer.WriteInt16((Int16)value); + return; + case 5: + writer.WriteUInt16((UInt16)value); + return; + case 6: + writer.WriteInt32((Int32)value); + return; + case 7: + writer.WriteUInt32((UInt32)value); + return; + case 8: + writer.WriteInt64((Int64)value); + return; + case 9: + writer.WriteUInt64((UInt64)value); + return; + case 10: + writer.Write((Single)value); + return; + case 11: + writer.Write((double)value); + return; + case 12: + writer.Write((DateTime)value); + return; + case 13: + writer.Write((string)value); + return; + case 14: + writer.Write((byte[])value); + return; + default: + throw new MessagePackSerializationException("Not supported primitive object resolver. type:" + t.Name); + } + } + else + { +#if UNITY_2018_3_OR_NEWER && !NETFX_CORE + if (t.IsEnum) +#else + if (t.GetTypeInfo().IsEnum) +#endif + { + Type underlyingType = Enum.GetUnderlyingType(t); + var code2 = TypeToJumpCode[underlyingType]; + switch (code2) + { + case 2: + writer.WriteInt8((sbyte)value); + return; + case 3: + writer.WriteUInt8((byte)value); + return; + case 4: + writer.WriteInt16((Int16)value); + return; + case 5: + writer.WriteUInt16((UInt16)value); + return; + case 6: + writer.WriteInt32((Int32)value); + return; + case 7: + writer.WriteUInt32((UInt32)value); + return; + case 8: + writer.WriteInt64((Int64)value); + return; + case 9: + writer.WriteUInt64((UInt64)value); + return; + default: + break; + } + } + else if (value is System.Collections.IDictionary) + { + // check IDictionary first + var d = value as System.Collections.IDictionary; + writer.WriteMapHeader(d.Count); + foreach (System.Collections.DictionaryEntry item in d) + { + this.Serialize(ref writer, item.Key, options); + this.Serialize(ref writer, item.Value, options); + } + + return; + } + else if (value is System.Collections.ICollection) + { + var c = value as System.Collections.ICollection; + writer.WriteArrayHeader(c.Count); + foreach (var item in c) + { + this.Serialize(ref writer, item, options); + } + + return; + } + } + + throw new MessagePackSerializationException("Not supported primitive object resolver. type:" + t.Name); + } + + public object Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + MessagePackType type = reader.NextMessagePackType; + IFormatterResolver resolver = options.Resolver; + switch (type) + { + case MessagePackType.Integer: + var code = reader.NextCode; + if (code >= MessagePackCode.MinNegativeFixInt && code <= MessagePackCode.MaxNegativeFixInt) + { + return reader.ReadSByte(); + } + else if (code >= MessagePackCode.MinFixInt && code <= MessagePackCode.MaxFixInt) + { + return reader.ReadByte(); + } + else if (code == MessagePackCode.Int8) + { + return reader.ReadSByte(); + } + else if (code == MessagePackCode.Int16) + { + return reader.ReadInt16(); + } + else if (code == MessagePackCode.Int32) + { + return reader.ReadInt32(); + } + else if (code == MessagePackCode.Int64) + { + return reader.ReadInt64(); + } + else if (code == MessagePackCode.UInt8) + { + return reader.ReadByte(); + } + else if (code == MessagePackCode.UInt16) + { + return reader.ReadUInt16(); + } + else if (code == MessagePackCode.UInt32) + { + return reader.ReadUInt32(); + } + else if (code == MessagePackCode.UInt64) + { + return reader.ReadUInt64(); + } + + throw new MessagePackSerializationException("Invalid primitive bytes."); + case MessagePackType.Boolean: + return reader.ReadBoolean(); + case MessagePackType.Float: + if (reader.NextCode == MessagePackCode.Float32) + { + return reader.ReadSingle(); + } + else + { + return reader.ReadDouble(); + } + + case MessagePackType.String: + return reader.ReadString(); + case MessagePackType.Binary: + // We must copy the sequence returned by ReadBytes since the reader's sequence is only valid during deserialization. + return reader.ReadBytes()?.ToArray(); + case MessagePackType.Extension: + ExtensionHeader ext = reader.ReadExtensionFormatHeader(); + if (ext.TypeCode == ReservedMessagePackExtensionTypeCode.DateTime) + { + return reader.ReadDateTime(ext); + } + + throw new MessagePackSerializationException("Invalid primitive bytes."); + case MessagePackType.Array: + { + var length = reader.ReadArrayHeader(); + + IMessagePackFormatter objectFormatter = resolver.GetFormatter(); + var array = new object[length]; + options.Security.DepthStep(ref reader); + try + { + for (int i = 0; i < length; i++) + { + array[i] = objectFormatter.Deserialize(ref reader, options); + } + } + finally + { + reader.Depth--; + } + + return array; + } + + case MessagePackType.Map: + { + var length = reader.ReadMapHeader(); + + IMessagePackFormatter objectFormatter = resolver.GetFormatter(); + var hash = new Dictionary(length, options.Security.GetEqualityComparer()); + options.Security.DepthStep(ref reader); + try + { + for (int i = 0; i < length; i++) + { + var key = objectFormatter.Deserialize(ref reader, options); + + var value = objectFormatter.Deserialize(ref reader, options); + + hash.Add(key, value); + } + } + finally + { + reader.Depth--; + } + + return hash; + } + + case MessagePackType.Nil: + reader.ReadNil(); + return null; + default: + throw new MessagePackSerializationException("Invalid primitive bytes."); + } + } + } +} diff --git a/Assets/Scripts/MessagePack/Formatters/PrimitiveObjectFormatter.cs.meta b/Assets/Scripts/MessagePack/Formatters/PrimitiveObjectFormatter.cs.meta new file mode 100644 index 000000000..1b8766a23 --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/PrimitiveObjectFormatter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d46d293dc804af1669409cc12690a3ad +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Formatters/StandardClassLibraryFormatter.cs b/Assets/Scripts/MessagePack/Formatters/StandardClassLibraryFormatter.cs new file mode 100644 index 000000000..703d3bda5 --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/StandardClassLibraryFormatter.cs @@ -0,0 +1,599 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Text; +using MessagePack.Internal; + +#pragma warning disable SA1649 // File name should match first type name + +namespace MessagePack.Formatters +{ + // NET40 -> BigInteger, Complex, Tuple + + // byte[] is special. represents bin type. + public sealed class ByteArrayFormatter : IMessagePackFormatter + { + public static readonly ByteArrayFormatter Instance = new ByteArrayFormatter(); + + private ByteArrayFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, byte[] value, MessagePackSerializerOptions options) + { + writer.Write(value); + } + + public byte[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadBytes()?.ToArray(); + } + } + + public sealed class NullableStringFormatter : IMessagePackFormatter + { + public static readonly NullableStringFormatter Instance = new NullableStringFormatter(); + + private NullableStringFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, string value, MessagePackSerializerOptions options) + { + writer.Write(value); + } + + public string Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadString(); + } + } + + public sealed class NullableStringArrayFormatter : IMessagePackFormatter + { + public static readonly NullableStringArrayFormatter Instance = new NullableStringArrayFormatter(); + + private NullableStringArrayFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, String[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(value.Length); + for (int i = 0; i < value.Length; i++) + { + writer.Write(value[i]); + } + } + } + + public String[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return null; + } + else + { + var len = reader.ReadArrayHeader(); + var array = new String[len]; + for (int i = 0; i < array.Length; i++) + { + array[i] = reader.ReadString(); + } + + return array; + } + } + } + + public sealed class DecimalFormatter : IMessagePackFormatter + { + public static readonly DecimalFormatter Instance = new DecimalFormatter(); + + private DecimalFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, decimal value, MessagePackSerializerOptions options) + { + var dest = writer.GetSpan(MessagePackRange.MaxFixStringLength); + if (System.Buffers.Text.Utf8Formatter.TryFormat(value, dest.Slice(1), out var written)) + { + // write header + dest[0] = (byte)(MessagePackCode.MinFixStr | written); + writer.Advance(written + 1); + } + else + { + // reset writer's span previously acquired that does not use + writer.Advance(0); + writer.Write(value.ToString(CultureInfo.InvariantCulture)); + } + } + + public decimal Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (!(reader.ReadStringSequence() is ReadOnlySequence sequence)) + { + throw new MessagePackSerializationException(string.Format("Unexpected msgpack code {0} ({1}) encountered.", MessagePackCode.Nil, MessagePackCode.ToFormatName(MessagePackCode.Nil))); + } + + if (sequence.IsSingleSegment) + { + var span = sequence.First.Span; + if (System.Buffers.Text.Utf8Parser.TryParse(span, out decimal result, out var bytesConsumed)) + { + if (span.Length != bytesConsumed) + { + throw new MessagePackSerializationException("Unexpected length of string."); + } + + return result; + } + } + else + { + // sequence.Length is not free + var seqLen = (int)sequence.Length; + if (seqLen < 128) + { + Span span = stackalloc byte[seqLen]; + sequence.CopyTo(span); + if (System.Buffers.Text.Utf8Parser.TryParse(span, out decimal result, out var bytesConsumed)) + { + if (seqLen != bytesConsumed) + { + throw new MessagePackSerializationException("Unexpected length of string."); + } + + return result; + } + } + else + { + var rentArray = ArrayPool.Shared.Rent(seqLen); + try + { + sequence.CopyTo(rentArray); + if (System.Buffers.Text.Utf8Parser.TryParse(rentArray.AsSpan(0, seqLen), out decimal result, out var bytesConsumed)) + { + if (seqLen != bytesConsumed) + { + throw new MessagePackSerializationException("Unexpected length of string."); + } + + return result; + } + } + finally + { + ArrayPool.Shared.Return(rentArray); + } + } + } + + throw new MessagePackSerializationException("Can't parse to decimal, input string was not in a correct format."); + } + } + + public sealed class TimeSpanFormatter : IMessagePackFormatter + { + public static readonly IMessagePackFormatter Instance = new TimeSpanFormatter(); + + private TimeSpanFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, TimeSpan value, MessagePackSerializerOptions options) + { + writer.Write(value.Ticks); + return; + } + + public TimeSpan Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return new TimeSpan(reader.ReadInt64()); + } + } + + public sealed class DateTimeOffsetFormatter : IMessagePackFormatter + { + public static readonly IMessagePackFormatter Instance = new DateTimeOffsetFormatter(); + + private DateTimeOffsetFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, DateTimeOffset value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(2); + writer.Write(new DateTime(value.Ticks, DateTimeKind.Utc)); // current ticks as is + writer.Write((short)value.Offset.TotalMinutes); // offset is normalized in minutes + return; + } + + public DateTimeOffset Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var count = reader.ReadArrayHeader(); + + if (count != 2) + { + throw new MessagePackSerializationException("Invalid DateTimeOffset format."); + } + + DateTime utc = reader.ReadDateTime(); + + var dtOffsetMinutes = reader.ReadInt16(); + + return new DateTimeOffset(utc.Ticks, TimeSpan.FromMinutes(dtOffsetMinutes)); + } + } + + public sealed class GuidFormatter : IMessagePackFormatter + { + public static readonly IMessagePackFormatter Instance = new GuidFormatter(); + + private GuidFormatter() + { + } + + public unsafe void Serialize(ref MessagePackWriter writer, Guid value, MessagePackSerializerOptions options) + { + byte* pBytes = stackalloc byte[36]; + Span bytes = new Span(pBytes, 36); + new GuidBits(ref value).Write(bytes); + writer.WriteString(bytes); + } + + public Guid Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + ReadOnlySequence segment = reader.ReadStringSequence().Value; + if (segment.Length != 36) + { + throw new MessagePackSerializationException("Unexpected length of string."); + } + + GuidBits result; + if (segment.IsSingleSegment) + { + result = new GuidBits(segment.First.Span); + } + else + { + Span bytes = stackalloc byte[36]; + segment.CopyTo(bytes); + result = new GuidBits(bytes); + } + + return result.Value; + } + } + + public sealed class UriFormatter : IMessagePackFormatter + { + public static readonly IMessagePackFormatter Instance = new UriFormatter(); + + private UriFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Uri value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.Write(value.ToString()); + } + } + + public Uri Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return null; + } + else + { + return new Uri(reader.ReadString(), UriKind.RelativeOrAbsolute); + } + } + } + + public sealed class VersionFormatter : IMessagePackFormatter + { + public static readonly IMessagePackFormatter Instance = new VersionFormatter(); + + private VersionFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Version value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.Write(value.ToString()); + } + } + + public Version Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return null; + } + else + { + return new Version(reader.ReadString()); + } + } + } + + public sealed class KeyValuePairFormatter : IMessagePackFormatter> + { + public void Serialize(ref MessagePackWriter writer, KeyValuePair value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(2); + IFormatterResolver resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Key, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Value, options); + return; + } + + public KeyValuePair Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var count = reader.ReadArrayHeader(); + + if (count != 2) + { + throw new MessagePackSerializationException("Invalid KeyValuePair format."); + } + + IFormatterResolver resolver = options.Resolver; + options.Security.DepthStep(ref reader); + try + { + TKey key = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + TValue value = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + return new KeyValuePair(key, value); + } + finally + { + reader.Depth--; + } + } + } + + public sealed class StringBuilderFormatter : IMessagePackFormatter + { + public static readonly IMessagePackFormatter Instance = new StringBuilderFormatter(); + + private StringBuilderFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, StringBuilder value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.Write(value.ToString()); + } + } + + public StringBuilder Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return null; + } + else + { + return new StringBuilder(reader.ReadString()); + } + } + } + + public sealed class BitArrayFormatter : IMessagePackFormatter + { + public static readonly IMessagePackFormatter Instance = new BitArrayFormatter(); + + private BitArrayFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, BitArray value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + var len = value.Length; + writer.WriteArrayHeader(len); + for (int i = 0; i < len; i++) + { + writer.Write(value.Get(i)); + } + + return; + } + } + + public BitArray Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return null; + } + else + { + var len = reader.ReadArrayHeader(); + + var array = new BitArray(len); + for (int i = 0; i < len; i++) + { + array[i] = reader.ReadBoolean(); + } + + return array; + } + } + } + + public sealed class BigIntegerFormatter : IMessagePackFormatter + { + public static readonly IMessagePackFormatter Instance = new BigIntegerFormatter(); + + private BigIntegerFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, System.Numerics.BigInteger value, MessagePackSerializerOptions options) + { +#if NETCOREAPP2_1 + if (!writer.OldSpec) + { + // try to get bin8 buffer. + var span = writer.GetSpan(byte.MaxValue); + if (value.TryWriteBytes(span.Slice(2), out var written)) + { + span[0] = MessagePackCode.Bin8; + span[1] = (byte)written; + + writer.Advance(written + 2); + return; + } + else + { + // reset writer's span previously acquired that does not use + writer.Advance(0); + } + } +#endif + + writer.Write(value.ToByteArray()); + return; + } + + public System.Numerics.BigInteger Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + ReadOnlySequence bytes = reader.ReadBytes().Value; +#if NETCOREAPP2_1 + if (bytes.IsSingleSegment) + { + return new System.Numerics.BigInteger(bytes.First.Span); + } + else + { + byte[] bytesArray = ArrayPool.Shared.Rent((int)bytes.Length); + try + { + bytes.CopyTo(bytesArray); + return new System.Numerics.BigInteger(bytesArray.AsSpan(0, (int)bytes.Length)); + } + finally + { + ArrayPool.Shared.Return(bytesArray); + } + } +#else + return new System.Numerics.BigInteger(bytes.ToArray()); +#endif + } + } + + public sealed class ComplexFormatter : IMessagePackFormatter + { + public static readonly IMessagePackFormatter Instance = new ComplexFormatter(); + + private ComplexFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, System.Numerics.Complex value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(2); + writer.Write(value.Real); + writer.Write(value.Imaginary); + return; + } + + public System.Numerics.Complex Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + var count = reader.ReadArrayHeader(); + + if (count != 2) + { + throw new MessagePackSerializationException("Invalid Complex format."); + } + + var real = reader.ReadDouble(); + + var imaginary = reader.ReadDouble(); + + return new System.Numerics.Complex(real, imaginary); + } + } + + public sealed class LazyFormatter : IMessagePackFormatter> + { + public void Serialize(ref MessagePackWriter writer, Lazy value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + IFormatterResolver resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Value, options); + } + } + + public Lazy Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return null; + } + else + { + options.Security.DepthStep(ref reader); + try + { + // deserialize immediately(no delay, because capture byte[] causes memory leak) + IFormatterResolver resolver = options.Resolver; + T v = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + return new Lazy(() => v); + } + finally + { + reader.Depth--; + } + } + } + } +} diff --git a/Assets/Scripts/MessagePack/Formatters/StandardClassLibraryFormatter.cs.meta b/Assets/Scripts/MessagePack/Formatters/StandardClassLibraryFormatter.cs.meta new file mode 100644 index 000000000..4a3c25ca2 --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/StandardClassLibraryFormatter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6dc8f5f9191421c21bd1ba87f5a70d27 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Formatters/TypelessFormatter.cs b/Assets/Scripts/MessagePack/Formatters/TypelessFormatter.cs new file mode 100644 index 000000000..c487526bd --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/TypelessFormatter.cs @@ -0,0 +1,313 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +#if !UNITY_2018_3_OR_NEWER + +using System; +using System.Buffers; +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Text.RegularExpressions; +using MessagePack.Internal; + +namespace MessagePack.Formatters +{ + /// + /// For `object` field that holds derived from `object` value, ex: var arr = new object[] { 1, "a", new Model() };. + /// + public sealed class TypelessFormatter : IMessagePackFormatter + { + private delegate void SerializeMethod(object dynamicContractlessFormatter, ref MessagePackWriter writer, object value, MessagePackSerializerOptions options); + + private delegate object DeserializeMethod(object dynamicContractlessFormatter, ref MessagePackReader reader, MessagePackSerializerOptions options); + + /// + /// The singleton instance that can be used. + /// + public static readonly IMessagePackFormatter Instance = new TypelessFormatter(); + + private readonly ThreadsafeTypeKeyHashTable serializers = new ThreadsafeTypeKeyHashTable(); + private readonly ThreadsafeTypeKeyHashTable deserializers = new ThreadsafeTypeKeyHashTable(); + private readonly ThreadsafeTypeKeyHashTable fullTypeNameCache = new ThreadsafeTypeKeyHashTable(); + private readonly ThreadsafeTypeKeyHashTable shortenedTypeNameCache = new ThreadsafeTypeKeyHashTable(); + private readonly AsymmetricKeyHashTable, Type> typeCache = new AsymmetricKeyHashTable, Type>(new StringArraySegmentByteAscymmetricEqualityComparer()); + + private static readonly HashSet UseBuiltinTypes = new HashSet + { + typeof(Boolean), + ////typeof(Char), + typeof(SByte), + typeof(Byte), + typeof(Int16), + typeof(UInt16), + typeof(Int32), + typeof(UInt32), + typeof(Int64), + typeof(UInt64), + typeof(Single), + typeof(Double), + typeof(string), + typeof(byte[]), + + // array should save their types. + ////typeof(Boolean[]), + ////typeof(Char[]), + ////typeof(SByte[]), + ////typeof(Int16[]), + ////typeof(UInt16[]), + ////typeof(Int32[]), + ////typeof(UInt32[]), + ////typeof(Int64[]), + ////typeof(UInt64[]), + ////typeof(Single[]), + ////typeof(Double[]), + ////typeof(string[]), + + typeof(Boolean?), + ////typeof(Char?), + typeof(SByte?), + typeof(Byte?), + typeof(Int16?), + typeof(UInt16?), + typeof(Int32?), + typeof(UInt32?), + typeof(Int64?), + typeof(UInt64?), + typeof(Single?), + typeof(Double?), + }; + + //ForceSizePrimitiveObjectResolver.Instance, + //ContractlessStandardResolverAllowPrivate.Instance); + + // mscorlib or System.Private.CoreLib + private static readonly bool IsMscorlib = typeof(int).AssemblyQualifiedName.Contains("mscorlib"); + + private TypelessFormatter() + { + this.serializers.TryAdd(typeof(object), _ => (object p1, ref MessagePackWriter p2, object p3, MessagePackSerializerOptions p4) => { }); + this.deserializers.TryAdd(typeof(object), _ => (object p1, ref MessagePackReader p2, MessagePackSerializerOptions p3) => new object()); + } + + private string BuildTypeName(Type type, MessagePackSerializerOptions options) + { + if (options.OmitAssemblyVersion) + { + string full = type.AssemblyQualifiedName; + + var shortened = MessagePackSerializerOptions.AssemblyNameVersionSelectorRegex.Replace(full, string.Empty); + if (Type.GetType(shortened, false) == null) + { + // if type cannot be found with shortened name - use full name + shortened = full; + } + + return shortened; + } + else + { + return type.AssemblyQualifiedName; + } + } + + public void Serialize(ref MessagePackWriter writer, object value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + return; + } + + Type type = value.GetType(); + + byte[] typeName; + var typeNameCache = options.OmitAssemblyVersion ? this.shortenedTypeNameCache : this.fullTypeNameCache; + if (!typeNameCache.TryGetValue(type, out typeName)) + { + TypeInfo ti = type.GetTypeInfo(); + if (ti.IsAnonymous() || UseBuiltinTypes.Contains(type)) + { + typeName = null; + } + else + { + typeName = StringEncoding.UTF8.GetBytes(this.BuildTypeName(type, options)); + } + + typeNameCache.TryAdd(type, typeName); + } + + if (typeName == null) + { + DynamicObjectTypeFallbackFormatter.Instance.Serialize(ref writer, value, options); + return; + } + + var formatter = options.Resolver.GetFormatterDynamicWithVerify(type); + + // don't use GetOrAdd for avoid closure capture. + if (!this.serializers.TryGetValue(type, out SerializeMethod serializeMethod)) + { + // double check locking... + lock (this.serializers) + { + if (!this.serializers.TryGetValue(type, out serializeMethod)) + { + TypeInfo ti = type.GetTypeInfo(); + + Type formatterType = typeof(IMessagePackFormatter<>).MakeGenericType(type); + ParameterExpression param0 = Expression.Parameter(typeof(object), "formatter"); + ParameterExpression param1 = Expression.Parameter(typeof(MessagePackWriter).MakeByRefType(), "writer"); + ParameterExpression param2 = Expression.Parameter(typeof(object), "value"); + ParameterExpression param3 = Expression.Parameter(typeof(MessagePackSerializerOptions), "options"); + + MethodInfo serializeMethodInfo = formatterType.GetRuntimeMethod("Serialize", new[] { typeof(MessagePackWriter).MakeByRefType(), type, typeof(MessagePackSerializerOptions) }); + + MethodCallExpression body = Expression.Call( + Expression.Convert(param0, formatterType), + serializeMethodInfo, + param1, + ti.IsValueType ? Expression.Unbox(param2, type) : Expression.Convert(param2, type), + param3); + + serializeMethod = Expression.Lambda(body, param0, param1, param2, param3).Compile(); + + this.serializers.TryAdd(type, serializeMethod); + } + } + } + + // mark will be written at the end, when size is known + using (var scratchRental = SequencePool.Shared.Rent()) + { + MessagePackWriter scratchWriter = writer.Clone(scratchRental.Value); + scratchWriter.WriteString(typeName); + serializeMethod(formatter, ref scratchWriter, value, options); + scratchWriter.Flush(); + + // mark as extension with code 100 + writer.WriteExtensionFormat(new ExtensionResult((sbyte)ThisLibraryExtensionTypeCodes.TypelessFormatter, scratchRental.Value)); + } + } + + public object Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return null; + } + + if (reader.NextMessagePackType == MessagePackType.Extension) + { + ExtensionHeader ext = reader.ReadExtensionFormatHeader(); + if (ext.TypeCode == ThisLibraryExtensionTypeCodes.TypelessFormatter) + { + // it has type name serialized + ReadOnlySequence typeName = reader.ReadStringSequence().Value; + ArraySegment typeNameArraySegment; + byte[] rented = null; + if (!typeName.IsSingleSegment || !MemoryMarshal.TryGetArray(typeName.First, out typeNameArraySegment)) + { + rented = ArrayPool.Shared.Rent((int)typeName.Length); + typeName.CopyTo(rented); + typeNameArraySegment = new ArraySegment(rented, 0, (int)typeName.Length); + } + + var result = this.DeserializeByTypeName(typeNameArraySegment, ref reader, options); + + if (rented != null) + { + ArrayPool.Shared.Return(rented); + } + + return result; + } + } + + // fallback + return DynamicObjectTypeFallbackFormatter.Instance.Deserialize(ref reader, options); + } + + /// + /// Does not support deserializing of anonymous types + /// Type should be covered by preceeding resolvers in complex/standard resolver. + /// + private object DeserializeByTypeName(ArraySegment typeName, ref MessagePackReader byteSequence, MessagePackSerializerOptions options) + { + // try get type with assembly name, throw if not found + Type type; + if (!this.typeCache.TryGetValue(typeName, out type)) + { + var buffer = new byte[typeName.Count]; + Buffer.BlockCopy(typeName.Array, typeName.Offset, buffer, 0, buffer.Length); + var str = StringEncoding.UTF8.GetString(buffer); + type = options.LoadType(str); + if (type == null) + { + if (IsMscorlib && str.Contains("System.Private.CoreLib")) + { + str = str.Replace("System.Private.CoreLib", "mscorlib"); + type = Type.GetType(str, true); // throw + } + else if (!IsMscorlib && str.Contains("mscorlib")) + { + str = str.Replace("mscorlib", "System.Private.CoreLib"); + type = Type.GetType(str, true); // throw + } + else + { + type = Type.GetType(str, true); // re-throw + } + } + + this.typeCache.TryAdd(buffer, type); + } + + options.ThrowIfDeserializingTypeIsDisallowed(type); + + var formatter = options.Resolver.GetFormatterDynamicWithVerify(type); + + if (!this.deserializers.TryGetValue(type, out DeserializeMethod deserializeMethod)) + { + lock (this.deserializers) + { + if (!this.deserializers.TryGetValue(type, out deserializeMethod)) + { + TypeInfo ti = type.GetTypeInfo(); + + Type formatterType = typeof(IMessagePackFormatter<>).MakeGenericType(type); + ParameterExpression param0 = Expression.Parameter(typeof(object), "formatter"); + ParameterExpression param1 = Expression.Parameter(typeof(MessagePackReader).MakeByRefType(), "reader"); + ParameterExpression param2 = Expression.Parameter(typeof(MessagePackSerializerOptions), "options"); + + MethodInfo deserializeMethodInfo = formatterType.GetRuntimeMethod("Deserialize", new[] { typeof(MessagePackReader).MakeByRefType(), typeof(MessagePackSerializerOptions) }); + + MethodCallExpression deserialize = Expression.Call( + Expression.Convert(param0, formatterType), + deserializeMethodInfo, + param1, + param2); + + Expression body = deserialize; + if (ti.IsValueType) + { + body = Expression.Convert(deserialize, typeof(object)); + } + + deserializeMethod = Expression.Lambda(body, param0, param1, param2).Compile(); + + this.deserializers.TryAdd(type, deserializeMethod); + } + } + } + + return deserializeMethod(formatter, ref byteSequence, options); + } + } +} + +#endif diff --git a/Assets/Scripts/MessagePack/Formatters/TypelessFormatter.cs.meta b/Assets/Scripts/MessagePack/Formatters/TypelessFormatter.cs.meta new file mode 100644 index 000000000..ba44e44f6 --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/TypelessFormatter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fe17a811684aa2fa786684f83f7fbbe7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Formatters/UnsafeBinaryFormatters.cs b/Assets/Scripts/MessagePack/Formatters/UnsafeBinaryFormatters.cs new file mode 100644 index 000000000..56f589961 --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/UnsafeBinaryFormatters.cs @@ -0,0 +1,100 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; + +#pragma warning disable SA1649 // File name should match first type name + +namespace MessagePack.Formatters +{ + public sealed class NativeGuidFormatter : IMessagePackFormatter + { + /// + /// Unsafe binary Guid formatter. this is only allowed on LittleEndian environment. + /// + public static readonly IMessagePackFormatter Instance = new NativeGuidFormatter(); + + private NativeGuidFormatter() + { + } + + /* Guid's underlying _a,...,_k field is sequential and same layout as .NET Framework and Mono(Unity). + * But target machines must be same endian so restrict only for little endian. */ + + public unsafe void Serialize(ref MessagePackWriter writer, Guid value, MessagePackSerializerOptions options) + { + if (!BitConverter.IsLittleEndian) + { + throw new InvalidOperationException("NativeGuidFormatter only allows on little endian env."); + } + + var valueSpan = new ReadOnlySpan(&value, sizeof(Guid)); + writer.Write(valueSpan); + } + + public unsafe Guid Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (!BitConverter.IsLittleEndian) + { + throw new InvalidOperationException("NativeGuidFormatter only allows on little endian env."); + } + + ReadOnlySequence valueSequence = reader.ReadBytes().Value; + if (valueSequence.Length != sizeof(Guid)) + { + throw new MessagePackSerializationException("Invalid Guid Size."); + } + + Guid result; + var resultSpan = new Span(&result, sizeof(Guid)); + valueSequence.CopyTo(resultSpan); + return result; + } + } + + public sealed class NativeDecimalFormatter : IMessagePackFormatter + { + /// + /// Unsafe binary Decimal formatter. this is only allows on LittleEndian environment. + /// + public static readonly IMessagePackFormatter Instance = new NativeDecimalFormatter(); + + private NativeDecimalFormatter() + { + } + + /* decimal underlying "flags, hi, lo, mid" fields are sequential and same layuout with .NET Framework and Mono(Unity) + * But target machines must be same endian so restrict only for little endian. */ + + public unsafe void Serialize(ref MessagePackWriter writer, Decimal value, MessagePackSerializerOptions options) + { + if (!BitConverter.IsLittleEndian) + { + throw new InvalidOperationException("NativeDecimalFormatter only allows on little endian env."); + } + + var valueSpan = new ReadOnlySpan(&value, sizeof(Decimal)); + writer.Write(valueSpan); + } + + public unsafe Decimal Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (!BitConverter.IsLittleEndian) + { + throw new InvalidOperationException("NativeDecimalFormatter only allows on little endian env."); + } + + ReadOnlySequence valueSequence = reader.ReadBytes().Value; + if (valueSequence.Length != sizeof(decimal)) + { + throw new MessagePackSerializationException("Invalid decimal Size."); + } + + decimal result; + var resultSpan = new Span(&result, sizeof(decimal)); + valueSequence.CopyTo(resultSpan); + return result; + } + } +} diff --git a/Assets/Scripts/MessagePack/Formatters/UnsafeBinaryFormatters.cs.meta b/Assets/Scripts/MessagePack/Formatters/UnsafeBinaryFormatters.cs.meta new file mode 100644 index 000000000..dafce71d0 --- /dev/null +++ b/Assets/Scripts/MessagePack/Formatters/UnsafeBinaryFormatters.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2c4fcfc3f496806c7915aba0cdb3f1ba +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/HashCode.cs b/Assets/Scripts/MessagePack/HashCode.cs new file mode 100644 index 000000000..8d48c08fd --- /dev/null +++ b/Assets/Scripts/MessagePack/HashCode.cs @@ -0,0 +1,481 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +// + +/* + +The xxHash32 implementation is based on the code published by Yann Collet: +https://raw.githubusercontent.com/Cyan4973/xxHash/5c174cfa4e45a42f94082dc0d4539b39696afea1/xxhash.c + + xxHash - Fast Hash algorithm + Copyright (C) 2012-2016, Yann Collet + + BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + You can contact the author at : + - xxHash homepage: http://www.xxhash.com + - xxHash source repository : https://github.com/Cyan4973/xxHash + +*/ + +#if !NETCOREAPP + +using System.Collections.Generic; +using System.ComponentModel; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Security.Cryptography; + +namespace System +{ + // xxHash32 is used for the hash code. + // https://github.com/Cyan4973/xxHash + + internal struct HashCode + { + private static readonly uint s_seed = GenerateGlobalSeed(); + + private const uint Prime1 = 2654435761U; + private const uint Prime2 = 2246822519U; + private const uint Prime3 = 3266489917U; + private const uint Prime4 = 668265263U; + private const uint Prime5 = 374761393U; + + private uint _v1, _v2, _v3, _v4; + private uint _queue1, _queue2, _queue3; + private uint _length; + + private static uint GenerateGlobalSeed() + { + var bytes = new byte[4]; + using (var rng = RandomNumberGenerator.Create()) + { + rng.GetBytes(bytes); + } + + return BitConverter.ToUInt32(bytes, 0); + } + + public static int Combine(T1 value1) + { + unchecked + { + // Provide a way of diffusing bits from something with a limited + // input hash space. For example, many enums only have a few + // possible hashes, only using the bottom few bits of the code. Some + // collections are built on the assumption that hashes are spread + // over a larger space, so diffusing the bits may help the + // collection work more efficiently. + + uint hc1 = (uint)(value1?.GetHashCode() ?? 0); + + uint hash = MixEmptyState(); + hash += 4; + + hash = QueueRound(hash, hc1); + + hash = MixFinal(hash); + return (int)hash; + } + } + + public static int Combine(T1 value1, T2 value2) + { + unchecked + { + uint hc1 = (uint)(value1?.GetHashCode() ?? 0); + uint hc2 = (uint)(value2?.GetHashCode() ?? 0); + + uint hash = MixEmptyState(); + hash += 8; + + hash = QueueRound(hash, hc1); + hash = QueueRound(hash, hc2); + + hash = MixFinal(hash); + return (int)hash; + } + } + + public static int Combine(T1 value1, T2 value2, T3 value3) + { + unchecked + { + uint hc1 = (uint)(value1?.GetHashCode() ?? 0); + uint hc2 = (uint)(value2?.GetHashCode() ?? 0); + uint hc3 = (uint)(value3?.GetHashCode() ?? 0); + + uint hash = MixEmptyState(); + hash += 12; + + hash = QueueRound(hash, hc1); + hash = QueueRound(hash, hc2); + hash = QueueRound(hash, hc3); + + hash = MixFinal(hash); + return (int)hash; + } + } + + public static int Combine(T1 value1, T2 value2, T3 value3, T4 value4) + { + unchecked + { + uint hc1 = (uint)(value1?.GetHashCode() ?? 0); + uint hc2 = (uint)(value2?.GetHashCode() ?? 0); + uint hc3 = (uint)(value3?.GetHashCode() ?? 0); + uint hc4 = (uint)(value4?.GetHashCode() ?? 0); + + Initialize(out uint v1, out uint v2, out uint v3, out uint v4); + + v1 = Round(v1, hc1); + v2 = Round(v2, hc2); + v3 = Round(v3, hc3); + v4 = Round(v4, hc4); + + uint hash = MixState(v1, v2, v3, v4); + hash += 16; + + hash = MixFinal(hash); + return (int)hash; + } + } + + public static int Combine(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5) + { + unchecked + { + uint hc1 = (uint)(value1?.GetHashCode() ?? 0); + uint hc2 = (uint)(value2?.GetHashCode() ?? 0); + uint hc3 = (uint)(value3?.GetHashCode() ?? 0); + uint hc4 = (uint)(value4?.GetHashCode() ?? 0); + uint hc5 = (uint)(value5?.GetHashCode() ?? 0); + + Initialize(out uint v1, out uint v2, out uint v3, out uint v4); + + v1 = Round(v1, hc1); + v2 = Round(v2, hc2); + v3 = Round(v3, hc3); + v4 = Round(v4, hc4); + + uint hash = MixState(v1, v2, v3, v4); + hash += 20; + + hash = QueueRound(hash, hc5); + + hash = MixFinal(hash); + return (int)hash; + } + } + + public static int Combine(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6) + { + unchecked + { + uint hc1 = (uint)(value1?.GetHashCode() ?? 0); + uint hc2 = (uint)(value2?.GetHashCode() ?? 0); + uint hc3 = (uint)(value3?.GetHashCode() ?? 0); + uint hc4 = (uint)(value4?.GetHashCode() ?? 0); + uint hc5 = (uint)(value5?.GetHashCode() ?? 0); + uint hc6 = (uint)(value6?.GetHashCode() ?? 0); + + Initialize(out uint v1, out uint v2, out uint v3, out uint v4); + + v1 = Round(v1, hc1); + v2 = Round(v2, hc2); + v3 = Round(v3, hc3); + v4 = Round(v4, hc4); + + uint hash = MixState(v1, v2, v3, v4); + hash += 24; + + hash = QueueRound(hash, hc5); + hash = QueueRound(hash, hc6); + + hash = MixFinal(hash); + return (int)hash; + } + } + + public static int Combine(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7) + { + unchecked + { + uint hc1 = (uint)(value1?.GetHashCode() ?? 0); + uint hc2 = (uint)(value2?.GetHashCode() ?? 0); + uint hc3 = (uint)(value3?.GetHashCode() ?? 0); + uint hc4 = (uint)(value4?.GetHashCode() ?? 0); + uint hc5 = (uint)(value5?.GetHashCode() ?? 0); + uint hc6 = (uint)(value6?.GetHashCode() ?? 0); + uint hc7 = (uint)(value7?.GetHashCode() ?? 0); + + Initialize(out uint v1, out uint v2, out uint v3, out uint v4); + + v1 = Round(v1, hc1); + v2 = Round(v2, hc2); + v3 = Round(v3, hc3); + v4 = Round(v4, hc4); + + uint hash = MixState(v1, v2, v3, v4); + hash += 28; + + hash = QueueRound(hash, hc5); + hash = QueueRound(hash, hc6); + hash = QueueRound(hash, hc7); + + hash = MixFinal(hash); + return (int)hash; + } + } + + public static int Combine(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8) + { + unchecked + { + uint hc1 = (uint)(value1?.GetHashCode() ?? 0); + uint hc2 = (uint)(value2?.GetHashCode() ?? 0); + uint hc3 = (uint)(value3?.GetHashCode() ?? 0); + uint hc4 = (uint)(value4?.GetHashCode() ?? 0); + uint hc5 = (uint)(value5?.GetHashCode() ?? 0); + uint hc6 = (uint)(value6?.GetHashCode() ?? 0); + uint hc7 = (uint)(value7?.GetHashCode() ?? 0); + uint hc8 = (uint)(value8?.GetHashCode() ?? 0); + + Initialize(out uint v1, out uint v2, out uint v3, out uint v4); + + v1 = Round(v1, hc1); + v2 = Round(v2, hc2); + v3 = Round(v3, hc3); + v4 = Round(v4, hc4); + + v1 = Round(v1, hc5); + v2 = Round(v2, hc6); + v3 = Round(v3, hc7); + v4 = Round(v4, hc8); + + uint hash = MixState(v1, v2, v3, v4); + hash += 32; + + hash = MixFinal(hash); + return (int)hash; + } + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static void Initialize(out uint v1, out uint v2, out uint v3, out uint v4) + { + unchecked + { + v1 = s_seed + Prime1 + Prime2; + v2 = s_seed + Prime2; + v3 = s_seed; + v4 = s_seed - Prime1; + } + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint Round(uint hash, uint input) + { + unchecked + { + return BitOperations.RotateLeft(hash + input * Prime2, 13) * Prime1; + } + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint QueueRound(uint hash, uint queuedValue) + { + unchecked + { + return BitOperations.RotateLeft(hash + queuedValue * Prime3, 17) * Prime4; + } + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint MixState(uint v1, uint v2, uint v3, uint v4) + { + unchecked + { + return BitOperations.RotateLeft(v1, 1) + BitOperations.RotateLeft(v2, 7) + BitOperations.RotateLeft(v3, 12) + BitOperations.RotateLeft(v4, 18); + } + } + + private static uint MixEmptyState() + { + unchecked + { + return s_seed + Prime5; + } + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint MixFinal(uint hash) + { + unchecked + { + hash ^= hash >> 15; + hash *= Prime2; + hash ^= hash >> 13; + hash *= Prime3; + hash ^= hash >> 16; + return hash; + } + } + + public void Add(T value) + { + Add(value?.GetHashCode() ?? 0); + } + + public void Add(T value, IEqualityComparer comparer) + { + Add(comparer != null ? comparer.GetHashCode(value) : (value?.GetHashCode() ?? 0)); + } + + private void Add(int value) + { + unchecked + { + // The original xxHash works as follows: + // 0. Initialize immediately. We can't do this in a struct (no + // default ctor). + // 1. Accumulate blocks of length 16 (4 uints) into 4 accumulators. + // 2. Accumulate remaining blocks of length 4 (1 uint) into the + // hash. + // 3. Accumulate remaining blocks of length 1 into the hash. + + // There is no need for #3 as this type only accepts ints. _queue1, + // _queue2 and _queue3 are basically a buffer so that when + // ToHashCode is called we can execute #2 correctly. + + // We need to initialize the xxHash32 state (_v1 to _v4) lazily (see + // #0) nd the last place that can be done if you look at the + // original code is just before the first block of 16 bytes is mixed + // in. The xxHash32 state is never used for streams containing fewer + // than 16 bytes. + + // To see what's really going on here, have a look at the Combine + // methods. + + uint val = (uint)value; + + // Storing the value of _length locally shaves of quite a few bytes + // in the resulting machine code. + uint previousLength = _length++; + uint position = previousLength % 4; + + // Switch can't be inlined. + + if (position == 0) + _queue1 = val; + else if (position == 1) + _queue2 = val; + else if (position == 2) + _queue3 = val; + else // position == 3 + { + if (previousLength == 3) + Initialize(out _v1, out _v2, out _v3, out _v4); + + _v1 = Round(_v1, _queue1); + _v2 = Round(_v2, _queue2); + _v3 = Round(_v3, _queue3); + _v4 = Round(_v4, val); + } + } + } + + public int ToHashCode() + { + unchecked + { + // Storing the value of _length locally shaves of quite a few bytes + // in the resulting machine code. + uint length = _length; + + // position refers to the *next* queue position in this method, so + // position == 1 means that _queue1 is populated; _queue2 would have + // been populated on the next call to Add. + uint position = length % 4; + + // If the length is less than 4, _v1 to _v4 don't contain anything + // yet. xxHash32 treats this differently. + + uint hash = length < 4 ? MixEmptyState() : MixState(_v1, _v2, _v3, _v4); + + // _length is incremented once per Add(Int32) and is therefore 4 + // times too small (xxHash length is in bytes, not ints). + + hash += length * 4; + + // Mix what remains in the queue + + // Switch can't be inlined right now, so use as few branches as + // possible by manually excluding impossible scenarios (position > 1 + // is always false if position is not > 0). + if (position > 0) + { + hash = QueueRound(hash, _queue1); + if (position > 1) + { + hash = QueueRound(hash, _queue2); + if (position > 2) + hash = QueueRound(hash, _queue3); + } + } + + hash = MixFinal(hash); + return (int)hash; + } + } + +#pragma warning disable 0809 + // Obsolete member 'memberA' overrides non-obsolete member 'memberB'. + // Disallowing GetHashCode and Equals is by design + + // * We decided to not override GetHashCode() to produce the hash code + // as this would be weird, both naming-wise as well as from a + // behavioral standpoint (GetHashCode() should return the object's + // hash code, not the one being computed). + + // * Even though ToHashCode() can be called safely multiple times on + // this implementation, it is not part of the contract. If the + // implementation has to change in the future we don't want to worry + // about people who might have incorrectly used this type. + + [Obsolete("HashCode is a mutable struct and should not be compared with other HashCodes. Use ToHashCode to retrieve the computed hash code.", error: true)] + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => throw new NotSupportedException(); + + [Obsolete("HashCode is a mutable struct and should not be compared with other HashCodes.", error: true)] + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => throw new NotSupportedException(); +#pragma warning restore 0809 + } +} + +#endif diff --git a/Assets/Scripts/MessagePack/HashCode.cs.meta b/Assets/Scripts/MessagePack/HashCode.cs.meta new file mode 100644 index 000000000..1b90d9175 --- /dev/null +++ b/Assets/Scripts/MessagePack/HashCode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9909e9074ddc955f18803bd2037102f7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/IFormatterResolver.cs b/Assets/Scripts/MessagePack/IFormatterResolver.cs new file mode 100644 index 000000000..0638fc65f --- /dev/null +++ b/Assets/Scripts/MessagePack/IFormatterResolver.cs @@ -0,0 +1,104 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.ExceptionServices; +using MessagePack.Formatters; + +namespace MessagePack +{ + /// + /// Allows querying for a formatter for serializing or deserializing a particular . + /// + public interface IFormatterResolver + { + /// + /// Gets an instance that can serialize or deserialize some type . + /// + /// The type of value to be serialized or deserialized. + /// A formatter, if this resolver supplies one for type ; otherwise null. + IMessagePackFormatter GetFormatter(); + } + + public static class FormatterResolverExtensions + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IMessagePackFormatter GetFormatterWithVerify(this IFormatterResolver resolver) + { + if (resolver is null) + { + throw new ArgumentNullException(nameof(resolver)); + } + + IMessagePackFormatter formatter; + try + { + formatter = resolver.GetFormatter(); + } + catch (TypeInitializationException ex) + { + // The fact that we're using static constructors to initialize this is an internal detail. + // Rethrow the inner exception if there is one. + // Do it carefully so as to not stomp on the original callstack. + Throw(ex); + return default; // not reachable + } + + if (formatter == null) + { + Throw(typeof(T), resolver); + } + + return formatter; + } + + private static void Throw(TypeInitializationException ex) + { + ExceptionDispatchInfo.Capture(ex.InnerException ?? ex).Throw(); + } + + private static void Throw(Type t, IFormatterResolver resolver) + { + throw new FormatterNotRegisteredException(t.FullName + " is not registered in resolver: " + resolver.GetType()); + } + + public static object GetFormatterDynamic(this IFormatterResolver resolver, Type type) + { + if (resolver is null) + { + throw new ArgumentNullException(nameof(resolver)); + } + + if (type is null) + { + throw new ArgumentNullException(nameof(type)); + } + + MethodInfo methodInfo = typeof(IFormatterResolver).GetRuntimeMethod(nameof(IFormatterResolver.GetFormatter), Type.EmptyTypes); + + var formatter = methodInfo.MakeGenericMethod(type).Invoke(resolver, null); + return formatter; + } + + internal static object GetFormatterDynamicWithVerify(this IFormatterResolver resolver, Type type) + { + object result = GetFormatterDynamic(resolver, type); + if (result == null) + { + Throw(type, resolver); + } + + return result; + } + } + + public class FormatterNotRegisteredException : MessagePackSerializationException + { + public FormatterNotRegisteredException(string message) + : base(message) + { + } + } +} diff --git a/Assets/Scripts/MessagePack/IFormatterResolver.cs.meta b/Assets/Scripts/MessagePack/IFormatterResolver.cs.meta new file mode 100644 index 000000000..5ff4bd7a4 --- /dev/null +++ b/Assets/Scripts/MessagePack/IFormatterResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 51a5ebbfbdf12b0cc80f0f57550f61a0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Internal.meta b/Assets/Scripts/MessagePack/Internal.meta new file mode 100644 index 000000000..09938949d --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7303cf02620047543873c4663322e112 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Internal/AsymmetricKeyHashTable.cs b/Assets/Scripts/MessagePack/Internal/AsymmetricKeyHashTable.cs new file mode 100644 index 000000000..4f0a2f146 --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/AsymmetricKeyHashTable.cs @@ -0,0 +1,306 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +#if !UNITY_2018_3_OR_NEWER + +using System; + +#pragma warning disable SA1649 // File name should match first type name + +namespace MessagePack.Internal +{ + /* Safe for multiple-read, single-write. + * Add and Get Key is asymmetric. */ + + internal interface IAsymmetricEqualityComparer + { + int GetHashCode(TKey1 key1); + + int GetHashCode(TKey2 key2); + + bool Equals(TKey1 x, TKey1 y); // when used rehash + + bool Equals(TKey1 x, TKey2 y); // when used get + } + + internal class StringArraySegmentByteAscymmetricEqualityComparer : IAsymmetricEqualityComparer> + { + private static readonly bool Is32Bit = IntPtr.Size == 4; + + public bool Equals(byte[] x, byte[] y) + { + if (x.Length != y.Length) + { + return false; + } + + for (int i = 0; i < x.Length; i++) + { + if (x[i] != y[i]) + { + return false; + } + } + + return true; + } + + public bool Equals(byte[] x, ArraySegment y) + { + return x.AsSpan().SequenceEqual(y); + } + + public int GetHashCode(byte[] key1) + { + return this.GetHashCode(new ArraySegment(key1, 0, key1.Length)); + } + + public int GetHashCode(ArraySegment key2) + { + unchecked + { + if (Is32Bit) + { + return (int)FarmHash.Hash32(key2); + } + else + { + return (int)FarmHash.Hash64(key2); + } + } + } + } + + internal sealed class AsymmetricKeyHashTable + { + private Entry[] buckets; + private int size; // only use in writer lock + + private readonly object writerLock = new object(); + private readonly float loadFactor; + private readonly IAsymmetricEqualityComparer comparer; + + public AsymmetricKeyHashTable(IAsymmetricEqualityComparer comparer) + : this(4, 0.72f, comparer) + { + } + + public AsymmetricKeyHashTable(int capacity, float loadFactor, IAsymmetricEqualityComparer comparer) + { + var tableSize = CalculateCapacity(capacity, loadFactor); + this.buckets = new Entry[tableSize]; + this.loadFactor = loadFactor; + this.comparer = comparer; + } + + public TValue AddOrGet(TKey1 key1, Func valueFactory) + { + TValue v; + this.TryAddInternal(key1, valueFactory, out v); + return v; + } + + public bool TryAdd(TKey1 key, TValue value) + { + return this.TryAdd(key, _ => value); // closure capture + } + + public bool TryAdd(TKey1 key, Func valueFactory) + { + return this.TryAddInternal(key, valueFactory, out TValue _); + } + + private bool TryAddInternal(TKey1 key, Func valueFactory, out TValue resultingValue) + { + lock (this.writerLock) + { + var nextCapacity = CalculateCapacity(this.size + 1, this.loadFactor); + + if (this.buckets.Length < nextCapacity) + { + // rehash + var nextBucket = new Entry[nextCapacity]; + for (int i = 0; i < this.buckets.Length; i++) + { + Entry e = this.buckets[i]; + while (e != null) + { + var newEntry = new Entry { Key = e.Key, Value = e.Value, Hash = e.Hash }; + this.AddToBuckets(nextBucket, key, newEntry, null, out resultingValue); + e = e.Next; + } + } + + // add entry(if failed to add, only do resize) + var successAdd = this.AddToBuckets(nextBucket, key, null, valueFactory, out resultingValue); + + // replace field(threadsafe for read) + VolatileWrite(ref this.buckets, nextBucket); + + if (successAdd) + { + this.size++; + } + + return successAdd; + } + else + { + // add entry(insert last is thread safe for read) + var successAdd = this.AddToBuckets(this.buckets, key, null, valueFactory, out resultingValue); + if (successAdd) + { + this.size++; + } + + return successAdd; + } + } + } + + private bool AddToBuckets(Entry[] buckets, TKey1 newKey, Entry newEntryOrNull, Func valueFactory, out TValue resultingValue) + { + var h = (newEntryOrNull != null) ? newEntryOrNull.Hash : this.comparer.GetHashCode(newKey); + if (buckets[h & (buckets.Length - 1)] == null) + { + if (newEntryOrNull != null) + { + resultingValue = newEntryOrNull.Value; + VolatileWrite(ref buckets[h & (buckets.Length - 1)], newEntryOrNull); + } + else + { + resultingValue = valueFactory(newKey); + VolatileWrite(ref buckets[h & (buckets.Length - 1)], new Entry { Key = newKey, Value = resultingValue, Hash = h }); + } + } + else + { + Entry searchLastEntry = buckets[h & (buckets.Length - 1)]; + while (true) + { + if (this.comparer.Equals(searchLastEntry.Key, newKey)) + { + resultingValue = searchLastEntry.Value; + return false; + } + + if (searchLastEntry.Next == null) + { + if (newEntryOrNull != null) + { + resultingValue = newEntryOrNull.Value; + VolatileWrite(ref searchLastEntry.Next, newEntryOrNull); + } + else + { + resultingValue = valueFactory(newKey); + VolatileWrite(ref searchLastEntry.Next, new Entry { Key = newKey, Value = resultingValue, Hash = h }); + } + + break; + } + + searchLastEntry = searchLastEntry.Next; + } + } + + return true; + } + + public bool TryGetValue(TKey2 key, out TValue value) + { + Entry[] table = this.buckets; + var hash = this.comparer.GetHashCode(key); + Entry entry = table[hash & table.Length - 1]; + + if (entry == null) + { + goto NOT_FOUND; + } + + if (this.comparer.Equals(entry.Key, key)) + { + value = entry.Value; + return true; + } + + Entry next = entry.Next; + while (next != null) + { + if (this.comparer.Equals(next.Key, key)) + { + value = next.Value; + return true; + } + + next = next.Next; + } + +NOT_FOUND: + value = default(TValue); + return false; + } + + private static int CalculateCapacity(int collectionSize, float loadFactor) + { + var initialCapacity = (int)(((float)collectionSize) / loadFactor); + var capacity = 1; + while (capacity < initialCapacity) + { + capacity <<= 1; + } + + if (capacity < 8) + { + return 8; + } + + return capacity; + } + + private static void VolatileWrite(ref Entry location, Entry value) + { + System.Threading.Volatile.Write(ref location, value); + } + + private static void VolatileWrite(ref Entry[] location, Entry[] value) + { + System.Threading.Volatile.Write(ref location, value); + } + + private class Entry + { +#pragma warning disable SA1401 // Fields should be private + internal TKey1 Key; + internal TValue Value; + internal int Hash; + internal Entry Next; +#pragma warning restore SA1401 // Fields should be private + + // from debugger only + public override string ToString() + { + return "Count:" + this.Count; + } + + internal int Count + { + get + { + var count = 1; + Entry n = this; + while (n.Next != null) + { + count++; + n = n.Next; + } + + return count; + } + } + } + } +} + +#endif diff --git a/Assets/Scripts/MessagePack/Internal/AsymmetricKeyHashTable.cs.meta b/Assets/Scripts/MessagePack/Internal/AsymmetricKeyHashTable.cs.meta new file mode 100644 index 000000000..3a33ed1c0 --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/AsymmetricKeyHashTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6862254987b9738ab9482616a323c2b5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Internal/AutomataDictionary.cs b/Assets/Scripts/MessagePack/Internal/AutomataDictionary.cs new file mode 100644 index 000000000..811390b42 --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/AutomataDictionary.cs @@ -0,0 +1,504 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Reflection.Emit; +using System.Runtime.InteropServices; +using System.Text; + +#pragma warning disable SA1509 // Opening braces should not be preceded by blank line + +namespace MessagePack.Internal +{ + // Key = long, Value = int for UTF8String Dictionary + + /// + /// This code is used by dynamically generated code as well as AOT generated code, + /// and thus must be public for the "C# generated and compiled into saved assembly" scenario. + /// + public class AutomataDictionary : IEnumerable> + { + private readonly AutomataNode root; + + public AutomataDictionary() + { + this.root = new AutomataNode(0); + } + + public void Add(string str, int value) + { + ReadOnlySpan bytes = Encoding.UTF8.GetBytes(str); + AutomataNode node = this.root; + + while (bytes.Length > 0) + { + var key = AutomataKeyGen.GetKey(ref bytes); + + if (bytes.Length == 0) + { + node = node.Add(key, value, str); + } + else + { + node = node.Add(key); + } + } + } + + public bool TryGetValue(in ReadOnlySequence bytes, out int value) => this.TryGetValue(bytes.ToArray(), out value); + + public bool TryGetValue(ReadOnlySpan bytes, out int value) + { + AutomataNode node = this.root; + + while (bytes.Length > 0 && node != null) + { + node = node.SearchNext(ref bytes); + } + + if (node == null) + { + value = -1; + return false; + } + else + { + value = node.Value; + return true; + } + } + + // for debugging + public override string ToString() + { + var sb = new StringBuilder(); + ToStringCore(this.root.YieldChildren(), sb, 0); + return sb.ToString(); + } + + private static void ToStringCore(IEnumerable nexts, StringBuilder sb, int depth) + { + foreach (AutomataNode item in nexts) + { + if (depth != 0) + { + sb.Append(' ', depth * 2); + } + + sb.Append("[" + item.Key + "]"); + if (item.Value != -1) + { + sb.Append("(" + item.OriginalKey + ")"); + sb.Append(" = "); + sb.Append(item.Value); + } + + sb.AppendLine(); + ToStringCore(item.YieldChildren(), sb, depth + 1); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return this.GetEnumerator(); + } + + public IEnumerator> GetEnumerator() + { + return YieldCore(this.root.YieldChildren()).GetEnumerator(); + } + + private static IEnumerable> YieldCore(IEnumerable nexts) + { + foreach (AutomataNode item in nexts) + { + if (item.Value != -1) + { + yield return new KeyValuePair(item.OriginalKey, item.Value); + } + + foreach (KeyValuePair x in YieldCore(item.YieldChildren())) + { + yield return x; + } + } + } + + /* IL Emit */ + +#if !NET_STANDARD_2_0 + + public void EmitMatch(ILGenerator il, LocalBuilder bytesSpan, LocalBuilder key, Action> onFound, Action onNotFound) + { + this.root.EmitSearchNext(il, bytesSpan, key, onFound, onNotFound); + } + +#endif + + private class AutomataNode : IComparable + { + private static readonly AutomataNode[] EmptyNodes = new AutomataNode[0]; + private static readonly ulong[] EmptyKeys = new ulong[0]; + +#pragma warning disable SA1401 // Fields should be private + internal ulong Key; + internal int Value; + internal string OriginalKey; +#pragma warning restore SA1401 // Fields should be private + + private AutomataNode[] nexts; + private ulong[] nextKeys; + private int count; + + public bool HasChildren + { + get { return this.count != 0; } + } + + public AutomataNode(ulong key) + { + this.Key = key; + this.Value = -1; + this.nexts = EmptyNodes; + this.nextKeys = EmptyKeys; + this.count = 0; + this.OriginalKey = null; + } + + public AutomataNode Add(ulong key) + { + var index = Array.BinarySearch(this.nextKeys, 0, this.count, key); + if (index < 0) + { + if (this.nexts.Length == this.count) + { + Array.Resize(ref this.nexts, (this.count == 0) ? 4 : (this.count * 2)); + Array.Resize(ref this.nextKeys, (this.count == 0) ? 4 : (this.count * 2)); + } + + this.count++; + + var nextNode = new AutomataNode(key); + this.nexts[this.count - 1] = nextNode; + this.nextKeys[this.count - 1] = key; + Array.Sort(this.nexts, 0, this.count); + Array.Sort(this.nextKeys, 0, this.count); + return nextNode; + } + else + { + return this.nexts[index]; + } + } + + public AutomataNode Add(ulong key, int value, string originalKey) + { + AutomataNode v = this.Add(key); + v.Value = value; + v.OriginalKey = originalKey; + return v; + } + + public AutomataNode SearchNext(ref ReadOnlySpan value) + { + var key = AutomataKeyGen.GetKey(ref value); + if (this.count < 4) + { + // linear search + for (int i = 0; i < this.count; i++) + { + if (this.nextKeys[i] == key) + { + return this.nexts[i]; + } + } + } + else + { + // binary search + var index = BinarySearch(this.nextKeys, 0, this.count, key); + if (index >= 0) + { + return this.nexts[index]; + } + } + + return null; + } + + internal static int BinarySearch(ulong[] array, int index, int length, ulong value) + { + int lo = index; + int hi = index + length - 1; + while (lo <= hi) + { + int i = lo + ((hi - lo) >> 1); + + var arrayValue = array[i]; + int order; + if (arrayValue < value) + { + order = -1; + } + else if (arrayValue > value) + { + order = 1; + } + else + { + order = 0; + } + + if (order == 0) + { + return i; + } + + if (order < 0) + { + lo = i + 1; + } + else + { + hi = i - 1; + } + } + + return ~lo; + } + + public int CompareTo(AutomataNode other) + { + return this.Key.CompareTo(other.Key); + } + + public IEnumerable YieldChildren() + { + for (int i = 0; i < this.count; i++) + { + yield return this.nexts[i]; + } + } + +#if !NET_STANDARD_2_0 + + // SearchNext(ref ReadOnlySpan bytes) + public void EmitSearchNext(ILGenerator il, LocalBuilder bytesSpan, LocalBuilder key, Action> onFound, Action onNotFound) + { + // key = AutomataKeyGen.GetKey(ref bytesSpan); + il.EmitLdloca(bytesSpan); + il.EmitCall(AutomataKeyGen.GetKeyMethod); + il.EmitStloc(key); + + // match children. + EmitSearchNextCore(il, bytesSpan, key, onFound, onNotFound, this.nexts, this.count); + } + + private static void EmitSearchNextCore(ILGenerator il, LocalBuilder bytesSpan, LocalBuilder key, Action> onFound, Action onNotFound, AutomataNode[] nexts, int count) + { + if (count < 4) + { + // linear-search + AutomataNode[] valueExists = nexts.Take(count).Where(x => x.Value != -1).ToArray(); + AutomataNode[] childrenExists = nexts.Take(count).Where(x => x.HasChildren).ToArray(); + Label gotoSearchNext = il.DefineLabel(); + Label gotoNotFound = il.DefineLabel(); + + { + // bytesSpan.Length + il.EmitLdloca(bytesSpan); + il.EmitCall(typeof(ReadOnlySpan).GetRuntimeProperty(nameof(ReadOnlySpan.Length)).GetMethod); + if (childrenExists.Length != 0 && valueExists.Length == 0) + { + il.Emit(OpCodes.Brfalse, gotoNotFound); // if(bytesSpan.Length == 0) + } + else + { + il.Emit(OpCodes.Brtrue, gotoSearchNext); // if(bytesSpan.Length != 0) + } + } + + { + Label[] ifValueNexts = Enumerable.Range(0, Math.Max(valueExists.Length - 1, 0)).Select(_ => il.DefineLabel()).ToArray(); + for (int i = 0; i < valueExists.Length; i++) + { + Label notFoundLabel = il.DefineLabel(); + if (i != 0) + { + il.MarkLabel(ifValueNexts[i - 1]); + } + + il.EmitLdloc(key); + il.EmitULong(valueExists[i].Key); + il.Emit(OpCodes.Bne_Un, notFoundLabel); + + // found + onFound(new KeyValuePair(valueExists[i].OriginalKey, valueExists[i].Value)); + + // notfound + il.MarkLabel(notFoundLabel); + if (i != valueExists.Length - 1) + { + il.Emit(OpCodes.Br, ifValueNexts[i]); + } + else + { + onNotFound(); + } + } + } + + il.MarkLabel(gotoSearchNext); + Label[] ifRecNext = Enumerable.Range(0, Math.Max(childrenExists.Length - 1, 0)).Select(_ => il.DefineLabel()).ToArray(); + for (int i = 0; i < childrenExists.Length; i++) + { + Label notFoundLabel = il.DefineLabel(); + if (i != 0) + { + il.MarkLabel(ifRecNext[i - 1]); + } + + il.EmitLdloc(key); + il.EmitULong(childrenExists[i].Key); + il.Emit(OpCodes.Bne_Un, notFoundLabel); + + // found + childrenExists[i].EmitSearchNext(il, bytesSpan, key, onFound, onNotFound); + + // notfound + il.MarkLabel(notFoundLabel); + if (i != childrenExists.Length - 1) + { + il.Emit(OpCodes.Br, ifRecNext[i]); + } + else + { + onNotFound(); + } + } + + il.MarkLabel(gotoNotFound); + onNotFound(); + } + else + { + // binary-search + var midline = count / 2; + var mid = nexts[midline].Key; + AutomataNode[] l = nexts.Take(count).Take(midline).ToArray(); + AutomataNode[] r = nexts.Take(count).Skip(midline).ToArray(); + + Label gotoRight = il.DefineLabel(); + + // if(key < mid) + il.EmitLdloc(key); + il.EmitULong(mid); + il.Emit(OpCodes.Bge, gotoRight); + EmitSearchNextCore(il, bytesSpan, key, onFound, onNotFound, l, l.Length); + + // else + il.MarkLabel(gotoRight); + EmitSearchNextCore(il, bytesSpan, key, onFound, onNotFound, r, r.Length); + } + } + +#endif + } + } + + /// + /// This is used by dynamically generated code. It can be made internal after we enable our dynamic assemblies to access internals. + /// But that trick may require net46, so maybe we should leave this as public. + /// + public static class AutomataKeyGen + { + public static readonly MethodInfo GetKeyMethod = typeof(AutomataKeyGen).GetRuntimeMethod(nameof(GetKey), new[] { typeof(ReadOnlySpan).MakeByRefType() }); + + public static ulong GetKey(ref ReadOnlySpan span) + { + ulong key; + + unchecked + { + if (span.Length >= 8) + { + key = MemoryMarshal.Cast(span)[0]; + span = span.Slice(8); + } + else + { + switch (span.Length) + { + case 1: + { + key = span[0]; + span = span.Slice(1); + break; + } + + case 2: + { + key = MemoryMarshal.Cast(span)[0]; + span = span.Slice(2); + break; + } + + case 3: + { + var a = span[0]; + var b = MemoryMarshal.Cast(span.Slice(1))[0]; + key = a | (ulong)b << 8; + span = span.Slice(3); + break; + } + + case 4: + { + key = MemoryMarshal.Cast(span)[0]; + span = span.Slice(4); + break; + } + + case 5: + { + var a = span[0]; + var b = MemoryMarshal.Cast(span.Slice(1))[0]; + key = a | (ulong)b << 8; + span = span.Slice(5); + break; + } + + case 6: + { + ulong a = MemoryMarshal.Cast(span)[0]; + ulong b = MemoryMarshal.Cast(span.Slice(2))[0]; + key = a | (b << 16); + span = span.Slice(6); + break; + } + + case 7: + { + var a = span[0]; + var b = MemoryMarshal.Cast(span.Slice(1))[0]; + var c = MemoryMarshal.Cast(span.Slice(3))[0]; + key = a | (ulong)b << 8 | (ulong)c << 24; + span = span.Slice(7); + break; + } + + default: + throw new MessagePackSerializationException("Not Supported Length"); + } + } + + return key; + } + } + } +} diff --git a/Assets/Scripts/MessagePack/Internal/AutomataDictionary.cs.meta b/Assets/Scripts/MessagePack/Internal/AutomataDictionary.cs.meta new file mode 100644 index 000000000..10175d1c3 --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/AutomataDictionary.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fc94f4e5525f7ba44b4e68f3cdcb1050 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Internal/ByteArrayStringHashTable.cs b/Assets/Scripts/MessagePack/Internal/ByteArrayStringHashTable.cs new file mode 100644 index 000000000..dc1d4d409 --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/ByteArrayStringHashTable.cs @@ -0,0 +1,193 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; +using System.Collections; +using System.Collections.Generic; +using System.Text; + +namespace MessagePack.Internal +{ + // like ArraySegment hashtable. + // Add is safe for construction phase only and requires capacity(does not do rehash) + // and specialized for internal use(nongenerics, TValue is int) + + // internal, but code generator requires this class + // or at least PerfBenchmarkDotNet + public class ByteArrayStringHashTable : IEnumerable> + { + private readonly Entry[][] buckets; // immutable array(faster than linkedlist) + private readonly ulong indexFor; + + public ByteArrayStringHashTable(int capacity) + : this(capacity, 0.42f) // default: 0.75f -> 0.42f + { + } + + public ByteArrayStringHashTable(int capacity, float loadFactor) + { + var tableSize = CalculateCapacity(capacity, loadFactor); + this.buckets = new Entry[tableSize][]; + this.indexFor = (ulong)this.buckets.Length - 1; + } + + public void Add(string key, int value) + { + if (!this.TryAddInternal(Encoding.UTF8.GetBytes(key), value)) + { + throw new ArgumentException("Key was already exists. Key:" + key); + } + } + + public void Add(byte[] key, int value) + { + if (!this.TryAddInternal(key, value)) + { + throw new ArgumentException("Key was already exists. Key:" + key); + } + } + + private bool TryAddInternal(byte[] key, int value) + { + var h = ByteArrayGetHashCode(key); + var entry = new Entry { Key = key, Value = value }; + + Entry[] array = this.buckets[h & this.indexFor]; + if (array == null) + { + this.buckets[h & this.indexFor] = new[] { entry }; + } + else + { + // check duplicate + for (int i = 0; i < array.Length; i++) + { + byte[] e = array[i].Key; + if (key.AsSpan().SequenceEqual(e)) + { + return false; + } + } + + var newArray = new Entry[array.Length + 1]; + Array.Copy(array, newArray, array.Length); + array = newArray; + array[array.Length - 1] = entry; + this.buckets[h & this.indexFor] = array; + } + + return true; + } + + public bool TryGetValue(in ReadOnlySequence key, out int value) => this.TryGetValue(CodeGenHelpers.GetSpanFromSequence(key), out value); + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + public bool TryGetValue(ReadOnlySpan key, out int value) + { + Entry[][] table = this.buckets; + var hash = ByteArrayGetHashCode(key); + Entry[] entry = table[hash & this.indexFor]; + + if (entry == null) + { + value = default(int); + return false; + } + + ref Entry v = ref entry[0]; + if (key.SequenceEqual(v.Key)) + { + value = v.Value; + return true; + } + + return TryGetValueSlow(key, entry, out value); + } + + private bool TryGetValueSlow(ReadOnlySpan key, Entry[] entry, out int value) + { + for (int i = 1; i < entry.Length; i++) + { + ref Entry v = ref entry[i]; + if (key.SequenceEqual(v.Key)) + { + value = v.Value; + return true; + } + } + + value = default(int); + return false; + } + + private static readonly bool Is32Bit = IntPtr.Size == 4; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static ulong ByteArrayGetHashCode(ReadOnlySpan x) + { + // FarmHash https://github.com/google/farmhash + if (Is32Bit) + { + return (ulong)FarmHash.Hash32(x); + } + else + { + return FarmHash.Hash64(x); + } + } + + private static int CalculateCapacity(int collectionSize, float loadFactor) + { + var initialCapacity = (int)(((float)collectionSize) / loadFactor); + var capacity = 1; + while (capacity < initialCapacity) + { + capacity <<= 1; + } + + if (capacity < 8) + { + return 8; + } + + return capacity; + } + + // only for Debug use + public IEnumerator> GetEnumerator() + { + Entry[][] b = this.buckets; + + foreach (Entry[] item in b) + { + if (item == null) + { + continue; + } + + foreach (Entry item2 in item) + { + yield return new KeyValuePair(Encoding.UTF8.GetString(item2.Key), item2.Value); + } + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return this.GetEnumerator(); + } + + private struct Entry + { + public byte[] Key; + public int Value; + + // for debugging + public override string ToString() + { + return "(" + Encoding.UTF8.GetString(this.Key) + ", " + this.Value + ")"; + } + } + } +} diff --git a/Assets/Scripts/MessagePack/Internal/ByteArrayStringHashTable.cs.meta b/Assets/Scripts/MessagePack/Internal/ByteArrayStringHashTable.cs.meta new file mode 100644 index 000000000..67659d82d --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/ByteArrayStringHashTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 28c84212e5b4fc4d7b4b66cdb741984d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Internal/CodeGenHelpers.cs b/Assets/Scripts/MessagePack/Internal/CodeGenHelpers.cs new file mode 100644 index 000000000..67880968b --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/CodeGenHelpers.cs @@ -0,0 +1,87 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; +using System.ComponentModel; + +namespace MessagePack.Internal +{ + /// + /// Helpers for generated code. + /// + /// + /// This code is used by dynamically generated code as well as AOT generated code, + /// and thus must be public for the "C# generated and compiled into saved assembly" scenario. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public static class CodeGenHelpers + { + public static byte[] GetEncodedStringBytes(string value) + { + var byteCount = StringEncoding.UTF8.GetByteCount(value); + if (byteCount <= MessagePackRange.MaxFixStringLength) + { + var bytes = new byte[byteCount + 1]; + bytes[0] = (byte)(MessagePackCode.MinFixStr | byteCount); + StringEncoding.UTF8.GetBytes(value, 0, value.Length, bytes, 1); + return bytes; + } + else if (byteCount <= byte.MaxValue) + { + var bytes = new byte[byteCount + 2]; + bytes[0] = MessagePackCode.Str8; + bytes[1] = unchecked((byte)byteCount); + StringEncoding.UTF8.GetBytes(value, 0, value.Length, bytes, 2); + return bytes; + } + else if (byteCount <= ushort.MaxValue) + { + var bytes = new byte[byteCount + 3]; + bytes[0] = MessagePackCode.Str16; + bytes[1] = unchecked((byte)(byteCount >> 8)); + bytes[2] = unchecked((byte)byteCount); + StringEncoding.UTF8.GetBytes(value, 0, value.Length, bytes, 3); + return bytes; + } + else + { + var bytes = new byte[byteCount + 5]; + bytes[0] = MessagePackCode.Str32; + bytes[1] = unchecked((byte)(byteCount >> 24)); + bytes[2] = unchecked((byte)(byteCount >> 16)); + bytes[3] = unchecked((byte)(byteCount >> 8)); + bytes[4] = unchecked((byte)byteCount); + StringEncoding.UTF8.GetBytes(value, 0, value.Length, bytes, 5); + return bytes; + } + } + + public static ReadOnlySpan GetSpanFromSequence(in ReadOnlySequence sequence) + { + if (sequence.IsSingleSegment) + { + return sequence.First.Span; + } + + return sequence.ToArray(); + } + + public static ReadOnlySpan ReadStringSpan(ref MessagePackReader reader) + { + if (!reader.TryReadStringSpan(out ReadOnlySpan result)) + { + return GetSpanFromSequence(reader.ReadStringSequence()); + } + + return result; + } + + public static byte[] GetArrayFromNullableSequence(in ReadOnlySequence? sequence) => sequence?.ToArray(); + + private static ReadOnlySpan GetSpanFromSequence(in ReadOnlySequence? sequence) + { + return sequence.HasValue ? GetSpanFromSequence(sequence.Value) : default; + } + } +} diff --git a/Assets/Scripts/MessagePack/Internal/CodeGenHelpers.cs.meta b/Assets/Scripts/MessagePack/Internal/CodeGenHelpers.cs.meta new file mode 100644 index 000000000..692460918 --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/CodeGenHelpers.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4f2dcc1d826e7ff7da02bd691c4dd6a0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Internal/DateTimeConstants.cs b/Assets/Scripts/MessagePack/Internal/DateTimeConstants.cs new file mode 100644 index 000000000..84fbfe9a2 --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/DateTimeConstants.cs @@ -0,0 +1,14 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; + +namespace MessagePack.Internal +{ + internal static class DateTimeConstants + { + internal const long BclSecondsAtUnixEpoch = 62135596800; + internal const int NanosecondsPerTick = 100; + internal static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + } +} diff --git a/Assets/Scripts/MessagePack/Internal/DateTimeConstants.cs.meta b/Assets/Scripts/MessagePack/Internal/DateTimeConstants.cs.meta new file mode 100644 index 000000000..58c92ac0c --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/DateTimeConstants.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a0cf18db43b878d71a216123e3309b65 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Internal/DynamicAssembly.cs b/Assets/Scripts/MessagePack/Internal/DynamicAssembly.cs new file mode 100644 index 000000000..7b8daa38d --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/DynamicAssembly.cs @@ -0,0 +1,75 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +#if !(UNITY_2018_3_OR_NEWER && NET_STANDARD_2_0) + +using System; +using System.Reflection; +using System.Reflection.Emit; + +namespace MessagePack.Internal +{ + internal class DynamicAssembly + { +#if NETFRAMEWORK // We don't ship a net472 target, but we might add one for debugging purposes + private readonly string moduleName; +#endif + private readonly AssemblyBuilder assemblyBuilder; + private readonly ModuleBuilder moduleBuilder; + + // don't expose ModuleBuilder + //// public ModuleBuilder ModuleBuilder { get { return moduleBuilder; } } + + private readonly object gate = new object(); + + public DynamicAssembly(string moduleName) + { +#if NETFRAMEWORK // We don't ship a net472 target, but we might add one for debugging purposes + AssemblyBuilderAccess builderAccess = AssemblyBuilderAccess.RunAndSave; + this.moduleName = moduleName; +#else + AssemblyBuilderAccess builderAccess = AssemblyBuilderAccess.Run; +#endif + this.assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName(moduleName), builderAccess); + this.moduleBuilder = this.assemblyBuilder.DefineDynamicModule(moduleName + ".dll"); + } + + /* requires lock on mono environment. see: https://github.com/neuecc/MessagePack-CSharp/issues/161 */ + + public TypeBuilder DefineType(string name, TypeAttributes attr) + { + lock (this.gate) + { + return this.moduleBuilder.DefineType(name, attr); + } + } + + public TypeBuilder DefineType(string name, TypeAttributes attr, Type parent) + { + lock (this.gate) + { + return this.moduleBuilder.DefineType(name, attr, parent); + } + } + + public TypeBuilder DefineType(string name, TypeAttributes attr, Type parent, Type[] interfaces) + { + lock (this.gate) + { + return this.moduleBuilder.DefineType(name, attr, parent, interfaces); + } + } + +#if NETFRAMEWORK + + public AssemblyBuilder Save() + { + this.assemblyBuilder.Save(this.moduleName + ".dll"); + return this.assemblyBuilder; + } + +#endif + } +} + +#endif diff --git a/Assets/Scripts/MessagePack/Internal/DynamicAssembly.cs.meta b/Assets/Scripts/MessagePack/Internal/DynamicAssembly.cs.meta new file mode 100644 index 000000000..933588e12 --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/DynamicAssembly.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f44ca64eddd25f5a896a2f72b21fcc9b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Internal/ExpressionUtility.cs b/Assets/Scripts/MessagePack/Internal/ExpressionUtility.cs new file mode 100644 index 000000000..3dbf46e99 --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/ExpressionUtility.cs @@ -0,0 +1,85 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Linq.Expressions; +using System.Reflection; + +namespace MessagePack.Internal +{ + internal static class ExpressionUtility + { + private static MethodInfo GetMethodInfoCore(LambdaExpression expression) + { + if (expression == null) + { + throw new ArgumentNullException("expression"); + } + + return (expression.Body as MethodCallExpression).Method; + } + + /// + /// Get MethodInfo from Expression for Static(with result) method. + /// + public static MethodInfo GetMethodInfo(Expression> expression) + { + return GetMethodInfoCore(expression); + } + + /// + /// Get MethodInfo from Expression for Static(void) method. + /// + public static MethodInfo GetMethodInfo(Expression expression) + { + return GetMethodInfoCore(expression); + } + + /// + /// Get MethodInfo from Expression for Instance(with result) method. + /// + public static MethodInfo GetMethodInfo(Expression> expression) + { + return GetMethodInfoCore(expression); + } + + /// + /// Get MethodInfo from Expression for Instance(void) method. + /// + public static MethodInfo GetMethodInfo(Expression> expression) + { + return GetMethodInfoCore(expression); + } + + // WithArgument(for ref, out) helper + + /// + /// Get MethodInfo from Expression for Instance(with result) method. + /// + public static MethodInfo GetMethodInfo(Expression> expression) + { + return GetMethodInfoCore(expression); + } + + private static MemberInfo GetMemberInfoCore(Expression source) + { + if (source == null) + { + throw new ArgumentNullException("source"); + } + + var memberExpression = source.Body as MemberExpression; + return memberExpression.Member; + } + + public static PropertyInfo GetPropertyInfo(Expression> expression) + { + return GetMemberInfoCore(expression) as PropertyInfo; + } + + public static FieldInfo GetFieldInfo(Expression> expression) + { + return GetMemberInfoCore(expression) as FieldInfo; + } + } +} diff --git a/Assets/Scripts/MessagePack/Internal/ExpressionUtility.cs.meta b/Assets/Scripts/MessagePack/Internal/ExpressionUtility.cs.meta new file mode 100644 index 000000000..790bc2483 --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/ExpressionUtility.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1e2163b0f9d41a70599e1d5bd231a4b6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Internal/FarmHash.cs b/Assets/Scripts/MessagePack/Internal/FarmHash.cs new file mode 100644 index 000000000..36d4b8e4e --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/FarmHash.cs @@ -0,0 +1,601 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Runtime.CompilerServices; + +#pragma warning disable SA1300 // Element should begin with uppercase letter +#pragma warning disable SA1303 // Const field names should begin with uppercase letter +#pragma warning disable SA1307 // (public) field names should begin with uppercase letter + +namespace MessagePack.Internal +{ + internal static class FarmHash + { + #region Hash32 + + // entry point of 32bit + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe uint Hash32(ReadOnlySpan bytes) + { + if (bytes.Length <= 4) + { + return Hash32Len0to4(bytes); + } + + fixed (byte* p = bytes) + { + return Hash32(p, (uint)bytes.Length); + } + } + + // port of farmhash.cc, 32bit only + + // Magic numbers for 32-bit hashing. Copied from Murmur3. + private const uint c1 = 0xcc9e2d51; + private const uint c2 = 0x1b873593; + + private static unsafe uint Fetch32(byte* p) + { + return *(uint*)p; + } + + private static uint Rotate32(uint val, int shift) + { + return shift == 0 ? val : ((val >> shift) | (val << (32 - shift))); + } + + // A 32-bit to 32-bit integer hash copied from Murmur3. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint fmix(uint h) + { + unchecked + { + h ^= h >> 16; + h *= 0x85ebca6b; + h ^= h >> 13; + h *= 0xc2b2ae35; + h ^= h >> 16; + return h; + } + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint Mur(uint a, uint h) + { + unchecked + { + // Helper from Murmur3 for combining two 32-bit values. + a *= c1; + a = Rotate32(a, 17); + a *= c2; + h ^= a; + h = Rotate32(h, 19); + return (h * 5) + 0xe6546b64; + } + } + + // 0-4 + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static unsafe uint Hash32Len0to4(ReadOnlySpan s) + { + unchecked + { + uint b = 0; + uint c = 9; + for (int i = 0; i < s.Length; i++) + { + b = (b * c1) + s[i]; + c ^= b; + } + + return fmix(Mur(b, Mur((uint)s.Length, c))); + } + } + + // 5-12 + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static unsafe uint Hash32Len5to12(byte* s, uint len) + { + unchecked + { + uint a = len, b = len * 5, c = 9, d = b; + a += Fetch32(s); + b += Fetch32(s + len - 4); + c += Fetch32(s + ((len >> 1) & 4)); + return fmix(Mur(c, Mur(b, Mur(a, d)))); + } + } + + // 13-24 + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static unsafe uint Hash32Len13to24(byte* s, uint len) + { + unchecked + { + uint a = Fetch32(s - 4 + (len >> 1)); + uint b = Fetch32(s + 4); + uint c = Fetch32(s + len - 8); + uint d = Fetch32(s + (len >> 1)); + uint e = Fetch32(s); + uint f = Fetch32(s + len - 4); + uint h = (d * c1) + len; + a = Rotate32(a, 12) + f; + h = Mur(c, h) + a; + a = Rotate32(a, 3) + c; + h = Mur(e, h) + a; + a = Rotate32(a + f, 12) + d; + h = Mur(b, h) + a; + return fmix(h); + } + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static unsafe uint Hash32(byte* s, uint len) + { + if (len <= 24) + { + return len <= 12 ? Hash32Len5to12(s, len) : Hash32Len13to24(s, len); + } + + unchecked + { + // len > 24 + uint h = len, g = c1 * len, f = g; + uint a0 = Rotate32(Fetch32(s + len - 4) * c1, 17) * c2; + uint a1 = Rotate32(Fetch32(s + len - 8) * c1, 17) * c2; + uint a2 = Rotate32(Fetch32(s + len - 16) * c1, 17) * c2; + uint a3 = Rotate32(Fetch32(s + len - 12) * c1, 17) * c2; + uint a4 = Rotate32(Fetch32(s + len - 20) * c1, 17) * c2; + h ^= a0; + h = Rotate32(h, 19); + h = (h * 5) + 0xe6546b64; + h ^= a2; + h = Rotate32(h, 19); + h = (h * 5) + 0xe6546b64; + g ^= a1; + g = Rotate32(g, 19); + g = (g * 5) + 0xe6546b64; + g ^= a3; + g = Rotate32(g, 19); + g = (g * 5) + 0xe6546b64; + f += a4; + f = Rotate32(f, 19) + 113; + uint iters = (len - 1) / 20; + do + { + uint a = Fetch32(s); + uint b = Fetch32(s + 4); + uint c = Fetch32(s + 8); + uint d = Fetch32(s + 12); + uint e = Fetch32(s + 16); + h += a; + g += b; + f += c; + h = Mur(d, h) + e; + g = Mur(c, g) + a; + f = Mur(b + (e * c1), f) + d; + f += g; + g += f; + s += 20; + } + while (--iters != 0); + g = Rotate32(g, 11) * c1; + g = Rotate32(g, 17) * c1; + f = Rotate32(f, 11) * c1; + f = Rotate32(f, 17) * c1; + h = Rotate32(h + g, 19); + h = (h * 5) + 0xe6546b64; + h = Rotate32(h, 17) * c1; + h = Rotate32(h + f, 19); + h = (h * 5) + 0xe6546b64; + h = Rotate32(h, 17) * c1; + return h; + } + } + + #endregion + + #region hash64 + + // entry point + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe ulong Hash64(ReadOnlySpan bytes) + { + fixed (byte* p = bytes) + { + return Hash64(p, (uint)bytes.Length); + } + } + + /* port from farmhash.cc */ + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static void swap(ref ulong x, ref ulong z) + { + var temp = z; + z = x; + x = temp; + } + + // Some primes between 2^63 and 2^64 for various uses. + private const ulong k0 = 0xc3a5c85c97cb3127UL; + private const ulong k1 = 0xb492b66fbe98f273UL; + private const ulong k2 = 0x9ae16a3b2f90404fUL; + + private static unsafe ulong Fetch64(byte* p) + { + return *(ulong*)p; + } + + private static ulong Rotate64(ulong val, int shift) + { + return shift == 0 ? val : (val >> shift) | (val << (64 - shift)); + } + + // farmhashna.cc + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static ulong ShiftMix(ulong val) + { + return val ^ (val >> 47); + } + + // farmhashna.cc + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static ulong HashLen16(ulong u, ulong v, ulong mul) + { + unchecked + { + // Murmur-inspired hashing. + ulong a = (u ^ v) * mul; + a ^= a >> 47; + ulong b = (v ^ a) * mul; + b ^= b >> 47; + b *= mul; + return b; + } + } + + // farmhashxo.cc + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static unsafe ulong Hash64(byte* s, uint len) + { + if (len <= 16) + { + // farmhashna:: + return HashLen0to16(s, len); + } + + if (len <= 32) + { + // farmhashna:: + return HashLen17to32(s, len); + } + + if (len <= 64) + { + return HashLen33to64(s, len); + } + + if (len <= 96) + { + return HashLen65to96(s, len); + } + + if (len <= 256) + { + // farmhashna:: + return Hash64NA(s, len); + } + + // farmhashuo:: + return Hash64UO(s, len); + } + + // 0-16 farmhashna.cc + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static unsafe ulong HashLen0to16(byte* s, uint len) + { + unchecked + { + if (len >= 8) + { + ulong mul = k2 + (len * 2); + ulong a = Fetch64(s) + k2; + ulong b = Fetch64(s + len - 8); + ulong c = (Rotate64(b, 37) * mul) + a; + ulong d = (Rotate64(a, 25) + b) * mul; + return HashLen16(c, d, mul); + } + + if (len >= 4) + { + ulong mul = k2 + (len * 2); + ulong a = Fetch32(s); + return HashLen16(len + (a << 3), Fetch32(s + len - 4), mul); + } + + if (len > 0) + { + ushort a = s[0]; + ushort b = s[len >> 1]; + ushort c = s[len - 1]; + uint y = a + ((uint)b << 8); + uint z = len + ((uint)c << 2); + return ShiftMix(y * k2 ^ z * k0) * k2; + } + + return k2; + } + } + + // 17-32 farmhashna.cc + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static unsafe ulong HashLen17to32(byte* s, uint len) + { + unchecked + { + ulong mul = k2 + (len * 2); + ulong a = Fetch64(s) * k1; + ulong b = Fetch64(s + 8); + ulong c = Fetch64(s + len - 8) * mul; + ulong d = Fetch64(s + len - 16) * k2; + return HashLen16( + Rotate64(a + b, 43) + Rotate64(c, 30) + d, + a + Rotate64(b + k2, 18) + c, + mul); + } + } + + // farmhashxo.cc + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static unsafe ulong H32(byte* s, uint len, ulong mul, ulong seed0 = 0, ulong seed1 = 0) + { + unchecked + { + ulong a = Fetch64(s) * k1; + ulong b = Fetch64(s + 8); + ulong c = Fetch64(s + len - 8) * mul; + ulong d = Fetch64(s + len - 16) * k2; + ulong u = Rotate64(a + b, 43) + Rotate64(c, 30) + d + seed0; + ulong v = a + Rotate64(b + k2, 18) + c + seed1; + a = ShiftMix((u ^ v) * mul); + b = ShiftMix((v ^ a) * mul); + return b; + } + } + + // 33-64 farmhashxo.cc + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static unsafe ulong HashLen33to64(byte* s, uint len) + { + const ulong mul0 = k2 - 30; + + unchecked + { + ulong mul1 = k2 - 30 + (2 * len); + ulong h0 = H32(s, 32, mul0); + ulong h1 = H32(s + len - 32, 32, mul1); + return ((h1 * mul1) + h0) * mul1; + } + } + + // 65-96 farmhashxo.cc + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static unsafe ulong HashLen65to96(byte* s, uint len) + { + const ulong mul0 = k2 - 114; + + unchecked + { + ulong mul1 = k2 - 114 + (2 * len); + ulong h0 = H32(s, 32, mul0); + ulong h1 = H32(s + 32, 32, mul1); + ulong h2 = H32(s + len - 32, 32, mul1, h0, h1); + return ((h2 * 9) + (h0 >> 17) + (h1 >> 21)) * mul1; + } + } + + // farmhashna.cc + // Return a 16-byte hash for 48 bytes. Quick and dirty. + // Callers do best to use "random-looking" values for a and b. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static unsafe void WeakHashLen32WithSeeds(ulong w, ulong x, ulong y, ulong z, ulong a, ulong b, out ulong first, out ulong second) + { + unchecked + { + a += w; + b = Rotate64(b + a + z, 21); + ulong c = a; + a += x; + a += y; + b += Rotate64(a, 44); + first = a + z; + second = b + c; + } + } + + // farmhashna.cc + // Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static unsafe void WeakHashLen32WithSeeds(byte* s, ulong a, ulong b, out ulong first, out ulong second) + { + WeakHashLen32WithSeeds( + Fetch64(s), + Fetch64(s + 8), + Fetch64(s + 16), + Fetch64(s + 24), + a, + b, + out first, + out second); + } + + // na(97-256) farmhashna.cc + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static unsafe ulong Hash64NA(byte* s, uint len) + { + const ulong seed = 81; + + unchecked + { + // For strings over 64 bytes we loop. Internal state consists of + // 56 bytes: v, w, x, y, and z. + ulong x = seed; + ulong y = (seed * k1) + 113; + ulong z = ShiftMix((y * k2) + 113) * k2; + ulong v_first = 0; + ulong v_second = 0; + ulong w_first = 0; + ulong w_second = 0; + x = (x * k2) + Fetch64(s); + + // Set end so that after the loop we have 1 to 64 bytes left to process. + byte* end = s + ((len - 1) / 64 * 64); + byte* last64 = end + ((len - 1) & 63) - 63; + + do + { + x = Rotate64(x + y + v_first + Fetch64(s + 8), 37) * k1; + y = Rotate64(y + v_second + Fetch64(s + 48), 42) * k1; + x ^= w_second; + y += v_first + Fetch64(s + 40); + z = Rotate64(z + w_first, 33) * k1; + WeakHashLen32WithSeeds(s, v_second * k1, x + w_first, out v_first, out v_second); + WeakHashLen32WithSeeds(s + 32, z + w_second, y + Fetch64(s + 16), out w_first, out w_second); + swap(ref z, ref x); + s += 64; + } + while (s != end); + ulong mul = k1 + ((z & 0xff) << 1); + + // Make s point to the last 64 bytes of input. + s = last64; + w_first += (len - 1) & 63; + v_first += w_first; + w_first += v_first; + x = Rotate64(x + y + v_first + Fetch64(s + 8), 37) * mul; + y = Rotate64(y + v_second + Fetch64(s + 48), 42) * mul; + x ^= w_second * 9; + y += (v_first * 9) + Fetch64(s + 40); + z = Rotate64(z + w_first, 33) * mul; + WeakHashLen32WithSeeds(s, v_second * mul, x + w_first, out v_first, out v_second); + WeakHashLen32WithSeeds(s + 32, z + w_second, y + Fetch64(s + 16), out w_first, out w_second); + swap(ref z, ref x); + return HashLen16(HashLen16(v_first, w_first, mul) + (ShiftMix(y) * k0) + z, HashLen16(v_second, w_second, mul) + x, mul); + } + } + + // farmhashuo.cc + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static ulong H(ulong x, ulong y, ulong mul, int r) + { + unchecked + { + ulong a = (x ^ y) * mul; + a ^= a >> 47; + ulong b = (y ^ a) * mul; + return Rotate64(b, r) * mul; + } + } + + // uo(257-) farmhashuo.cc, Hash64WithSeeds + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static unsafe ulong Hash64UO(byte* s, uint len) + { + const ulong seed0 = 81; + const ulong seed1 = 0; + + unchecked + { + // For strings over 64 bytes we loop. Internal state consists of + // 64 bytes: u, v, w, x, y, and z. + ulong x = seed0; + ulong y = (seed1 * k2) + 113; + ulong z = ShiftMix(y * k2) * k2; + ulong v_first = seed0; + ulong v_second = seed1; + ulong w_first = 0; + ulong w_second = 0; + ulong u = x - z; + x *= k2; + ulong mul = k2 + (u & 0x82); + + // Set end so that after the loop we have 1 to 64 bytes left to process. + byte* end = s + ((len - 1) / 64 * 64); + byte* last64 = end + ((len - 1) & 63) - 63; + + do + { + ulong a0 = Fetch64(s); + ulong a1 = Fetch64(s + 8); + ulong a2 = Fetch64(s + 16); + ulong a3 = Fetch64(s + 24); + ulong a4 = Fetch64(s + 32); + ulong a5 = Fetch64(s + 40); + ulong a6 = Fetch64(s + 48); + ulong a7 = Fetch64(s + 56); + x += a0 + a1; + y += a2; + z += a3; + v_first += a4; + v_second += a5 + a1; + w_first += a6; + w_second += a7; + + x = Rotate64(x, 26); + x *= 9; + y = Rotate64(y, 29); + z *= mul; + v_first = Rotate64(v_first, 33); + v_second = Rotate64(v_second, 30); + w_first ^= x; + w_first *= 9; + z = Rotate64(z, 32); + z += w_second; + w_second += z; + z *= 9; + swap(ref u, ref y); + + z += a0 + a6; + v_first += a2; + v_second += a3; + w_first += a4; + w_second += a5 + a6; + x += a1; + y += a7; + + y += v_first; + v_first += x - y; + v_second += w_first; + w_first += v_second; + w_second += x - y; + x += w_second; + w_second = Rotate64(w_second, 34); + swap(ref u, ref z); + s += 64; + } + while (s != end); + + // Make s point to the last 64 bytes of input. + s = last64; + u *= 9; + v_second = Rotate64(v_second, 28); + v_first = Rotate64(v_first, 20); + w_first += (len - 1) & 63; + u += y; + y += u; + x = Rotate64(y - x + v_first + Fetch64(s + 8), 37) * mul; + y = Rotate64(y ^ v_second ^ Fetch64(s + 48), 42) * mul; + x ^= w_second * 9; + y += v_first + Fetch64(s + 40); + z = Rotate64(z + w_first, 33) * mul; + WeakHashLen32WithSeeds(s, v_second * mul, x + w_first, out v_first, out v_second); + WeakHashLen32WithSeeds(s + 32, z + w_second, y + Fetch64(s + 16), out w_first, out w_second); + return H(HashLen16(v_first + x, w_first ^ y, mul) + z - u, H(v_second + y, w_second + z, k2, 30) ^ x, k2, 31); + } + } + + #endregion + } +} diff --git a/Assets/Scripts/MessagePack/Internal/FarmHash.cs.meta b/Assets/Scripts/MessagePack/Internal/FarmHash.cs.meta new file mode 100644 index 000000000..bba8ec765 --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/FarmHash.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fb5a050df97c09dd9b40337e9c0bbdcd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Internal/GuidBits.cs b/Assets/Scripts/MessagePack/Internal/GuidBits.cs new file mode 100644 index 000000000..c8b12de23 --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/GuidBits.cs @@ -0,0 +1,391 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Runtime.InteropServices; + +namespace MessagePack.Internal +{ + [StructLayout(LayoutKind.Explicit, Pack = 1)] + internal struct GuidBits + { + [FieldOffset(0)] + public readonly Guid Value; + + [FieldOffset(0)] + public readonly byte Byte0; + [FieldOffset(1)] + public readonly byte Byte1; + [FieldOffset(2)] + public readonly byte Byte2; + [FieldOffset(3)] + public readonly byte Byte3; + [FieldOffset(4)] + public readonly byte Byte4; + [FieldOffset(5)] + public readonly byte Byte5; + [FieldOffset(6)] + public readonly byte Byte6; + [FieldOffset(7)] + public readonly byte Byte7; + [FieldOffset(8)] + public readonly byte Byte8; + [FieldOffset(9)] + public readonly byte Byte9; + [FieldOffset(10)] + public readonly byte Byte10; + [FieldOffset(11)] + public readonly byte Byte11; + [FieldOffset(12)] + public readonly byte Byte12; + [FieldOffset(13)] + public readonly byte Byte13; + [FieldOffset(14)] + public readonly byte Byte14; + [FieldOffset(15)] + public readonly byte Byte15; + + // string.Join(", ", Enumerable.Range(0, 256).Select(x => (int)BitConverter.ToString(new byte[] { (byte)x }).ToLower()[0])) + private static byte[] byteToHexStringHigh = new byte[256] { 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102 }; + + // string.Join(", ", Enumerable.Range(0, 256).Select(x => (int)BitConverter.ToString(new byte[] { (byte)x }).ToLower()[1])) + private static byte[] byteToHexStringLow = new byte[256] { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102 }; + + public GuidBits(ref Guid value) + { + this = default(GuidBits); + this.Value = value; + } + + // 4-pattern, lower/upper and '-' or no + public GuidBits(ReadOnlySpan utf8string) + { + this = default(GuidBits); + + // 32 + if (utf8string.Length == 32) + { + if (BitConverter.IsLittleEndian) + { + this.Byte0 = Parse(utf8string, 6); + this.Byte1 = Parse(utf8string, 4); + this.Byte2 = Parse(utf8string, 2); + this.Byte3 = Parse(utf8string, 0); + + this.Byte4 = Parse(utf8string, 10); + this.Byte5 = Parse(utf8string, 8); + + this.Byte6 = Parse(utf8string, 14); + this.Byte7 = Parse(utf8string, 12); + } + else + { + this.Byte0 = Parse(utf8string, 0); + this.Byte1 = Parse(utf8string, 2); + this.Byte2 = Parse(utf8string, 4); + this.Byte3 = Parse(utf8string, 6); + + this.Byte4 = Parse(utf8string, 8); + this.Byte5 = Parse(utf8string, 10); + + this.Byte6 = Parse(utf8string, 12); + this.Byte7 = Parse(utf8string, 14); + } + + this.Byte8 = Parse(utf8string, 16); + this.Byte9 = Parse(utf8string, 18); + + this.Byte10 = Parse(utf8string, 20); + this.Byte11 = Parse(utf8string, 22); + this.Byte12 = Parse(utf8string, 24); + this.Byte13 = Parse(utf8string, 26); + this.Byte14 = Parse(utf8string, 28); + this.Byte15 = Parse(utf8string, 30); + return; + } + else if (utf8string.Length == 36) + { + // '-' => 45 + if (BitConverter.IsLittleEndian) + { + this.Byte0 = Parse(utf8string, 6); + this.Byte1 = Parse(utf8string, 4); + this.Byte2 = Parse(utf8string, 2); + this.Byte3 = Parse(utf8string, 0); + + if (utf8string[8] != '-') + { + goto ERROR; + } + + this.Byte4 = Parse(utf8string, 11); + this.Byte5 = Parse(utf8string, 9); + + if (utf8string[13] != '-') + { + goto ERROR; + } + + this.Byte6 = Parse(utf8string, 16); + this.Byte7 = Parse(utf8string, 14); + } + else + { + this.Byte0 = Parse(utf8string, 0); + this.Byte1 = Parse(utf8string, 2); + this.Byte2 = Parse(utf8string, 4); + this.Byte3 = Parse(utf8string, 6); + + if (utf8string[8] != '-') + { + goto ERROR; + } + + this.Byte4 = Parse(utf8string, 9); + this.Byte5 = Parse(utf8string, 11); + + if (utf8string[13] != '-') + { + goto ERROR; + } + + this.Byte6 = Parse(utf8string, 14); + this.Byte7 = Parse(utf8string, 16); + } + + if (utf8string[18] != '-') + { + goto ERROR; + } + + this.Byte8 = Parse(utf8string, 19); + this.Byte9 = Parse(utf8string, 21); + + if (utf8string[23] != '-') + { + goto ERROR; + } + + this.Byte10 = Parse(utf8string, 24); + this.Byte11 = Parse(utf8string, 26); + this.Byte12 = Parse(utf8string, 28); + this.Byte13 = Parse(utf8string, 30); + this.Byte14 = Parse(utf8string, 32); + this.Byte15 = Parse(utf8string, 34); + return; + } + +ERROR: + throw new MessagePackSerializationException("Invalid Guid Pattern."); + } + +#if !UNITY_2018_3_OR_NEWER + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] +#endif + private static byte Parse(ReadOnlySpan bytes, int highOffset) + { + return unchecked((byte)((SwitchParse(bytes[highOffset]) * 16) + SwitchParse(bytes[highOffset + 1]))); + } + +#if !UNITY_2018_3_OR_NEWER + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] +#endif + private static byte SwitchParse(byte b) + { + // '0'(48) ~ '9'(57) => -48 + // 'A'(65) ~ 'F'(70) => -55 + // 'a'(97) ~ 'f'(102) => -87 + switch (b) + { + case 48: + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + case 56: + case 57: + return unchecked((byte)(b - 48)); + case 65: + case 66: + case 67: + case 68: + case 69: + case 70: + return unchecked((byte)(b - 55)); + case 97: + case 98: + case 99: + case 100: + case 101: + case 102: + return unchecked((byte)(b - 87)); + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 45: + case 46: + case 47: + case 58: + case 59: + case 60: + case 61: + case 62: + case 63: + case 64: + case 71: + case 72: + case 73: + case 74: + case 75: + case 76: + case 77: + case 78: + case 79: + case 80: + case 81: + case 82: + case 83: + case 84: + case 85: + case 86: + case 87: + case 88: + case 89: + case 90: + case 91: + case 92: + case 93: + case 94: + case 95: + case 96: + default: + throw new MessagePackSerializationException("Invalid Guid Pattern."); + } + } + + // 4(x2) - 2(x2) - 2(x2) - 2(x2) - 6(x2) + public void Write(Span buffer) + { + if (BitConverter.IsLittleEndian) + { + // int(_a) + buffer[6] = byteToHexStringHigh[this.Byte0]; + buffer[7] = byteToHexStringLow[this.Byte0]; + buffer[4] = byteToHexStringHigh[this.Byte1]; + buffer[5] = byteToHexStringLow[this.Byte1]; + buffer[2] = byteToHexStringHigh[this.Byte2]; + buffer[3] = byteToHexStringLow[this.Byte2]; + buffer[0] = byteToHexStringHigh[this.Byte3]; + buffer[1] = byteToHexStringLow[this.Byte3]; + + buffer[8] = (byte)'-'; + + // short(_b) + buffer[11] = byteToHexStringHigh[this.Byte4]; + buffer[12] = byteToHexStringLow[this.Byte4]; + buffer[9] = byteToHexStringHigh[this.Byte5]; + buffer[10] = byteToHexStringLow[this.Byte5]; + + buffer[13] = (byte)'-'; + + // short(_c) + buffer[16] = byteToHexStringHigh[this.Byte6]; + buffer[17] = byteToHexStringLow[this.Byte6]; + buffer[14] = byteToHexStringHigh[this.Byte7]; + buffer[15] = byteToHexStringLow[this.Byte7]; + } + else + { + buffer[0] = byteToHexStringHigh[this.Byte0]; + buffer[1] = byteToHexStringLow[this.Byte0]; + buffer[2] = byteToHexStringHigh[this.Byte1]; + buffer[3] = byteToHexStringLow[this.Byte1]; + buffer[4] = byteToHexStringHigh[this.Byte2]; + buffer[5] = byteToHexStringLow[this.Byte2]; + buffer[6] = byteToHexStringHigh[this.Byte3]; + buffer[7] = byteToHexStringLow[this.Byte3]; + + buffer[8] = (byte)'-'; + + buffer[9] = byteToHexStringHigh[this.Byte4]; + buffer[10] = byteToHexStringLow[this.Byte4]; + buffer[11] = byteToHexStringHigh[this.Byte5]; + buffer[12] = byteToHexStringLow[this.Byte5]; + + buffer[13] = (byte)'-'; + + buffer[14] = byteToHexStringHigh[this.Byte6]; + buffer[15] = byteToHexStringLow[this.Byte6]; + buffer[16] = byteToHexStringHigh[this.Byte7]; + buffer[17] = byteToHexStringLow[this.Byte7]; + } + + buffer[18] = (byte)'-'; + + buffer[19] = byteToHexStringHigh[this.Byte8]; + buffer[20] = byteToHexStringLow[this.Byte8]; + buffer[21] = byteToHexStringHigh[this.Byte9]; + buffer[22] = byteToHexStringLow[this.Byte9]; + + buffer[23] = (byte)'-'; + + buffer[24] = byteToHexStringHigh[this.Byte10]; + buffer[25] = byteToHexStringLow[this.Byte10]; + buffer[26] = byteToHexStringHigh[this.Byte11]; + buffer[27] = byteToHexStringLow[this.Byte11]; + buffer[28] = byteToHexStringHigh[this.Byte12]; + buffer[29] = byteToHexStringLow[this.Byte12]; + buffer[30] = byteToHexStringHigh[this.Byte13]; + buffer[31] = byteToHexStringLow[this.Byte13]; + buffer[32] = byteToHexStringHigh[this.Byte14]; + buffer[33] = byteToHexStringLow[this.Byte14]; + buffer[34] = byteToHexStringHigh[this.Byte15]; + buffer[35] = byteToHexStringLow[this.Byte15]; + } + } +} diff --git a/Assets/Scripts/MessagePack/Internal/GuidBits.cs.meta b/Assets/Scripts/MessagePack/Internal/GuidBits.cs.meta new file mode 100644 index 000000000..dbebe57a6 --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/GuidBits.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0bb83f98e290402db9fcb6da74f773ca +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Internal/ILGeneratorExtensions.cs b/Assets/Scripts/MessagePack/Internal/ILGeneratorExtensions.cs new file mode 100644 index 000000000..aabada186 --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/ILGeneratorExtensions.cs @@ -0,0 +1,401 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +#if !(UNITY_2018_3_OR_NEWER && NET_STANDARD_2_0) + +using System; +using System.Linq; +using System.Reflection; +using System.Reflection.Emit; + +#pragma warning disable SA1649 // File name should match first type name + +namespace MessagePack.Internal +{ + internal struct ArgumentField + { + private readonly int i; + private readonly bool @ref; + private readonly ILGenerator il; + + public ArgumentField(ILGenerator il, int i, bool @ref = false) + { + this.il = il; + this.i = i; + this.@ref = @ref; + } + + public ArgumentField(ILGenerator il, int i, Type type) + { + this.il = il; + this.i = i; + TypeInfo ti = type.GetTypeInfo(); + this.@ref = (ti.IsClass || ti.IsInterface || ti.IsAbstract) ? false : true; + } + + public void EmitLoad() + { + if (this.@ref) + { + this.il.EmitLdarga(this.i); + } + else + { + this.il.EmitLdarg(this.i); + } + } + + public void EmitLdarg() + { + this.il.EmitLdarg(this.i); + } + + public void EmitLdarga() + { + this.il.EmitLdarga(this.i); + } + + public void EmitStore() + { + this.il.EmitStarg(this.i); + } + } + + /// + /// Provides optimized generation code and helpers. + /// + internal static class ILGeneratorExtensions + { + /// + /// Loads the local variable at a specific index onto the evaluation stack. + /// + public static void EmitLdloc(this ILGenerator il, int index) + { + switch (index) + { + case 0: + il.Emit(OpCodes.Ldloc_0); + break; + case 1: + il.Emit(OpCodes.Ldloc_1); + break; + case 2: + il.Emit(OpCodes.Ldloc_2); + break; + case 3: + il.Emit(OpCodes.Ldloc_3); + break; + default: + if (index <= 255) + { + il.Emit(OpCodes.Ldloc_S, (byte)index); + } + else + { + il.Emit(OpCodes.Ldloc, (short)index); + } + + break; + } + } + + public static void EmitLdloc(this ILGenerator il, LocalBuilder local) + { + EmitLdloc(il, local.LocalIndex); + } + + /// + /// Pops the current value from the top of the evaluation stack and stores it in a the local variable list at a specified index. + /// + public static void EmitStloc(this ILGenerator il, int index) + { + switch (index) + { + case 0: + il.Emit(OpCodes.Stloc_0); + break; + case 1: + il.Emit(OpCodes.Stloc_1); + break; + case 2: + il.Emit(OpCodes.Stloc_2); + break; + case 3: + il.Emit(OpCodes.Stloc_3); + break; + default: + if (index <= 255) + { + il.Emit(OpCodes.Stloc_S, (byte)index); + } + else + { + il.Emit(OpCodes.Stloc, (short)index); + } + + break; + } + } + + public static void EmitStloc(this ILGenerator il, LocalBuilder local) + { + EmitStloc(il, local.LocalIndex); + } + + /// + /// Loads the address of the local variable at a specific index onto the evaluation statck. + /// + public static void EmitLdloca(this ILGenerator il, int index) + { + if (index <= 255) + { + il.Emit(OpCodes.Ldloca_S, (byte)index); + } + else + { + il.Emit(OpCodes.Ldloca, (short)index); + } + } + + public static void EmitLdloca(this ILGenerator il, LocalBuilder local) + { + EmitLdloca(il, local.LocalIndex); + } + + public static void EmitTrue(this ILGenerator il) + { + EmitBoolean(il, true); + } + + public static void EmitFalse(this ILGenerator il) + { + EmitBoolean(il, false); + } + + public static void EmitBoolean(this ILGenerator il, bool value) + { + EmitLdc_I4(il, value ? 1 : 0); + } + + /// + /// Pushes a supplied value of type int32 onto the evaluation stack as an int32. + /// + public static void EmitLdc_I4(this ILGenerator il, int value) + { + switch (value) + { + case -1: + il.Emit(OpCodes.Ldc_I4_M1); + break; + case 0: + il.Emit(OpCodes.Ldc_I4_0); + break; + case 1: + il.Emit(OpCodes.Ldc_I4_1); + break; + case 2: + il.Emit(OpCodes.Ldc_I4_2); + break; + case 3: + il.Emit(OpCodes.Ldc_I4_3); + break; + case 4: + il.Emit(OpCodes.Ldc_I4_4); + break; + case 5: + il.Emit(OpCodes.Ldc_I4_5); + break; + case 6: + il.Emit(OpCodes.Ldc_I4_6); + break; + case 7: + il.Emit(OpCodes.Ldc_I4_7); + break; + case 8: + il.Emit(OpCodes.Ldc_I4_8); + break; + default: + if (value >= -128 && value <= 127) + { + il.Emit(OpCodes.Ldc_I4_S, (sbyte)value); + } + else + { + il.Emit(OpCodes.Ldc_I4, value); + } + + break; + } + } + + public static void EmitUnboxOrCast(this ILGenerator il, Type type) + { + if (type.GetTypeInfo().IsValueType) + { + il.Emit(OpCodes.Unbox_Any, type); + } + else + { + il.Emit(OpCodes.Castclass, type); + } + } + + public static void EmitBoxOrDoNothing(this ILGenerator il, Type type) + { + if (type.GetTypeInfo().IsValueType) + { + il.Emit(OpCodes.Box, type); + } + } + + public static void EmitLdarg(this ILGenerator il, int index) + { + switch (index) + { + case 0: + il.Emit(OpCodes.Ldarg_0); + break; + case 1: + il.Emit(OpCodes.Ldarg_1); + break; + case 2: + il.Emit(OpCodes.Ldarg_2); + break; + case 3: + il.Emit(OpCodes.Ldarg_3); + break; + default: + if (index <= 255) + { + il.Emit(OpCodes.Ldarg_S, (byte)index); + } + else + { + il.Emit(OpCodes.Ldarg, index); + } + + break; + } + } + + public static void EmitLoadThis(this ILGenerator il) + { + EmitLdarg(il, 0); + } + + public static void EmitLdarga(this ILGenerator il, int index) + { + if (index <= 255) + { + il.Emit(OpCodes.Ldarga_S, (byte)index); + } + else + { + il.Emit(OpCodes.Ldarga, index); + } + } + + public static void EmitStarg(this ILGenerator il, int index) + { + if (index <= 255) + { + il.Emit(OpCodes.Starg_S, (byte)index); + } + else + { + il.Emit(OpCodes.Starg, index); + } + } + + /// + /// Helper for Pop op. + /// + public static void EmitPop(this ILGenerator il, int count) + { + for (int i = 0; i < count; i++) + { + il.Emit(OpCodes.Pop); + } + } + + public static void EmitCall(this ILGenerator il, MethodInfo methodInfo) + { + if (methodInfo.IsFinal || !methodInfo.IsVirtual) + { + il.Emit(OpCodes.Call, methodInfo); + } + else + { + il.Emit(OpCodes.Callvirt, methodInfo); + } + } + + public static void EmitLdfld(this ILGenerator il, FieldInfo fieldInfo) + { + il.Emit(OpCodes.Ldfld, fieldInfo); + } + + public static void EmitLdsfld(this ILGenerator il, FieldInfo fieldInfo) + { + il.Emit(OpCodes.Ldsfld, fieldInfo); + } + + public static void EmitRet(this ILGenerator il) + { + il.Emit(OpCodes.Ret); + } + + public static void EmitIntZeroReturn(this ILGenerator il) + { + il.EmitLdc_I4(0); + il.Emit(OpCodes.Ret); + } + + public static void EmitNullReturn(this ILGenerator il) + { + il.Emit(OpCodes.Ldnull); + il.Emit(OpCodes.Ret); + } + + public static void EmitULong(this ILGenerator il, ulong value) + { + il.Emit(OpCodes.Ldc_I8, unchecked((long)value)); + } + + public static void EmitThrowNotimplemented(this ILGenerator il) + { + il.Emit(OpCodes.Newobj, typeof(System.NotImplementedException).GetTypeInfo().DeclaredConstructors.First(x => x.GetParameters().Length == 0)); + il.Emit(OpCodes.Throw); + } + + /// for var i = 0, i ..., i++. + public static void EmitIncrementFor(this ILGenerator il, LocalBuilder conditionGreater, Action emitBody) + { + Label loopBegin = il.DefineLabel(); + Label condtionLabel = il.DefineLabel(); + + // var i = 0 + LocalBuilder forI = il.DeclareLocal(typeof(int)); + il.EmitLdc_I4(0); + il.EmitStloc(forI); + il.Emit(OpCodes.Br, condtionLabel); + + il.MarkLabel(loopBegin); + emitBody(forI); + + // i++ + il.EmitLdloc(forI); + il.EmitLdc_I4(1); + il.Emit(OpCodes.Add); + il.EmitStloc(forI); + + //// i < *** + il.MarkLabel(condtionLabel); + il.EmitLdloc(forI); + il.EmitLdloc(conditionGreater); + il.Emit(OpCodes.Blt, loopBegin); + } + } +} + +#endif diff --git a/Assets/Scripts/MessagePack/Internal/ILGeneratorExtensions.cs.meta b/Assets/Scripts/MessagePack/Internal/ILGeneratorExtensions.cs.meta new file mode 100644 index 000000000..f8017439d --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/ILGeneratorExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a7fcc89bc1ce33b46b7e5d8bcaa7f0fa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Internal/ReflectionExtensions.cs b/Assets/Scripts/MessagePack/Internal/ReflectionExtensions.cs new file mode 100644 index 000000000..33052b096 --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/ReflectionExtensions.cs @@ -0,0 +1,49 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Reflection; +using System.Runtime.CompilerServices; + +namespace MessagePack.Internal +{ + internal static class ReflectionExtensions + { + public static bool IsNullable(this System.Reflection.TypeInfo type) + { + return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(System.Nullable<>); + } + + public static bool IsPublic(this System.Reflection.TypeInfo type) + { + return type.IsPublic; + } + + public static bool IsAnonymous(this System.Reflection.TypeInfo type) + { + return type.GetCustomAttribute() != null + && type.IsGenericType && type.Name.Contains("AnonymousType") + && (type.Name.StartsWith("<>") || type.Name.StartsWith("VB$")) + && (type.Attributes & TypeAttributes.NotPublic) == TypeAttributes.NotPublic; + } + + public static bool IsIndexer(this System.Reflection.PropertyInfo propertyInfo) + { + return propertyInfo.GetIndexParameters().Length > 0; + } + + public static bool IsConstructedGenericType(this System.Reflection.TypeInfo type) + { + return type.AsType().IsConstructedGenericType; + } + + public static MethodInfo GetGetMethod(this PropertyInfo propInfo) + { + return propInfo.GetMethod; + } + + public static MethodInfo GetSetMethod(this PropertyInfo propInfo) + { + return propInfo.SetMethod; + } + } +} diff --git a/Assets/Scripts/MessagePack/Internal/ReflectionExtensions.cs.meta b/Assets/Scripts/MessagePack/Internal/ReflectionExtensions.cs.meta new file mode 100644 index 000000000..b8c951777 --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/ReflectionExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 82787207c36d0a4a98d7f53b49ba1576 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Internal/Sequence`1.cs b/Assets/Scripts/MessagePack/Internal/Sequence`1.cs new file mode 100644 index 000000000..62232e48b --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/Sequence`1.cs @@ -0,0 +1,573 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +/* Original license and copyright from file copied from https://github.com/AArnott/Nerdbank.Streams/blob/d656899be26d4d7c72c11c9232b4952c64a89bcb/src/Nerdbank.Streams/Sequence%601.cs + * Copyright (c) Andrew Arnott. All rights reserved. + * Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. +*/ + +using System; +using System.Buffers; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Nerdbank.Streams +{ + /// + /// Manages a sequence of elements, readily castable as a . + /// + /// The type of element stored by the sequence. + /// + /// Instance members are not thread-safe. + /// + [DebuggerDisplay("{" + nameof(DebuggerDisplay) + ",nq}")] + internal class Sequence : IBufferWriter, IDisposable + { + private static readonly int DefaultLengthFromArrayPool = 1 + (4095 / Marshal.SizeOf()); + + private readonly Stack segmentPool = new Stack(); + + private readonly MemoryPool memoryPool; + + private readonly ArrayPool arrayPool; + + private SequenceSegment first; + + private SequenceSegment last; + + /// + /// Initializes a new instance of the class + /// that uses a private for recycling arrays. + /// + public Sequence() + : this(ArrayPool.Create()) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The pool to use for recycling backing arrays. + public Sequence(MemoryPool memoryPool) + { + Requires.NotNull(memoryPool, nameof(memoryPool)); + this.memoryPool = memoryPool; + } + + /// + /// Initializes a new instance of the class. + /// + /// The pool to use for recycling backing arrays. + public Sequence(ArrayPool arrayPool) + { + Requires.NotNull(arrayPool, nameof(arrayPool)); + this.arrayPool = arrayPool; + } + + /// + /// Gets or sets the minimum length for any array allocated as a segment in the sequence. + /// Any non-positive value allows the pool to determine the length of the array. + /// + /// The default value is 0. + /// + /// + /// Each time or is called, + /// previously allocated memory is used if it is large enough to satisfy the length demand. + /// If new memory must be allocated, the argument to one of these methods typically dictate + /// the length of array to allocate. When the caller uses very small values (just enough for its immediate need) + /// but the high level scenario can predict that a large amount of memory will be ultimately required, + /// it can be advisable to set this property to a value such that just a few larger arrays are allocated + /// instead of many small ones. + /// + /// + /// The in use may itself have a minimum array length as well, + /// in which case the higher of the two minimums dictate the minimum array size that will be allocated. + /// + /// + public int MinimumSpanLength { get; set; } = 0; + + /// + /// Gets this sequence expressed as a . + /// + /// A read only sequence representing the data in this object. + public ReadOnlySequence AsReadOnlySequence => this; + + /// + /// Gets the length of the sequence. + /// + public long Length => this.AsReadOnlySequence.Length; + + /// + /// Gets the value to display in a debugger datatip. + /// + private string DebuggerDisplay => $"Length: {this.AsReadOnlySequence.Length}"; + + /// + /// Expresses this sequence as a . + /// + /// The sequence to convert. + public static implicit operator ReadOnlySequence(Sequence sequence) + { + return sequence.first != null + ? new ReadOnlySequence(sequence.first, sequence.first.Start, sequence.last, sequence.last.End) + : ReadOnlySequence.Empty; + } + + /// + /// Removes all elements from the sequence from its beginning to the specified position, + /// considering that data to have been fully processed. + /// + /// + /// The position of the first element that has not yet been processed. + /// This is typically after reading all elements from that instance. + /// + public void AdvanceTo(SequencePosition position) + { + var firstSegment = (SequenceSegment)position.GetObject(); + int firstIndex = position.GetInteger(); + + // Before making any mutations, confirm that the block specified belongs to this sequence. + var current = this.first; + while (current != firstSegment && current != null) + { + current = current.Next; + } + + Requires.Argument(current != null, nameof(position), "Position does not represent a valid position in this sequence."); + + // Also confirm that the position is not a prior position in the block. + Requires.Argument(firstIndex >= current.Start, nameof(position), "Position must not be earlier than current position."); + + // Now repeat the loop, performing the mutations. + current = this.first; + while (current != firstSegment) + { + current = this.RecycleAndGetNext(current); + } + + firstSegment.AdvanceTo(firstIndex); + + if (firstSegment.Length == 0) + { + firstSegment = this.RecycleAndGetNext(firstSegment); + } + + this.first = firstSegment; + + if (this.first == null) + { + this.last = null; + } + } + + /// + /// Advances the sequence to include the specified number of elements initialized into memory + /// returned by a prior call to . + /// + /// The number of elements written into memory. + public void Advance(int count) + { + SequenceSegment last = this.last; + Verify.Operation(last != null, "Cannot advance before acquiring memory."); + last.Advance(count); + } + + /// + /// Gets writable memory that can be initialized and added to the sequence via a subsequent call to . + /// + /// The size of the memory required, or 0 to just get a convenient (non-empty) buffer. + /// The requested memory. + public Memory GetMemory(int sizeHint) => this.GetSegment(sizeHint).RemainingMemory; + + /// + /// Gets writable memory that can be initialized and added to the sequence via a subsequent call to . + /// + /// The size of the memory required, or 0 to just get a convenient (non-empty) buffer. + /// The requested memory. + public Span GetSpan(int sizeHint) => this.GetSegment(sizeHint).RemainingSpan; + + /// + /// Clears the entire sequence, recycles associated memory into pools, + /// and resets this instance for reuse. + /// This invalidates any previously produced by this instance. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void Dispose() => this.Reset(); + + /// + /// Clears the entire sequence and recycles associated memory into pools. + /// This invalidates any previously produced by this instance. + /// + public void Reset() + { + var current = this.first; + while (current != null) + { + current = this.RecycleAndGetNext(current); + } + + this.first = this.last = null; + } + + private SequenceSegment GetSegment(int sizeHint) + { + Requires.Range(sizeHint >= 0, nameof(sizeHint)); + int? minBufferSize = null; + if (sizeHint == 0) + { + if (this.last == null || this.last.WritableBytes == 0) + { + // We're going to need more memory. Take whatever size the pool wants to give us. + minBufferSize = -1; + } + } + else + { + sizeHint = Math.Max(this.MinimumSpanLength, sizeHint); + if (this.last == null || this.last.WritableBytes < sizeHint) + { + minBufferSize = sizeHint; + } + } + + if (minBufferSize.HasValue) + { + var segment = this.segmentPool.Count > 0 ? this.segmentPool.Pop() : new SequenceSegment(); + if (this.arrayPool != null) + { + segment.Assign(this.arrayPool.Rent(minBufferSize.Value == -1 ? DefaultLengthFromArrayPool : minBufferSize.Value)); + } + else + { + segment.Assign(this.memoryPool.Rent(minBufferSize.Value)); + } + + this.Append(segment); + } + + return this.last; + } + + private void Append(SequenceSegment segment) + { + if (this.last == null) + { + this.first = this.last = segment; + } + else + { + if (this.last.Length > 0) + { + // Add a new block. + this.last.SetNext(segment); + } + else + { + // The last block is completely unused. Replace it instead of appending to it. + var current = this.first; + if (this.first != this.last) + { + while (current.Next != this.last) + { + current = current.Next; + } + } + else + { + this.first = segment; + } + + current.SetNext(segment); + this.RecycleAndGetNext(this.last); + } + + this.last = segment; + } + } + + private SequenceSegment RecycleAndGetNext(SequenceSegment segment) + { + var recycledSegment = segment; + segment = segment.Next; + recycledSegment.ResetMemory(this.arrayPool); + this.segmentPool.Push(recycledSegment); + return segment; + } + + private class SequenceSegment : ReadOnlySequenceSegment + { + /// + /// A value indicating whether the element is a value type. + /// + private static readonly bool IsValueTypeElement = typeof(T).GetTypeInfo().IsValueType; + + /// + /// Gets the backing array, when using an instead of a . + /// + private T[] array; + + /// + /// Gets the position within where the data starts. + /// + /// This may be nonzero as a result of calling . + internal int Start { get; private set; } + + /// + /// Gets the position within where the data ends. + /// + internal int End { get; private set; } + + /// + /// Gets the tail of memory that has not yet been committed. + /// + internal Memory RemainingMemory => this.AvailableMemory.Slice(this.End); + + /// + /// Gets the tail of memory that has not yet been committed. + /// + internal Span RemainingSpan => this.AvailableMemory.Span.Slice(this.End); + + /// + /// Gets the tracker for the underlying array for this segment, which can be used to recycle the array when we're disposed of. + /// Will be null if using an array pool, in which case the memory is held by . + /// + internal IMemoryOwner MemoryOwner { get; private set; } + + /// + /// Gets the full memory owned by the . + /// + internal Memory AvailableMemory => this.array ?? this.MemoryOwner?.Memory ?? default; + + /// + /// Gets the number of elements that are committed in this segment. + /// + internal int Length => this.End - this.Start; + + /// + /// Gets the amount of writable bytes in this segment. + /// It is the amount of bytes between and . + /// + internal int WritableBytes => this.AvailableMemory.Length - this.End; + + /// + /// Gets or sets the next segment in the singly linked list of segments. + /// + internal new SequenceSegment Next + { + get => (SequenceSegment)base.Next; + set => base.Next = value; + } + + /// + /// Assigns this (recyclable) segment a new area in memory. + /// + /// The memory and a means to recycle it. + internal void Assign(IMemoryOwner memoryOwner) + { + this.MemoryOwner = memoryOwner; + this.Memory = memoryOwner.Memory; + } + + /// + /// Assigns this (recyclable) segment a new area in memory. + /// + /// An array drawn from an . + internal void Assign(T[] array) + { + this.array = array; + this.Memory = array; + } + + /// + /// Clears all fields in preparation to recycle this instance. + /// + internal void ResetMemory(ArrayPool arrayPool) + { + this.ClearReferences(this.Start, this.End); + this.Memory = default; + this.Next = null; + this.RunningIndex = 0; + this.Start = 0; + this.End = 0; + if (this.array != null) + { + arrayPool.Return(this.array); + this.array = null; + } + else + { + this.MemoryOwner?.Dispose(); + this.MemoryOwner = null; + } + } + + /// + /// Adds a new segment after this one. + /// + /// The next segment in the linked list. + internal void SetNext(SequenceSegment segment) + { + Debug.Assert(segment != null, "Null not allowed."); + this.Next = segment; + segment.RunningIndex = this.RunningIndex + this.Start + this.Length; + + // When setting Memory, we start with index 0 instead of this.Start because + // the first segment has an explicit index set anyway, + // and we don't want to double-count it here. + this.Memory = this.AvailableMemory.Slice(0, this.Start + this.Length); + } + + /// + /// Commits more elements as written in this segment. + /// + /// The number of elements written. + internal void Advance(int count) + { + Requires.Range(count >= 0 && this.End + count <= this.Memory.Length, nameof(count)); + this.End += count; + } + + /// + /// Removes some elements from the start of this segment. + /// + /// The number of elements to ignore from the start of the underlying array. + internal void AdvanceTo(int offset) + { + Debug.Assert(offset >= this.Start, "Trying to rewind."); + this.ClearReferences(this.Start, offset - this.Start); + this.Start = offset; + } + + private void ClearReferences(int startIndex, int length) + { + // If we store references, clear them to allow the objects to be GC'd. + if (!IsValueTypeElement) + { + this.AvailableMemory.Span.Slice(startIndex, length).Fill(default); + } + } + } + } + + internal static class Requires + { + /// + /// Throws an if a condition does not evaluate to true. + /// + [DebuggerStepThrough] + public static void Range(bool condition, string parameterName, string message = null) + { + if (!condition) + { + FailRange(parameterName, message); + } + } + + /// + /// Throws an if a condition does not evaluate to true. + /// + /// Nothing. This method always throws. + [DebuggerStepThrough] + public static Exception FailRange(string parameterName, string message = null) + { + if (string.IsNullOrEmpty(message)) + { + throw new ArgumentOutOfRangeException(parameterName); + } + else + { + throw new ArgumentOutOfRangeException(parameterName, message); + } + } + + /// + /// Throws an exception if the specified parameter's value is null. + /// + /// The type of the parameter. + /// The value of the argument. + /// The name of the parameter to include in any thrown exception. + /// The value of the parameter. + /// Thrown if is null. + [DebuggerStepThrough] + public static T NotNull(T value, string parameterName) + where T : class // ensures value-types aren't passed to a null checking method + { + if (value == null) + { + throw new ArgumentNullException(parameterName); + } + + return value; + } + + /// + /// Throws an ArgumentException if a condition does not evaluate to true. + /// + [DebuggerStepThrough] + public static void Argument(bool condition, string parameterName, string message) + { + if (!condition) + { + throw new ArgumentException(message, parameterName); + } + } + + /// + /// Throws an ArgumentException if a condition does not evaluate to true. + /// + [DebuggerStepThrough] + public static void Argument(bool condition, string parameterName, string message, object arg1) + { + if (!condition) + { + throw new ArgumentException(String.Format(message, arg1), parameterName); + } + } + + /// + /// Throws an ArgumentException if a condition does not evaluate to true. + /// + [DebuggerStepThrough] + public static void Argument(bool condition, string parameterName, string message, object arg1, object arg2) + { + if (!condition) + { + throw new ArgumentException(String.Format(message, arg1, arg2), parameterName); + } + } + + /// + /// Throws an ArgumentException if a condition does not evaluate to true. + /// + [DebuggerStepThrough] + public static void Argument(bool condition, string parameterName, string message, params object[] args) + { + if (!condition) + { + throw new ArgumentException(String.Format(message, args), parameterName); + } + } + } + + /// + /// Common runtime checks that throw exceptions upon failure. + /// + internal static partial class Verify + { + /// + /// Throws an if a condition is false. + /// + [DebuggerStepThrough] + internal static void Operation(bool condition, string message) + { + if (!condition) + { + throw new InvalidOperationException(message); + } + } + } +} diff --git a/Assets/Scripts/MessagePack/Internal/Sequence`1.cs.meta b/Assets/Scripts/MessagePack/Internal/Sequence`1.cs.meta new file mode 100644 index 000000000..3ce445047 --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/Sequence`1.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 19e730b2bfc50b981bdcd41c703daab2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Internal/ThreadsafeTypeKeyHashTable.cs b/Assets/Scripts/MessagePack/Internal/ThreadsafeTypeKeyHashTable.cs new file mode 100644 index 000000000..74d954630 --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/ThreadsafeTypeKeyHashTable.cs @@ -0,0 +1,246 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Runtime.CompilerServices; + +#pragma warning disable SA1649 // File name should match first type name + +namespace MessagePack.Internal +{ + /// + /// A dictionary where is the key, and a configurable type + /// that is thread-safe to read and write, allowing concurrent reads and exclusive writes. + /// + /// The type of value stored in the dictionary. + internal class ThreadsafeTypeKeyHashTable + { + private Entry[] buckets; + private int size; // only use in writer lock + + private readonly object writerLock = new object(); + private readonly float loadFactor; + + // IEqualityComparer.Equals is overhead if key only Type, don't use it. + //// readonly IEqualityComparer comparer; + + public ThreadsafeTypeKeyHashTable(int capacity = 4, float loadFactor = 0.75f) + { + var tableSize = CalculateCapacity(capacity, loadFactor); + this.buckets = new Entry[tableSize]; + this.loadFactor = loadFactor; + } + + public bool TryAdd(Type key, TValue value) + { + return this.TryAdd(key, _ => value); // create lambda capture + } + + public bool TryAdd(Type key, Func valueFactory) + { + return this.TryAddInternal(key, valueFactory, out TValue _); + } + + private bool TryAddInternal(Type key, Func valueFactory, out TValue resultingValue) + { + lock (this.writerLock) + { + var nextCapacity = CalculateCapacity(this.size + 1, this.loadFactor); + + if (this.buckets.Length < nextCapacity) + { + // rehash + var nextBucket = new Entry[nextCapacity]; + for (int i = 0; i < this.buckets.Length; i++) + { + Entry e = this.buckets[i]; + while (e != null) + { + var newEntry = new Entry { Key = e.Key, Value = e.Value, Hash = e.Hash }; + this.AddToBuckets(nextBucket, key, newEntry, null, out resultingValue); + e = e.Next; + } + } + + // add entry(if failed to add, only do resize) + var successAdd = this.AddToBuckets(nextBucket, key, null, valueFactory, out resultingValue); + + // replace field(threadsafe for read) + VolatileWrite(ref this.buckets, nextBucket); + + if (successAdd) + { + this.size++; + } + + return successAdd; + } + else + { + // add entry(insert last is thread safe for read) + var successAdd = this.AddToBuckets(this.buckets, key, null, valueFactory, out resultingValue); + if (successAdd) + { + this.size++; + } + + return successAdd; + } + } + } + + private bool AddToBuckets(Entry[] buckets, Type newKey, Entry newEntryOrNull, Func valueFactory, out TValue resultingValue) + { + var h = (newEntryOrNull != null) ? newEntryOrNull.Hash : newKey.GetHashCode(); + if (buckets[h & (buckets.Length - 1)] == null) + { + if (newEntryOrNull != null) + { + resultingValue = newEntryOrNull.Value; + VolatileWrite(ref buckets[h & (buckets.Length - 1)], newEntryOrNull); + } + else + { + resultingValue = valueFactory(newKey); + VolatileWrite(ref buckets[h & (buckets.Length - 1)], new Entry { Key = newKey, Value = resultingValue, Hash = h }); + } + } + else + { + Entry searchLastEntry = buckets[h & (buckets.Length - 1)]; + while (true) + { + if (searchLastEntry.Key == newKey) + { + resultingValue = searchLastEntry.Value; + return false; + } + + if (searchLastEntry.Next == null) + { + if (newEntryOrNull != null) + { + resultingValue = newEntryOrNull.Value; + VolatileWrite(ref searchLastEntry.Next, newEntryOrNull); + } + else + { + resultingValue = valueFactory(newKey); + VolatileWrite(ref searchLastEntry.Next, new Entry { Key = newKey, Value = resultingValue, Hash = h }); + } + + break; + } + + searchLastEntry = searchLastEntry.Next; + } + } + + return true; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public bool TryGetValue(Type key, out TValue value) + { + Entry[] table = this.buckets; + var hash = key.GetHashCode(); + Entry entry = table[hash & table.Length - 1]; + + while (entry != null) + { + if (entry.Key == key) + { + value = entry.Value; + return true; + } + + entry = entry.Next; + } + + value = default(TValue); + return false; + } + + public TValue GetOrAdd(Type key, Func valueFactory) + { + TValue v; + if (this.TryGetValue(key, out v)) + { + return v; + } + + this.TryAddInternal(key, valueFactory, out v); + return v; + } + + private static int CalculateCapacity(int collectionSize, float loadFactor) + { + var initialCapacity = (int)(((float)collectionSize) / loadFactor); + var capacity = 1; + while (capacity < initialCapacity) + { + capacity <<= 1; + } + + if (capacity < 8) + { + return 8; + } + + return capacity; + } + + private static void VolatileWrite(ref Entry location, Entry value) + { +#if !UNITY_2018_3_OR_NEWER + System.Threading.Volatile.Write(ref location, value); +#elif UNITY_2018_3_OR_NEWER || NET_4_6 + System.Threading.Volatile.Write(ref location, value); +#else + System.Threading.Thread.MemoryBarrier(); + location = value; +#endif + } + + private static void VolatileWrite(ref Entry[] location, Entry[] value) + { +#if !UNITY_2018_3_OR_NEWER + System.Threading.Volatile.Write(ref location, value); +#elif UNITY_2018_3_OR_NEWER || NET_4_6 + System.Threading.Volatile.Write(ref location, value); +#else + System.Threading.Thread.MemoryBarrier(); + location = value; +#endif + } + + private class Entry + { +#pragma warning disable SA1401 // Fields should be private + internal Type Key; + internal TValue Value; + internal int Hash; + internal Entry Next; +#pragma warning restore SA1401 // Fields should be private + + // debug only + public override string ToString() + { + return this.Key + "(" + this.Count() + ")"; + } + + private int Count() + { + var count = 1; + Entry n = this; + while (n.Next != null) + { + count++; + n = n.Next; + } + + return count; + } + } + } +} diff --git a/Assets/Scripts/MessagePack/Internal/ThreadsafeTypeKeyHashTable.cs.meta b/Assets/Scripts/MessagePack/Internal/ThreadsafeTypeKeyHashTable.cs.meta new file mode 100644 index 000000000..7b29cc78f --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/ThreadsafeTypeKeyHashTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 517dd6b1707013015b06ebfbeeea1f2c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Internal/TinyJsonReader.cs b/Assets/Scripts/MessagePack/Internal/TinyJsonReader.cs new file mode 100644 index 000000000..87263061a --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/TinyJsonReader.cs @@ -0,0 +1,430 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Globalization; +using System.IO; +using System.Text; + +#pragma warning disable SA1649 // File name should match first type name + +namespace MessagePack +{ + /* simple, tiny JSON reader for MessagePackSerializer.FromJson. + * this is simple, compact and enough fast but not optimized extremely. */ + + internal enum TinyJsonToken + { + None, + StartObject, // { + EndObject, // } + StartArray, // [ + EndArray, // ] + Number, // -0~9 + String, // "___" + True, // true + False, // false + Null, // null + } + + internal enum ValueType : byte + { + Null, + True, + False, + Double, + Long, + ULong, + Decimal, + String, + } + + public class TinyJsonException : MessagePackSerializationException + { + public TinyJsonException(string message) + : base(message) + { + } + } + + internal class TinyJsonReader : IDisposable + { + private readonly TextReader reader; + private readonly bool disposeInnerReader; + private StringBuilder reusableBuilder; + + public TinyJsonToken TokenType { get; private set; } + + public ValueType ValueType { get; private set; } + + public double DoubleValue { get; private set; } + + public long LongValue { get; private set; } + + public ulong ULongValue { get; private set; } + + public decimal DecimalValue { get; private set; } + + public string StringValue { get; private set; } + + public TinyJsonReader(TextReader reader, bool disposeInnerReader = true) + { + this.reader = reader; + this.disposeInnerReader = disposeInnerReader; + } + + public bool Read() + { + this.ReadNextToken(); + this.ReadValue(); + return this.TokenType != TinyJsonToken.None; + } + + public void Dispose() + { + if (this.reader != null && this.disposeInnerReader) + { + this.reader.Dispose(); + } + + this.TokenType = TinyJsonToken.None; + this.ValueType = ValueType.Null; + } + + private void SkipWhiteSpace() + { + var c = this.reader.Peek(); + while (c != -1 && Char.IsWhiteSpace((char)c)) + { + this.reader.Read(); + c = this.reader.Peek(); + } + } + + private char ReadChar() + { + return (char)this.reader.Read(); + } + + private static bool IsWordBreak(char c) + { + switch (c) + { + case ' ': + case '{': + case '}': + case '[': + case ']': + case ',': + case ':': + case '\"': + return true; + default: + return false; + } + } + + private void ReadNextToken() + { + this.SkipWhiteSpace(); + + var intChar = this.reader.Peek(); + if (intChar == -1) + { + this.TokenType = TinyJsonToken.None; + return; + } + + var c = (char)intChar; + switch (c) + { + case '{': + this.TokenType = TinyJsonToken.StartObject; + return; + case '}': + this.TokenType = TinyJsonToken.EndObject; + return; + case '[': + this.TokenType = TinyJsonToken.StartArray; + return; + case ']': + this.TokenType = TinyJsonToken.EndArray; + return; + case '"': + this.TokenType = TinyJsonToken.String; + return; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '-': + this.TokenType = TinyJsonToken.Number; + return; + case 't': + this.TokenType = TinyJsonToken.True; + return; + case 'f': + this.TokenType = TinyJsonToken.False; + return; + case 'n': + this.TokenType = TinyJsonToken.Null; + return; + case ',': + case ':': + this.reader.Read(); + this.ReadNextToken(); + return; + default: + throw new TinyJsonException("Invalid String:" + c); + } + } + + private void ReadValue() + { + this.ValueType = ValueType.Null; + + switch (this.TokenType) + { + case TinyJsonToken.None: + break; + case TinyJsonToken.StartObject: + case TinyJsonToken.EndObject: + case TinyJsonToken.StartArray: + case TinyJsonToken.EndArray: + this.reader.Read(); + break; + case TinyJsonToken.Number: + this.ReadNumber(); + break; + case TinyJsonToken.String: + this.ReadString(); + break; + case TinyJsonToken.True: + if (this.ReadChar() != 't') + { + throw new TinyJsonException("Invalid Token"); + } + + if (this.ReadChar() != 'r') + { + throw new TinyJsonException("Invalid Token"); + } + + if (this.ReadChar() != 'u') + { + throw new TinyJsonException("Invalid Token"); + } + + if (this.ReadChar() != 'e') + { + throw new TinyJsonException("Invalid Token"); + } + + this.ValueType = ValueType.True; + break; + case TinyJsonToken.False: + if (this.ReadChar() != 'f') + { + throw new TinyJsonException("Invalid Token"); + } + + if (this.ReadChar() != 'a') + { + throw new TinyJsonException("Invalid Token"); + } + + if (this.ReadChar() != 'l') + { + throw new TinyJsonException("Invalid Token"); + } + + if (this.ReadChar() != 's') + { + throw new TinyJsonException("Invalid Token"); + } + + if (this.ReadChar() != 'e') + { + throw new TinyJsonException("Invalid Token"); + } + + this.ValueType = ValueType.False; + break; + case TinyJsonToken.Null: + if (this.ReadChar() != 'n') + { + throw new TinyJsonException("Invalid Token"); + } + + if (this.ReadChar() != 'u') + { + throw new TinyJsonException("Invalid Token"); + } + + if (this.ReadChar() != 'l') + { + throw new TinyJsonException("Invalid Token"); + } + + if (this.ReadChar() != 'l') + { + throw new TinyJsonException("Invalid Token"); + } + + this.ValueType = ValueType.Null; + break; + default: + throw new MessagePackSerializationException("InvalidTokenState:" + this.TokenType); + } + } + + private void ReadNumber() + { + StringBuilder numberWord; + if (this.reusableBuilder == null) + { + this.reusableBuilder = new StringBuilder(); + numberWord = this.reusableBuilder; + } + else + { + numberWord = this.reusableBuilder; + numberWord.Length = 0; // Clear + } + + var isDouble = false; + var intChar = this.reader.Peek(); + while (intChar != -1 && !IsWordBreak((char)intChar)) + { + var c = this.ReadChar(); + numberWord.Append(c); + if (c == '.' || c == 'e' || c == 'E') + { + isDouble = true; + } + + intChar = this.reader.Peek(); + } + + var number = numberWord.ToString(); + if (isDouble) + { + double parsedDouble; + Double.TryParse(number, NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite | NumberStyles.AllowLeadingSign | NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands | NumberStyles.AllowExponent, System.Globalization.CultureInfo.InvariantCulture, out parsedDouble); + this.ValueType = ValueType.Double; + this.DoubleValue = parsedDouble; + } + else + { + long parsedInt; + if (Int64.TryParse(number, NumberStyles.Integer, System.Globalization.CultureInfo.InvariantCulture, out parsedInt)) + { + this.ValueType = ValueType.Long; + this.LongValue = parsedInt; + return; + } + + ulong parsedULong; + if (ulong.TryParse(number, NumberStyles.Integer, System.Globalization.CultureInfo.InvariantCulture, out parsedULong)) + { + this.ValueType = ValueType.ULong; + this.ULongValue = parsedULong; + return; + } + + Decimal parsedDecimal; + if (decimal.TryParse(number, NumberStyles.Number, System.Globalization.CultureInfo.InvariantCulture, out parsedDecimal)) + { + this.ValueType = ValueType.Decimal; + this.DecimalValue = parsedDecimal; + return; + } + } + } + + private void ReadString() + { + this.reader.Read(); // skip ["] + + StringBuilder sb; + if (this.reusableBuilder == null) + { + this.reusableBuilder = new StringBuilder(); + sb = this.reusableBuilder; + } + else + { + sb = this.reusableBuilder; + sb.Length = 0; // Clear + } + + while (true) + { + if (this.reader.Peek() == -1) + { + throw new TinyJsonException("Invalid Json String"); + } + + var c = this.ReadChar(); + switch (c) + { + case '"': // endtoken + goto END; + case '\\': // escape character + if (this.reader.Peek() == -1) + { + throw new TinyJsonException("Invalid Json String"); + } + + c = this.ReadChar(); + switch (c) + { + case '"': + case '\\': + case '/': + sb.Append(c); + break; + case 'b': + sb.Append('\b'); + break; + case 'f': + sb.Append('\f'); + break; + case 'n': + sb.Append('\n'); + break; + case 'r': + sb.Append('\r'); + break; + case 't': + sb.Append('\t'); + break; + case 'u': + var hex = new char[4]; + hex[0] = this.ReadChar(); + hex[1] = this.ReadChar(); + hex[2] = this.ReadChar(); + hex[3] = this.ReadChar(); + sb.Append((char)Convert.ToInt32(new string(hex), 16)); + break; + } + + break; + default: // string + sb.Append(c); + break; + } + } + +END: + this.ValueType = ValueType.String; + this.StringValue = sb.ToString(); + } + } +} diff --git a/Assets/Scripts/MessagePack/Internal/TinyJsonReader.cs.meta b/Assets/Scripts/MessagePack/Internal/TinyJsonReader.cs.meta new file mode 100644 index 000000000..60e432a72 --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/TinyJsonReader.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: adc1157b80c30cf2d8845336b9c1cfc2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Internal/UnsafeMemory.Low.cs b/Assets/Scripts/MessagePack/Internal/UnsafeMemory.Low.cs new file mode 100644 index 000000000..39e1f5c16 --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/UnsafeMemory.Low.cs @@ -0,0 +1,170 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +#if !UNITY_2018_3_OR_NEWER + +using System; +using System.Runtime.CompilerServices; + +namespace MessagePack.Internal +{ + /* for string key property name write optimization. */ + + public static class UnsafeMemory + { + public static readonly bool Is32Bit = IntPtr.Size == 4; + } + + public static partial class UnsafeMemory32 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw1(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(byte*)pDst = *(byte*)pSrc; + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw2(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(short*)pDst = *(short*)pSrc; + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw3(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(byte*)pDst = *(byte*)pSrc; + *(short*)(pDst + 1) = *(short*)(pSrc + 1); + } + + writer.Advance(src.Length); + } + } + + public static partial class UnsafeMemory64 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw1(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(byte*)pDst = *(byte*)pSrc; + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw2(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(short*)pDst = *(short*)pSrc; + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw3(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(byte*)pDst = *(byte*)pSrc; + *(short*)(pDst + 1) = *(short*)(pSrc + 1); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw4(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw5(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 1) = *(int*)(pSrc + 1); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw6(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 2) = *(int*)(pSrc + 2); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw7(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 3) = *(int*)(pSrc + 3); + } + + writer.Advance(src.Length); + } + } +} + +#endif diff --git a/Assets/Scripts/MessagePack/Internal/UnsafeMemory.Low.cs.meta b/Assets/Scripts/MessagePack/Internal/UnsafeMemory.Low.cs.meta new file mode 100644 index 000000000..0d94cbdbe --- /dev/null +++ b/Assets/Scripts/MessagePack/Internal/UnsafeMemory.Low.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2126473180c3a7d3a8860c4fd8aa4183 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/LZ4.meta b/Assets/Scripts/MessagePack/LZ4.meta new file mode 100644 index 000000000..655ac4352 --- /dev/null +++ b/Assets/Scripts/MessagePack/LZ4.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c633d9a494df48a45b82671c008a72a1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Helper.cs b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Helper.cs new file mode 100644 index 000000000..5c2004331 --- /dev/null +++ b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Helper.cs @@ -0,0 +1,94 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; + +namespace MessagePack.LZ4 +{ + internal partial class LZ4Codec + { +#if UNITY_2018_3_OR_NEWER + + // use 'Safe' code for Unity because in IL2CPP gots strange behaviour. + + public static int Encode(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset, int outputLength) + { + if (IntPtr.Size == 4) + { + return LZ4Codec.Encode32Safe(input, inputOffset, inputLength, output, outputOffset, outputLength); + } + else + { + return LZ4Codec.Encode64Safe(input, inputOffset, inputLength, output, outputOffset, outputLength); + } + } + + public static int Decode(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset, int outputLength) + { + if (IntPtr.Size == 4) + { + return LZ4Codec.Decode32Safe(input, inputOffset, inputLength, output, outputOffset, outputLength); + } + else + { + return LZ4Codec.Decode64Safe(input, inputOffset, inputLength, output, outputOffset, outputLength); + } + } + +#endif + + internal static class HashTablePool + { + [ThreadStatic] + private static ushort[] ushortPool; + + [ThreadStatic] + private static uint[] uintPool; + + [ThreadStatic] + private static int[] intPool; + + public static ushort[] GetUShortHashTablePool() + { + if (ushortPool == null) + { + ushortPool = new ushort[HASH64K_TABLESIZE]; + } + else + { + Array.Clear(ushortPool, 0, ushortPool.Length); + } + + return ushortPool; + } + + public static uint[] GetUIntHashTablePool() + { + if (uintPool == null) + { + uintPool = new uint[HASH_TABLESIZE]; + } + else + { + Array.Clear(uintPool, 0, uintPool.Length); + } + + return uintPool; + } + + public static int[] GetIntHashTablePool() + { + if (intPool == null) + { + intPool = new int[HASH_TABLESIZE]; + } + else + { + Array.Clear(intPool, 0, intPool.Length); + } + + return intPool; + } + } + } +} diff --git a/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Helper.cs.meta b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Helper.cs.meta new file mode 100644 index 000000000..84913cb4f --- /dev/null +++ b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Helper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f33bc878911a8855d8df41dd514c5a42 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Safe.cs b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Safe.cs new file mode 100644 index 000000000..18e423a7d --- /dev/null +++ b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Safe.cs @@ -0,0 +1,467 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +#if UNITY_2018_3_OR_NEWER + +#region license + +/* +Copyright (c) 2013, Milosz Krajewski +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided +that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#endregion + +using System; +using System.Diagnostics; + +namespace MessagePack.LZ4 +{ + /// Safe LZ4 codec. + internal partial class LZ4Codec + { +#region Helper + + [Conditional("DEBUG")] + private static void Assert(bool condition, string errorMessage) + { + if (!condition) + { + throw new ArgumentException(errorMessage); + } + + Debug.Assert(condition, errorMessage); + } + +#endregion + +#region Byte manipulation + + internal static void Poke2(byte[] buffer, int offset, ushort value) + { + buffer[offset] = (byte)value; + buffer[offset + 1] = (byte)(value >> 8); + } + + internal static ushort Peek2(byte[] buffer, int offset) + { + // NOTE: It's faster than BitConverter.ToUInt16 (suprised? me too) + return (ushort)(((uint)buffer[offset]) | ((uint)buffer[offset + 1] << 8)); + } + + internal static uint Peek4(byte[] buffer, int offset) + { + // NOTE: It's faster than BitConverter.ToUInt32 (suprised? me too) + return + ((uint)buffer[offset]) | + ((uint)buffer[offset + 1] << 8) | + ((uint)buffer[offset + 2] << 16) | + ((uint)buffer[offset + 3] << 24); + } + + private static uint Xor4(byte[] buffer, int offset1, int offset2) + { + // return Peek4(buffer, offset1) ^ Peek4(buffer, offset2); + var value1 = + ((uint)buffer[offset1]) | + ((uint)buffer[offset1 + 1] << 8) | + ((uint)buffer[offset1 + 2] << 16) | + ((uint)buffer[offset1 + 3] << 24); + var value2 = + ((uint)buffer[offset2]) | + ((uint)buffer[offset2 + 1] << 8) | + ((uint)buffer[offset2 + 2] << 16) | + ((uint)buffer[offset2 + 3] << 24); + return value1 ^ value2; + } + + private static ulong Xor8(byte[] buffer, int offset1, int offset2) + { + // return Peek8(buffer, offset1) ^ Peek8(buffer, offset2); + var value1 = + ((ulong)buffer[offset1]) | + ((ulong)buffer[offset1 + 1] << 8) | + ((ulong)buffer[offset1 + 2] << 16) | + ((ulong)buffer[offset1 + 3] << 24) | + ((ulong)buffer[offset1 + 4] << 32) | + ((ulong)buffer[offset1 + 5] << 40) | + ((ulong)buffer[offset1 + 6] << 48) | + ((ulong)buffer[offset1 + 7] << 56); + var value2 = + ((ulong)buffer[offset2]) | + ((ulong)buffer[offset2 + 1] << 8) | + ((ulong)buffer[offset2 + 2] << 16) | + ((ulong)buffer[offset2 + 3] << 24) | + ((ulong)buffer[offset2 + 4] << 32) | + ((ulong)buffer[offset2 + 5] << 40) | + ((ulong)buffer[offset2 + 6] << 48) | + ((ulong)buffer[offset2 + 7] << 56); + return value1 ^ value2; + } + + private static bool Equal2(byte[] buffer, int offset1, int offset2) + { + // return Peek2(buffer, offset1) == Peek2(buffer, offset2); + if (buffer[offset1] != buffer[offset2]) + { + return false; + } + + return buffer[offset1 + 1] == buffer[offset2 + 1]; + } + + private static bool Equal4(byte[] buffer, int offset1, int offset2) + { + // return Peek4(buffer, offset1) == Peek4(buffer, offset2); + if (buffer[offset1] != buffer[offset2]) + { + return false; + } + + if (buffer[offset1 + 1] != buffer[offset2 + 1]) + { + return false; + } + + if (buffer[offset1 + 2] != buffer[offset2 + 2]) + { + return false; + } + + return buffer[offset1 + 3] == buffer[offset2 + 3]; + } + +#endregion + +#region Byte block copy + + private static void Copy4(byte[] buf, int src, int dst) + { + Assert(dst > src, "Copying backwards is not implemented"); + buf[dst + 3] = buf[src + 3]; + buf[dst + 2] = buf[src + 2]; + buf[dst + 1] = buf[src + 1]; + buf[dst] = buf[src]; + } + + private static void Copy8(byte[] buf, int src, int dst) + { + Assert(dst > src, "Copying backwards is not implemented"); + buf[dst + 7] = buf[src + 7]; + buf[dst + 6] = buf[src + 6]; + buf[dst + 5] = buf[src + 5]; + buf[dst + 4] = buf[src + 4]; + buf[dst + 3] = buf[src + 3]; + buf[dst + 2] = buf[src + 2]; + buf[dst + 1] = buf[src + 1]; + buf[dst] = buf[src]; + } + + private static void BlockCopy(byte[] src, int src_0, byte[] dst, int dst_0, int len) + { + Assert(src != dst, "BlockCopy does not handle copying to the same buffer"); + + if (len >= BLOCK_COPY_LIMIT) + { + Buffer.BlockCopy(src, src_0, dst, dst_0, len); + } + else + { + while (len >= 8) + { + dst[dst_0] = src[src_0]; + dst[dst_0 + 1] = src[src_0 + 1]; + dst[dst_0 + 2] = src[src_0 + 2]; + dst[dst_0 + 3] = src[src_0 + 3]; + dst[dst_0 + 4] = src[src_0 + 4]; + dst[dst_0 + 5] = src[src_0 + 5]; + dst[dst_0 + 6] = src[src_0 + 6]; + dst[dst_0 + 7] = src[src_0 + 7]; + len -= 8; + src_0 += 8; + dst_0 += 8; + } + + while (len >= 4) + { + dst[dst_0] = src[src_0]; + dst[dst_0 + 1] = src[src_0 + 1]; + dst[dst_0 + 2] = src[src_0 + 2]; + dst[dst_0 + 3] = src[src_0 + 3]; + len -= 4; + src_0 += 4; + dst_0 += 4; + } + + while (len-- > 0) + { + dst[dst_0++] = src[src_0++]; + } + } + } + + private static int WildCopy(byte[] src, int src_0, byte[] dst, int dst_0, int dst_end) + { + var len = dst_end - dst_0; + + Assert(src != dst, "BlockCopy does not handle copying to the same buffer"); + Assert(len > 0, "Length have to be greater than 0"); + + if (len >= BLOCK_COPY_LIMIT) + { + Buffer.BlockCopy(src, src_0, dst, dst_0, len); + } + else + { + // apparently (tested) this is an overkill + // it seems to be faster without this 8-byte loop + ////while (len >= 8) + ////{ + //// dst[dst_0] = src[src_0]; + //// dst[dst_0 + 1] = src[src_0 + 1]; + //// dst[dst_0 + 2] = src[src_0 + 2]; + //// dst[dst_0 + 3] = src[src_0 + 3]; + //// dst[dst_0 + 4] = src[src_0 + 4]; + //// dst[dst_0 + 5] = src[src_0 + 5]; + //// dst[dst_0 + 6] = src[src_0 + 6]; + //// dst[dst_0 + 7] = src[src_0 + 7]; + //// len -= 8; src_0 += 8; dst_0 += 8; + ////} + + while (len >= 4) + { + dst[dst_0] = src[src_0]; + dst[dst_0 + 1] = src[src_0 + 1]; + dst[dst_0 + 2] = src[src_0 + 2]; + dst[dst_0 + 3] = src[src_0 + 3]; + len -= 4; + src_0 += 4; + dst_0 += 4; + } + + while (len-- > 0) + { + dst[dst_0++] = src[src_0++]; + } + } + + return len; + } + + private static int SecureCopy(byte[] buffer, int src, int dst, int dst_end) + { + var diff = dst - src; + var length = dst_end - dst; + var len = length; + + Assert(diff >= 4, "Target must be at least 4 bytes further than source"); + Assert(BLOCK_COPY_LIMIT > 4, "This method requires BLOCK_COPY_LIMIT > 4"); + Assert(len > 0, "Length have to be greater than 0"); + + if (diff >= BLOCK_COPY_LIMIT) + { + if (diff >= length) + { + Buffer.BlockCopy(buffer, src, buffer, dst, length); + return length; // done + } + + do + { + Buffer.BlockCopy(buffer, src, buffer, dst, diff); + src += diff; + dst += diff; + len -= diff; + } + while (len >= diff); + } + + // apparently (tested) this is an overkill + // it seems to be faster without this 8-byte loop + ////while (len >= 8) + ////{ + //// buffer[dst] = buffer[src]; + //// buffer[dst + 1] = buffer[src + 1]; + //// buffer[dst + 2] = buffer[src + 2]; + //// buffer[dst + 3] = buffer[src + 3]; + //// buffer[dst + 4] = buffer[src + 4]; + //// buffer[dst + 5] = buffer[src + 5]; + //// buffer[dst + 6] = buffer[src + 6]; + //// buffer[dst + 7] = buffer[src + 7]; + //// dst += 8; src += 8; len -= 8; + ////} + + while (len >= 4) + { + buffer[dst] = buffer[src]; + buffer[dst + 1] = buffer[src + 1]; + buffer[dst + 2] = buffer[src + 2]; + buffer[dst + 3] = buffer[src + 3]; + dst += 4; + src += 4; + len -= 4; + } + + while (len-- > 0) + { + buffer[dst++] = buffer[src++]; + } + + return length; // done + } + +#endregion + + /// Encodes the specified input. + /// The input. + /// The input offset. + /// Length of the input. + /// The output. + /// The output offset. + /// Length of the output. + /// Number of bytes written. + public static int Encode32Safe( + byte[] input, + int inputOffset, + int inputLength, + byte[] output, + int outputOffset, + int outputLength) + { + CheckArguments(input, inputOffset, inputLength, output, outputOffset, outputLength); + if (outputLength == 0) + { + return 0; + } + + if (inputLength < LZ4_64KLIMIT) + { + var hashTable = HashTablePool.GetUShortHashTablePool(); + return LZ4_compress64kCtx_safe32(hashTable, input, output, inputOffset, outputOffset, inputLength, outputLength); + } + else + { + var hashTable = HashTablePool.GetIntHashTablePool(); + return LZ4_compressCtx_safe32(hashTable, input, output, inputOffset, outputOffset, inputLength, outputLength); + } + } + + /// Encodes the specified input. + /// The input. + /// The input offset. + /// Length of the input. + /// The output. + /// The output offset. + /// Length of the output. + /// Number of bytes written. + public static int Encode64Safe( + byte[] input, + int inputOffset, + int inputLength, + byte[] output, + int outputOffset, + int outputLength) + { + CheckArguments(input, inputOffset, inputLength, output, outputOffset, outputLength); + if (outputLength == 0) + { + return 0; + } + + if (inputLength < LZ4_64KLIMIT) + { + var hashTable = HashTablePool.GetUShortHashTablePool(); + return LZ4_compress64kCtx_safe64(hashTable, input, output, inputOffset, outputOffset, inputLength, outputLength); + } + else + { + var hashTable = HashTablePool.GetIntHashTablePool(); + return LZ4_compressCtx_safe64(hashTable, input, output, inputOffset, outputOffset, inputLength, outputLength); + } + } + + /// Decodes the specified input. + /// The input. + /// The input offset. + /// Length of the input. + /// The output. + /// The output offset. + /// Length of the output. + /// Number of bytes written. + public static int Decode32Safe( + byte[] input, + int inputOffset, + int inputLength, + byte[] output, + int outputOffset, + int outputLength) + { + CheckArguments(input, inputOffset, inputLength, output, outputOffset, outputLength); + + if (outputLength == 0) + { + return 0; + } + + var length = LZ4_uncompress_safe32(input, output, inputOffset, outputOffset, outputLength); + if (length != inputLength) + { + throw new MessagePackSerializationException("LZ4 block is corrupted, or invalid length has been given."); + } + + return outputLength; + } + + /// Decodes the specified input. + /// The input. + /// The input offset. + /// Length of the input. + /// The output. + /// The output offset. + /// Length of the output. + /// Number of bytes written. + public static int Decode64Safe( + byte[] input, + int inputOffset, + int inputLength, + byte[] output, + int outputOffset, + int outputLength) + { + CheckArguments(input, inputOffset, inputLength, output, outputOffset, outputLength); + + if (outputLength == 0) + { + return 0; + } + + var length = LZ4_uncompress_safe64(input, output, inputOffset, outputOffset, outputLength); + if (length != inputLength) + { + throw new MessagePackSerializationException("LZ4 block is corrupted, or invalid length has been given."); + } + + return outputLength; + } + } +} + +#endif diff --git a/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Safe.cs.meta b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Safe.cs.meta new file mode 100644 index 000000000..8db917c6c --- /dev/null +++ b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Safe.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5fe9256cf4f62c6df8c144caef0ebc6a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Safe32.Dirty.cs b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Safe32.Dirty.cs new file mode 100644 index 000000000..054721368 --- /dev/null +++ b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Safe32.Dirty.cs @@ -0,0 +1,753 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +#if UNITY_2018_3_OR_NEWER + +#region LZ4 original + +/* + LZ4 - Fast LZ compression algorithm + Copyright (C) 2011-2012, Yann Collet. + BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + You can contact the author at : + - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html + - LZ4 source repository : http://code.google.com/p/lz4/ +*/ + +#endregion + +#region LZ4 port + +/* +Copyright (c) 2013, Milosz Krajewski +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided +that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#endregion + +#pragma warning disable SA1312 // Variable names should begin with lower-case letter + +namespace MessagePack.LZ4 +{ + internal partial class LZ4Codec + { +#region LZ4_compressCtx + + private static int LZ4_compressCtx_safe32( + int[] hash_table, + byte[] src, + byte[] dst, + int src_0, + int dst_0, + int src_len, + int dst_maxlen) + { + unchecked + { + var debruijn32 = DEBRUIJN_TABLE_32; + int _i; + + // ---- preprocessed source start here ---- + // r93 + var src_p = src_0; + var src_base = src_0; + var src_anchor = src_p; + var src_end = src_p + src_len; + var src_mflimit = src_end - MFLIMIT; + + var dst_p = dst_0; + var dst_end = dst_p + dst_maxlen; + + var src_LASTLITERALS = src_end - LASTLITERALS; + var src_LASTLITERALS_1 = src_LASTLITERALS - 1; + + var src_LASTLITERALS_STEPSIZE_1 = src_LASTLITERALS - (STEPSIZE_32 - 1); + var dst_LASTLITERALS_1 = dst_end - (1 + LASTLITERALS); + var dst_LASTLITERALS_3 = dst_end - (2 + 1 + LASTLITERALS); + + int length; + + uint h, h_fwd; + + // Init + if (src_len < MINLENGTH) + { + goto _last_literals; + } + + // First Byte + hash_table[(Peek4(src, src_p) * 2654435761u) >> HASH_ADJUST] = src_p - src_base; + src_p++; + h_fwd = (Peek4(src, src_p) * 2654435761u) >> HASH_ADJUST; + + // Main Loop + while (true) + { + var findMatchAttempts = (1 << SKIPSTRENGTH) + 3; + var src_p_fwd = src_p; + int src_ref; + int dst_token; + + // Find a match + do + { + h = h_fwd; + var step = findMatchAttempts++ >> SKIPSTRENGTH; + src_p = src_p_fwd; + src_p_fwd = src_p + step; + + if (src_p_fwd > src_mflimit) + { + goto _last_literals; + } + + h_fwd = (Peek4(src, src_p_fwd) * 2654435761u) >> HASH_ADJUST; + src_ref = src_base + hash_table[h]; + hash_table[h] = src_p - src_base; + } + while ((src_ref < src_p - MAX_DISTANCE) || (!Equal4(src, src_ref, src_p))); + + // Catch up + while ((src_p > src_anchor) && (src_ref > src_0) && (src[src_p - 1] == src[src_ref - 1])) + { + src_p--; + src_ref--; + } + + // Encode Literal length + length = src_p - src_anchor; + dst_token = dst_p++; + + if (dst_p + length + (length >> 8) > dst_LASTLITERALS_3) + { + return 0; // Check output limit + } + + if (length >= RUN_MASK) + { + var len = length - RUN_MASK; + dst[dst_token] = RUN_MASK << ML_BITS; + if (len > 254) + { + do + { + dst[dst_p++] = 255; + len -= 255; + } + while (len > 254); + dst[dst_p++] = (byte)len; + BlockCopy(src, src_anchor, dst, dst_p, length); + dst_p += length; + goto _next_match; + } + else + { + dst[dst_p++] = (byte)len; + } + } + else + { + dst[dst_token] = (byte)(length << ML_BITS); + } + + // Copy Literals + if (length > 0) + { + _i = dst_p + length; + WildCopy(src, src_anchor, dst, dst_p, _i); + dst_p = _i; + } + +_next_match: + +// Encode Offset + Poke2(dst, dst_p, (ushort)(src_p - src_ref)); + dst_p += 2; + + // Start Counting + src_p += MINMATCH; + src_ref += MINMATCH; // MinMatch already verified + src_anchor = src_p; + + while (src_p < src_LASTLITERALS_STEPSIZE_1) + { + var diff = (int)Xor4(src, src_ref, src_p); + if (diff == 0) + { + src_p += STEPSIZE_32; + src_ref += STEPSIZE_32; + continue; + } + + src_p += debruijn32[((uint)(diff & -diff) * 0x077CB531u) >> 27]; + goto _endCount; + } + + if ((src_p < src_LASTLITERALS_1) && Equal2(src, src_ref, src_p)) + { + src_p += 2; + src_ref += 2; + } + + if ((src_p < src_LASTLITERALS) && (src[src_ref] == src[src_p])) + { + src_p++; + } + +_endCount: + +// Encode MatchLength + length = src_p - src_anchor; + + if (dst_p + (length >> 8) > dst_LASTLITERALS_1) + { + return 0; // Check output limit + } + + if (length >= ML_MASK) + { + dst[dst_token] += ML_MASK; + length -= ML_MASK; + for (; length > 509; length -= 510) + { + dst[dst_p++] = 255; + dst[dst_p++] = 255; + } + + if (length > 254) + { + length -= 255; + dst[dst_p++] = 255; + } + + dst[dst_p++] = (byte)length; + } + else + { + dst[dst_token] += (byte)length; + } + + // Test end of chunk + if (src_p > src_mflimit) + { + src_anchor = src_p; + break; + } + + // Fill table + hash_table[(Peek4(src, src_p - 2) * 2654435761u) >> HASH_ADJUST] = src_p - 2 - src_base; + + // Test next position + h = (Peek4(src, src_p) * 2654435761u) >> HASH_ADJUST; + src_ref = src_base + hash_table[h]; + hash_table[h] = src_p - src_base; + + if ((src_ref > src_p - (MAX_DISTANCE + 1)) && Equal4(src, src_ref, src_p)) + { + dst_token = dst_p++; + dst[dst_token] = 0; + goto _next_match; + } + + // Prepare next loop + src_anchor = src_p++; + h_fwd = (Peek4(src, src_p) * 2654435761u) >> HASH_ADJUST; + } + +_last_literals: + +// Encode Last Literals + { + var lastRun = src_end - src_anchor; + + if (dst_p + lastRun + 1 + ((lastRun + 255 - RUN_MASK) / 255) > dst_end) + { + return 0; + } + + if (lastRun >= RUN_MASK) + { + dst[dst_p++] = RUN_MASK << ML_BITS; + lastRun -= RUN_MASK; + for (; lastRun > 254; lastRun -= 255) + { + dst[dst_p++] = 255; + } + + dst[dst_p++] = (byte)lastRun; + } + else + { + dst[dst_p++] = (byte)(lastRun << ML_BITS); + } + + BlockCopy(src, src_anchor, dst, dst_p, src_end - src_anchor); + dst_p += src_end - src_anchor; + } + + // End + return dst_p - dst_0; + } + } + +#endregion + +#region LZ4_compress64kCtx + + private static int LZ4_compress64kCtx_safe32( + ushort[] hash_table, + byte[] src, + byte[] dst, + int src_0, + int dst_0, + int src_len, + int dst_maxlen) + { + unchecked + { + var debruijn32 = DEBRUIJN_TABLE_32; + int _i; + + // ---- preprocessed source start here ---- + // r93 + var src_p = src_0; + var src_anchor = src_p; + var src_base = src_p; + var src_end = src_p + src_len; + var src_mflimit = src_end - MFLIMIT; + + var dst_p = dst_0; + var dst_end = dst_p + dst_maxlen; + + var src_LASTLITERALS = src_end - LASTLITERALS; + var src_LASTLITERALS_1 = src_LASTLITERALS - 1; + + var src_LASTLITERALS_STEPSIZE_1 = src_LASTLITERALS - (STEPSIZE_32 - 1); + var dst_LASTLITERALS_1 = dst_end - (1 + LASTLITERALS); + var dst_LASTLITERALS_3 = dst_end - (2 + 1 + LASTLITERALS); + + int len, length; + + uint h, h_fwd; + + // Init + if (src_len < MINLENGTH) + { + goto _last_literals; + } + + // First Byte + src_p++; + h_fwd = (Peek4(src, src_p) * 2654435761u) >> HASH64K_ADJUST; + + // Main Loop + while (true) + { + var findMatchAttempts = (1 << SKIPSTRENGTH) + 3; + var src_p_fwd = src_p; + int src_ref; + int dst_token; + + // Find a match + do + { + h = h_fwd; + var step = findMatchAttempts++ >> SKIPSTRENGTH; + src_p = src_p_fwd; + src_p_fwd = src_p + step; + + if (src_p_fwd > src_mflimit) + { + goto _last_literals; + } + + h_fwd = (Peek4(src, src_p_fwd) * 2654435761u) >> HASH64K_ADJUST; + src_ref = src_base + hash_table[h]; + hash_table[h] = (ushort)(src_p - src_base); + } + while (!Equal4(src, src_ref, src_p)); + + // Catch up + while ((src_p > src_anchor) && (src_ref > src_0) && (src[src_p - 1] == src[src_ref - 1])) + { + src_p--; + src_ref--; + } + + // Encode Literal length + length = src_p - src_anchor; + dst_token = dst_p++; + + if (dst_p + length + (length >> 8) > dst_LASTLITERALS_3) + { + return 0; // Check output limit + } + + if (length >= RUN_MASK) + { + len = length - RUN_MASK; + dst[dst_token] = RUN_MASK << ML_BITS; + if (len > 254) + { + do + { + dst[dst_p++] = 255; + len -= 255; + } + while (len > 254); + dst[dst_p++] = (byte)len; + BlockCopy(src, src_anchor, dst, dst_p, length); + dst_p += length; + goto _next_match; + } + else + { + dst[dst_p++] = (byte)len; + } + } + else + { + dst[dst_token] = (byte)(length << ML_BITS); + } + + // Copy Literals + if (length > 0) + { + _i = dst_p + length; + WildCopy(src, src_anchor, dst, dst_p, _i); + dst_p = _i; + } + +_next_match: + +// Encode Offset + Poke2(dst, dst_p, (ushort)(src_p - src_ref)); + dst_p += 2; + + // Start Counting + src_p += MINMATCH; + src_ref += MINMATCH; // MinMatch verified + src_anchor = src_p; + + while (src_p < src_LASTLITERALS_STEPSIZE_1) + { + var diff = (int)Xor4(src, src_ref, src_p); + if (diff == 0) + { + src_p += STEPSIZE_32; + src_ref += STEPSIZE_32; + continue; + } + + src_p += debruijn32[((uint)(diff & -diff) * 0x077CB531u) >> 27]; + goto _endCount; + } + + if ((src_p < src_LASTLITERALS_1) && Equal2(src, src_ref, src_p)) + { + src_p += 2; + src_ref += 2; + } + + if ((src_p < src_LASTLITERALS) && (src[src_ref] == src[src_p])) + { + src_p++; + } + +_endCount: + +// Encode MatchLength + len = src_p - src_anchor; + + if (dst_p + (len >> 8) > dst_LASTLITERALS_1) + { + return 0; // Check output limit + } + + if (len >= ML_MASK) + { + dst[dst_token] += ML_MASK; + len -= ML_MASK; + for (; len > 509; len -= 510) + { + dst[dst_p++] = 255; + dst[dst_p++] = 255; + } + + if (len > 254) + { + len -= 255; + dst[dst_p++] = 255; + } + + dst[dst_p++] = (byte)len; + } + else + { + dst[dst_token] += (byte)len; + } + + // Test end of chunk + if (src_p > src_mflimit) + { + src_anchor = src_p; + break; + } + + // Fill table + hash_table[(Peek4(src, src_p - 2) * 2654435761u) >> HASH64K_ADJUST] = (ushort)(src_p - 2 - src_base); + + // Test next position + h = (Peek4(src, src_p) * 2654435761u) >> HASH64K_ADJUST; + src_ref = src_base + hash_table[h]; + hash_table[h] = (ushort)(src_p - src_base); + + if (Equal4(src, src_ref, src_p)) + { + dst_token = dst_p++; + dst[dst_token] = 0; + goto _next_match; + } + + // Prepare next loop + src_anchor = src_p++; + h_fwd = (Peek4(src, src_p) * 2654435761u) >> HASH64K_ADJUST; + } + +_last_literals: + +// Encode Last Literals + var lastRun = src_end - src_anchor; + if (dst_p + lastRun + 1 + ((lastRun - RUN_MASK + 255) / 255) > dst_end) + { + return 0; + } + + if (lastRun >= RUN_MASK) + { + dst[dst_p++] = RUN_MASK << ML_BITS; + lastRun -= RUN_MASK; + for (; lastRun > 254; lastRun -= 255) + { + dst[dst_p++] = 255; + } + + dst[dst_p++] = (byte)lastRun; + } + else + { + dst[dst_p++] = (byte)(lastRun << ML_BITS); + } + + BlockCopy(src, src_anchor, dst, dst_p, src_end - src_anchor); + dst_p += src_end - src_anchor; + + // End + return dst_p - dst_0; + } + } + +#endregion + +#region LZ4_uncompress + + private static int LZ4_uncompress_safe32( + byte[] src, + byte[] dst, + int src_0, + int dst_0, + int dst_len) + { + unchecked + { + var dec32table = DECODER_TABLE_32; + int _i; + + // ---- preprocessed source start here ---- + // r93 + var src_p = src_0; + int dst_ref; + + var dst_p = dst_0; + var dst_end = dst_p + dst_len; + int dst_cpy; + + var dst_LASTLITERALS = dst_end - LASTLITERALS; + var dst_COPYLENGTH = dst_end - COPYLENGTH; + var dst_COPYLENGTH_STEPSIZE_4 = dst_end - COPYLENGTH - (STEPSIZE_32 - 4); + + byte token; + + // Main Loop + while (true) + { + int length; + + // get runlength + token = src[src_p++]; + if ((length = token >> ML_BITS) == RUN_MASK) + { + int len; + for (; (len = src[src_p++]) == 255; length += 255) + { + /* do nothing */ + } + + length += len; + } + + // copy literals + dst_cpy = dst_p + length; + + if (dst_cpy > dst_COPYLENGTH) + { + if (dst_cpy != dst_end) + { + goto _output_error; // Error : not enough place for another match (min 4) + 5 literals + } + + BlockCopy(src, src_p, dst, dst_p, length); + src_p += length; + break; // EOF + } + + if (dst_p < dst_cpy) + { + _i = WildCopy(src, src_p, dst, dst_p, dst_cpy); + src_p += _i; + dst_p += _i; + } + + src_p -= dst_p - dst_cpy; + dst_p = dst_cpy; + + // get offset + dst_ref = dst_cpy - Peek2(src, src_p); + src_p += 2; + if (dst_ref < dst_0) + { + goto _output_error; // Error : offset outside destination buffer + } + + // get matchlength + if ((length = token & ML_MASK) == ML_MASK) + { + for (; src[src_p] == 255; length += 255) + { + src_p++; + } + + length += src[src_p++]; + } + + // copy repeated sequence + if ((dst_p - dst_ref) < STEPSIZE_32) + { + const int dec64 = 0; + dst[dst_p + 0] = dst[dst_ref + 0]; + dst[dst_p + 1] = dst[dst_ref + 1]; + dst[dst_p + 2] = dst[dst_ref + 2]; + dst[dst_p + 3] = dst[dst_ref + 3]; + dst_p += 4; + dst_ref += 4; + dst_ref -= dec32table[dst_p - dst_ref]; + Copy4(dst, dst_ref, dst_p); + dst_p += STEPSIZE_32 - 4; + dst_ref -= dec64; + } + else + { + Copy4(dst, dst_ref, dst_p); + dst_p += 4; + dst_ref += 4; + } + + dst_cpy = dst_p + length - (STEPSIZE_32 - 4); + + if (dst_cpy > dst_COPYLENGTH_STEPSIZE_4) + { + if (dst_cpy > dst_LASTLITERALS) + { + goto _output_error; // Error : last 5 bytes must be literals + } + + if (dst_p < dst_COPYLENGTH) + { + _i = SecureCopy(dst, dst_ref, dst_p, dst_COPYLENGTH); + dst_ref += _i; + dst_p += _i; + } + + while (dst_p < dst_cpy) + { + dst[dst_p++] = dst[dst_ref++]; + } + + dst_p = dst_cpy; + continue; + } + + if (dst_p < dst_cpy) + { + SecureCopy(dst, dst_ref, dst_p, dst_cpy); + } + + dst_p = dst_cpy; // correction + } + + // end of decoding + return src_p - src_0; + +// write overflow error detected +_output_error: + return -(src_p - src_0); + } + } + +#endregion + } +} + +#endif diff --git a/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Safe32.Dirty.cs.meta b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Safe32.Dirty.cs.meta new file mode 100644 index 000000000..607e7f063 --- /dev/null +++ b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Safe32.Dirty.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4e76c34fb36d14138b0196dbb3bdc544 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Safe64.Dirty.cs b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Safe64.Dirty.cs new file mode 100644 index 000000000..f8215f842 --- /dev/null +++ b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Safe64.Dirty.cs @@ -0,0 +1,774 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +#if UNITY_2018_3_OR_NEWER + +#region LZ4 original + +/* + LZ4 - Fast LZ compression algorithm + Copyright (C) 2011-2012, Yann Collet. + BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + You can contact the author at : + - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html + - LZ4 source repository : http://code.google.com/p/lz4/ +*/ + +#endregion + +#region LZ4 port + +/* +Copyright (c) 2013, Milosz Krajewski +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided +that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#endregion + +#pragma warning disable SA1312 // Variable names should begin with lower-case letter + +namespace MessagePack.LZ4 +{ + internal partial class LZ4Codec + { +#region LZ4_compressCtx + + private static int LZ4_compressCtx_safe64( + int[] hash_table, + byte[] src, + byte[] dst, + int src_0, + int dst_0, + int src_len, + int dst_maxlen) + { + unchecked + { + var debruijn64 = DEBRUIJN_TABLE_64; + int _i; + + // ---- preprocessed source start here ---- + // r93 + var src_p = src_0; + var src_base = src_0; + var src_anchor = src_p; + var src_end = src_p + src_len; + var src_mflimit = src_end - MFLIMIT; + + var dst_p = dst_0; + var dst_end = dst_p + dst_maxlen; + + var src_LASTLITERALS = src_end - LASTLITERALS; + var src_LASTLITERALS_1 = src_LASTLITERALS - 1; + + var src_LASTLITERALS_3 = src_LASTLITERALS - 3; + + var src_LASTLITERALS_STEPSIZE_1 = src_LASTLITERALS - (STEPSIZE_64 - 1); + var dst_LASTLITERALS_1 = dst_end - (1 + LASTLITERALS); + var dst_LASTLITERALS_3 = dst_end - (2 + 1 + LASTLITERALS); + + int length; + + uint h, h_fwd; + + // Init + if (src_len < MINLENGTH) + { + goto _last_literals; + } + + // First Byte + hash_table[(Peek4(src, src_p) * 2654435761u) >> HASH_ADJUST] = src_p - src_base; + src_p++; + h_fwd = (Peek4(src, src_p) * 2654435761u) >> HASH_ADJUST; + + // Main Loop + while (true) + { + var findMatchAttempts = (1 << SKIPSTRENGTH) + 3; + var src_p_fwd = src_p; + int src_ref; + int dst_token; + + // Find a match + do + { + h = h_fwd; + var step = findMatchAttempts++ >> SKIPSTRENGTH; + src_p = src_p_fwd; + src_p_fwd = src_p + step; + + if (src_p_fwd > src_mflimit) + { + goto _last_literals; + } + + h_fwd = (Peek4(src, src_p_fwd) * 2654435761u) >> HASH_ADJUST; + src_ref = src_base + hash_table[h]; + hash_table[h] = src_p - src_base; + } + while ((src_ref < src_p - MAX_DISTANCE) || (!Equal4(src, src_ref, src_p))); + + // Catch up + while ((src_p > src_anchor) && (src_ref > src_0) && (src[src_p - 1] == src[src_ref - 1])) + { + src_p--; + src_ref--; + } + + // Encode Literal length + length = src_p - src_anchor; + dst_token = dst_p++; + + if (dst_p + length + (length >> 8) > dst_LASTLITERALS_3) + { + return 0; // Check output limit + } + + if (length >= RUN_MASK) + { + var len = length - RUN_MASK; + dst[dst_token] = RUN_MASK << ML_BITS; + if (len > 254) + { + do + { + dst[dst_p++] = 255; + len -= 255; + } + while (len > 254); + dst[dst_p++] = (byte)len; + BlockCopy(src, src_anchor, dst, dst_p, length); + dst_p += length; + goto _next_match; + } + else + { + dst[dst_p++] = (byte)len; + } + } + else + { + dst[dst_token] = (byte)(length << ML_BITS); + } + + // Copy Literals + if (length > 0) + { + _i = dst_p + length; + WildCopy(src, src_anchor, dst, dst_p, _i); + dst_p = _i; + } + +_next_match: + +// Encode Offset + Poke2(dst, dst_p, (ushort)(src_p - src_ref)); + dst_p += 2; + + // Start Counting + src_p += MINMATCH; + src_ref += MINMATCH; // MinMatch already verified + src_anchor = src_p; + + while (src_p < src_LASTLITERALS_STEPSIZE_1) + { + var diff = (long)Xor8(src, src_ref, src_p); + if (diff == 0) + { + src_p += STEPSIZE_64; + src_ref += STEPSIZE_64; + continue; + } + + src_p += debruijn64[((ulong)(diff & -diff) * 0x0218A392CDABBD3FL) >> 58]; + goto _endCount; + } + + if ((src_p < src_LASTLITERALS_3) && Equal4(src, src_ref, src_p)) + { + src_p += 4; + src_ref += 4; + } + + if ((src_p < src_LASTLITERALS_1) && Equal2(src, src_ref, src_p)) + { + src_p += 2; + src_ref += 2; + } + + if ((src_p < src_LASTLITERALS) && (src[src_ref] == src[src_p])) + { + src_p++; + } + +_endCount: + +// Encode MatchLength + length = src_p - src_anchor; + + if (dst_p + (length >> 8) > dst_LASTLITERALS_1) + { + return 0; // Check output limit + } + + if (length >= ML_MASK) + { + dst[dst_token] += ML_MASK; + length -= ML_MASK; + for (; length > 509; length -= 510) + { + dst[dst_p++] = 255; + dst[dst_p++] = 255; + } + + if (length > 254) + { + length -= 255; + dst[dst_p++] = 255; + } + + dst[dst_p++] = (byte)length; + } + else + { + dst[dst_token] += (byte)length; + } + + // Test end of chunk + if (src_p > src_mflimit) + { + src_anchor = src_p; + break; + } + + // Fill table + hash_table[(Peek4(src, src_p - 2) * 2654435761u) >> HASH_ADJUST] = src_p - 2 - src_base; + + // Test next position + h = (Peek4(src, src_p) * 2654435761u) >> HASH_ADJUST; + src_ref = src_base + hash_table[h]; + hash_table[h] = src_p - src_base; + + if ((src_ref > src_p - (MAX_DISTANCE + 1)) && Equal4(src, src_ref, src_p)) + { + dst_token = dst_p++; + dst[dst_token] = 0; + goto _next_match; + } + + // Prepare next loop + src_anchor = src_p++; + h_fwd = (Peek4(src, src_p) * 2654435761u) >> HASH_ADJUST; + } + +_last_literals: + +// Encode Last Literals + { + var lastRun = src_end - src_anchor; + + if (dst_p + lastRun + 1 + ((lastRun + 255 - RUN_MASK) / 255) > dst_end) + { + return 0; + } + + if (lastRun >= RUN_MASK) + { + dst[dst_p++] = RUN_MASK << ML_BITS; + lastRun -= RUN_MASK; + for (; lastRun > 254; lastRun -= 255) + { + dst[dst_p++] = 255; + } + + dst[dst_p++] = (byte)lastRun; + } + else + { + dst[dst_p++] = (byte)(lastRun << ML_BITS); + } + + BlockCopy(src, src_anchor, dst, dst_p, src_end - src_anchor); + dst_p += src_end - src_anchor; + } + + // End + return dst_p - dst_0; + } + } + +#endregion + +#region LZ4_compress64kCtx + + private static int LZ4_compress64kCtx_safe64( + ushort[] hash_table, + byte[] src, + byte[] dst, + int src_0, + int dst_0, + int src_len, + int dst_maxlen) + { + unchecked + { + var debruijn64 = DEBRUIJN_TABLE_64; + int _i; + + // ---- preprocessed source start here ---- + // r93 + var src_p = src_0; + var src_anchor = src_p; + var src_base = src_p; + var src_end = src_p + src_len; + var src_mflimit = src_end - MFLIMIT; + + var dst_p = dst_0; + var dst_end = dst_p + dst_maxlen; + + var src_LASTLITERALS = src_end - LASTLITERALS; + var src_LASTLITERALS_1 = src_LASTLITERALS - 1; + + var src_LASTLITERALS_3 = src_LASTLITERALS - 3; + + var src_LASTLITERALS_STEPSIZE_1 = src_LASTLITERALS - (STEPSIZE_64 - 1); + var dst_LASTLITERALS_1 = dst_end - (1 + LASTLITERALS); + var dst_LASTLITERALS_3 = dst_end - (2 + 1 + LASTLITERALS); + + int len, length; + + uint h, h_fwd; + + // Init + if (src_len < MINLENGTH) + { + goto _last_literals; + } + + // First Byte + src_p++; + h_fwd = (Peek4(src, src_p) * 2654435761u) >> HASH64K_ADJUST; + + // Main Loop + while (true) + { + var findMatchAttempts = (1 << SKIPSTRENGTH) + 3; + var src_p_fwd = src_p; + int src_ref; + int dst_token; + + // Find a match + do + { + h = h_fwd; + var step = findMatchAttempts++ >> SKIPSTRENGTH; + src_p = src_p_fwd; + src_p_fwd = src_p + step; + + if (src_p_fwd > src_mflimit) + { + goto _last_literals; + } + + h_fwd = (Peek4(src, src_p_fwd) * 2654435761u) >> HASH64K_ADJUST; + src_ref = src_base + hash_table[h]; + hash_table[h] = (ushort)(src_p - src_base); + } + while (!Equal4(src, src_ref, src_p)); + + // Catch up + while ((src_p > src_anchor) && (src_ref > src_0) && (src[src_p - 1] == src[src_ref - 1])) + { + src_p--; + src_ref--; + } + + // Encode Literal length + length = src_p - src_anchor; + dst_token = dst_p++; + + if (dst_p + length + (length >> 8) > dst_LASTLITERALS_3) + { + return 0; // Check output limit + } + + if (length >= RUN_MASK) + { + len = length - RUN_MASK; + dst[dst_token] = RUN_MASK << ML_BITS; + if (len > 254) + { + do + { + dst[dst_p++] = 255; + len -= 255; + } + while (len > 254); + dst[dst_p++] = (byte)len; + BlockCopy(src, src_anchor, dst, dst_p, length); + dst_p += length; + goto _next_match; + } + else + { + dst[dst_p++] = (byte)len; + } + } + else + { + dst[dst_token] = (byte)(length << ML_BITS); + } + + // Copy Literals + if (length > 0) + { + _i = dst_p + length; + WildCopy(src, src_anchor, dst, dst_p, _i); + dst_p = _i; + } + +_next_match: + +// Encode Offset + Poke2(dst, dst_p, (ushort)(src_p - src_ref)); + dst_p += 2; + + // Start Counting + src_p += MINMATCH; + src_ref += MINMATCH; // MinMatch verified + src_anchor = src_p; + + while (src_p < src_LASTLITERALS_STEPSIZE_1) + { + var diff = (long)Xor8(src, src_ref, src_p); + if (diff == 0) + { + src_p += STEPSIZE_64; + src_ref += STEPSIZE_64; + continue; + } + + src_p += debruijn64[((ulong)(diff & -diff) * 0x0218A392CDABBD3FL) >> 58]; + goto _endCount; + } + + if ((src_p < src_LASTLITERALS_3) && Equal4(src, src_ref, src_p)) + { + src_p += 4; + src_ref += 4; + } + + if ((src_p < src_LASTLITERALS_1) && Equal2(src, src_ref, src_p)) + { + src_p += 2; + src_ref += 2; + } + + if ((src_p < src_LASTLITERALS) && (src[src_ref] == src[src_p])) + { + src_p++; + } + +_endCount: + +// Encode MatchLength + len = src_p - src_anchor; + + if (dst_p + (len >> 8) > dst_LASTLITERALS_1) + { + return 0; // Check output limit + } + + if (len >= ML_MASK) + { + dst[dst_token] += ML_MASK; + len -= ML_MASK; + for (; len > 509; len -= 510) + { + dst[dst_p++] = 255; + dst[dst_p++] = 255; + } + + if (len > 254) + { + len -= 255; + dst[dst_p++] = 255; + } + + dst[dst_p++] = (byte)len; + } + else + { + dst[dst_token] += (byte)len; + } + + // Test end of chunk + if (src_p > src_mflimit) + { + src_anchor = src_p; + break; + } + + // Fill table + hash_table[(Peek4(src, src_p - 2) * 2654435761u) >> HASH64K_ADJUST] = (ushort)(src_p - 2 - src_base); + + // Test next position + h = (Peek4(src, src_p) * 2654435761u) >> HASH64K_ADJUST; + src_ref = src_base + hash_table[h]; + hash_table[h] = (ushort)(src_p - src_base); + + if (Equal4(src, src_ref, src_p)) + { + dst_token = dst_p++; + dst[dst_token] = 0; + goto _next_match; + } + + // Prepare next loop + src_anchor = src_p++; + h_fwd = (Peek4(src, src_p) * 2654435761u) >> HASH64K_ADJUST; + } + +_last_literals: + +// Encode Last Literals + { + var lastRun = src_end - src_anchor; + if (dst_p + lastRun + 1 + ((lastRun - RUN_MASK + 255) / 255) > dst_end) + { + return 0; + } + + if (lastRun >= RUN_MASK) + { + dst[dst_p++] = RUN_MASK << ML_BITS; + lastRun -= RUN_MASK; + for (; lastRun > 254; lastRun -= 255) + { + dst[dst_p++] = 255; + } + + dst[dst_p++] = (byte)lastRun; + } + else + { + dst[dst_p++] = (byte)(lastRun << ML_BITS); + } + + BlockCopy(src, src_anchor, dst, dst_p, src_end - src_anchor); + dst_p += src_end - src_anchor; + } + + // End + return dst_p - dst_0; + } + } + +#endregion + +#region LZ4_uncompress + + private static int LZ4_uncompress_safe64( + byte[] src, + byte[] dst, + int src_0, + int dst_0, + int dst_len) + { + unchecked + { + var dec32table = DECODER_TABLE_32; + var dec64table = DECODER_TABLE_64; + int _i; + + // ---- preprocessed source start here ---- + // r93 + var src_p = src_0; + int dst_ref; + + var dst_p = dst_0; + var dst_end = dst_p + dst_len; + int dst_cpy; + + var dst_LASTLITERALS = dst_end - LASTLITERALS; + var dst_COPYLENGTH = dst_end - COPYLENGTH; + var dst_COPYLENGTH_STEPSIZE_4 = dst_end - COPYLENGTH - (STEPSIZE_64 - 4); + + uint token; + + // Main Loop + while (true) + { + int length; + + // get runlength + token = src[src_p++]; + if ((length = (byte)(token >> ML_BITS)) == RUN_MASK) + { + int len; + for (; (len = src[src_p++]) == 255; length += 255) + { + /* do nothing */ + } + + length += len; + } + + // copy literals + dst_cpy = dst_p + length; + + if (dst_cpy > dst_COPYLENGTH) + { + if (dst_cpy != dst_end) + { + goto _output_error; // Error : not enough place for another match (min 4) + 5 literals + } + + BlockCopy(src, src_p, dst, dst_p, length); + src_p += length; + break; // EOF + } + + if (dst_p < dst_cpy) + { + _i = WildCopy(src, src_p, dst, dst_p, dst_cpy); + src_p += _i; + dst_p += _i; + } + + src_p -= dst_p - dst_cpy; + dst_p = dst_cpy; + + // get offset + dst_ref = dst_cpy - Peek2(src, src_p); + src_p += 2; + if (dst_ref < dst_0) + { + goto _output_error; // Error : offset outside destination buffer + } + + // get matchlength + if ((length = (byte)(token & ML_MASK)) == ML_MASK) + { + for (; src[src_p] == 255; length += 255) + { + src_p++; + } + + length += src[src_p++]; + } + + // copy repeated sequence + if ((dst_p - dst_ref) < STEPSIZE_64) + { + var dec64 = dec64table[dst_p - dst_ref]; + + dst[dst_p + 0] = dst[dst_ref + 0]; + dst[dst_p + 1] = dst[dst_ref + 1]; + dst[dst_p + 2] = dst[dst_ref + 2]; + dst[dst_p + 3] = dst[dst_ref + 3]; + dst_p += 4; + dst_ref += 4; + dst_ref -= dec32table[dst_p - dst_ref]; + Copy4(dst, dst_ref, dst_p); + dst_p += STEPSIZE_64 - 4; + dst_ref -= dec64; + } + else + { + Copy8(dst, dst_ref, dst_p); + dst_p += 8; + dst_ref += 8; + } + + dst_cpy = dst_p + length - (STEPSIZE_64 - 4); + + if (dst_cpy > dst_COPYLENGTH_STEPSIZE_4) + { + if (dst_cpy > dst_LASTLITERALS) + { + goto _output_error; // Error : last 5 bytes must be literals + } + + if (dst_p < dst_COPYLENGTH) + { + _i = SecureCopy(dst, dst_ref, dst_p, dst_COPYLENGTH); + dst_ref += _i; + dst_p += _i; + } + + while (dst_p < dst_cpy) + { + dst[dst_p++] = dst[dst_ref++]; + } + + dst_p = dst_cpy; + continue; + } + + if (dst_p < dst_cpy) + { + SecureCopy(dst, dst_ref, dst_p, dst_cpy); + } + + dst_p = dst_cpy; // correction + } + + // end of decoding + return src_p - src_0; + +_output_error: + +// write overflow error detected + return -(src_p - src_0); + } + } + +#endregion + } +} + +#endif diff --git a/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Safe64.Dirty.cs.meta b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Safe64.Dirty.cs.meta new file mode 100644 index 000000000..dc5db1fb8 --- /dev/null +++ b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Safe64.Dirty.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 31798435f43678c67b458999c71cfbb3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Unsafe.cs b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Unsafe.cs new file mode 100644 index 000000000..ec9a28bc9 --- /dev/null +++ b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Unsafe.cs @@ -0,0 +1,118 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +#region license + +/* +Copyright (c) 2013, Milosz Krajewski +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided +that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#endregion + +using System; + +namespace MessagePack.LZ4 +{ + /// Unsafe LZ4 codec. + internal partial class LZ4Codec + { + /// Encodes the specified input. + /// The input. + /// The output. + /// Number of bytes written. + public static unsafe int Encode(ReadOnlySpan input, Span output) + { + if (output.Length == 0) + { + throw new MessagePackSerializationException("Output is empty."); + } + + fixed (byte* inputPtr = input) + fixed (byte* outputPtr = output) + { + if (input.Length < LZ4_64KLIMIT) + { + var uHashTable = HashTablePool.GetUShortHashTablePool(); + fixed (ushort* hash1 = &uHashTable[0]) + { + if (IntPtr.Size == 4) + { + return LZ4_compress64kCtx_32(hash1, inputPtr, outputPtr, input.Length, output.Length); + } + else + { + return LZ4_compress64kCtx_64(hash1, inputPtr, outputPtr, input.Length, output.Length); + } + } + } + else + { + var bHashTable = HashTablePool.GetUIntHashTablePool(); + fixed (uint* hash2 = &bHashTable[0]) + { + if (IntPtr.Size == 4) + { + return LZ4_compressCtx_32(hash2, inputPtr, outputPtr, input.Length, output.Length); + } + else + { + return LZ4_compressCtx_64(hash2, inputPtr, outputPtr, input.Length, output.Length); + } + } + } + } + } + + /// Decodes the specified input. + /// The input. + /// The output. + /// Number of bytes written. + public static unsafe int Decode(ReadOnlySpan input, Span output) + { + if (output.Length == 0) + { + throw new MessagePackSerializationException("Output is empty."); + } + + fixed (byte* inputPtr = input) + fixed (byte* outputPtr = output) + { + int length; + if (IntPtr.Size == 4) + { + length = LZ4_uncompress_32(inputPtr, outputPtr, output.Length); + } + else + { + length = LZ4_uncompress_64(inputPtr, outputPtr, output.Length); + } + + if (length != input.Length) + { + throw new MessagePackSerializationException("LZ4 block is corrupted, or invalid length has been given."); + } + + return output.Length; + } + } + } +} diff --git a/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Unsafe.cs.meta b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Unsafe.cs.meta new file mode 100644 index 000000000..5a7ca605a --- /dev/null +++ b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Unsafe.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 719385c28cab29b71a262f02263f385e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Unsafe32.Dirty.cs b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Unsafe32.Dirty.cs new file mode 100644 index 000000000..22d39b25d --- /dev/null +++ b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Unsafe32.Dirty.cs @@ -0,0 +1,796 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +#region LZ4 original + +/* + LZ4 - Fast LZ compression algorithm + Copyright (C) 2011-2012, Yann Collet. + BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + You can contact the author at : + - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html + - LZ4 source repository : http://code.google.com/p/lz4/ +*/ + +#endregion + +#region LZ4 port + +/* +Copyright (c) 2013, Milosz Krajewski +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided +that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#endregion + +#pragma warning disable SA1312 // Variable names should begin with lower-case letter + +namespace MessagePack.LZ4 +{ + internal partial class LZ4Codec + { + #region LZ4_compressCtx_32 + + private static unsafe int LZ4_compressCtx_32( + uint* hash_table, + byte* src, + byte* dst, + int src_len, + int dst_maxlen) + { + unchecked + { + byte* _p; + + fixed (int* debruijn32 = &DEBRUIJN_TABLE_32[0]) + { + // r93 + var src_p = src; + var src_base = src_p; + var src_anchor = src_p; + var src_end = src_p + src_len; + var src_mflimit = src_end - MFLIMIT; + + var dst_p = dst; + var dst_end = dst_p + dst_maxlen; + + var src_LASTLITERALS = src_end - LASTLITERALS; + var src_LASTLITERALS_1 = src_LASTLITERALS - 1; + + var src_LASTLITERALS_STEPSIZE_1 = src_LASTLITERALS - (STEPSIZE_32 - 1); + var dst_LASTLITERALS_1 = dst_end - (1 + LASTLITERALS); + var dst_LASTLITERALS_3 = dst_end - (2 + 1 + LASTLITERALS); + + int length; + + uint h, h_fwd; + + // Init + if (src_len < MINLENGTH) + { + goto _last_literals; + } + + // First Byte + hash_table[(*(uint*)src_p * 2654435761u) >> HASH_ADJUST] = (uint)(src_p - src_base); + src_p++; + h_fwd = (*(uint*)src_p * 2654435761u) >> HASH_ADJUST; + + // Main Loop + while (true) + { + var findMatchAttempts = (1 << SKIPSTRENGTH) + 3; + var src_p_fwd = src_p; + byte* xxx_ref; + byte* xxx_token; + + // Find a match + do + { + h = h_fwd; + var step = findMatchAttempts++ >> SKIPSTRENGTH; + src_p = src_p_fwd; + src_p_fwd = src_p + step; + + if (src_p_fwd > src_mflimit) + { + goto _last_literals; + } + + h_fwd = (*(uint*)src_p_fwd * 2654435761u) >> HASH_ADJUST; + xxx_ref = src_base + hash_table[h]; + hash_table[h] = (uint)(src_p - src_base); + } + while ((xxx_ref < src_p - MAX_DISTANCE) || ((*(uint*)xxx_ref) != (*(uint*)src_p))); + + // Catch up + while ((src_p > src_anchor) && (xxx_ref > src) && (src_p[-1] == xxx_ref[-1])) + { + src_p--; + xxx_ref--; + } + + // Encode Literal length + length = (int)(src_p - src_anchor); + xxx_token = dst_p++; + + if (dst_p + length + (length >> 8) > dst_LASTLITERALS_3) + { + return 0; // Check output limit + } + + if (length >= RUN_MASK) + { + var len = length - RUN_MASK; + *xxx_token = RUN_MASK << ML_BITS; + if (len > 254) + { + do + { + *dst_p++ = 255; + len -= 255; + } + while (len > 254); + *dst_p++ = (byte)len; + BlockCopy32(src_anchor, dst_p, length); + dst_p += length; + goto _next_match; + } + + *dst_p++ = (byte)len; + } + else + { + *xxx_token = (byte)(length << ML_BITS); + } + + // Copy Literals + _p = dst_p + length; + do + { + *(uint*)dst_p = *(uint*)src_anchor; + dst_p += 4; + src_anchor += 4; + *(uint*)dst_p = *(uint*)src_anchor; + dst_p += 4; + src_anchor += 4; + } + while (dst_p < _p); + dst_p = _p; + +_next_match: + +// Encode Offset + *(ushort*)dst_p = (ushort)(src_p - xxx_ref); + dst_p += 2; + + // Start Counting + src_p += MINMATCH; + xxx_ref += MINMATCH; // MinMatch already verified + src_anchor = src_p; + + while (src_p < src_LASTLITERALS_STEPSIZE_1) + { + var diff = (*(int*)xxx_ref) ^ (*(int*)src_p); + if (diff == 0) + { + src_p += STEPSIZE_32; + xxx_ref += STEPSIZE_32; + continue; + } + + src_p += debruijn32[((uint)(diff & -diff) * 0x077CB531u) >> 27]; + goto _endCount; + } + + if ((src_p < src_LASTLITERALS_1) && ((*(ushort*)xxx_ref) == (*(ushort*)src_p))) + { + src_p += 2; + xxx_ref += 2; + } + + if ((src_p < src_LASTLITERALS) && (*xxx_ref == *src_p)) + { + src_p++; + } + +_endCount: + +// Encode MatchLength + length = (int)(src_p - src_anchor); + + if (dst_p + (length >> 8) > dst_LASTLITERALS_1) + { + return 0; // Check output limit + } + + if (length >= ML_MASK) + { + *xxx_token += ML_MASK; + length -= ML_MASK; + for (; length > 509; length -= 510) + { + *dst_p++ = 255; + *dst_p++ = 255; + } + + if (length > 254) + { + length -= 255; + *dst_p++ = 255; + } + + *dst_p++ = (byte)length; + } + else + { + *xxx_token += (byte)length; + } + + // Test end of chunk + if (src_p > src_mflimit) + { + src_anchor = src_p; + break; + } + + // Fill table + hash_table[(*(uint*)(src_p - 2) * 2654435761u) >> HASH_ADJUST] = (uint)(src_p - 2 - src_base); + + // Test next position + h = (*(uint*)src_p * 2654435761u) >> HASH_ADJUST; + xxx_ref = src_base + hash_table[h]; + hash_table[h] = (uint)(src_p - src_base); + + if ((xxx_ref > src_p - (MAX_DISTANCE + 1)) && ((*(uint*)xxx_ref) == (*(uint*)src_p))) + { + xxx_token = dst_p++; + *xxx_token = 0; + goto _next_match; + } + + // Prepare next loop + src_anchor = src_p++; + h_fwd = (*(uint*)src_p * 2654435761u) >> HASH_ADJUST; + } + +_last_literals: + +// Encode Last Literals + { + var lastRun = (int)(src_end - src_anchor); + + if (dst_p + lastRun + 1 + ((lastRun + 255 - RUN_MASK) / 255) > dst_end) + { + return 0; + } + + if (lastRun >= RUN_MASK) + { + *dst_p++ = RUN_MASK << ML_BITS; + lastRun -= RUN_MASK; + for (; lastRun > 254; lastRun -= 255) + { + *dst_p++ = 255; + } + + *dst_p++ = (byte)lastRun; + } + else + { + *dst_p++ = (byte)(lastRun << ML_BITS); + } + + BlockCopy32(src_anchor, dst_p, (int)(src_end - src_anchor)); + dst_p += src_end - src_anchor; + } + + // End + return (int)(dst_p - dst); + } + } + } + + #endregion + + #region LZ4_compress64kCtx_32 + + private static unsafe int LZ4_compress64kCtx_32( + ushort* hash_table, + byte* src, + byte* dst, + int src_len, + int dst_maxlen) + { + unchecked + { + byte* _p; + fixed (int* debruijn32 = &DEBRUIJN_TABLE_32[0]) + { + // r93 + var src_p = src; + var src_anchor = src_p; + var src_base = src_p; + var src_end = src_p + src_len; + var src_mflimit = src_end - MFLIMIT; + + var dst_p = dst; + var dst_end = dst_p + dst_maxlen; + + var src_LASTLITERALS = src_end - LASTLITERALS; + var src_LASTLITERALS_1 = src_LASTLITERALS - 1; + + var src_LASTLITERALS_STEPSIZE_1 = src_LASTLITERALS - (STEPSIZE_32 - 1); + var dst_LASTLITERALS_1 = dst_end - (1 + LASTLITERALS); + var dst_LASTLITERALS_3 = dst_end - (2 + 1 + LASTLITERALS); + + int len, length; + + uint h, h_fwd; + + // Init + if (src_len < MINLENGTH) + { + goto _last_literals; + } + + // First Byte + src_p++; + h_fwd = (*(uint*)src_p * 2654435761u) >> HASH64K_ADJUST; + + // Main Loop + while (true) + { + var findMatchAttempts = (1 << SKIPSTRENGTH) + 3; + var src_p_fwd = src_p; + byte* xxx_ref; + byte* xxx_token; + + // Find a match + do + { + h = h_fwd; + var step = findMatchAttempts++ >> SKIPSTRENGTH; + src_p = src_p_fwd; + src_p_fwd = src_p + step; + + if (src_p_fwd > src_mflimit) + { + goto _last_literals; + } + + h_fwd = (*(uint*)src_p_fwd * 2654435761u) >> HASH64K_ADJUST; + xxx_ref = src_base + hash_table[h]; + hash_table[h] = (ushort)(src_p - src_base); + } + while ((*(uint*)xxx_ref) != (*(uint*)src_p)); + + // Catch up + while ((src_p > src_anchor) && (xxx_ref > src) && (src_p[-1] == xxx_ref[-1])) + { + src_p--; + xxx_ref--; + } + + // Encode Literal length + length = (int)(src_p - src_anchor); + xxx_token = dst_p++; + + if (dst_p + length + (length >> 8) > dst_LASTLITERALS_3) + { + return 0; // Check output limit + } + + if (length >= RUN_MASK) + { + len = length - RUN_MASK; + *xxx_token = RUN_MASK << ML_BITS; + if (len > 254) + { + do + { + *dst_p++ = 255; + len -= 255; + } + while (len > 254); + *dst_p++ = (byte)len; + BlockCopy32(src_anchor, dst_p, length); + dst_p += length; + goto _next_match; + } + + *dst_p++ = (byte)len; + } + else + { + *xxx_token = (byte)(length << ML_BITS); + } + + // Copy Literals + _p = dst_p + length; + do + { + *(uint*)dst_p = *(uint*)src_anchor; + dst_p += 4; + src_anchor += 4; + *(uint*)dst_p = *(uint*)src_anchor; + dst_p += 4; + src_anchor += 4; + } + while (dst_p < _p); + dst_p = _p; + +_next_match: + +// Encode Offset + *(ushort*)dst_p = (ushort)(src_p - xxx_ref); + dst_p += 2; + + // Start Counting + src_p += MINMATCH; + xxx_ref += MINMATCH; // MinMatch verified + src_anchor = src_p; + + while (src_p < src_LASTLITERALS_STEPSIZE_1) + { + var diff = (*(int*)xxx_ref) ^ (*(int*)src_p); + if (diff == 0) + { + src_p += STEPSIZE_32; + xxx_ref += STEPSIZE_32; + continue; + } + + src_p += debruijn32[((uint)(diff & -diff) * 0x077CB531u) >> 27]; + goto _endCount; + } + + if ((src_p < src_LASTLITERALS_1) && ((*(ushort*)xxx_ref) == (*(ushort*)src_p))) + { + src_p += 2; + xxx_ref += 2; + } + + if ((src_p < src_LASTLITERALS) && (*xxx_ref == *src_p)) + { + src_p++; + } + +_endCount: + +// Encode MatchLength + len = (int)(src_p - src_anchor); + + if (dst_p + (len >> 8) > dst_LASTLITERALS_1) + { + return 0; // Check output limit + } + + if (len >= ML_MASK) + { + *xxx_token += ML_MASK; + len -= ML_MASK; + for (; len > 509; len -= 510) + { + *dst_p++ = 255; + *dst_p++ = 255; + } + + if (len > 254) + { + len -= 255; + *dst_p++ = 255; + } + + *dst_p++ = (byte)len; + } + else + { + *xxx_token += (byte)len; + } + + // Test end of chunk + if (src_p > src_mflimit) + { + src_anchor = src_p; + break; + } + + // Fill table + hash_table[(*(uint*)(src_p - 2) * 2654435761u) >> HASH64K_ADJUST] = (ushort)(src_p - 2 - src_base); + + // Test next position + h = (*(uint*)src_p * 2654435761u) >> HASH64K_ADJUST; + xxx_ref = src_base + hash_table[h]; + hash_table[h] = (ushort)(src_p - src_base); + + if ((*(uint*)xxx_ref) == (*(uint*)src_p)) + { + xxx_token = dst_p++; + *xxx_token = 0; + goto _next_match; + } + + // Prepare next loop + src_anchor = src_p++; + h_fwd = (*(uint*)src_p * 2654435761u) >> HASH64K_ADJUST; + } + +_last_literals: + +// Encode Last Literals + { + var lastRun = (int)(src_end - src_anchor); + if (dst_p + lastRun + 1 + ((lastRun - RUN_MASK + 255) / 255) > dst_end) + { + return 0; + } + + if (lastRun >= RUN_MASK) + { + *dst_p++ = RUN_MASK << ML_BITS; + lastRun -= RUN_MASK; + for (; lastRun > 254; lastRun -= 255) + { + *dst_p++ = 255; + } + + *dst_p++ = (byte)lastRun; + } + else + { + *dst_p++ = (byte)(lastRun << ML_BITS); + } + + BlockCopy32(src_anchor, dst_p, (int)(src_end - src_anchor)); + dst_p += src_end - src_anchor; + } + + // End + return (int)(dst_p - dst); + } + } + } + + #endregion + + #region LZ4_uncompress_32 + + private static unsafe int LZ4_uncompress_32( + byte* src, + byte* dst, + int dst_len) + { + unchecked + { + fixed (int* dec32table = &DECODER_TABLE_32[0]) + { + // r93 + var src_p = src; + byte* xxx_ref; + + var dst_p = dst; + var dst_end = dst_p + dst_len; + byte* dst_cpy; + + var dst_LASTLITERALS = dst_end - LASTLITERALS; + var dst_COPYLENGTH = dst_end - COPYLENGTH; + var dst_COPYLENGTH_STEPSIZE_4 = dst_end - COPYLENGTH - (STEPSIZE_32 - 4); + + uint xxx_token; + + // Main Loop + while (true) + { + int length; + + // get runlength + xxx_token = *src_p++; + if ((length = (int)(xxx_token >> ML_BITS)) == RUN_MASK) + { + int len; + for (; (len = *src_p++) == 255; length += 255) + { + /* do nothing */ + } + + length += len; + } + + // copy literals + dst_cpy = dst_p + length; + + if (dst_cpy > dst_COPYLENGTH) + { + if (dst_cpy != dst_end) + { + goto _output_error; // Error : not enough place for another match (min 4) + 5 literals + } + + BlockCopy32(src_p, dst_p, length); + src_p += length; + break; // EOF + } + + do + { + *(uint*)dst_p = *(uint*)src_p; + dst_p += 4; + src_p += 4; + *(uint*)dst_p = *(uint*)src_p; + dst_p += 4; + src_p += 4; + } + while (dst_p < dst_cpy); + src_p -= dst_p - dst_cpy; + dst_p = dst_cpy; + + // get offset + xxx_ref = dst_cpy - (*(ushort*)src_p); + src_p += 2; + if (xxx_ref < dst) + { + goto _output_error; // Error : offset outside destination buffer + } + + // get matchlength + if ((length = (int)(xxx_token & ML_MASK)) == ML_MASK) + { + for (; *src_p == 255; length += 255) + { + src_p++; + } + + length += *src_p++; + } + + // copy repeated sequence + if ((dst_p - xxx_ref) < STEPSIZE_32) + { + const int dec64 = 0; + + dst_p[0] = xxx_ref[0]; + dst_p[1] = xxx_ref[1]; + dst_p[2] = xxx_ref[2]; + dst_p[3] = xxx_ref[3]; + dst_p += 4; + xxx_ref += 4; + xxx_ref -= dec32table[dst_p - xxx_ref]; + *(uint*)dst_p = *(uint*)xxx_ref; + dst_p += STEPSIZE_32 - 4; + xxx_ref -= dec64; + } + else + { + *(uint*)dst_p = *(uint*)xxx_ref; + dst_p += 4; + xxx_ref += 4; + } + + dst_cpy = dst_p + length - (STEPSIZE_32 - 4); + + if (dst_cpy > dst_COPYLENGTH_STEPSIZE_4) + { + if (dst_cpy > dst_LASTLITERALS) + { + goto _output_error; // Error : last 5 bytes must be literals + } + + { + do + { + *(uint*)dst_p = *(uint*)xxx_ref; + dst_p += 4; + xxx_ref += 4; + *(uint*)dst_p = *(uint*)xxx_ref; + dst_p += 4; + xxx_ref += 4; + } + while (dst_p < dst_COPYLENGTH); + } + + while (dst_p < dst_cpy) + { + *dst_p++ = *xxx_ref++; + } + + dst_p = dst_cpy; + continue; + } + + do + { + *(uint*)dst_p = *(uint*)xxx_ref; + dst_p += 4; + xxx_ref += 4; + *(uint*)dst_p = *(uint*)xxx_ref; + dst_p += 4; + xxx_ref += 4; + } + while (dst_p < dst_cpy); + dst_p = dst_cpy; // correction + } + + // end of decoding + return (int)(src_p - src); + +// write overflow error detected +_output_error: + return (int)-(src_p - src); + } + } + } + + #endregion + + /// Copies block of memory. + /// The source. + /// The destination. + /// The length (in bytes). + private static unsafe void BlockCopy32(byte* src, byte* dst, int len) + { + while (len >= 4) + { + *(uint*)dst = *(uint*)src; + dst += 4; + src += 4; + len -= 4; + } + + if (len >= 2) + { + *(ushort*)dst = *(ushort*)src; + dst += 2; + src += 2; + len -= 2; + } + + if (len >= 1) + { + *dst = *src; /* d++; s++; l--; */ + } + } + } +} diff --git a/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Unsafe32.Dirty.cs.meta b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Unsafe32.Dirty.cs.meta new file mode 100644 index 000000000..5222cd47d --- /dev/null +++ b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Unsafe32.Dirty.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 44efef809614456e8a4d40559c526efa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Unsafe64.Dirty.cs b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Unsafe64.Dirty.cs new file mode 100644 index 000000000..ba10e68d2 --- /dev/null +++ b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Unsafe64.Dirty.cs @@ -0,0 +1,808 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +#region LZ4 original + +/* + LZ4 - Fast LZ compression algorithm + Copyright (C) 2011-2012, Yann Collet. + BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + You can contact the author at : + - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html + - LZ4 source repository : http://code.google.com/p/lz4/ +*/ + +#endregion + +#region LZ4 port + +/* +Copyright (c) 2013, Milosz Krajewski +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided +that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#endregion + +#pragma warning disable SA1312 // Variable names should begin with lower-case letter + +namespace MessagePack.LZ4 +{ + internal partial class LZ4Codec + { + #region LZ4_compressCtx_64 + + private static unsafe int LZ4_compressCtx_64( + uint* hash_table, + byte* src, + byte* dst, + int src_len, + int dst_maxlen) + { + unchecked + { + byte* _p; + + fixed (int* debruijn64 = &DEBRUIJN_TABLE_64[0]) + { + // r93 + var src_p = src; + var src_base = src_p; + var src_anchor = src_p; + var src_end = src_p + src_len; + var src_mflimit = src_end - MFLIMIT; + + var dst_p = dst; + var dst_end = dst_p + dst_maxlen; + + var src_LASTLITERALS = src_end - LASTLITERALS; + var src_LASTLITERALS_1 = src_LASTLITERALS - 1; + + var src_LASTLITERALS_3 = src_LASTLITERALS - 3; + var src_LASTLITERALS_STEPSIZE_1 = src_LASTLITERALS - (STEPSIZE_64 - 1); + var dst_LASTLITERALS_1 = dst_end - (1 + LASTLITERALS); + var dst_LASTLITERALS_3 = dst_end - (2 + 1 + LASTLITERALS); + + int length; + uint h, h_fwd; + + // Init + if (src_len < MINLENGTH) + { + goto _last_literals; + } + + // First Byte + hash_table[(*(uint*)src_p * 2654435761u) >> HASH_ADJUST] = (uint)(src_p - src_base); + src_p++; + h_fwd = (*(uint*)src_p * 2654435761u) >> HASH_ADJUST; + + // Main Loop + while (true) + { + var findMatchAttempts = (1 << SKIPSTRENGTH) + 3; + var src_p_fwd = src_p; + byte* src_ref; + byte* dst_token; + + // Find a match + do + { + h = h_fwd; + var step = findMatchAttempts++ >> SKIPSTRENGTH; + src_p = src_p_fwd; + src_p_fwd = src_p + step; + + if (src_p_fwd > src_mflimit) + { + goto _last_literals; + } + + h_fwd = (*(uint*)src_p_fwd * 2654435761u) >> HASH_ADJUST; + src_ref = src_base + hash_table[h]; + hash_table[h] = (uint)(src_p - src_base); + } + while ((src_ref < src_p - MAX_DISTANCE) || ((*(uint*)src_ref) != (*(uint*)src_p))); + + // Catch up + while ((src_p > src_anchor) && (src_ref > src) && (src_p[-1] == src_ref[-1])) + { + src_p--; + src_ref--; + } + + // Encode Literal length + length = (int)(src_p - src_anchor); + dst_token = dst_p++; + + if (dst_p + length + (length >> 8) > dst_LASTLITERALS_3) + { + return 0; // Check output limit + } + + if (length >= RUN_MASK) + { + var len = length - RUN_MASK; + *dst_token = RUN_MASK << ML_BITS; + if (len > 254) + { + do + { + *dst_p++ = 255; + len -= 255; + } + while (len > 254); + *dst_p++ = (byte)len; + BlockCopy64(src_anchor, dst_p, length); + dst_p += length; + goto _next_match; + } + + *dst_p++ = (byte)len; + } + else + { + *dst_token = (byte)(length << ML_BITS); + } + + // Copy Literals + _p = dst_p + length; + { + do + { + *(ulong*)dst_p = *(ulong*)src_anchor; + dst_p += 8; + src_anchor += 8; + } + while (dst_p < _p); + } + + dst_p = _p; + +_next_match: + +// Encode Offset + *(ushort*)dst_p = (ushort)(src_p - src_ref); + dst_p += 2; + + // Start Counting + src_p += MINMATCH; + src_ref += MINMATCH; // MinMatch already verified + src_anchor = src_p; + + while (src_p < src_LASTLITERALS_STEPSIZE_1) + { + var diff = (*(long*)src_ref) ^ (*(long*)src_p); + if (diff == 0) + { + src_p += STEPSIZE_64; + src_ref += STEPSIZE_64; + continue; + } + + src_p += debruijn64[((ulong)(diff & -diff) * 0x0218A392CDABBD3FL) >> 58]; + goto _endCount; + } + + if ((src_p < src_LASTLITERALS_3) && ((*(uint*)src_ref) == (*(uint*)src_p))) + { + src_p += 4; + src_ref += 4; + } + + if ((src_p < src_LASTLITERALS_1) && ((*(ushort*)src_ref) == (*(ushort*)src_p))) + { + src_p += 2; + src_ref += 2; + } + + if ((src_p < src_LASTLITERALS) && (*src_ref == *src_p)) + { + src_p++; + } + +_endCount: + +// Encode MatchLength + length = (int)(src_p - src_anchor); + + if (dst_p + (length >> 8) > dst_LASTLITERALS_1) + { + return 0; // Check output limit + } + + if (length >= ML_MASK) + { + *dst_token += ML_MASK; + length -= ML_MASK; + for (; length > 509; length -= 510) + { + *dst_p++ = 255; + *dst_p++ = 255; + } + + if (length > 254) + { + length -= 255; + *dst_p++ = 255; + } + + *dst_p++ = (byte)length; + } + else + { + *dst_token += (byte)length; + } + + // Test end of chunk + if (src_p > src_mflimit) + { + src_anchor = src_p; + break; + } + + // Fill table + hash_table[(*(uint*)(src_p - 2) * 2654435761u) >> HASH_ADJUST] = (uint)(src_p - 2 - src_base); + + // Test next position + h = (*(uint*)src_p * 2654435761u) >> HASH_ADJUST; + src_ref = src_base + hash_table[h]; + hash_table[h] = (uint)(src_p - src_base); + + if ((src_ref > src_p - (MAX_DISTANCE + 1)) && ((*(uint*)src_ref) == (*(uint*)src_p))) + { + dst_token = dst_p++; + *dst_token = 0; + goto _next_match; + } + + // Prepare next loop + src_anchor = src_p++; + h_fwd = (*(uint*)src_p * 2654435761u) >> HASH_ADJUST; + } + +_last_literals: + +// Encode Last Literals + var lastRun = (int)(src_end - src_anchor); + if (dst_p + lastRun + 1 + ((lastRun + 255 - RUN_MASK) / 255) > dst_end) + { + return 0; + } + + if (lastRun >= RUN_MASK) + { + *dst_p++ = RUN_MASK << ML_BITS; + lastRun -= RUN_MASK; + for (; lastRun > 254; lastRun -= 255) + { + *dst_p++ = 255; + } + + *dst_p++ = (byte)lastRun; + } + else + { + *dst_p++ = (byte)(lastRun << ML_BITS); + } + + BlockCopy64(src_anchor, dst_p, (int)(src_end - src_anchor)); + dst_p += src_end - src_anchor; + + // End + return (int)(dst_p - dst); + } + } + } + + #endregion + + #region LZ4_compress64kCtx_64 + + private static unsafe int LZ4_compress64kCtx_64( + ushort* hash_table, + byte* src, + byte* dst, + int src_len, + int dst_maxlen) + { + unchecked + { + byte* _p; + + fixed (int* debruijn64 = &DEBRUIJN_TABLE_64[0]) + { + // r93 + var src_p = src; + var src_anchor = src_p; + var src_base = src_p; + var src_end = src_p + src_len; + var src_mflimit = src_end - MFLIMIT; + + var dst_p = dst; + var dst_end = dst_p + dst_maxlen; + + var src_LASTLITERALS = src_end - LASTLITERALS; + var src_LASTLITERALS_1 = src_LASTLITERALS - 1; + + var src_LASTLITERALS_3 = src_LASTLITERALS - 3; + + var src_LASTLITERALS_STEPSIZE_1 = src_LASTLITERALS - (STEPSIZE_64 - 1); + var dst_LASTLITERALS_1 = dst_end - (1 + LASTLITERALS); + var dst_LASTLITERALS_3 = dst_end - (2 + 1 + LASTLITERALS); + + int len, length; + + uint h, h_fwd; + + // Init + if (src_len < MINLENGTH) + { + goto _last_literals; + } + + // First Byte + src_p++; + h_fwd = (*(uint*)src_p * 2654435761u) >> HASH64K_ADJUST; + + // Main Loop + while (true) + { + var findMatchAttempts = (1 << SKIPSTRENGTH) + 3; + var src_p_fwd = src_p; + byte* src_ref; + byte* dst_token; + + // Find a match + do + { + h = h_fwd; + var step = findMatchAttempts++ >> SKIPSTRENGTH; + src_p = src_p_fwd; + src_p_fwd = src_p + step; + + if (src_p_fwd > src_mflimit) + { + goto _last_literals; + } + + h_fwd = (*(uint*)src_p_fwd * 2654435761u) >> HASH64K_ADJUST; + src_ref = src_base + hash_table[h]; + hash_table[h] = (ushort)(src_p - src_base); + } + while ((*(uint*)src_ref) != (*(uint*)src_p)); + + // Catch up + while ((src_p > src_anchor) && (src_ref > src) && (src_p[-1] == src_ref[-1])) + { + src_p--; + src_ref--; + } + + // Encode Literal length + length = (int)(src_p - src_anchor); + dst_token = dst_p++; + + if (dst_p + length + (length >> 8) > dst_LASTLITERALS_3) + { + return 0; // Check output limit + } + + if (length >= RUN_MASK) + { + len = length - RUN_MASK; + *dst_token = RUN_MASK << ML_BITS; + if (len > 254) + { + do + { + *dst_p++ = 255; + len -= 255; + } + while (len > 254); + *dst_p++ = (byte)len; + BlockCopy64(src_anchor, dst_p, length); + dst_p += length; + goto _next_match; + } + + *dst_p++ = (byte)len; + } + else + { + *dst_token = (byte)(length << ML_BITS); + } + + // Copy Literals + { + _p = dst_p + length; + { + do + { + *(ulong*)dst_p = *(ulong*)src_anchor; + dst_p += 8; + src_anchor += 8; + } + while (dst_p < _p); + } + + dst_p = _p; + } + +_next_match: + +// Encode Offset + *(ushort*)dst_p = (ushort)(src_p - src_ref); + dst_p += 2; + + // Start Counting + src_p += MINMATCH; + src_ref += MINMATCH; // MinMatch verified + src_anchor = src_p; + + while (src_p < src_LASTLITERALS_STEPSIZE_1) + { + var diff = (*(long*)src_ref) ^ (*(long*)src_p); + if (diff == 0) + { + src_p += STEPSIZE_64; + src_ref += STEPSIZE_64; + continue; + } + + src_p += debruijn64[((ulong)(diff & -diff) * 0x0218A392CDABBD3FL) >> 58]; + goto _endCount; + } + + if ((src_p < src_LASTLITERALS_3) && ((*(uint*)src_ref) == (*(uint*)src_p))) + { + src_p += 4; + src_ref += 4; + } + + if ((src_p < src_LASTLITERALS_1) && ((*(ushort*)src_ref) == (*(ushort*)src_p))) + { + src_p += 2; + src_ref += 2; + } + + if ((src_p < src_LASTLITERALS) && (*src_ref == *src_p)) + { + src_p++; + } + +_endCount: + +// Encode MatchLength + len = (int)(src_p - src_anchor); + + if (dst_p + (len >> 8) > dst_LASTLITERALS_1) + { + return 0; // Check output limit + } + + if (len >= ML_MASK) + { + *dst_token += ML_MASK; + len -= ML_MASK; + for (; len > 509; len -= 510) + { + *dst_p++ = 255; + *dst_p++ = 255; + } + + if (len > 254) + { + len -= 255; + *dst_p++ = 255; + } + + *dst_p++ = (byte)len; + } + else + { + *dst_token += (byte)len; + } + + // Test end of chunk + if (src_p > src_mflimit) + { + src_anchor = src_p; + break; + } + + // Fill table + hash_table[(*(uint*)(src_p - 2) * 2654435761u) >> HASH64K_ADJUST] = (ushort)(src_p - 2 - src_base); + + // Test next position + h = (*(uint*)src_p * 2654435761u) >> HASH64K_ADJUST; + src_ref = src_base + hash_table[h]; + hash_table[h] = (ushort)(src_p - src_base); + + if ((*(uint*)src_ref) == (*(uint*)src_p)) + { + dst_token = dst_p++; + *dst_token = 0; + goto _next_match; + } + + // Prepare next loop + src_anchor = src_p++; + h_fwd = (*(uint*)src_p * 2654435761u) >> HASH64K_ADJUST; + } + +_last_literals: + +// Encode Last Literals + var lastRun = (int)(src_end - src_anchor); + if (dst_p + lastRun + 1 + ((lastRun - RUN_MASK + 255) / 255) > dst_end) + { + return 0; + } + + if (lastRun >= RUN_MASK) + { + *dst_p++ = RUN_MASK << ML_BITS; + lastRun -= RUN_MASK; + for (; lastRun > 254; lastRun -= 255) + { + *dst_p++ = 255; + } + + *dst_p++ = (byte)lastRun; + } + else + { + *dst_p++ = (byte)(lastRun << ML_BITS); + } + + BlockCopy64(src_anchor, dst_p, (int)(src_end - src_anchor)); + dst_p += src_end - src_anchor; + + // End + return (int)(dst_p - dst); + } + } + } + + #endregion + + #region LZ4_uncompress_64 + + private static unsafe int LZ4_uncompress_64( + byte* src, + byte* dst, + int dst_len) + { + unchecked + { + fixed (int* dec32table = &DECODER_TABLE_32[0]) + fixed (int* dec64table = &DECODER_TABLE_64[0]) + { + // r93 + var src_p = src; + byte* dst_ref; + + var dst_p = dst; + var dst_end = dst_p + dst_len; + byte* dst_cpy; + + var dst_LASTLITERALS = dst_end - LASTLITERALS; + var dst_COPYLENGTH = dst_end - COPYLENGTH; + var dst_COPYLENGTH_STEPSIZE_4 = dst_end - COPYLENGTH - (STEPSIZE_64 - 4); + + byte token; + + // Main Loop + while (true) + { + int length; + + // get runlength + token = *src_p++; + if ((length = token >> ML_BITS) == RUN_MASK) + { + int len; + for (; (len = *src_p++) == 255; length += 255) + { + /* do nothing */ + } + + length += len; + } + + // copy literals + dst_cpy = dst_p + length; + + if (dst_cpy > dst_COPYLENGTH) + { + if (dst_cpy != dst_end) + { + goto _output_error; // Error : not enough place for another match (min 4) + 5 literals + } + + BlockCopy64(src_p, dst_p, length); + src_p += length; + break; // EOF + } + + do + { + *(ulong*)dst_p = *(ulong*)src_p; + dst_p += 8; + src_p += 8; + } + while (dst_p < dst_cpy); + src_p -= dst_p - dst_cpy; + dst_p = dst_cpy; + + // get offset + dst_ref = dst_cpy - (*(ushort*)src_p); + src_p += 2; + if (dst_ref < dst) + { + goto _output_error; // Error : offset outside destination buffer + } + + // get matchlength + if ((length = token & ML_MASK) == ML_MASK) + { + for (; *src_p == 255; length += 255) + { + src_p++; + } + + length += *src_p++; + } + + // copy repeated sequence + if ((dst_p - dst_ref) < STEPSIZE_64) + { + var dec64 = dec64table[dst_p - dst_ref]; + + dst_p[0] = dst_ref[0]; + dst_p[1] = dst_ref[1]; + dst_p[2] = dst_ref[2]; + dst_p[3] = dst_ref[3]; + dst_p += 4; + dst_ref += 4; + dst_ref -= dec32table[dst_p - dst_ref]; + *(uint*)dst_p = *(uint*)dst_ref; + dst_p += STEPSIZE_64 - 4; + dst_ref -= dec64; + } + else + { + *(ulong*)dst_p = *(ulong*)dst_ref; + dst_p += 8; + dst_ref += 8; + } + + dst_cpy = dst_p + length - (STEPSIZE_64 - 4); + + if (dst_cpy > dst_COPYLENGTH_STEPSIZE_4) + { + if (dst_cpy > dst_LASTLITERALS) + { + goto _output_error; // Error : last 5 bytes must be literals + } + + while (dst_p < dst_COPYLENGTH) + { + *(ulong*)dst_p = *(ulong*)dst_ref; + dst_p += 8; + dst_ref += 8; + } + + while (dst_p < dst_cpy) + { + *dst_p++ = *dst_ref++; + } + + dst_p = dst_cpy; + continue; + } + + { + do + { + *(ulong*)dst_p = *(ulong*)dst_ref; + dst_p += 8; + dst_ref += 8; + } + while (dst_p < dst_cpy); + } + + dst_p = dst_cpy; // correction + } + + // end of decoding + return (int)(src_p - src); + +// write overflow error detected +_output_error: + return (int)-(src_p - src); + } + } + } + + #endregion + + /// Copies block of memory. + /// The source. + /// The destination. + /// The length (in bytes). + private static unsafe void BlockCopy64(byte* src, byte* dst, int len) + { + while (len >= 8) + { + *(ulong*)dst = *(ulong*)src; + dst += 8; + src += 8; + len -= 8; + } + + if (len >= 4) + { + *(uint*)dst = *(uint*)src; + dst += 4; + src += 4; + len -= 4; + } + + if (len >= 2) + { + *(ushort*)dst = *(ushort*)src; + dst += 2; + src += 2; + len -= 2; + } + + if (len >= 1) + { + *dst = *src; /* d++; s++; l--; */ + } + } + } +} diff --git a/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Unsafe64.Dirty.cs.meta b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Unsafe64.Dirty.cs.meta new file mode 100644 index 000000000..66706fb15 --- /dev/null +++ b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.Unsafe64.Dirty.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fa2e5105dcebe0410bb8ed76f622889f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/LZ4/LZ4Codec.cs b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.cs new file mode 100644 index 000000000..8445807fc --- /dev/null +++ b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.cs @@ -0,0 +1,178 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +#region license + +/* +Copyright (c) 2013, Milosz Krajewski +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided +that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#endregion + +using System; + +#pragma warning disable SA1310 // Field names should not contain underscore + +namespace MessagePack.LZ4 +{ + internal static partial class LZ4Codec + { + #region configuration + + /// + /// Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; etc.) + /// Increasing memory usage improves compression ratio + /// Reduced memory usage can improve speed, due to cache effect + /// Default value is 14, for 16KB, which nicely fits into Intel x86 L1 cache. + /// + private const int MEMORY_USAGE = 12; // modified use 12. + + /// + /// Decreasing this value will make the algorithm skip faster data segments considered "incompressible" + /// This may decrease compression ratio dramatically, but will be faster on incompressible data + /// Increasing this value will make the algorithm search more before declaring a segment "incompressible" + /// This could improve compression a bit, but will be slower on incompressible data + /// The default value (6) is recommended. + /// + private const int NOTCOMPRESSIBLE_DETECTIONLEVEL = 6; + + #endregion + + #region consts + + private const int MINMATCH = 4; + +#pragma warning disable 162, 429 + + private const int SKIPSTRENGTH = NOTCOMPRESSIBLE_DETECTIONLEVEL > 2 ? NOTCOMPRESSIBLE_DETECTIONLEVEL : 2; +#pragma warning restore 162, 429 + + private const int COPYLENGTH = 8; + private const int LASTLITERALS = 5; + private const int MFLIMIT = COPYLENGTH + MINMATCH; + private const int MINLENGTH = MFLIMIT + 1; + private const int MAXD_LOG = 16; + private const int MAXD = 1 << MAXD_LOG; + private const int MAXD_MASK = MAXD - 1; + private const int MAX_DISTANCE = (1 << MAXD_LOG) - 1; + private const int ML_BITS = 4; + private const int ML_MASK = (1 << ML_BITS) - 1; + private const int RUN_BITS = 8 - ML_BITS; + private const int RUN_MASK = (1 << RUN_BITS) - 1; + private const int STEPSIZE_64 = 8; + private const int STEPSIZE_32 = 4; + + private const int LZ4_64KLIMIT = (1 << 16) + (MFLIMIT - 1); + + private const int HASH_LOG = MEMORY_USAGE - 2; + private const int HASH_TABLESIZE = 1 << HASH_LOG; + private const int HASH_ADJUST = (MINMATCH * 8) - HASH_LOG; + + private const int HASH64K_LOG = HASH_LOG + 1; + private const int HASH64K_TABLESIZE = 1 << HASH64K_LOG; + private const int HASH64K_ADJUST = (MINMATCH * 8) - HASH64K_LOG; + + private const int HASHHC_LOG = MAXD_LOG - 1; + private const int HASHHC_TABLESIZE = 1 << HASHHC_LOG; + private const int HASHHC_ADJUST = (MINMATCH * 8) - HASHHC_LOG; + ////private const int HASHHC_MASK = HASHHC_TABLESIZE - 1; + + private const int MAX_NB_ATTEMPTS = 256; + private const int OPTIMAL_ML = ML_MASK - 1 + MINMATCH; + + private const int BLOCK_COPY_LIMIT = 16; + + private static readonly int[] DECODER_TABLE_32 = { 0, 3, 2, 3, 0, 0, 0, 0 }; + private static readonly int[] DECODER_TABLE_64 = { 0, 0, 0, -1, 0, 1, 2, 3 }; + + private static readonly int[] DEBRUIJN_TABLE_32 = + { + 0, 0, 3, 0, 3, 1, 3, 0, 3, 2, 2, 1, 3, 2, 0, 1, + 3, 3, 1, 2, 2, 2, 2, 0, 3, 1, 2, 0, 1, 0, 1, 1, + }; + + private static readonly int[] DEBRUIJN_TABLE_64 = + { + 0, 0, 0, 0, 0, 1, 1, 2, 0, 3, 1, 3, 1, 4, 2, 7, + 0, 2, 3, 6, 1, 5, 3, 5, 1, 3, 4, 4, 2, 5, 6, 7, + 7, 0, 1, 2, 3, 3, 4, 6, 2, 6, 5, 5, 3, 4, 5, 6, + 7, 1, 2, 4, 6, 4, 4, 5, 7, 2, 6, 5, 7, 6, 7, 7, + }; + + #endregion + + #region public interface (common) + + /// Gets maximum the length of the output. + /// Length of the input. + /// Maximum number of bytes needed for compressed buffer. + public static int MaximumOutputLength(int inputLength) + { + return inputLength + (inputLength / 255) + 16; + } + + #endregion + + #region internal interface (common) + + internal static void CheckArguments(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset, int outputLength) + { + if (inputLength == 0) + { + outputLength = 0; + return; + } + + if (input == null) + { + throw new ArgumentNullException("input"); + } + + if ((uint)inputOffset > (uint)input.Length) + { + throw new ArgumentOutOfRangeException("inputOffset"); + } + + if ((uint)inputLength > (uint)input.Length - (uint)inputOffset) + { + throw new ArgumentOutOfRangeException("inputLength"); + } + + if (output == null) + { + throw new ArgumentNullException("output"); + } + + if ((uint)outputOffset > (uint)output.Length) + { + throw new ArgumentOutOfRangeException("outputOffset"); + } + + if ((uint)outputLength > (uint)output.Length - (uint)outputOffset) + { + throw new ArgumentOutOfRangeException("outputLength"); + } + } + + #endregion + } +} diff --git a/Assets/Scripts/MessagePack/LZ4/LZ4Codec.cs.meta b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.cs.meta new file mode 100644 index 000000000..632797c95 --- /dev/null +++ b/Assets/Scripts/MessagePack/LZ4/LZ4Codec.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b67a7760eb98ee768b90af4f2d6d9dc4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/MessagePack.asmdef b/Assets/Scripts/MessagePack/MessagePack.asmdef new file mode 100644 index 000000000..0b434a446 --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePack.asmdef @@ -0,0 +1,13 @@ +{ + "name": "MessagePack", + "references": [], + "optionalUnityReferences": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": true, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [] +} \ No newline at end of file diff --git a/Assets/Scripts/MessagePack/MessagePack.asmdef.meta b/Assets/Scripts/MessagePack/MessagePack.asmdef.meta new file mode 100644 index 000000000..f94a18979 --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePack.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ddc6e27fff8ae94ed9ccb00c84df6e24 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/MessagePackCode.cs b/Assets/Scripts/MessagePack/MessagePackCode.cs new file mode 100644 index 000000000..25374798c --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePackCode.cs @@ -0,0 +1,248 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Collections.Generic; +using System.Text; + +namespace MessagePack +{ + /// + /// https://github.com/msgpack/msgpack/blob/master/spec.md#serialization-type-to-format-conversion. + /// +#if MESSAGEPACK_INTERNAL + internal +#else + public +#endif + enum MessagePackType : byte + { + Unknown = 0, + + Integer = 1, + Nil = 2, + Boolean = 3, + Float = 4, + String = 5, + Binary = 6, + Array = 7, + Map = 8, + Extension = 9, + } + + /// + /// The core type codes as defined by msgpack. + /// + /// +#if MESSAGEPACK_INTERNAL + internal +#else + public +#endif + static class MessagePackCode + { + public const byte MinFixInt = 0x00; // 0 + public const byte MaxFixInt = 0x7f; // 127 + public const byte MinFixMap = 0x80; // 128 + public const byte MaxFixMap = 0x8f; // 143 + public const byte MinFixArray = 0x90; // 144 + public const byte MaxFixArray = 0x9f; // 159 + public const byte MinFixStr = 0xa0; // 160 + public const byte MaxFixStr = 0xbf; // 191 + public const byte Nil = 0xc0; + public const byte NeverUsed = 0xc1; + public const byte False = 0xc2; + public const byte True = 0xc3; + public const byte Bin8 = 0xc4; + public const byte Bin16 = 0xc5; + public const byte Bin32 = 0xc6; + public const byte Ext8 = 0xc7; + public const byte Ext16 = 0xc8; + public const byte Ext32 = 0xc9; + public const byte Float32 = 0xca; + public const byte Float64 = 0xcb; + public const byte UInt8 = 0xcc; + public const byte UInt16 = 0xcd; + public const byte UInt32 = 0xce; + public const byte UInt64 = 0xcf; + public const byte Int8 = 0xd0; + public const byte Int16 = 0xd1; + public const byte Int32 = 0xd2; + public const byte Int64 = 0xd3; + public const byte FixExt1 = 0xd4; + public const byte FixExt2 = 0xd5; + public const byte FixExt4 = 0xd6; + public const byte FixExt8 = 0xd7; + public const byte FixExt16 = 0xd8; + public const byte Str8 = 0xd9; + public const byte Str16 = 0xda; + public const byte Str32 = 0xdb; + public const byte Array16 = 0xdc; + public const byte Array32 = 0xdd; + public const byte Map16 = 0xde; + public const byte Map32 = 0xdf; + public const byte MinNegativeFixInt = 0xe0; // 224 + public const byte MaxNegativeFixInt = 0xff; // 255 + + private static readonly MessagePackType[] TypeLookupTable = new MessagePackType[256]; + private static readonly string[] FormatNameTable = new string[256]; + + static MessagePackCode() + { + // Init Lookup Table + for (int i = MinFixInt; i <= MaxFixInt; i++) + { + TypeLookupTable[i] = MessagePackType.Integer; + FormatNameTable[i] = "positive fixint"; + } + + for (int i = MinFixMap; i <= MaxFixMap; i++) + { + TypeLookupTable[i] = MessagePackType.Map; + FormatNameTable[i] = "fixmap"; + } + + for (int i = MinFixArray; i <= MaxFixArray; i++) + { + TypeLookupTable[i] = MessagePackType.Array; + FormatNameTable[i] = "fixarray"; + } + + for (int i = MinFixStr; i <= MaxFixStr; i++) + { + TypeLookupTable[i] = MessagePackType.String; + FormatNameTable[i] = "fixstr"; + } + + TypeLookupTable[Nil] = MessagePackType.Nil; + TypeLookupTable[NeverUsed] = MessagePackType.Unknown; + TypeLookupTable[False] = MessagePackType.Boolean; + TypeLookupTable[True] = MessagePackType.Boolean; + TypeLookupTable[Bin8] = MessagePackType.Binary; + TypeLookupTable[Bin16] = MessagePackType.Binary; + TypeLookupTable[Bin32] = MessagePackType.Binary; + TypeLookupTable[Ext8] = MessagePackType.Extension; + TypeLookupTable[Ext16] = MessagePackType.Extension; + TypeLookupTable[Ext32] = MessagePackType.Extension; + TypeLookupTable[Float32] = MessagePackType.Float; + TypeLookupTable[Float64] = MessagePackType.Float; + TypeLookupTable[UInt8] = MessagePackType.Integer; + TypeLookupTable[UInt16] = MessagePackType.Integer; + TypeLookupTable[UInt32] = MessagePackType.Integer; + TypeLookupTable[UInt64] = MessagePackType.Integer; + TypeLookupTable[Int8] = MessagePackType.Integer; + TypeLookupTable[Int16] = MessagePackType.Integer; + TypeLookupTable[Int32] = MessagePackType.Integer; + TypeLookupTable[Int64] = MessagePackType.Integer; + TypeLookupTable[FixExt1] = MessagePackType.Extension; + TypeLookupTable[FixExt2] = MessagePackType.Extension; + TypeLookupTable[FixExt4] = MessagePackType.Extension; + TypeLookupTable[FixExt8] = MessagePackType.Extension; + TypeLookupTable[FixExt16] = MessagePackType.Extension; + TypeLookupTable[Str8] = MessagePackType.String; + TypeLookupTable[Str16] = MessagePackType.String; + TypeLookupTable[Str32] = MessagePackType.String; + TypeLookupTable[Array16] = MessagePackType.Array; + TypeLookupTable[Array32] = MessagePackType.Array; + TypeLookupTable[Map16] = MessagePackType.Map; + TypeLookupTable[Map32] = MessagePackType.Map; + + FormatNameTable[Nil] = "nil"; + FormatNameTable[NeverUsed] = "(never used)"; + FormatNameTable[False] = "false"; + FormatNameTable[True] = "true"; + FormatNameTable[Bin8] = "bin 8"; + FormatNameTable[Bin16] = "bin 16"; + FormatNameTable[Bin32] = "bin 32"; + FormatNameTable[Ext8] = "ext 8"; + FormatNameTable[Ext16] = "ext 16"; + FormatNameTable[Ext32] = "ext 32"; + FormatNameTable[Float32] = "float 32"; + FormatNameTable[Float64] = "float 64"; + FormatNameTable[UInt8] = "uint 8"; + FormatNameTable[UInt16] = "uint 16"; + FormatNameTable[UInt32] = "uint 32"; + FormatNameTable[UInt64] = "uint 64"; + FormatNameTable[Int8] = "int 8"; + FormatNameTable[Int16] = "int 16"; + FormatNameTable[Int32] = "int 32"; + FormatNameTable[Int64] = "int 64"; + FormatNameTable[FixExt1] = "fixext 1"; + FormatNameTable[FixExt2] = "fixext 2"; + FormatNameTable[FixExt4] = "fixext 4"; + FormatNameTable[FixExt8] = "fixext 8"; + FormatNameTable[FixExt16] = "fixext 16"; + FormatNameTable[Str8] = "str 8"; + FormatNameTable[Str16] = "str 16"; + FormatNameTable[Str32] = "str 32"; + FormatNameTable[Array16] = "array 16"; + FormatNameTable[Array32] = "array 32"; + FormatNameTable[Map16] = "map 16"; + FormatNameTable[Map32] = "map 32"; + + for (int i = MinNegativeFixInt; i <= MaxNegativeFixInt; i++) + { + TypeLookupTable[i] = MessagePackType.Integer; + FormatNameTable[i] = "negative fixint"; + } + } + + public static MessagePackType ToMessagePackType(byte code) + { + return TypeLookupTable[code]; + } + + public static string ToFormatName(byte code) + { + return FormatNameTable[code]; + } + + /// + /// Checks whether a given messagepack code represents an integer that might include a sign (i.e. might be a negative number). + /// + /// The messagepack code. + /// A boolean value. + internal static bool IsSignedInteger(byte code) + { + switch (code) + { + case Int8: + case Int16: + case Int32: + case Int64: + return true; + default: + return code >= MinNegativeFixInt && code <= MaxNegativeFixInt; + } + } + } + + /// + /// The officially defined messagepack extension type codes. + /// +#if MESSAGEPACK_INTERNAL + internal +#else + public +#endif + static class ReservedMessagePackExtensionTypeCode + { + public const sbyte DateTime = -1; + } + +#if MESSAGEPACK_INTERNAL + internal +#else + public +#endif + static class MessagePackRange + { + public const int MinFixNegativeInt = -32; + public const int MaxFixNegativeInt = -1; + public const int MaxFixPositiveInt = 127; + public const int MinFixStringLength = 0; + public const int MaxFixStringLength = 31; + public const int MaxFixMapCount = 15; + public const int MaxFixArrayCount = 15; + } +} diff --git a/Assets/Scripts/MessagePack/MessagePackCode.cs.meta b/Assets/Scripts/MessagePack/MessagePackCode.cs.meta new file mode 100644 index 000000000..296c8e42b --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePackCode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d493a26c728a2e7d2abf11945f3486c3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/MessagePackCompression.cs b/Assets/Scripts/MessagePack/MessagePackCompression.cs new file mode 100644 index 000000000..1fb1a7229 --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePackCompression.cs @@ -0,0 +1,57 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace MessagePack +{ + /// + /// Identifies the various compression schemes which might be applied at the msgpack level. + /// + public enum MessagePackCompression + { + /// + /// No compression is applied at the msgpack level. + /// + None, + + /// + /// Compresses an entire msgpack sequence as a single lz4 block format. + /// This is the simple compression that achieves best compression ratio, + /// at the cost of copying the entire sequence when necessary to get contiguous memory. + /// + /// + /// Uses msgpack type code ext99 and is compatible with v1 of this library. + /// + /// + /// See also ThisLibraryExtensionTypeCodes.Lz4Block + /// + Lz4Block, + + /// + /// Compresses an entire msgpack sequence as a array of lz4 block format. + /// This is compressed/decompressed in chunks that do not consume LOH, + /// but the compression ratio is slightly sacrificed. + /// + /// + /// Uses msgpack type code ext98 in array. + /// + /// + /// See also ThisLibraryExtensionTypeCodes.Lz4BlockArray + /// + Lz4BlockArray, + } + +#pragma warning disable SA1649 // File name should match first type name + + /// + /// Extensions for . + /// + internal static class MessagePackCompressionExtensions + { + public static bool IsCompression(this MessagePackCompression compression) + { + return compression != MessagePackCompression.None; + } + } + +#pragma warning restore SA1649 // File name should match first type name +} diff --git a/Assets/Scripts/MessagePack/MessagePackCompression.cs.meta b/Assets/Scripts/MessagePack/MessagePackCompression.cs.meta new file mode 100644 index 000000000..f5cf9b590 --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePackCompression.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 465ff1ba0b3de79669df07fa6a47971d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/MessagePackReader.cs b/Assets/Scripts/MessagePack/MessagePackReader.cs new file mode 100644 index 000000000..ce94e841e --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePackReader.cs @@ -0,0 +1,1090 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; +using System.Diagnostics; +using System.IO; +using System.Runtime.CompilerServices; +using System.Threading; +using MessagePack.Internal; + +namespace MessagePack +{ + /// + /// A primitive types reader for the MessagePack format. + /// + /// + /// The MessagePack spec.. + /// + /// Thrown when reading methods fail due to invalid data. + /// Thrown by reading methods when there are not enough bytes to read the required value. +#if MESSAGEPACK_INTERNAL + internal +#else + public +#endif + ref partial struct MessagePackReader + { + /// + /// The reader over the sequence. + /// + private SequenceReader reader; + + /// + /// Initializes a new instance of the struct. + /// + /// The buffer to read from. + public MessagePackReader(ReadOnlyMemory memory) + : this() + { + this.reader = new SequenceReader(memory); + this.Depth = 0; + } + + /// + /// Initializes a new instance of the struct. + /// + /// The sequence to read from. + public MessagePackReader(in ReadOnlySequence readOnlySequence) + : this() + { + this.reader = new SequenceReader(readOnlySequence); + this.Depth = 0; + } + + /// + /// Gets or sets the cancellation token for this deserialization operation. + /// + public CancellationToken CancellationToken { get; set; } + + /// + /// Gets or sets the present depth of the object graph being deserialized. + /// + public int Depth { get; set; } + + /// + /// Gets the originally supplied to the constructor. + /// + public ReadOnlySequence Sequence => this.reader.Sequence; + + /// + /// Gets the current position of the reader within . + /// + public SequencePosition Position => this.reader.Position; + + /// + /// Gets the number of bytes consumed by the reader. + /// + public long Consumed => this.reader.Consumed; + + /// + /// Gets a value indicating whether the reader is at the end of the sequence. + /// + public bool End => this.reader.End; + + /// + /// Gets a value indicating whether the reader position is pointing at a nil value. + /// + /// Thrown if the end of the sequence provided to the constructor is reached before the expected end of the data. + public bool IsNil => this.NextCode == MessagePackCode.Nil; + + /// + /// Gets the next message pack type to be read. + /// + public MessagePackType NextMessagePackType => MessagePackCode.ToMessagePackType(this.NextCode); + + /// + /// Gets the type of the next MessagePack block. + /// + /// Thrown if the end of the sequence provided to the constructor is reached before the expected end of the data. + /// + /// See for valid message pack codes and ranges. + /// + public byte NextCode + { + get + { + ThrowInsufficientBufferUnless(this.reader.TryPeek(out byte code)); + return code; + } + } + + /// + /// Initializes a new instance of the struct, + /// with the same settings as this one, but with its own buffer to read from. + /// + /// The sequence to read from. + /// The new reader. + public MessagePackReader Clone(in ReadOnlySequence readOnlySequence) => new MessagePackReader(readOnlySequence) + { + CancellationToken = this.CancellationToken, + Depth = this.Depth, + }; + + /// + /// Creates a new at this reader's current position. + /// The two readers may then be used independently without impacting each other. + /// + /// A new . + /// + /// Since this is a struct, copying it completely is as simple as returning itself + /// from a property that isn't a "ref return" property. + /// + public MessagePackReader CreatePeekReader() => this; + + /// + /// Advances the reader to the next MessagePack primitive to be read. + /// + /// + /// The entire primitive is skipped, including content of maps or arrays, or any other type with payloads. + /// To get the raw MessagePack sequence that was skipped, use instead. + /// + public void Skip() => ThrowInsufficientBufferUnless(this.TrySkip()); + + /// + /// Advances the reader to the next MessagePack primitive to be read. + /// + /// true if the entire structure beginning at the current is found in the ; false otherwise. + /// + /// The entire primitive is skipped, including content of maps or arrays, or any other type with payloads. + /// To get the raw MessagePack sequence that was skipped, use instead. + /// + internal bool TrySkip() + { + if (this.reader.Remaining == 0) + { + return false; + } + + byte code = this.NextCode; + switch (code) + { + case MessagePackCode.Nil: + case MessagePackCode.True: + case MessagePackCode.False: + return this.reader.TryAdvance(1); + case MessagePackCode.Int8: + case MessagePackCode.UInt8: + return this.reader.TryAdvance(2); + case MessagePackCode.Int16: + case MessagePackCode.UInt16: + return this.reader.TryAdvance(3); + case MessagePackCode.Int32: + case MessagePackCode.UInt32: + case MessagePackCode.Float32: + return this.reader.TryAdvance(5); + case MessagePackCode.Int64: + case MessagePackCode.UInt64: + case MessagePackCode.Float64: + return this.reader.TryAdvance(9); + case MessagePackCode.Map16: + case MessagePackCode.Map32: + return this.TrySkipNextMap(); + case MessagePackCode.Array16: + case MessagePackCode.Array32: + return this.TrySkipNextArray(); + case MessagePackCode.Str8: + case MessagePackCode.Str16: + case MessagePackCode.Str32: + return this.reader.TryAdvance(this.GetStringLengthInBytes()); + case MessagePackCode.Bin8: + case MessagePackCode.Bin16: + case MessagePackCode.Bin32: + return this.reader.TryAdvance(this.GetBytesLength()); + case MessagePackCode.FixExt1: + case MessagePackCode.FixExt2: + case MessagePackCode.FixExt4: + case MessagePackCode.FixExt8: + case MessagePackCode.FixExt16: + case MessagePackCode.Ext8: + case MessagePackCode.Ext16: + case MessagePackCode.Ext32: + return this.TryReadExtensionFormatHeader(out ExtensionHeader header) && this.reader.TryAdvance(header.Length); + default: + if ((code >= MessagePackCode.MinNegativeFixInt && code <= MessagePackCode.MaxNegativeFixInt) || + (code >= MessagePackCode.MinFixInt && code <= MessagePackCode.MaxFixInt)) + { + return this.reader.TryAdvance(1); + } + + if (code >= MessagePackCode.MinFixMap && code <= MessagePackCode.MaxFixMap) + { + return this.TrySkipNextMap(); + } + + if (code >= MessagePackCode.MinFixArray && code <= MessagePackCode.MaxFixArray) + { + return this.TrySkipNextArray(); + } + + if (code >= MessagePackCode.MinFixStr && code <= MessagePackCode.MaxFixStr) + { + return this.reader.TryAdvance(this.GetStringLengthInBytes()); + } + + // We don't actually expect to ever hit this point, since every code is supported. + Debug.Fail("Missing handler for code: " + code); + throw ThrowInvalidCode(code); + } + } + + /// + /// Reads a value. + /// + /// A nil value. + public Nil ReadNil() + { + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte code)); + + return code == MessagePackCode.Nil + ? Nil.Default + : throw ThrowInvalidCode(code); + } + + /// + /// Reads nil if it is the next token. + /// + /// true if the next token was nil; false otherwise. + /// Thrown if the end of the sequence provided to the constructor is reached before the expected end of the data. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public bool TryReadNil() + { + if (this.NextCode == MessagePackCode.Nil) + { + this.reader.Advance(1); + return true; + } + + return false; + } + + /// + /// Reads a sequence of bytes without any decoding. + /// + /// The number of bytes to read. + /// The sequence of bytes read. + public ReadOnlySequence ReadRaw(long length) + { + try + { + ReadOnlySequence result = this.reader.Sequence.Slice(this.reader.Position, length); + this.reader.Advance(length); + return result; + } + catch (ArgumentOutOfRangeException ex) + { + throw ThrowNotEnoughBytesException(ex); + } + } + + /// + /// Reads the next MessagePack primitive. + /// + /// The raw MessagePack sequence. + /// + /// The entire primitive is read, including content of maps or arrays, or any other type with payloads. + /// + public ReadOnlySequence ReadRaw() + { + SequencePosition initialPosition = this.Position; + this.Skip(); + return this.Sequence.Slice(initialPosition, this.Position); + } + + /// + /// Read an array header from + /// , + /// , or + /// some built-in code between and . + /// + /// + /// Thrown if the header cannot be read in the bytes left in the + /// or if it is clear that there are insufficient bytes remaining after the header to include all the elements the header claims to be there. + /// + /// Thrown if a code other than an array header is encountered. + public int ReadArrayHeader() + { + ThrowInsufficientBufferUnless(this.TryReadArrayHeader(out int count)); + + // Protect against corrupted or mischievious data that may lead to allocating way too much memory. + // We allow for each primitive to be the minimal 1 byte in size. + // Formatters that know each element is larger can optionally add a stronger check. + ThrowInsufficientBufferUnless(this.reader.Remaining >= count); + + return count; + } + + /// + /// Reads an array header from + /// , + /// , or + /// some built-in code between and + /// if there is sufficient buffer to read it. + /// + /// Receives the number of elements in the array if the entire array header could be read. + /// true if there was sufficient buffer and an array header was found; false if the buffer incompletely describes an array header. + /// Thrown if a code other than an array header is encountered. + /// + /// When this method returns false the position of the reader is left in an undefined position. + /// The caller is expected to recreate the reader (presumably with a longer sequence to read from) before continuing. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public bool TryReadArrayHeader(out int count) + { + count = -1; + if (!this.reader.TryRead(out byte code)) + { + return false; + } + + switch (code) + { + case MessagePackCode.Array16: + if (!this.reader.TryReadBigEndian(out short shortValue)) + { + return false; + } + + count = unchecked((ushort)shortValue); + break; + case MessagePackCode.Array32: + if (!this.reader.TryReadBigEndian(out int intValue)) + { + return false; + } + + count = intValue; + break; + default: + if (code >= MessagePackCode.MinFixArray && code <= MessagePackCode.MaxFixArray) + { + count = code & 0xF; + break; + } + + throw ThrowInvalidCode(code); + } + + return true; + } + + /// + /// Read a map header from + /// , + /// , or + /// some built-in code between and . + /// + /// The number of key=value pairs in the map. + /// + /// Thrown if the header cannot be read in the bytes left in the + /// or if it is clear that there are insufficient bytes remaining after the header to include all the elements the header claims to be there. + /// + /// Thrown if a code other than an map header is encountered. + public int ReadMapHeader() + { + ThrowInsufficientBufferUnless(this.TryReadMapHeader(out int count)); + + // Protect against corrupted or mischievious data that may lead to allocating way too much memory. + // We allow for each primitive to be the minimal 1 byte in size, and we have a key=value map, so that's 2 bytes. + // Formatters that know each element is larger can optionally add a stronger check. + ThrowInsufficientBufferUnless(this.reader.Remaining >= count * 2); + + return count; + } + + /// + /// Reads a map header from + /// , + /// , or + /// some built-in code between and + /// if there is sufficient buffer to read it. + /// + /// Receives the number of key=value pairs in the map if the entire map header can be read. + /// true if there was sufficient buffer and a map header was found; false if the buffer incompletely describes an map header. + /// Thrown if a code other than an map header is encountered. + /// + /// When this method returns false the position of the reader is left in an undefined position. + /// The caller is expected to recreate the reader (presumably with a longer sequence to read from) before continuing. + /// + public bool TryReadMapHeader(out int count) + { + count = -1; + if (!this.reader.TryRead(out byte code)) + { + return false; + } + + switch (code) + { + case MessagePackCode.Map16: + if (!this.reader.TryReadBigEndian(out short shortValue)) + { + return false; + } + + count = unchecked((ushort)shortValue); + break; + case MessagePackCode.Map32: + if (!this.reader.TryReadBigEndian(out int intValue)) + { + return false; + } + + count = intValue; + break; + default: + if (code >= MessagePackCode.MinFixMap && code <= MessagePackCode.MaxFixMap) + { + count = (byte)(code & 0xF); + break; + } + + throw ThrowInvalidCode(code); + } + + return true; + } + + /// + /// Reads a boolean value from either a or . + /// + /// The value. + public bool ReadBoolean() + { + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte code)); + switch (code) + { + case MessagePackCode.True: + return true; + case MessagePackCode.False: + return false; + default: + throw ThrowInvalidCode(code); + } + } + + /// + /// Reads a from any of: + /// , + /// , + /// or anything between and . + /// + /// A character. + public char ReadChar() => (char)this.ReadUInt16(); + + /// + /// Reads an value from any value encoded with: + /// , + /// , + /// , + /// , + /// , + /// , + /// , + /// , + /// , + /// or some value between and , + /// or some value between and . + /// + /// The value. + public unsafe float ReadSingle() + { + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte code)); + + switch (code) + { + case MessagePackCode.Float32: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out float floatValue)); + return floatValue; + case MessagePackCode.Float64: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out double doubleValue)); + return (float)doubleValue; + case MessagePackCode.Int8: + ThrowInsufficientBufferUnless(this.reader.TryRead(out sbyte sbyteValue)); + return sbyteValue; + case MessagePackCode.Int16: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out short shortValue)); + return shortValue; + case MessagePackCode.Int32: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out int intValue)); + return intValue; + case MessagePackCode.Int64: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out long longValue)); + return longValue; + case MessagePackCode.UInt8: + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte byteValue)); + return byteValue; + case MessagePackCode.UInt16: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ushort ushortValue)); + return ushortValue; + case MessagePackCode.UInt32: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out uint uintValue)); + return uintValue; + case MessagePackCode.UInt64: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ulong ulongValue)); + return ulongValue; + default: + if (code >= MessagePackCode.MinNegativeFixInt && code <= MessagePackCode.MaxNegativeFixInt) + { + return unchecked((sbyte)code); + } + else if (code >= MessagePackCode.MinFixInt && code <= MessagePackCode.MaxFixInt) + { + return code; + } + + throw ThrowInvalidCode(code); + } + } + + /// + /// Reads an value from any value encoded with: + /// , + /// , + /// , + /// , + /// , + /// , + /// , + /// , + /// , + /// , + /// or some value between and , + /// or some value between and . + /// + /// The value. + public unsafe double ReadDouble() + { + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte code)); + + switch (code) + { + case MessagePackCode.Float64: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out double doubleValue)); + return doubleValue; + case MessagePackCode.Float32: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out float floatValue)); + return floatValue; + case MessagePackCode.Int8: + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte byteValue)); + return unchecked((sbyte)byteValue); + case MessagePackCode.Int16: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out short shortValue)); + return shortValue; + case MessagePackCode.Int32: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out int intValue)); + return intValue; + case MessagePackCode.Int64: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out long longValue)); + return longValue; + case MessagePackCode.UInt8: + ThrowInsufficientBufferUnless(this.reader.TryRead(out byteValue)); + return byteValue; + case MessagePackCode.UInt16: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out shortValue)); + return unchecked((ushort)shortValue); + case MessagePackCode.UInt32: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out intValue)); + return unchecked((uint)intValue); + case MessagePackCode.UInt64: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out longValue)); + return unchecked((ulong)longValue); + default: + if (code >= MessagePackCode.MinNegativeFixInt && code <= MessagePackCode.MaxNegativeFixInt) + { + return unchecked((sbyte)code); + } + else if (code >= MessagePackCode.MinFixInt && code <= MessagePackCode.MaxFixInt) + { + return code; + } + + throw ThrowInvalidCode(code); + } + } + + /// + /// Reads a from a value encoded with + /// , + /// , or + /// . + /// Expects extension type code . + /// + /// The value. + public DateTime ReadDateTime() => this.ReadDateTime(this.ReadExtensionFormatHeader()); + + /// + /// Reads a from a value encoded with + /// , + /// , + /// . + /// Expects extension type code . + /// + /// The extension header that was already read. + /// The value. + public DateTime ReadDateTime(ExtensionHeader header) + { + if (header.TypeCode != ReservedMessagePackExtensionTypeCode.DateTime) + { + throw new MessagePackSerializationException(string.Format("Extension TypeCode is invalid. typeCode: {0}", header.TypeCode)); + } + + switch (header.Length) + { + case 4: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out int intValue)); + return DateTimeConstants.UnixEpoch.AddSeconds(unchecked((uint)intValue)); + case 8: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out long longValue)); + ulong ulongValue = unchecked((ulong)longValue); + long nanoseconds = (long)(ulongValue >> 34); + ulong seconds = ulongValue & 0x00000003ffffffffL; + return DateTimeConstants.UnixEpoch.AddSeconds(seconds).AddTicks(nanoseconds / DateTimeConstants.NanosecondsPerTick); + case 12: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out intValue)); + nanoseconds = unchecked((uint)intValue); + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out longValue)); + return DateTimeConstants.UnixEpoch.AddSeconds(longValue).AddTicks(nanoseconds / DateTimeConstants.NanosecondsPerTick); + default: + throw new MessagePackSerializationException($"Length of extension was {header.Length}. Either 4 or 8 were expected."); + } + } + + /// + /// Reads a span of bytes, whose length is determined by a header of one of these types: + /// , + /// , + /// , + /// or to support OldSpec compatibility: + /// , + /// , + /// or something beteween and . + /// + /// + /// A sequence of bytes, or null if the read token is . + /// The data is a slice from the original sequence passed to this reader's constructor. + /// + public ReadOnlySequence? ReadBytes() + { + if (this.TryReadNil()) + { + return null; + } + + int length = this.GetBytesLength(); + ThrowInsufficientBufferUnless(this.reader.Remaining >= length); + ReadOnlySequence result = this.reader.Sequence.Slice(this.reader.Position, length); + this.reader.Advance(length); + return result; + } + + /// + /// Reads a string of bytes, whose length is determined by a header of one of these types: + /// , + /// , + /// , + /// or a code between and . + /// + /// + /// The sequence of bytes, or null if the read token is . + /// The data is a slice from the original sequence passed to this reader's constructor. + /// + public ReadOnlySequence? ReadStringSequence() + { + if (this.TryReadNil()) + { + return null; + } + + int length = this.GetStringLengthInBytes(); + ThrowInsufficientBufferUnless(this.reader.Remaining >= length); + ReadOnlySequence result = this.reader.Sequence.Slice(this.reader.Position, length); + this.reader.Advance(length); + return result; + } + + /// + /// Reads a string of bytes, whose length is determined by a header of one of these types: + /// , + /// , + /// , + /// or a code between and . + /// + /// Receives the span to the string. + /// + /// true if the string is contiguous in memory such that it could be set as a single span. + /// false if the read token is or the string is not in a contiguous span. + /// + /// + /// Callers should generally be prepared for a false result and failover to calling + /// which can represent a null result and handle strings that are not contiguous in memory. + /// + public bool TryReadStringSpan(out ReadOnlySpan span) + { + if (this.IsNil) + { + span = default; + return false; + } + + long oldPosition = this.reader.Consumed; + int length = this.GetStringLengthInBytes(); + ThrowInsufficientBufferUnless(this.reader.Remaining >= length); + + if (this.reader.CurrentSpanIndex + length <= this.reader.CurrentSpan.Length) + { + span = this.reader.CurrentSpan.Slice(this.reader.CurrentSpanIndex, length); + this.reader.Advance(length); + return true; + } + else + { + this.reader.Rewind(this.reader.Consumed - oldPosition); + span = default; + return false; + } + } + + /// + /// Reads a string, whose length is determined by a header of one of these types: + /// , + /// , + /// , + /// or a code between and . + /// + /// A string, or null if the current msgpack token is . + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public string ReadString() + { + if (this.TryReadNil()) + { + return null; + } + + int byteLength = this.GetStringLengthInBytes(); + + ReadOnlySpan unreadSpan = this.reader.UnreadSpan; + //UnityEngine.Debug.Log(reader.CurrentSpan[0]); + //UnityEngine.Debug.Log(unreadSpan[0]); + if (unreadSpan.Length >= byteLength) + { + // Fast path: all bytes to decode appear in the same span. + string value = StringEncoding.UTF8.GetString(unreadSpan.Slice(0, byteLength)); + this.reader.Advance(byteLength); + return value; + } + else + { + return this.ReadStringSlow(byteLength); + } + } + + /// + /// Reads an extension format header, based on one of these codes: + /// , + /// , + /// , + /// , + /// , + /// , + /// , or + /// . + /// + /// The extension header. + /// + /// Thrown if the header cannot be read in the bytes left in the + /// or if it is clear that there are insufficient bytes remaining after the header to include all the bytes the header claims to be there. + /// + /// Thrown if a code other than an extension format header is encountered. + public ExtensionHeader ReadExtensionFormatHeader() + { + ThrowInsufficientBufferUnless(this.TryReadExtensionFormatHeader(out ExtensionHeader header)); + + // Protect against corrupted or mischievious data that may lead to allocating way too much memory. + ThrowInsufficientBufferUnless(this.reader.Remaining >= header.Length); + + return header; + } + + /// + /// Reads an extension format header, based on one of these codes: + /// , + /// , + /// , + /// , + /// , + /// , + /// , or + /// + /// if there is sufficient buffer to read it. + /// + /// Receives the extension header if the remaining bytes in the fully describe the header. + /// The number of key=value pairs in the map. + /// Thrown if a code other than an extension format header is encountered. + /// + /// When this method returns false the position of the reader is left in an undefined position. + /// The caller is expected to recreate the reader (presumably with a longer sequence to read from) before continuing. + /// + public bool TryReadExtensionFormatHeader(out ExtensionHeader extensionHeader) + { + extensionHeader = default; + if (!this.reader.TryRead(out byte code)) + { + return false; + } + + uint length; + switch (code) + { + case MessagePackCode.FixExt1: + length = 1; + break; + case MessagePackCode.FixExt2: + length = 2; + break; + case MessagePackCode.FixExt4: + length = 4; + break; + case MessagePackCode.FixExt8: + length = 8; + break; + case MessagePackCode.FixExt16: + length = 16; + break; + case MessagePackCode.Ext8: + if (!this.reader.TryRead(out byte byteLength)) + { + return false; + } + + length = byteLength; + break; + case MessagePackCode.Ext16: + if (!this.reader.TryReadBigEndian(out short shortLength)) + { + return false; + } + + length = unchecked((ushort)shortLength); + break; + case MessagePackCode.Ext32: + if (!this.reader.TryReadBigEndian(out int intLength)) + { + return false; + } + + length = unchecked((uint)intLength); + break; + default: + throw ThrowInvalidCode(code); + } + + if (!this.reader.TryRead(out byte typeCode)) + { + return false; + } + + extensionHeader = new ExtensionHeader(unchecked((sbyte)typeCode), length); + return true; + } + + /// + /// Reads an extension format header and data, based on one of these codes: + /// , + /// , + /// , + /// , + /// , + /// , + /// , or + /// . + /// + /// + /// The extension format. + /// The data is a slice from the original sequence passed to this reader's constructor. + /// + public ExtensionResult ReadExtensionFormat() + { + ExtensionHeader header = this.ReadExtensionFormatHeader(); + try + { + ReadOnlySequence data = this.reader.Sequence.Slice(this.reader.Position, header.Length); + this.reader.Advance(header.Length); + return new ExtensionResult(header.TypeCode, data); + } + catch (ArgumentOutOfRangeException ex) + { + throw ThrowNotEnoughBytesException(ex); + } + } + + /// + /// Throws an exception indicating that there aren't enough bytes remaining in the buffer to store + /// the promised data. + /// + private static EndOfStreamException ThrowNotEnoughBytesException() => throw new EndOfStreamException(); + + /// + /// Throws an exception indicating that there aren't enough bytes remaining in the buffer to store + /// the promised data. + /// + private static EndOfStreamException ThrowNotEnoughBytesException(Exception innerException) => throw new EndOfStreamException(new EndOfStreamException().Message, innerException); + + /// + /// Throws an explaining an unexpected code was encountered. + /// + /// The code that was encountered. + /// Nothing. This method always throws. + private static Exception ThrowInvalidCode(byte code) + { + throw new MessagePackSerializationException(string.Format("Unexpected msgpack code {0} ({1}) encountered.", code, MessagePackCode.ToFormatName(code))); + } + + /// + /// Throws if a condition is false. + /// + /// A boolean value. + /// Thrown if is false. + private static void ThrowInsufficientBufferUnless(bool condition) + { + if (!condition) + { + ThrowNotEnoughBytesException(); + } + } + + private int GetBytesLength() + { + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte code)); + + // In OldSpec mode, Bin didn't exist, so Str was used. Str8 didn't exist either. + int length; + switch (code) + { + case MessagePackCode.Bin8: + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte byteLength)); + length = byteLength; + break; + case MessagePackCode.Bin16: + case MessagePackCode.Str16: // OldSpec compatibility + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out short shortLength)); + length = unchecked((ushort)shortLength); + break; + case MessagePackCode.Bin32: + case MessagePackCode.Str32: // OldSpec compatibility + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out length)); + break; + default: + // OldSpec compatibility + if (code >= MessagePackCode.MinFixStr && code <= MessagePackCode.MaxFixStr) + { + length = code & 0x1F; + break; + } + + throw ThrowInvalidCode(code); + } + + return length; + } + + /// + /// Gets the length of the next string. + /// + /// The length of the next string. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private int GetStringLengthInBytes() + { + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte code)); + + if (code >= MessagePackCode.MinFixStr && code <= MessagePackCode.MaxFixStr) + { + return code & 0x1F; + } + + return this.GetStringLengthInBytesSlow(code); + } + + private int GetStringLengthInBytesSlow(byte code) + { + switch (code) + { + case MessagePackCode.Str8: + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte byteValue)); + return byteValue; + case MessagePackCode.Str16: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out short shortValue)); + return unchecked((ushort)shortValue); + case MessagePackCode.Str32: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out int intValue)); + return intValue; + default: + if (code >= MessagePackCode.MinFixStr && code <= MessagePackCode.MaxFixStr) + { + return code & 0x1F; + } + + throw ThrowInvalidCode(code); + } + } + + /// + /// Reads a string assuming that it is spread across multiple spans in the . + /// + /// The length of the string to be decoded, in bytes. + /// The decoded string. + private string ReadStringSlow(int byteLength) + { + ThrowInsufficientBufferUnless(this.reader.Remaining >= byteLength); + + // We need to decode bytes incrementally across multiple spans. + int maxCharLength = StringEncoding.UTF8.GetMaxCharCount(byteLength); + char[] charArray = ArrayPool.Shared.Rent(maxCharLength); + System.Text.Decoder decoder = StringEncoding.UTF8.GetDecoder(); + + int remainingByteLength = byteLength; + int initializedChars = 0; + while (remainingByteLength > 0) + { + int bytesRead = Math.Min(remainingByteLength, this.reader.UnreadSpan.Length); + remainingByteLength -= bytesRead; + bool flush = remainingByteLength == 0; +#if NETCOREAPP2_1 + initializedChars += decoder.GetChars(this.reader.UnreadSpan.Slice(0, bytesRead), charArray.AsSpan(initializedChars), flush); +#else + unsafe + { + fixed (byte* pUnreadSpan = this.reader.UnreadSpan) + fixed (char* pCharArray = &charArray[initializedChars]) + { + initializedChars += decoder.GetChars(pUnreadSpan, bytesRead, pCharArray, charArray.Length - initializedChars, flush); + } + } +#endif + this.reader.Advance(bytesRead); + } + + string value = new string(charArray, 0, initializedChars); + ArrayPool.Shared.Return(charArray); + return value; + } + + private bool TrySkipNextArray() => this.TryReadArrayHeader(out int count) && this.TrySkip(count); + + private bool TrySkipNextMap() => this.TryReadMapHeader(out int count) && this.TrySkip(count * 2); + + private bool TrySkip(int count) + { + for (int i = 0; i < count; i++) + { + if (!this.TrySkip()) + { + return false; + } + } + + return true; + } + } +} diff --git a/Assets/Scripts/MessagePack/MessagePackReader.cs.meta b/Assets/Scripts/MessagePack/MessagePackReader.cs.meta new file mode 100644 index 000000000..b74580f0a --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePackReader.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 83f0995886fa5ea1fab77523785e1982 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/MessagePackSecurity.cs b/Assets/Scripts/MessagePack/MessagePackSecurity.cs new file mode 100644 index 000000000..c362f9157 --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePackSecurity.cs @@ -0,0 +1,417 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Runtime.ExceptionServices; +using MessagePack.Formatters; +using MessagePack.Internal; + +namespace MessagePack +{ + /// + /// Settings related to security, particularly relevant when deserializing data from untrusted sources. + /// + public class MessagePackSecurity + { + /// + /// Gets an instance preconfigured with settings that omit all protections. Useful for deserializing fully-trusted and valid msgpack sequences. + /// + public static readonly MessagePackSecurity TrustedData = new MessagePackSecurity(); + + /// + /// Gets an instance preconfigured with protections applied with reasonable settings for deserializing untrusted msgpack sequences. + /// + public static readonly MessagePackSecurity UntrustedData = new MessagePackSecurity + { + HashCollisionResistant = true, + MaximumObjectGraphDepth = 500, + }; + + private readonly ObjectFallbackEqualityComparer objectFallbackEqualityComparer; + + private MessagePackSecurity() + { + this.objectFallbackEqualityComparer = new ObjectFallbackEqualityComparer(this); + } + + /// + /// Initializes a new instance of the class + /// with properties copied from a provided template. + /// + /// The template to copy from. + protected MessagePackSecurity(MessagePackSecurity copyFrom) + : this() + { + if (copyFrom is null) + { + throw new ArgumentNullException(nameof(copyFrom)); + } + + this.HashCollisionResistant = copyFrom.HashCollisionResistant; + this.MaximumObjectGraphDepth = copyFrom.MaximumObjectGraphDepth; + } + + /// + /// Gets a value indicating whether data to be deserialized is untrusted and thus should not be allowed to create + /// dictionaries or other hash-based collections unless the hashed type has a hash collision resistant implementation available. + /// This can mitigate some denial of service attacks when deserializing untrusted code. + /// + /// + /// The value is false for and true for . + /// + public bool HashCollisionResistant { get; private set; } + + /// + /// Gets the maximum depth of an object graph that may be deserialized. + /// + /// + /// + /// This value can be reduced to avoid a stack overflow that would crash the process when deserializing a msgpack sequence designed to cause deep recursion. + /// A very short callstack on a thread with 1MB of total stack space might deserialize ~2000 nested arrays before crashing due to a stack overflow. + /// Since stack space occupied may vary by the kind of object deserialized, a conservative value for this property to defend against stack overflow attacks might be 500. + /// + /// + public int MaximumObjectGraphDepth { get; private set; } = int.MaxValue; + + /// + /// Gets a copy of these options with the property set to a new value. + /// + /// The new value for the property. + /// The new instance; or the original if the value is unchanged. + public MessagePackSecurity WithMaximumObjectGraphDepth(int maximumObjectGraphDepth) + { + if (this.MaximumObjectGraphDepth == maximumObjectGraphDepth) + { + return this; + } + + var clone = this.Clone(); + clone.MaximumObjectGraphDepth = maximumObjectGraphDepth; + return clone; + } + + /// + /// Gets a copy of these options with the property set to a new value. + /// + /// The new value for the property. + /// The new instance; or the original if the value is unchanged. + public MessagePackSecurity WithHashCollisionResistant(bool hashCollisionResistant) + { + if (this.HashCollisionResistant == hashCollisionResistant) + { + return this; + } + + var clone = this.Clone(); + clone.HashCollisionResistant = hashCollisionResistant; + return clone; + } + + /// + /// Gets an that is suitable to use with a hash-based collection. + /// + /// The type of key that will be hashed in the collection. + /// The to use. + /// + /// When is active, this will be a collision resistant instance which may reject certain key types. + /// When is not active, this will be . + /// + public IEqualityComparer GetEqualityComparer() + { + return this.HashCollisionResistant ? GetHashCollisionResistantEqualityComparer() : EqualityComparer.Default; + } + + /// + /// Gets an that is suitable to use with a hash-based collection. + /// + /// The to use. + /// + /// When is active, this will be a collision resistant instance which may reject certain key types. + /// When is not active, this will be . + /// + public IEqualityComparer GetEqualityComparer() + { + return this.HashCollisionResistant ? GetHashCollisionResistantEqualityComparer() : EqualityComparer.Default; + } + + /// + /// Returns a hash collision resistant equality comparer. + /// + /// The type of key that will be hashed in the collection. + /// A hash collision resistant equality comparer. + protected virtual IEqualityComparer GetHashCollisionResistantEqualityComparer() + { + IEqualityComparer result = null; + if (typeof(T).GetTypeInfo().IsEnum) + { + Type underlyingType = typeof(T).GetTypeInfo().GetEnumUnderlyingType(); + result = + underlyingType == typeof(sbyte) ? CollisionResistantHasher.Instance : + underlyingType == typeof(byte) ? CollisionResistantHasher.Instance : + underlyingType == typeof(short) ? CollisionResistantHasher.Instance : + underlyingType == typeof(ushort) ? CollisionResistantHasher.Instance : + underlyingType == typeof(int) ? CollisionResistantHasher.Instance : + underlyingType == typeof(uint) ? CollisionResistantHasher.Instance : + null; + } + else + { + // For anything 32-bits and under, our fallback base secure hasher is usually adequate since it makes the hash unpredictable. + // We should have special implementations for any value that is larger than 32-bits in order to make sure + // that all the data gets hashed securely rather than trivially and predictably compressed into 32-bits before being hashed. + // We also have to specially handle some 32-bit types (e.g. float) where multiple in-memory representations should hash to the same value. + // Any type supported by the PrimitiveObjectFormatter should be added here if supporting it as a key in a collection makes sense. + result = + // 32-bits or smaller: + typeof(T) == typeof(bool) ? CollisionResistantHasher.Instance : + typeof(T) == typeof(char) ? CollisionResistantHasher.Instance : + typeof(T) == typeof(sbyte) ? CollisionResistantHasher.Instance : + typeof(T) == typeof(byte) ? CollisionResistantHasher.Instance : + typeof(T) == typeof(short) ? CollisionResistantHasher.Instance : + typeof(T) == typeof(ushort) ? CollisionResistantHasher.Instance : + typeof(T) == typeof(int) ? CollisionResistantHasher.Instance : + typeof(T) == typeof(uint) ? CollisionResistantHasher.Instance : + + // Larger than 32-bits (or otherwise require special handling): + typeof(T) == typeof(long) ? (IEqualityComparer)Int64EqualityComparer.Instance : + typeof(T) == typeof(ulong) ? (IEqualityComparer)UInt64EqualityComparer.Instance : + typeof(T) == typeof(float) ? (IEqualityComparer)SingleEqualityComparer.Instance : + typeof(T) == typeof(double) ? (IEqualityComparer)DoubleEqualityComparer.Instance : + typeof(T) == typeof(string) ? (IEqualityComparer)StringEqualityComparer.Instance : + typeof(T) == typeof(Guid) ? (IEqualityComparer)GuidEqualityComparer.Instance : + typeof(T) == typeof(DateTime) ? (IEqualityComparer)DateTimeEqualityComparer.Instance : + typeof(T) == typeof(DateTimeOffset) ? (IEqualityComparer)DateTimeOffsetEqualityComparer.Instance : + typeof(T) == typeof(object) ? (IEqualityComparer)this.objectFallbackEqualityComparer : + null; + } + + // Any type we don't explicitly whitelist here shouldn't be allowed to use as the key in a hash-based collection since it isn't known to be hash resistant. + // This method can of course be overridden to add more hash collision resistant type support, or the deserializing party can indicate that the data is Trusted + // so that this method doesn't even get called. + return result ?? throw new TypeAccessException($"No hash-resistant equality comparer available for type: {typeof(T)}"); + } + + /// + /// Checks the depth of the deserializing graph and increments it by 1. + /// + /// The reader that is involved in deserialization. + /// + /// Callers should decrement after exiting that edge in the graph. + /// + /// Thrown if is already at or exceeds . + /// + /// Rather than wrap the body of every method, + /// this should wrap *calls* to these methods. They need not appear in pure "thunk" methods that simply delegate the deserialization to another formatter. + /// In this way, we can avoid repeatedly incrementing and decrementing the counter when deserializing each element of a collection. + /// + public void DepthStep(ref MessagePackReader reader) + { + if (reader.Depth >= this.MaximumObjectGraphDepth) + { + throw new InsufficientExecutionStackException($"This msgpack sequence has an object graph that exceeds the maximum depth allowed of {MaximumObjectGraphDepth}."); + } + + reader.Depth++; + } + + /// + /// Returns a hash collision resistant equality comparer. + /// + /// A hash collision resistant equality comparer. + protected virtual IEqualityComparer GetHashCollisionResistantEqualityComparer() => (IEqualityComparer)this.GetHashCollisionResistantEqualityComparer(); + + /// + /// Creates a new instance that is a copy of this one. + /// + /// + /// Derived types should override this method to instantiate their own derived type. + /// + protected virtual MessagePackSecurity Clone() => new MessagePackSecurity(this); + + /// + /// A hash collision resistant implementation of . + /// + /// The type of key that will be hashed. + private class CollisionResistantHasher : IEqualityComparer, IEqualityComparer + { + internal static readonly CollisionResistantHasher Instance = new CollisionResistantHasher(); + + public bool Equals(T x, T y) => EqualityComparer.Default.Equals(x, y); + + bool IEqualityComparer.Equals(object x, object y) => ((IEqualityComparer)EqualityComparer.Default).Equals(x, y); + + public int GetHashCode(object obj) => this.GetHashCode((T)obj); + + public virtual int GetHashCode(T value) => HashCode.Combine(value); + } + + /// + /// A special hash-resistent equality comparer that defers picking the actual implementation + /// till it can check the runtime type of each value to be hashed. + /// + private class ObjectFallbackEqualityComparer : IEqualityComparer, IEqualityComparer + { + private static readonly MethodInfo GetHashCollisionResistantEqualityComparerOpenGenericMethod = typeof(MessagePackSecurity).GetTypeInfo().DeclaredMethods.Single(m => m.Name == nameof(MessagePackSecurity.GetHashCollisionResistantEqualityComparer) && m.IsGenericMethod); + private readonly MessagePackSecurity security; + private readonly ThreadsafeTypeKeyHashTable equalityComparerCache = new ThreadsafeTypeKeyHashTable(); + + internal ObjectFallbackEqualityComparer(MessagePackSecurity security) + { + this.security = security ?? throw new ArgumentNullException(nameof(security)); + } + + bool IEqualityComparer.Equals(object x, object y) => EqualityComparer.Default.Equals(x, y); + + bool IEqualityComparer.Equals(object x, object y) => ((IEqualityComparer)EqualityComparer.Default).Equals(x, y); + + public int GetHashCode(object value) + { + if (value is null) + { + return 0; + } + + Type valueType = value.GetType(); + + // Take care to avoid recursion. + if (valueType == typeof(object)) + { + // We can trust object.GetHashCode() to be collision resistant. + return value.GetHashCode(); + } + + if (!equalityComparerCache.TryGetValue(valueType, out IEqualityComparer equalityComparer)) + { + try + { + equalityComparer = (IEqualityComparer)GetHashCollisionResistantEqualityComparerOpenGenericMethod.MakeGenericMethod(valueType).Invoke(this.security, Array.Empty()); + } + catch (TargetInvocationException ex) + { + ExceptionDispatchInfo.Capture(ex.InnerException).Throw(); + } + + equalityComparerCache.TryAdd(valueType, equalityComparer); + } + + return equalityComparer.GetHashCode(value); + } + } + + private class UInt64EqualityComparer : CollisionResistantHasher + { + internal static new readonly UInt64EqualityComparer Instance = new UInt64EqualityComparer(); + + public override int GetHashCode(ulong value) => HashCode.Combine((uint)(value >> 32), unchecked((uint)value)); + } + + private class Int64EqualityComparer : CollisionResistantHasher + { + internal static new readonly Int64EqualityComparer Instance = new Int64EqualityComparer(); + + public override int GetHashCode(long value) => HashCode.Combine((int)(value >> 32), unchecked((int)value)); + } + + private class SingleEqualityComparer : CollisionResistantHasher + { + internal static new readonly SingleEqualityComparer Instance = new SingleEqualityComparer(); + + public override unsafe int GetHashCode(float value) + { + // Special check for 0.0 so that the hash of 0.0 and -0.0 will equal. + if (value == 0.0f) + { + return HashCode.Combine(0); + } + + // Standardize on the binary representation of NaN prior to hashing. + if (float.IsNaN(value)) + { + value = float.NaN; + } + + long l = *(long*)&value; + return HashCode.Combine((int)(l >> 32), unchecked((int)l)); + } + } + + private class DoubleEqualityComparer : CollisionResistantHasher + { + internal static new readonly DoubleEqualityComparer Instance = new DoubleEqualityComparer(); + + public override unsafe int GetHashCode(double value) + { + // Special check for 0.0 so that the hash of 0.0 and -0.0 will equal. + if (value == 0.0) + { + return HashCode.Combine(0); + } + + // Standardize on the binary representation of NaN prior to hashing. + if (double.IsNaN(value)) + { + value = double.NaN; + } + + long l = *(long*)&value; + return HashCode.Combine((int)(l >> 32), unchecked((int)l)); + } + } + + private class GuidEqualityComparer : CollisionResistantHasher + { + internal static new readonly GuidEqualityComparer Instance = new GuidEqualityComparer(); + + public override unsafe int GetHashCode(Guid value) + { + var hash = default(HashCode); + int* pGuid = (int*)&value; + for (int i = 0; i < sizeof(Guid) / sizeof(int); i++) + { + hash.Add(pGuid[i]); + } + + return hash.ToHashCode(); + } + } + + private class StringEqualityComparer : CollisionResistantHasher + { + internal static new readonly StringEqualityComparer Instance = new StringEqualityComparer(); + + public override int GetHashCode(string value) + { +#if NETCOREAPP + // .NET Core already has a secure string hashing function. Just use it. + return value?.GetHashCode() ?? 0; +#else + var hash = default(HashCode); + for (int i = 0; i < value.Length; i++) + { + hash.Add(value[i]); + } + + return hash.ToHashCode(); +#endif + } + } + + private class DateTimeEqualityComparer : CollisionResistantHasher + { + internal static new readonly DateTimeEqualityComparer Instance = new DateTimeEqualityComparer(); + + public override unsafe int GetHashCode(DateTime value) => HashCode.Combine((int)(value.Ticks >> 32), unchecked((int)value.Ticks), value.Kind); + } + + private class DateTimeOffsetEqualityComparer : CollisionResistantHasher + { + internal static new readonly DateTimeOffsetEqualityComparer Instance = new DateTimeOffsetEqualityComparer(); + + public override unsafe int GetHashCode(DateTimeOffset value) => HashCode.Combine((int)(value.UtcTicks >> 32), unchecked((int)value.UtcTicks)); + } + } +} diff --git a/Assets/Scripts/MessagePack/MessagePackSecurity.cs.meta b/Assets/Scripts/MessagePack/MessagePackSecurity.cs.meta new file mode 100644 index 000000000..f7011bbe4 --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePackSecurity.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 26fcc356242b5925cb5329bd41e488c7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/MessagePackSerializationException.cs b/Assets/Scripts/MessagePack/MessagePackSerializationException.cs new file mode 100644 index 000000000..85aa1ef7e --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePackSerializationException.cs @@ -0,0 +1,57 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; + +namespace MessagePack +{ + /// + /// An exception thrown during serializing an object graph or deserializing a messagepack sequence. + /// + [Serializable] +#if MESSAGEPACK_INTERNAL + internal +#else + public +#endif + class MessagePackSerializationException : Exception + { + /// + /// Initializes a new instance of the class. + /// + public MessagePackSerializationException() + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The exception message. + public MessagePackSerializationException(string message) + : base(message) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The exception message. + /// The inner exception. + public MessagePackSerializationException(string message, Exception inner) + : base(message, inner) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Serialization info. + /// Serialization context. + protected MessagePackSerializationException( + System.Runtime.Serialization.SerializationInfo info, + System.Runtime.Serialization.StreamingContext context) + : base(info, context) + { + } + } +} diff --git a/Assets/Scripts/MessagePack/MessagePackSerializationException.cs.meta b/Assets/Scripts/MessagePack/MessagePackSerializationException.cs.meta new file mode 100644 index 000000000..995f0e36d --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePackSerializationException.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 839dc4ff13364b00e8d85ca4c6293047 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/MessagePackSerializer.Json.cs b/Assets/Scripts/MessagePack/MessagePackSerializer.Json.cs new file mode 100644 index 000000000..091e2a950 --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePackSerializer.Json.cs @@ -0,0 +1,497 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; +using System.Globalization; +using System.IO; +using System.Text; +using System.Threading; +using MessagePack.Formatters; +using Nerdbank.Streams; + +namespace MessagePack +{ + // JSON API + public partial class MessagePackSerializer + { + /// + /// Serialize an object to JSON string. + /// + /// Thrown if an error occurs during serialization. + public static void SerializeToJson(TextWriter textWriter, T obj, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) + { + using (var sequenceRental = SequencePool.Shared.Rent()) + { + var msgpackWriter = new MessagePackWriter(sequenceRental.Value) + { + CancellationToken = cancellationToken, + }; + Serialize(ref msgpackWriter, obj, options); + msgpackWriter.Flush(); + var msgpackReader = new MessagePackReader(sequenceRental.Value) + { + CancellationToken = cancellationToken, + }; + ConvertToJson(ref msgpackReader, textWriter, options); + } + } + + /// + /// Serialize an object to JSON string. + /// + /// Thrown if an error occurs during serialization. + public static string SerializeToJson(T obj, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) + { + var writer = new StringWriter(); + SerializeToJson(writer, obj, options, cancellationToken); + return writer.ToString(); + } + + /// + /// Convert a message-pack binary to a JSON string. + /// + /// Thrown if an error occurs while reading the messagepack data or writing out the JSON. + public static string ConvertToJson(ReadOnlyMemory bytes, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) => ConvertToJson(new ReadOnlySequence(bytes), options, cancellationToken); + + /// + /// Convert a message-pack binary to a JSON string. + /// + /// Thrown if an error occurs while reading the messagepack data or writing out the JSON. + public static string ConvertToJson(in ReadOnlySequence bytes, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) + { + var jsonWriter = new StringWriter(); + var reader = new MessagePackReader(bytes) + { + CancellationToken = cancellationToken, + }; + ConvertToJson(ref reader, jsonWriter, options); + return jsonWriter.ToString(); + } + + /// + /// Convert a message-pack binary to a JSON string. + /// + /// Thrown if an error occurs while reading the messagepack data or writing out the JSON. + public static void ConvertToJson(ref MessagePackReader reader, TextWriter jsonWriter, MessagePackSerializerOptions options = null) + { + if (reader.End) + { + return; + } + + options = options ?? DefaultOptions; + try + { + if (options.Compression.IsCompression()) + { + using (var scratchRental = SequencePool.Shared.Rent()) + { + if (TryDecompress(ref reader, scratchRental.Value)) + { + var scratchReader = new MessagePackReader(scratchRental.Value) + { + CancellationToken = reader.CancellationToken, + }; + if (scratchReader.End) + { + return; + } + + ToJsonCore(ref scratchReader, jsonWriter, options); + } + else + { + ToJsonCore(ref reader, jsonWriter, options); + } + } + } + else + { + ToJsonCore(ref reader, jsonWriter, options); + } + } + catch (Exception ex) + { + throw new MessagePackSerializationException("Error occurred while translating msgpack to JSON.", ex); + } + } + + /// + /// Translates the given JSON to MessagePack. + /// + public static void ConvertFromJson(string str, ref MessagePackWriter writer, MessagePackSerializerOptions options = null) + { + using (var sr = new StringReader(str)) + { + ConvertFromJson(sr, ref writer, options); + } + } + + /// + /// Translates the given JSON to MessagePack. + /// + public static byte[] ConvertFromJson(string str, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) + { + using (var scratchRental = SequencePool.Shared.Rent()) + { + var writer = new MessagePackWriter(scratchRental.Value) + { + CancellationToken = cancellationToken, + }; + using (var sr = new StringReader(str)) + { + ConvertFromJson(sr, ref writer, options); + } + + writer.Flush(); + return scratchRental.Value.AsReadOnlySequence.ToArray(); + } + } + + /// + /// Translates the given JSON to MessagePack. + /// + public static void ConvertFromJson(TextReader reader, ref MessagePackWriter writer, MessagePackSerializerOptions options = null) + { + options = options ?? DefaultOptions; + if (options.Compression.IsCompression()) + { + using (var scratchRental = SequencePool.Shared.Rent()) + { + MessagePackWriter scratchWriter = writer.Clone(scratchRental.Value); + using (var jr = new TinyJsonReader(reader, false)) + { + FromJsonCore(jr, ref scratchWriter); + } + + scratchWriter.Flush(); + ToLZ4BinaryCore(scratchRental.Value, ref writer, options.Compression); + } + } + else + { + using (var jr = new TinyJsonReader(reader, false)) + { + FromJsonCore(jr, ref writer); + } + } + } + + private static uint FromJsonCore(TinyJsonReader jr, ref MessagePackWriter writer) + { + uint count = 0; + while (jr.Read()) + { + switch (jr.TokenType) + { + case TinyJsonToken.None: + break; + case TinyJsonToken.StartObject: + // Set up a scratch area to serialize the collection since we don't know its length yet, which must be written first. + using (var scratchRental = SequencePool.Shared.Rent()) + { + MessagePackWriter scratchWriter = writer.Clone(scratchRental.Value); + var mapCount = FromJsonCore(jr, ref scratchWriter); + scratchWriter.Flush(); + + mapCount = mapCount / 2; // remove propertyname string count. + writer.WriteMapHeader(mapCount); + writer.WriteRaw(scratchRental.Value); + } + + count++; + break; + case TinyJsonToken.EndObject: + return count; // break + case TinyJsonToken.StartArray: + // Set up a scratch area to serialize the collection since we don't know its length yet, which must be written first. + using (var scratchRental = SequencePool.Shared.Rent()) + { + MessagePackWriter scratchWriter = writer.Clone(scratchRental.Value); + var arrayCount = FromJsonCore(jr, ref scratchWriter); + scratchWriter.Flush(); + + writer.WriteArrayHeader(arrayCount); + writer.WriteRaw(scratchRental.Value); + } + + count++; + break; + case TinyJsonToken.EndArray: + return count; // break + case TinyJsonToken.Number: + ValueType v = jr.ValueType; + if (v == ValueType.Double) + { + writer.Write(jr.DoubleValue); + } + else if (v == ValueType.Long) + { + writer.Write(jr.LongValue); + } + else if (v == ValueType.ULong) + { + writer.Write(jr.ULongValue); + } + else if (v == ValueType.Decimal) + { + DecimalFormatter.Instance.Serialize(ref writer, jr.DecimalValue, null); + } + + count++; + break; + case TinyJsonToken.String: + writer.Write(jr.StringValue); + count++; + break; + case TinyJsonToken.True: + writer.Write(true); + count++; + break; + case TinyJsonToken.False: + writer.Write(false); + count++; + break; + case TinyJsonToken.Null: + writer.WriteNil(); + count++; + break; + default: + break; + } + } + + return count; + } + + private static void ToJsonCore(ref MessagePackReader reader, TextWriter writer, MessagePackSerializerOptions options) + { + MessagePackType type = reader.NextMessagePackType; + switch (type) + { + case MessagePackType.Integer: + if (MessagePackCode.IsSignedInteger(reader.NextCode)) + { + writer.Write(reader.ReadInt64().ToString(CultureInfo.InvariantCulture)); + } + else + { + writer.Write(reader.ReadUInt64().ToString(CultureInfo.InvariantCulture)); + } + + break; + case MessagePackType.Boolean: + writer.Write(reader.ReadBoolean() ? "true" : "false"); + break; + case MessagePackType.Float: + if (reader.NextCode == MessagePackCode.Float32) + { + writer.Write(reader.ReadSingle().ToString(CultureInfo.InvariantCulture)); + } + else + { + writer.Write(reader.ReadDouble().ToString(CultureInfo.InvariantCulture)); + } + + break; + case MessagePackType.String: + WriteJsonString(reader.ReadString(), writer); + break; + case MessagePackType.Binary: + ArraySegment segment = ByteArraySegmentFormatter.Instance.Deserialize(ref reader, DefaultOptions); + writer.Write("\"" + Convert.ToBase64String(segment.Array, segment.Offset, segment.Count) + "\""); + break; + case MessagePackType.Array: + { + int length = reader.ReadArrayHeader(); + options.Security.DepthStep(ref reader); + try + { + writer.Write("["); + for (int i = 0; i < length; i++) + { + ToJsonCore(ref reader, writer, options); + + if (i != length - 1) + { + writer.Write(","); + } + } + + writer.Write("]"); + } + finally + { + reader.Depth--; + } + + return; + } + + case MessagePackType.Map: + { + int length = reader.ReadMapHeader(); + options.Security.DepthStep(ref reader); + try + { + writer.Write("{"); + for (int i = 0; i < length; i++) + { + // write key + { + MessagePackType keyType = reader.NextMessagePackType; + if (keyType == MessagePackType.String || keyType == MessagePackType.Binary) + { + ToJsonCore(ref reader, writer, options); + } + else + { + writer.Write("\""); + ToJsonCore(ref reader, writer, options); + writer.Write("\""); + } + } + + writer.Write(":"); + + // write body + { + ToJsonCore(ref reader, writer, options); + } + + if (i != length - 1) + { + writer.Write(","); + } + } + + writer.Write("}"); + } + finally + { + reader.Depth--; + } + + return; + } + + case MessagePackType.Extension: + ExtensionHeader extHeader = reader.ReadExtensionFormatHeader(); + if (extHeader.TypeCode == ReservedMessagePackExtensionTypeCode.DateTime) + { + DateTime dt = reader.ReadDateTime(extHeader); + writer.Write("\""); + writer.Write(dt.ToString("o", CultureInfo.InvariantCulture)); + writer.Write("\""); + } +#if !UNITY_2018_3_OR_NEWER + else if (extHeader.TypeCode == ThisLibraryExtensionTypeCodes.TypelessFormatter) + { + // prepare type name token + var privateBuilder = new StringBuilder(); + var typeNameTokenBuilder = new StringBuilder(); + SequencePosition positionBeforeTypeNameRead = reader.Position; + ToJsonCore(ref reader, new StringWriter(typeNameTokenBuilder), options); + int typeNameReadSize = (int)reader.Sequence.Slice(positionBeforeTypeNameRead, reader.Position).Length; + if (extHeader.Length > typeNameReadSize) + { + // object map or array + MessagePackType typeInside = reader.NextMessagePackType; + if (typeInside != MessagePackType.Array && typeInside != MessagePackType.Map) + { + privateBuilder.Append("{"); + } + + ToJsonCore(ref reader, new StringWriter(privateBuilder), options); + + // insert type name token to start of object map or array + if (typeInside != MessagePackType.Array) + { + typeNameTokenBuilder.Insert(0, "\"$type\":"); + } + + if (typeInside != MessagePackType.Array && typeInside != MessagePackType.Map) + { + privateBuilder.Append("}"); + } + + if (privateBuilder.Length > 2) + { + typeNameTokenBuilder.Append(","); + } + + privateBuilder.Insert(1, typeNameTokenBuilder.ToString()); + + writer.Write(privateBuilder.ToString()); + } + else + { + writer.Write("{\"$type\":\"" + typeNameTokenBuilder.ToString() + "}"); + } + } +#endif + else + { + var data = reader.ReadRaw((long)extHeader.Length); + writer.Write("["); + writer.Write(extHeader.TypeCode); + writer.Write(","); + writer.Write("\""); + writer.Write(Convert.ToBase64String(data.ToArray())); + writer.Write("\""); + writer.Write("]"); + } + + break; + case MessagePackType.Nil: + reader.Skip(); + writer.Write("null"); + break; + default: + throw new MessagePackSerializationException($"code is invalid. code: {reader.NextCode} format: {MessagePackCode.ToFormatName(reader.NextCode)}"); + } + } + + // escape string + private static void WriteJsonString(string value, TextWriter builder) + { + builder.Write('\"'); + + var len = value.Length; + for (int i = 0; i < len; i++) + { + var c = value[i]; + switch (c) + { + case '"': + builder.Write("\\\""); + break; + case '\\': + builder.Write("\\\\"); + break; + case '\b': + builder.Write("\\b"); + break; + case '\f': + builder.Write("\\f"); + break; + case '\n': + builder.Write("\\n"); + break; + case '\r': + builder.Write("\\r"); + break; + case '\t': + builder.Write("\\t"); + break; + default: + builder.Write(c); + break; + } + } + + builder.Write('\"'); + } + } +} diff --git a/Assets/Scripts/MessagePack/MessagePackSerializer.Json.cs.meta b/Assets/Scripts/MessagePack/MessagePackSerializer.Json.cs.meta new file mode 100644 index 000000000..ab90bbf74 --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePackSerializer.Json.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dc00f1de4bb511e45840cd820c364204 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/MessagePackSerializer.NonGeneric.cs b/Assets/Scripts/MessagePack/MessagePackSerializer.NonGeneric.cs new file mode 100644 index 000000000..7302567c7 --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePackSerializer.NonGeneric.cs @@ -0,0 +1,321 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; +using System.IO; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using System.Threading; +using System.Threading.Tasks; + +namespace MessagePack +{ + public partial class MessagePackSerializer + { + private static readonly Func CreateCompiledMethods; + private static readonly MessagePack.Internal.ThreadsafeTypeKeyHashTable Serializes = new MessagePack.Internal.ThreadsafeTypeKeyHashTable(capacity: 64); + + static MessagePackSerializer() + { + CreateCompiledMethods = t => new CompiledMethods(t); + } + + /// + public static void Serialize(Type type, ref MessagePackWriter writer, object obj, MessagePackSerializerOptions options = null) + { + GetOrAdd(type).Serialize_MessagePackWriter_T_Options.Invoke(ref writer, obj, options); + } + + /// + public static void Serialize(Type type, IBufferWriter writer, object obj, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) + { + GetOrAdd(type).Serialize_IBufferWriter_T_Options_CancellationToken.Invoke(writer, obj, options, cancellationToken); + } + + /// + public static byte[] Serialize(Type type, object obj, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) + { + return GetOrAdd(type).Serialize_T_Options.Invoke(obj, options, cancellationToken); + } + + /// + public static void Serialize(Type type, Stream stream, object obj, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) + { + GetOrAdd(type).Serialize_Stream_T_Options_CancellationToken.Invoke(stream, obj, options, cancellationToken); + } + + /// + public static Task SerializeAsync(Type type, Stream stream, object obj, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) + { + return GetOrAdd(type).SerializeAsync_Stream_T_Options_CancellationToken.Invoke(stream, obj, options, cancellationToken); + } + + /// + public static object Deserialize(Type type, ref MessagePackReader reader, MessagePackSerializerOptions options = null) + { + return GetOrAdd(type).Deserialize_MessagePackReader_Options.Invoke(ref reader, options); + } + + /// + public static object Deserialize(Type type, Stream stream, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) + { + return GetOrAdd(type).Deserialize_Stream_Options_CancellationToken.Invoke(stream, options, cancellationToken); + } + + /// + public static ValueTask DeserializeAsync(Type type, Stream stream, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) + { + return GetOrAdd(type).DeserializeAsync_Stream_Options_CancellationToken.Invoke(stream, options, cancellationToken); + } + + /// + public static object Deserialize(Type type, ReadOnlyMemory bytes, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) + { + return GetOrAdd(type).Deserialize_ReadOnlyMemory_Options.Invoke(bytes, options, cancellationToken); + } + + /// + public static object Deserialize(Type type, ReadOnlySequence bytes, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) + { + return GetOrAdd(type).Deserialize_ReadOnlySequence_Options_CancellationToken.Invoke(bytes, options, cancellationToken); + } + + private static async ValueTask DeserializeObjectAsync(Stream stream, MessagePackSerializerOptions options, CancellationToken cancellationToken) => await DeserializeAsync(stream, options, cancellationToken).ConfigureAwait(false); + + private static CompiledMethods GetOrAdd(Type type) + { + return Serializes.GetOrAdd(type, CreateCompiledMethods); + } + + private class CompiledMethods + { + internal delegate void MessagePackWriterSerialize(ref MessagePackWriter writer, object value, MessagePackSerializerOptions options); + + internal delegate object MessagePackReaderDeserialize(ref MessagePackReader reader, MessagePackSerializerOptions options); + +#pragma warning disable SA1310 // Field names should not contain underscore +#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter +#pragma warning disable SA1401 // Fields should be private + internal readonly Func Serialize_T_Options; + internal readonly Action Serialize_Stream_T_Options_CancellationToken; + internal readonly Func SerializeAsync_Stream_T_Options_CancellationToken; + internal readonly MessagePackWriterSerialize Serialize_MessagePackWriter_T_Options; + internal readonly Action, object, MessagePackSerializerOptions, CancellationToken> Serialize_IBufferWriter_T_Options_CancellationToken; + + internal readonly MessagePackReaderDeserialize Deserialize_MessagePackReader_Options; + internal readonly Func Deserialize_Stream_Options_CancellationToken; + internal readonly Func> DeserializeAsync_Stream_Options_CancellationToken; + + internal readonly Func, MessagePackSerializerOptions, CancellationToken, object> Deserialize_ReadOnlyMemory_Options; + internal readonly Func, MessagePackSerializerOptions, CancellationToken, object> Deserialize_ReadOnlySequence_Options_CancellationToken; +#pragma warning restore SA1401 // Fields should be private +#pragma warning restore SA1307 // Accessible fields should begin with upper-case letter +#pragma warning restore SA1310 // Field names should not contain underscore + + internal CompiledMethods(Type type) + { + TypeInfo ti = type.GetTypeInfo(); + { + // public static byte[] Serialize(T obj, MessagePackSerializerOptions options, CancellationToken cancellationToken) + MethodInfo serialize = GetMethod(nameof(Serialize), type, new Type[] { null, typeof(MessagePackSerializerOptions), typeof(CancellationToken) }); + + ParameterExpression param1 = Expression.Parameter(typeof(object), "obj"); + ParameterExpression param2 = Expression.Parameter(typeof(MessagePackSerializerOptions), "options"); + ParameterExpression param3 = Expression.Parameter(typeof(CancellationToken), "cancellationToken"); + + MethodCallExpression body = Expression.Call( + null, + serialize, + ti.IsValueType ? Expression.Unbox(param1, type) : Expression.Convert(param1, type), + param2, + param3); + Func lambda = Expression.Lambda>(body, param1, param2, param3).Compile(); + + this.Serialize_T_Options = lambda; + } + + { + // public static void Serialize(Stream stream, T obj, MessagePackSerializerOptions options, CancellationToken cancellationToken) + MethodInfo serialize = GetMethod(nameof(Serialize), type, new Type[] { typeof(Stream), null, typeof(MessagePackSerializerOptions), typeof(CancellationToken) }); + + ParameterExpression param1 = Expression.Parameter(typeof(Stream), "stream"); + ParameterExpression param2 = Expression.Parameter(typeof(object), "obj"); + ParameterExpression param3 = Expression.Parameter(typeof(MessagePackSerializerOptions), "options"); + ParameterExpression param4 = Expression.Parameter(typeof(CancellationToken), "cancellationToken"); + + MethodCallExpression body = Expression.Call( + null, + serialize, + param1, + ti.IsValueType ? Expression.Unbox(param2, type) : Expression.Convert(param2, type), + param3, + param4); + Action lambda = Expression.Lambda>(body, param1, param2, param3, param4).Compile(); + + this.Serialize_Stream_T_Options_CancellationToken = lambda; + } + + { + // public static Task SerializeAsync(Stream stream, T obj, MessagePackSerializerOptions options, CancellationToken cancellationToken) + MethodInfo serialize = GetMethod(nameof(SerializeAsync), type, new Type[] { typeof(Stream), null, typeof(MessagePackSerializerOptions), typeof(CancellationToken) }); + + ParameterExpression param1 = Expression.Parameter(typeof(Stream), "stream"); + ParameterExpression param2 = Expression.Parameter(typeof(object), "obj"); + ParameterExpression param3 = Expression.Parameter(typeof(MessagePackSerializerOptions), "options"); + ParameterExpression param4 = Expression.Parameter(typeof(CancellationToken), "cancellationToken"); + + MethodCallExpression body = Expression.Call( + null, + serialize, + param1, + ti.IsValueType ? Expression.Unbox(param2, type) : Expression.Convert(param2, type), + param3, + param4); + Func lambda = Expression.Lambda>(body, param1, param2, param3, param4).Compile(); + + this.SerializeAsync_Stream_T_Options_CancellationToken = lambda; + } + + { + // public static Task Serialize(IBufferWriter writer, T obj, MessagePackSerializerOptions options, CancellationToken cancellationToken) + MethodInfo serialize = GetMethod(nameof(Serialize), type, new Type[] { typeof(IBufferWriter), null, typeof(MessagePackSerializerOptions), typeof(CancellationToken) }); + + ParameterExpression param1 = Expression.Parameter(typeof(IBufferWriter), "writer"); + ParameterExpression param2 = Expression.Parameter(typeof(object), "obj"); + ParameterExpression param3 = Expression.Parameter(typeof(MessagePackSerializerOptions), "options"); + ParameterExpression param4 = Expression.Parameter(typeof(CancellationToken), "cancellationToken"); + + MethodCallExpression body = Expression.Call( + null, + serialize, + param1, + ti.IsValueType ? Expression.Unbox(param2, type) : Expression.Convert(param2, type), + param3, + param4); + Action, object, MessagePackSerializerOptions, CancellationToken> lambda = Expression.Lambda, object, MessagePackSerializerOptions, CancellationToken>>(body, param1, param2, param3, param4).Compile(); + + this.Serialize_IBufferWriter_T_Options_CancellationToken = lambda; + } + + { + // public static void Serialize(ref MessagePackWriter writer, T obj, MessagePackSerializerOptions options) + MethodInfo serialize = GetMethod(nameof(Serialize), type, new Type[] { typeof(MessagePackWriter).MakeByRefType(), null, typeof(MessagePackSerializerOptions) }); + + ParameterExpression param1 = Expression.Parameter(typeof(MessagePackWriter).MakeByRefType(), "writer"); + ParameterExpression param2 = Expression.Parameter(typeof(object), "obj"); + ParameterExpression param3 = Expression.Parameter(typeof(MessagePackSerializerOptions), "options"); + + MethodCallExpression body = Expression.Call( + null, + serialize, + param1, + ti.IsValueType ? Expression.Unbox(param2, type) : Expression.Convert(param2, type), + param3); + MessagePackWriterSerialize lambda = Expression.Lambda(body, param1, param2, param3).Compile(); + + this.Serialize_MessagePackWriter_T_Options = lambda; + } + + { + // public static T Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + MethodInfo deserialize = GetMethod(nameof(Deserialize), type, new Type[] { typeof(MessagePackReader).MakeByRefType(), typeof(MessagePackSerializerOptions) }); + + ParameterExpression param1 = Expression.Parameter(typeof(MessagePackReader).MakeByRefType(), "reader"); + ParameterExpression param2 = Expression.Parameter(typeof(MessagePackSerializerOptions), "options"); + UnaryExpression body = Expression.Convert(Expression.Call(null, deserialize, param1, param2), typeof(object)); + MessagePackReaderDeserialize lambda = Expression.Lambda(body, param1, param2).Compile(); + + this.Deserialize_MessagePackReader_Options = lambda; + } + + { + // public static T Deserialize(Stream stream, MessagePackSerializerOptions options, CancellationToken cancellationToken) + MethodInfo deserialize = GetMethod(nameof(Deserialize), type, new Type[] { typeof(Stream), typeof(MessagePackSerializerOptions), typeof(CancellationToken) }); + + ParameterExpression param1 = Expression.Parameter(typeof(Stream), "stream"); + ParameterExpression param2 = Expression.Parameter(typeof(MessagePackSerializerOptions), "options"); + ParameterExpression param3 = Expression.Parameter(typeof(CancellationToken), "cancellationToken"); + UnaryExpression body = Expression.Convert(Expression.Call(null, deserialize, param1, param2, param3), typeof(object)); + Func lambda = Expression.Lambda>(body, param1, param2, param3).Compile(); + + this.Deserialize_Stream_Options_CancellationToken = lambda; + } + + { + // public static ValueTask DeserializeObjectAsync(Stream stream, MessagePackSerializerOptions options, CancellationToken cancellationToken) + MethodInfo deserialize = GetMethod(nameof(DeserializeObjectAsync), type, new Type[] { typeof(Stream), typeof(MessagePackSerializerOptions), typeof(CancellationToken) }); + + ParameterExpression param1 = Expression.Parameter(typeof(Stream), "stream"); + ParameterExpression param2 = Expression.Parameter(typeof(MessagePackSerializerOptions), "options"); + ParameterExpression param3 = Expression.Parameter(typeof(CancellationToken), "cancellationToken"); + UnaryExpression body = Expression.Convert(Expression.Call(null, deserialize, param1, param2, param3), typeof(ValueTask)); + Func> lambda = Expression.Lambda>>(body, param1, param2, param3).Compile(); + + this.DeserializeAsync_Stream_Options_CancellationToken = lambda; + } + + { + // public static T Deserialize(ReadOnlyMemory bytes, MessagePackSerializerOptions options, CancellationToken cancellationToken) + MethodInfo deserialize = GetMethod(nameof(Deserialize), type, new Type[] { typeof(ReadOnlyMemory), typeof(MessagePackSerializerOptions), typeof(CancellationToken) }); + + ParameterExpression param1 = Expression.Parameter(typeof(ReadOnlyMemory), "bytes"); + ParameterExpression param2 = Expression.Parameter(typeof(MessagePackSerializerOptions), "options"); + ParameterExpression param3 = Expression.Parameter(typeof(CancellationToken), "cancellationToken"); + UnaryExpression body = Expression.Convert(Expression.Call(null, deserialize, param1, param2, param3), typeof(object)); + Func, MessagePackSerializerOptions, CancellationToken, object> lambda = Expression.Lambda, MessagePackSerializerOptions, CancellationToken, object>>(body, param1, param2, param3).Compile(); + + this.Deserialize_ReadOnlyMemory_Options = lambda; + } + + { + // public static T Deserialize(ReadOnlySequence bytes, MessagePackSerializerOptions options, CancellationToken cancellationToken) + MethodInfo deserialize = GetMethod(nameof(Deserialize), type, new Type[] { typeof(ReadOnlySequence).MakeByRefType(), typeof(MessagePackSerializerOptions), typeof(CancellationToken) }); + + ParameterExpression param1 = Expression.Parameter(typeof(ReadOnlySequence), "bytes"); + ParameterExpression param2 = Expression.Parameter(typeof(MessagePackSerializerOptions), "options"); + ParameterExpression param3 = Expression.Parameter(typeof(CancellationToken), "cancellationToken"); + UnaryExpression body = Expression.Convert(Expression.Call(null, deserialize, param1, param2, param3), typeof(object)); + Func, MessagePackSerializerOptions, CancellationToken, object> lambda = Expression.Lambda, MessagePackSerializerOptions, CancellationToken, object>>(body, param1, param2, param3).Compile(); + + this.Deserialize_ReadOnlySequence_Options_CancellationToken = lambda; + } + } + + // null is generic type marker. + private static MethodInfo GetMethod(string methodName, Type type, Type[] parameters) + { + return typeof(MessagePackSerializer).GetRuntimeMethods().Single(x => + { + if (methodName != x.Name) + { + return false; + } + + ParameterInfo[] ps = x.GetParameters(); + if (ps.Length != parameters.Length) + { + return false; + } + + for (int i = 0; i < ps.Length; i++) + { + if (parameters[i] == null && ps[i].ParameterType.IsGenericParameter) + { + continue; + } + + if (ps[i].ParameterType != parameters[i]) + { + return false; + } + } + + return true; + }) + .MakeGenericMethod(type); + } + } + } +} diff --git a/Assets/Scripts/MessagePack/MessagePackSerializer.NonGeneric.cs.meta b/Assets/Scripts/MessagePack/MessagePackSerializer.NonGeneric.cs.meta new file mode 100644 index 000000000..6c1d5e929 --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePackSerializer.NonGeneric.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 16a18255b8720219687e6195745bf4a3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/MessagePackSerializer.cs b/Assets/Scripts/MessagePack/MessagePackSerializer.cs new file mode 100644 index 000000000..0a4dbc0b9 --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePackSerializer.cs @@ -0,0 +1,670 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; +using System.Diagnostics; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using MessagePack.LZ4; +using Nerdbank.Streams; + +namespace MessagePack +{ + /// + /// High-Level API of MessagePack for C#. + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Each overload has sufficiently unique required parameters.")] + public static partial class MessagePackSerializer + { + private const int LZ4NotCompressionSizeInLz4BlockType = 64; + + /// + /// Gets or sets the default set of options to use when not explicitly specified for a method call. + /// + /// The default value is . + /// + /// This is an AppDomain or process-wide setting. + /// If you're writing a library, you should NOT set or rely on this property but should instead pass + /// in (or the required options) explicitly to every method call + /// to guarantee appropriate behavior in any application. + /// If you are an app author, realize that setting this property impacts the entire application so it should only be + /// set once, and before any use of occurs. + /// + public static MessagePackSerializerOptions DefaultOptions { get; set; } = MessagePackSerializerOptions.Standard; + + /// + /// A thread-local, recyclable array that may be used for short bursts of code. + /// + [ThreadStatic] + private static byte[] scratchArray; + + /// + /// Serializes a given value with the specified buffer writer. + /// + /// The buffer writer to serialize with. + /// The value to serialize. + /// The options. Use null to use default options. + /// A cancellation token. + /// Thrown when any error occurs during serialization. + public static void Serialize(IBufferWriter writer, T value, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) + { + var fastWriter = new MessagePackWriter(writer) + { + CancellationToken = cancellationToken, + }; + Serialize(ref fastWriter, value, options); + fastWriter.Flush(); + } + + /// + /// Serializes a given value with the specified buffer writer. + /// + /// The buffer writer to serialize with. + /// The value to serialize. + /// The options. Use null to use default options. + /// Thrown when any error occurs during serialization. + public static void Serialize(ref MessagePackWriter writer, T value, MessagePackSerializerOptions options = null) + { + options = options ?? DefaultOptions; + bool originalOldSpecValue = writer.OldSpec; + if (options.OldSpec.HasValue) + { + writer.OldSpec = options.OldSpec.Value; + } + + try + { + if (options.Compression.IsCompression() && !PrimitiveChecker.IsMessagePackFixedSizePrimitive) + { + using (var scratchRental = SequencePool.Shared.Rent()) + { + var scratch = scratchRental.Value; + MessagePackWriter scratchWriter = writer.Clone(scratch); + options.Resolver.GetFormatterWithVerify().Serialize(ref scratchWriter, value, options); + scratchWriter.Flush(); + ToLZ4BinaryCore(scratch, ref writer, options.Compression); + } + } + else + { + options.Resolver.GetFormatterWithVerify().Serialize(ref writer, value, options); + } + } + catch (Exception ex) + { + throw new MessagePackSerializationException($"Failed to serialize {typeof(T).FullName} value.", ex); + } + finally + { + writer.OldSpec = originalOldSpecValue; + } + } + + /// + /// Serializes a given value with the specified buffer writer. + /// + /// The value to serialize. + /// The options. Use null to use default options. + /// A cancellation token. + /// A byte array with the serialized value. + /// Thrown when any error occurs during serialization. + public static byte[] Serialize(T value, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) + { + byte[] array = scratchArray; + if (array == null) + { + scratchArray = array = new byte[65536]; + } + + var msgpackWriter = new MessagePackWriter(SequencePool.Shared, array) + { + CancellationToken = cancellationToken, + }; + Serialize(ref msgpackWriter, value, options); + return msgpackWriter.FlushAndGetArray(); + } + + /// + /// Serializes a given value to the specified stream. + /// + /// The stream to serialize to. + /// The value to serialize. + /// The options. Use null to use default options. + /// A cancellation token. + /// Thrown when any error occurs during serialization. + public static void Serialize(Stream stream, T value, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) + { + cancellationToken.ThrowIfCancellationRequested(); + using (SequencePool.Rental sequenceRental = SequencePool.Shared.Rent()) + { + Serialize(sequenceRental.Value, value, options, cancellationToken); + + try + { + foreach (ReadOnlyMemory segment in sequenceRental.Value.AsReadOnlySequence) + { + cancellationToken.ThrowIfCancellationRequested(); + stream.Write(segment.Span); + } + } + catch (Exception ex) + { + throw new MessagePackSerializationException("Error occurred while writing the serialized data to the stream.", ex); + } + } + } + + /// + /// Serializes a given value to the specified stream. + /// + /// The stream to serialize to. + /// The value to serialize. + /// The options. Use null to use default options. + /// A cancellation token. + /// A task that completes with the result of the async serialization operation. + /// Thrown when any error occurs during serialization. + public static async Task SerializeAsync(Stream stream, T value, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) + { + cancellationToken.ThrowIfCancellationRequested(); + using (SequencePool.Rental sequenceRental = SequencePool.Shared.Rent()) + { + Serialize(sequenceRental.Value, value, options, cancellationToken); + + try + { + foreach (ReadOnlyMemory segment in sequenceRental.Value.AsReadOnlySequence) + { + cancellationToken.ThrowIfCancellationRequested(); + await stream.WriteAsync(segment, cancellationToken).ConfigureAwait(false); + } + } + catch (Exception ex) + { + throw new MessagePackSerializationException("Error occurred while writing the serialized data to the stream.", ex); + } + } + } + + /// + /// Deserializes a value of a given type from a sequence of bytes. + /// + /// The type of value to deserialize. + /// The sequence to deserialize from. + /// The options. Use null to use default options. + /// A cancellation token. + /// The deserialized value. + /// Thrown when any error occurs during deserialization. + public static T Deserialize(in ReadOnlySequence byteSequence, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) + { + var reader = new MessagePackReader(byteSequence) + { + CancellationToken = cancellationToken, + }; + return Deserialize(ref reader, options); + } + + /// + /// Deserializes a value of a given type from a sequence of bytes. + /// + /// The type of value to deserialize. + /// The reader to deserialize from. + /// The options. Use null to use default options. + /// The deserialized value. + /// Thrown when any error occurs during deserialization. + public static T Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options = null) + { + options = options ?? DefaultOptions; + + try + { + if (options.Compression.IsCompression()) + { + using (var msgPackUncompressedRental = SequencePool.Shared.Rent()) + { + var msgPackUncompressed = msgPackUncompressedRental.Value; + if (TryDecompress(ref reader, msgPackUncompressed)) + { + MessagePackReader uncompressedReader = reader.Clone(msgPackUncompressed.AsReadOnlySequence); + return options.Resolver.GetFormatterWithVerify().Deserialize(ref uncompressedReader, options); + } + else + { + return options.Resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + } + } + } + else + { + return options.Resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + } + } + catch (Exception ex) + { + throw new MessagePackSerializationException($"Failed to deserialize {typeof(T).FullName} value.", ex); + } + } + + /// + /// Deserializes a value of a given type from a sequence of bytes. + /// + /// The type of value to deserialize. + /// The buffer to deserialize from. + /// The options. Use null to use default options. + /// A cancellation token. + /// The deserialized value. + /// Thrown when any error occurs during deserialization. + public static T Deserialize(ReadOnlyMemory buffer, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) + { + var reader = new MessagePackReader(buffer) + { + CancellationToken = cancellationToken, + }; + return Deserialize(ref reader, options); + } + + /// + /// Deserializes a value of a given type from a sequence of bytes. + /// + /// The type of value to deserialize. + /// The memory to deserialize from. + /// The number of bytes read. + /// A cancellation token. + /// The deserialized value. + /// Thrown when any error occurs during deserialization. + public static T Deserialize(ReadOnlyMemory buffer, out int bytesRead, CancellationToken cancellationToken = default) => Deserialize(buffer, options: null, out bytesRead, cancellationToken); + + /// + /// Deserializes a value of a given type from a sequence of bytes. + /// + /// The type of value to deserialize. + /// The memory to deserialize from. + /// The options. Use null to use default options. + /// The number of bytes read. + /// A cancellation token. + /// The deserialized value. + /// Thrown when any error occurs during deserialization. + public static T Deserialize(ReadOnlyMemory buffer, MessagePackSerializerOptions options, out int bytesRead, CancellationToken cancellationToken = default) + { + var reader = new MessagePackReader(buffer) + { + CancellationToken = cancellationToken, + }; + T result = Deserialize(ref reader, options); + bytesRead = buffer.Slice(0, (int)reader.Consumed).Length; + return result; + } + + /// + /// Deserializes the entire content of a . + /// + /// The type of value to deserialize. + /// + /// The stream to deserialize from. + /// The entire stream will be read, and the first msgpack token deserialized will be returned. + /// If is true on the stream, its position will be set to just after the last deserialized byte. + /// + /// The options. Use null to use default options. + /// A cancellation token. + /// The deserialized value. + /// Thrown when any error occurs during deserialization. + /// + /// If multiple top-level msgpack data structures are expected on the stream, use instead. + /// + public static T Deserialize(Stream stream, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) + { + if (TryDeserializeFromMemoryStream(stream, options, cancellationToken, out T result)) + { + return result; + } + + using (var sequenceRental = SequencePool.Shared.Rent()) + { + var sequence = sequenceRental.Value; + try + { + int bytesRead; + do + { + cancellationToken.ThrowIfCancellationRequested(); + Span span = sequence.GetSpan(stream.CanSeek ? (int)(stream.Length - stream.Position) : 0); + bytesRead = stream.Read(span); + sequence.Advance(bytesRead); + } + while (bytesRead > 0); + } + catch (Exception ex) + { + throw new MessagePackSerializationException("Error occurred while reading from the stream.", ex); + } + + return DeserializeFromSequenceAndRewindStreamIfPossible(stream, options, sequence, cancellationToken); + } + } + + /// + /// Deserializes the entire content of a . + /// + /// The type of value to deserialize. + /// + /// The stream to deserialize from. + /// The entire stream will be read, and the first msgpack token deserialized will be returned. + /// If is true on the stream, its position will be set to just after the last deserialized byte. + /// + /// The options. Use null to use default options. + /// A cancellation token. + /// The deserialized value. + /// Thrown when any error occurs during deserialization. + /// + /// If multiple top-level msgpack data structures are expected on the stream, use instead. + /// + public static async ValueTask DeserializeAsync(Stream stream, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default) + { + if (TryDeserializeFromMemoryStream(stream, options, cancellationToken, out T result)) + { + return result; + } + + using (var sequenceRental = SequencePool.Shared.Rent()) + { + var sequence = sequenceRental.Value; + try + { + int bytesRead; + do + { + Memory memory = sequence.GetMemory(stream.CanSeek ? (int)(stream.Length - stream.Position) : 0); + bytesRead = await stream.ReadAsync(memory, cancellationToken).ConfigureAwait(false); + sequence.Advance(bytesRead); + } + while (bytesRead > 0); + } + catch (Exception ex) + { + throw new MessagePackSerializationException("Error occurred while reading from the stream.", ex); + } + + return DeserializeFromSequenceAndRewindStreamIfPossible(stream, options, sequence, cancellationToken); + } + } + + private delegate int LZ4Transform(ReadOnlySpan input, Span output); + + private static readonly LZ4Transform LZ4CodecEncode = LZ4Codec.Encode; + private static readonly LZ4Transform LZ4CodecDecode = LZ4Codec.Decode; + + private static bool TryDeserializeFromMemoryStream(Stream stream, MessagePackSerializerOptions options, CancellationToken cancellationToken, out T result) + { + cancellationToken.ThrowIfCancellationRequested(); + if (stream is MemoryStream ms && ms.TryGetBuffer(out ArraySegment streamBuffer)) + { + result = Deserialize(streamBuffer.AsMemory(checked((int)ms.Position)), options, out int bytesRead, cancellationToken); + + // Emulate that we had actually "read" from the stream. + ms.Seek(bytesRead, SeekOrigin.Current); + return true; + } + + result = default; + return false; + } + + private static T DeserializeFromSequenceAndRewindStreamIfPossible(Stream streamToRewind, MessagePackSerializerOptions options, ReadOnlySequence sequence, CancellationToken cancellationToken) + { + if (streamToRewind is null) + { + throw new ArgumentNullException(nameof(streamToRewind)); + } + + var reader = new MessagePackReader(sequence) + { + CancellationToken = cancellationToken, + }; + T result = Deserialize(ref reader, options); + + if (streamToRewind.CanSeek && !reader.End) + { + // Reverse the stream as many bytes as we left unread. + int bytesNotRead = checked((int)reader.Sequence.Slice(reader.Position).Length); + streamToRewind.Seek(-bytesNotRead, SeekOrigin.Current); + } + + return result; + } + + /// + /// Performs LZ4 compression or decompression. + /// + /// The input for the operation. + /// The buffer to write the result of the operation. + /// The LZ4 codec transformation. + /// The number of bytes written to the . + private static int LZ4Operation(in ReadOnlySequence input, Span output, LZ4Transform lz4Operation) + { + ReadOnlySpan inputSpan; + byte[] rentedInputArray = null; + if (input.IsSingleSegment) + { + inputSpan = input.First.Span; + } + else + { + rentedInputArray = ArrayPool.Shared.Rent((int)input.Length); + input.CopyTo(rentedInputArray); + inputSpan = rentedInputArray.AsSpan(0, (int)input.Length); + } + + try + { + return lz4Operation(inputSpan, output); + } + finally + { + if (rentedInputArray != null) + { + ArrayPool.Shared.Return(rentedInputArray); + } + } + } + + private static bool TryDecompress(ref MessagePackReader reader, IBufferWriter writer) + { + if (!reader.End) + { + // Try to find LZ4Block + if (reader.NextMessagePackType == MessagePackType.Extension) + { + MessagePackReader peekReader = reader.CreatePeekReader(); + ExtensionHeader header = peekReader.ReadExtensionFormatHeader(); + if (header.TypeCode == ThisLibraryExtensionTypeCodes.Lz4Block) + { + // Read the extension using the original reader, so we "consume" it. + ExtensionResult extension = reader.ReadExtensionFormat(); + var extReader = new MessagePackReader(extension.Data); + + // The first part of the extension payload is a MessagePack-encoded Int32 that + // tells us the length the data will be AFTER decompression. + int uncompressedLength = extReader.ReadInt32(); + + // The rest of the payload is the compressed data itself. + ReadOnlySequence compressedData = extReader.Sequence.Slice(extReader.Position); + + Span uncompressedSpan = writer.GetSpan(uncompressedLength).Slice(0, uncompressedLength); + int actualUncompressedLength = LZ4Operation(compressedData, uncompressedSpan, LZ4CodecDecode); + Debug.Assert(actualUncompressedLength == uncompressedLength, "Unexpected length of uncompressed data."); + writer.Advance(actualUncompressedLength); + return true; + } + } + + // Try to find LZ4BlockArray + if (reader.NextMessagePackType == MessagePackType.Array) + { + MessagePackReader peekReader = reader.CreatePeekReader(); + var arrayLength = peekReader.ReadArrayHeader(); + if (arrayLength != 0 && peekReader.NextMessagePackType == MessagePackType.Extension) + { + ExtensionHeader header = peekReader.ReadExtensionFormatHeader(); + if (header.TypeCode == ThisLibraryExtensionTypeCodes.Lz4BlockArray) + { + // switch peekReader as original reader. + reader = peekReader; + + // Read from [Ext(98:int,int...), bin,bin,bin...] + var sequenceCount = arrayLength - 1; + var uncompressedLengths = ArrayPool.Shared.Rent(sequenceCount); + try + { + for (int i = 0; i < sequenceCount; i++) + { + uncompressedLengths[i] = reader.ReadInt32(); + } + + for (int i = 0; i < sequenceCount; i++) + { + var uncompressedLength = uncompressedLengths[i]; + var lz4Block = reader.ReadBytes(); + Span uncompressedSpan = writer.GetSpan(uncompressedLength).Slice(0, uncompressedLength); + var actualUncompressedLength = LZ4Operation(lz4Block.Value, uncompressedSpan, LZ4CodecDecode); + Debug.Assert(actualUncompressedLength == uncompressedLength, "Unexpected length of uncompressed data."); + writer.Advance(actualUncompressedLength); + } + + return true; + } + finally + { + ArrayPool.Shared.Return(uncompressedLengths); + } + } + } + } + } + + return false; + } + + private static void ToLZ4BinaryCore(in ReadOnlySequence msgpackUncompressedData, ref MessagePackWriter writer, MessagePackCompression compression) + { + if (compression == MessagePackCompression.Lz4Block) + { + if (msgpackUncompressedData.Length < LZ4NotCompressionSizeInLz4BlockType) + { + writer.WriteRaw(msgpackUncompressedData); + return; + } + + var maxCompressedLength = LZ4Codec.MaximumOutputLength((int)msgpackUncompressedData.Length); + var lz4Span = ArrayPool.Shared.Rent(maxCompressedLength); + try + { + int lz4Length = LZ4Operation(msgpackUncompressedData, lz4Span, LZ4CodecEncode); + + const int LengthOfUncompressedDataSizeHeader = 5; + writer.WriteExtensionFormatHeader(new ExtensionHeader(ThisLibraryExtensionTypeCodes.Lz4Block, LengthOfUncompressedDataSizeHeader + (uint)lz4Length)); + writer.WriteInt32((int)msgpackUncompressedData.Length); + writer.WriteRaw(lz4Span.AsSpan(0, lz4Length)); + } + finally + { + ArrayPool.Shared.Return(lz4Span); + } + } + else if (compression == MessagePackCompression.Lz4BlockArray) + { + // Write to [Ext(98:int,int...), bin,bin,bin...] + var sequenceCount = 0; + var extHeaderSize = 0; + foreach (var item in msgpackUncompressedData) + { + sequenceCount++; + extHeaderSize += GetUInt32WriteSize((uint)item.Length); + } + + writer.WriteArrayHeader(sequenceCount + 1); + writer.WriteExtensionFormatHeader(new ExtensionHeader(ThisLibraryExtensionTypeCodes.Lz4BlockArray, extHeaderSize)); + { + foreach (var item in msgpackUncompressedData) + { + writer.Write(item.Length); + } + } + + foreach (var item in msgpackUncompressedData) + { + var maxCompressedLength = LZ4Codec.MaximumOutputLength(item.Length); + var lz4Span = writer.GetSpan(maxCompressedLength + 5); + int lz4Length = LZ4Codec.Encode(item.Span, lz4Span.Slice(5, lz4Span.Length - 5)); + WriteBin32Header((uint)lz4Length, lz4Span); + writer.Advance(lz4Length + 5); + } + } + else + { + throw new ArgumentException("Invalid MessagePackCompression Code. Code:" + compression); + } + } + + private static int GetUInt32WriteSize(uint value) + { + if (value <= MessagePackRange.MaxFixPositiveInt) + { + return 1; + } + else if (value <= byte.MaxValue) + { + return 2; + } + else if (value <= ushort.MaxValue) + { + return 3; + } + else + { + return 5; + } + } + + private static void WriteBin32Header(uint value, Span span) + { + unchecked + { + span[0] = MessagePackCode.Bin32; + + // Write to highest index first so the JIT skips bounds checks on subsequent writes. + span[4] = (byte)value; + span[3] = (byte)(value >> 8); + span[2] = (byte)(value >> 16); + span[1] = (byte)(value >> 24); + } + } + + private static class PrimitiveChecker + { + public static readonly bool IsMessagePackFixedSizePrimitive; + + static PrimitiveChecker() + { + IsMessagePackFixedSizePrimitive = IsMessagePackFixedSizePrimitiveTypeHelper(typeof(T)); + } + } + + private static bool IsMessagePackFixedSizePrimitiveTypeHelper(Type type) + { + return type == typeof(short) + || type == typeof(int) + || type == typeof(long) + || type == typeof(ushort) + || type == typeof(uint) + || type == typeof(ulong) + || type == typeof(float) + || type == typeof(double) + || type == typeof(bool) + || type == typeof(byte) + || type == typeof(sbyte) + || type == typeof(char) + ; + } + } +} diff --git a/Assets/Scripts/MessagePack/MessagePackSerializer.cs.meta b/Assets/Scripts/MessagePack/MessagePackSerializer.cs.meta new file mode 100644 index 000000000..41bd3c47d --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePackSerializer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d7b51af2d7d3d2fb985dbe15e77b9461 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs b/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs new file mode 100644 index 000000000..a259c99ce --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs @@ -0,0 +1,284 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Collections.Generic; +using System.Text.RegularExpressions; + +namespace MessagePack +{ +#if !DYNAMICCODEDUMPER + /// + /// An immutable description of options for running the . + /// +#endif + public class MessagePackSerializerOptions + { + // see:http://msdn.microsoft.com/en-us/library/w3f99sx1.aspx + internal static readonly Regex AssemblyNameVersionSelectorRegex = new Regex(@", Version=\d+.\d+.\d+.\d+, Culture=[\w-]+, PublicKeyToken=(?:null|[a-f0-9]{16})$", RegexOptions.Compiled); + + /// + /// A collection of known dangerous types that are not expected in a typical MessagePack stream, + /// and thus are rejected by the default implementation of . + /// + private static readonly HashSet BlacklistCheck = new HashSet + { + "System.CodeDom.Compiler.TempFileCollection", + "System.Management.IWbemClassObjectFreeThreaded", + }; + +#if !DYNAMICCODEDUMPER + /// + /// Gets a good default set of options that uses the and no compression. + /// + public static MessagePackSerializerOptions Standard => MessagePackSerializerOptionsDefaultSettingsLazyInitializationHelper.Standard; +#endif + + /// + /// Initializes a new instance of the class. + /// + protected internal MessagePackSerializerOptions(IFormatterResolver resolver) + { + this.Resolver = resolver ?? throw new ArgumentNullException(nameof(resolver)); + } + + /// + /// Initializes a new instance of the class + /// with members initialized from an existing instance. + /// + /// The options to copy from. + protected MessagePackSerializerOptions(MessagePackSerializerOptions copyFrom) + { + if (copyFrom == null) + { + throw new ArgumentNullException(nameof(copyFrom)); + } + + this.Resolver = copyFrom.Resolver; + this.Compression = copyFrom.Compression; + this.OldSpec = copyFrom.OldSpec; + this.OmitAssemblyVersion = copyFrom.OmitAssemblyVersion; + this.AllowAssemblyVersionMismatch = copyFrom.AllowAssemblyVersionMismatch; + this.Security = copyFrom.Security; + } + + /// + /// Gets the resolver to use for complex types. + /// + /// An instance of . Never null. + /// Thrown if an attempt is made to set this property to null. + public IFormatterResolver Resolver { get; private set; } + + /// + /// Gets the compression scheme to apply to serialized sequences. + /// + /// + /// When set to something other than , + /// deserialization can still work on uncompressed sequences, + /// and serialization may not compress if msgpack sequences are short enough that compression would not likely be advantageous. + /// + public MessagePackCompression Compression { get; private set; } + + /// + /// Gets a value indicating whether to serialize with set to some value + /// causing messagepack spec compliance to be explicitly set to the old or new format. + /// + /// + /// A null value means the 's default or previous setting will be used. + /// A non-null value will be applied to the property for the duration of a + /// serialization and then reverted to its prior setting. + /// + /// + /// Reading always supports both new and old spec. + /// + public bool? OldSpec { get; private set; } + + /// + /// Gets a value indicating whether serialization should omit assembly version, culture and public key token metadata when using the typeless formatter. + /// + /// The default value is false. + public bool OmitAssemblyVersion { get; private set; } + + /// + /// Gets a value indicating whether deserialization may instantiate types from an assembly with a different version if a matching version cannot be found. + /// + /// The default value is false. + public bool AllowAssemblyVersionMismatch { get; private set; } + + /// + /// Gets the security-related options for deserializing messagepack sequences. + /// + /// + /// The default value is to use . + /// + public MessagePackSecurity Security { get; private set; } = MessagePackSecurity.TrustedData; + + /// + /// Gets a type given a string representation of the type. + /// + /// The name of the type to load. This is typically the but may use the assembly's simple name. + /// The loaded type or null if no matching type could be found. + public virtual Type LoadType(string typeName) + { + Type result = Type.GetType(typeName, false); + if (result == null && this.AllowAssemblyVersionMismatch) + { + string shortenedName = AssemblyNameVersionSelectorRegex.Replace(typeName, string.Empty); + if (shortenedName != typeName) + { + result = Type.GetType(shortenedName, false); + } + } + + return result; + } + + /// + /// Checks whether a given type may be deserialized. + /// + /// The type to be instantiated. + /// Thrown if the is not allowed to be deserialized. + /// + /// This method provides a means for an important security mitigation when using the Typeless formatter to prevent untrusted messagepack from + /// deserializing objects that may be harmful if instantiated, disposed or finalized. + /// The default implementation throws for only a few known dangerous types. + /// Applications that deserialize from untrusted sources should override this method and throw if the type is not among the expected set. + /// + public virtual void ThrowIfDeserializingTypeIsDisallowed(Type type) + { + if (BlacklistCheck.Contains(type.FullName)) + { + throw new MessagePackSerializationException("Deserialization attempted to create the type " + type.FullName + " which is not allowed."); + } + } + + /// + /// Gets a copy of these options with the property set to a new value. + /// + /// The new value for the . + /// The new instance; or the original if the value is unchanged. + public MessagePackSerializerOptions WithResolver(IFormatterResolver resolver) + { + if (this.Resolver == resolver) + { + return this; + } + + var result = this.Clone(); + result.Resolver = resolver; + return result; + } + + /// + /// Gets a copy of these options with the property set to a new value. + /// + /// The new value for the property. + /// The new instance; or the original if the value is unchanged. + public MessagePackSerializerOptions WithCompression(MessagePackCompression compression) + { + if (this.Compression == compression) + { + return this; + } + + var result = this.Clone(); + result.Compression = compression; + return result; + } + + /// + /// Gets a copy of these options with the property set to a new value. + /// + /// The new value for the . + /// The new instance; or the original if the value is unchanged. + public MessagePackSerializerOptions WithOldSpec(bool? oldSpec = true) + { + if (this.OldSpec == oldSpec) + { + return this; + } + + var result = this.Clone(); + result.OldSpec = oldSpec; + return result; + } + + /// + /// Gets a copy of these options with the property set to a new value. + /// + /// The new value for the property. + /// The new instance; or the original if the value is unchanged. + public MessagePackSerializerOptions WithOmitAssemblyVersion(bool omitAssemblyVersion) + { + if (this.OmitAssemblyVersion == omitAssemblyVersion) + { + return this; + } + + var result = this.Clone(); + result.OmitAssemblyVersion = omitAssemblyVersion; + return result; + } + + /// + /// Gets a copy of these options with the property set to a new value. + /// + /// The new value for the property. + /// The new instance; or the original if the value is unchanged. + public MessagePackSerializerOptions WithAllowAssemblyVersionMismatch(bool allowAssemblyVersionMismatch) + { + if (this.AllowAssemblyVersionMismatch == allowAssemblyVersionMismatch) + { + return this; + } + + var result = this.Clone(); + result.AllowAssemblyVersionMismatch = allowAssemblyVersionMismatch; + return result; + } + + /// + /// Gets a copy of these options with the property set to a new value. + /// + /// The new value for the property. + /// The new instance; or the original if the value is unchanged. + public MessagePackSerializerOptions WithSecurity(MessagePackSecurity security) + { + if (security is null) + { + throw new ArgumentNullException(nameof(security)); + } + + if (this.Security == security) + { + return this; + } + + var result = this.Clone(); + result.Security = security; + return result; + } + + /// + /// Creates a clone of this instance with the same properties set. + /// + /// The cloned instance. Guaranteed to be a new instance. + /// Thrown if this instance is a derived type that doesn't override this method. + protected virtual MessagePackSerializerOptions Clone() + { + if (this.GetType() != typeof(MessagePackSerializerOptions)) + { + throw new NotSupportedException($"The derived type {this.GetType().FullName} did not override the {nameof(Clone)} method as required."); + } + + return new MessagePackSerializerOptions(this); + } + +#if !DYNAMICCODEDUMPER + private static class MessagePackSerializerOptionsDefaultSettingsLazyInitializationHelper + { + public static readonly MessagePackSerializerOptions Standard = new MessagePackSerializerOptions(Resolvers.StandardResolver.Instance); + } +#endif + } +} diff --git a/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs.meta b/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs.meta new file mode 100644 index 000000000..86bd30ca6 --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePackSerializerOptions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 97c761333b96605e78fae4ae77707e1b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/MessagePackStreamReader.cs b/Assets/Scripts/MessagePack/MessagePackStreamReader.cs new file mode 100644 index 000000000..fb439ddc7 --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePackStreamReader.cs @@ -0,0 +1,179 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Nerdbank.Streams; + +namespace MessagePack +{ + /// + /// Reads one or more messagepack data structures from a . + /// + /// + /// This class is *not* thread-safe. Do not call more than one member at once and be sure any call completes (including asynchronous tasks) + /// before calling the next one. + /// + public partial class MessagePackStreamReader : IDisposable + { + private readonly Stream stream; + private readonly bool leaveOpen; + private SequencePool.Rental sequenceRental = SequencePool.Shared.Rent(); + private SequencePosition? endOfLastMessage; + + /// + /// Initializes a new instance of the class. + /// + /// The stream to read from. This stream will be disposed of when this is disposed. + public MessagePackStreamReader(Stream stream) + : this(stream, leaveOpen: false) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The stream to read from. + /// If true, leaves the stream open after this is disposed; otherwise, false. + public MessagePackStreamReader(Stream stream, bool leaveOpen) + { + this.stream = stream ?? throw new ArgumentNullException(nameof(stream)); + this.leaveOpen = leaveOpen; + } + + /// + /// Gets any bytes that have been read since the last complete message returned from . + /// + public ReadOnlySequence RemainingBytes => this.endOfLastMessage.HasValue ? this.ReadData.AsReadOnlySequence.Slice(this.endOfLastMessage.Value) : this.ReadData.AsReadOnlySequence; + + /// + /// Gets the sequence that we read data from the into. + /// + private Sequence ReadData => this.sequenceRental.Value; + + /// + /// Reads the next whole (top-level) messagepack data structure. + /// + /// A cancellation token. + /// + /// A task whose result is the next whole data structure from the stream, or null if the stream ends. + /// The returned sequence is valid until this is disposed or + /// until this method is called again, whichever comes first. + /// + /// + /// When null is the result of the returned task, + /// any extra bytes read (between the last complete message and the end of the stream) will be available via the property. + /// + public async ValueTask?> ReadAsync(CancellationToken cancellationToken) + { + this.RecycleLastMessage(); + + while (true) + { + // Check if we have a complete message and return it if we have it. + // We do this before reading anything since a previous read may have brought in several messages. + cancellationToken.ThrowIfCancellationRequested(); + if (this.TryReadNextMessage(out ReadOnlySequence completeMessage)) + { + return completeMessage; + } + + if (!await this.TryReadMoreDataAsync(cancellationToken).ConfigureAwait(false)) + { + // We've reached the end of the stream. + // We already checked for a complete message with what we already had, so evidently it's not a complete message. + return null; + } + } + } + + /// + /// Arranges for the next read operation to start by reading from the underlying + /// instead of any data buffered from a previous read. + /// + /// + /// This is appropriate if the underlying has been repositioned such that + /// any previously buffered data is no longer applicable to what the caller wants to read. + /// + public void DiscardBufferedData() + { + this.sequenceRental.Value.Reset(); + this.endOfLastMessage = default; + } + + /// + public void Dispose() + { + if (!this.leaveOpen) + { + this.stream.Dispose(); + } + + this.sequenceRental.Dispose(); + this.sequenceRental = default; + } + + /// + /// Recycle memory from a previously returned message. + /// + private void RecycleLastMessage() + { + if (this.endOfLastMessage.HasValue) + { + // A previously returned message can now be safely recycled since the caller wants more. + this.ReadData.AdvanceTo(this.endOfLastMessage.Value); + this.endOfLastMessage = null; + } + } + + /// + /// Read more data from the stream into the buffer. + /// + /// A cancellation token. + /// true if more data was read; false if the end of the stream had already been reached. + private async Task TryReadMoreDataAsync(CancellationToken cancellationToken) + { + cancellationToken.ThrowIfCancellationRequested(); + Memory buffer = this.ReadData.GetMemory(sizeHint: 0); + int bytesRead = 0; + try + { + bytesRead = await this.stream.ReadAsync(buffer, cancellationToken).ConfigureAwait(false); + return bytesRead > 0; + } + finally + { + // Keep our state clean in case the caller wants to call us again. + this.ReadData.Advance(bytesRead); + } + } + + /// + /// Checks whether the content in include a complete messagepack structure. + /// + /// Receives the sequence of the first complete data structure found, if any. + /// true if a complete data structure was found; false otherwise. + private bool TryReadNextMessage(out ReadOnlySequence completeMessage) + { + if (this.ReadData.Length > 0) + { + var reader = new MessagePackReader(this.ReadData); + + // Perf opportunity: instead of skipping from the start each time, we could incrementally skip across tries + // possibly as easy as simply keeping a count of how many tokens still need to be skipped (that we know about). + if (reader.TrySkip()) + { + this.endOfLastMessage = reader.Position; + completeMessage = reader.Sequence.Slice(0, reader.Position); + return true; + } + } + + completeMessage = default; + return false; + } + } +} diff --git a/Assets/Scripts/MessagePack/MessagePackStreamReader.cs.meta b/Assets/Scripts/MessagePack/MessagePackStreamReader.cs.meta new file mode 100644 index 000000000..cc25ca51a --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePackStreamReader.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 680529136fcef07e78156a87b5d33f1f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/MessagePackWriter.cs b/Assets/Scripts/MessagePack/MessagePackWriter.cs new file mode 100644 index 000000000..71296ed70 --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePackWriter.cs @@ -0,0 +1,1322 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; +using System.Collections.Generic; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading; +using MessagePack.Internal; +using Microsoft; + +namespace MessagePack +{ + /// + /// A primitive types writer for the MessagePack format. + /// + /// + /// The MessagePack spec.. + /// +#if MESSAGEPACK_INTERNAL + internal +#else + public +#endif + ref struct MessagePackWriter + { + /// + /// The writer to use. + /// + private BufferWriter writer; + + /// + /// Initializes a new instance of the struct. + /// + /// The writer to use. + public MessagePackWriter(IBufferWriter writer) + : this() + { + this.writer = new BufferWriter(writer); + this.OldSpec = false; + } + + /// + /// Initializes a new instance of the struct. + /// + /// The pool from which to draw an if required.. + /// An array to start with so we can avoid accessing the if possible. + internal MessagePackWriter(SequencePool sequencePool, byte[] array) + : this() + { + this.writer = new BufferWriter(sequencePool, array); + this.OldSpec = false; + } + + /// + /// Gets or sets the cancellation token for this serialization operation. + /// + public CancellationToken CancellationToken { get; set; } + + /// + /// Gets or sets a value indicating whether to write in old spec compatibility mode. + /// + public bool OldSpec { get; set; } + + /// + /// Initializes a new instance of the struct, + /// with the same settings as this one, but with its own buffer writer. + /// + /// The writer to use for the new instance. + /// The new writer. + public MessagePackWriter Clone(IBufferWriter writer) => new MessagePackWriter(writer) + { + OldSpec = this.OldSpec, + CancellationToken = this.CancellationToken, + }; + + /// + /// Ensures everything previously written has been flushed to the underlying . + /// + public void Flush() => this.writer.Commit(); + + /// + /// Writes a value. + /// + public void WriteNil() + { + Span span = this.writer.GetSpan(1); + span[0] = MessagePackCode.Nil; + this.writer.Advance(1); + } + + /// + /// Copies bytes directly into the message pack writer. + /// + /// The span of bytes to copy from. + public void WriteRaw(ReadOnlySpan rawMessagePackBlock) => this.writer.Write(rawMessagePackBlock); + + /// + /// Copies bytes directly into the message pack writer. + /// + /// The span of bytes to copy from. + public void WriteRaw(in ReadOnlySequence rawMessagePackBlock) + { + foreach (ReadOnlyMemory segment in rawMessagePackBlock) + { + this.writer.Write(segment.Span); + } + } + + /// + /// Write the length of the next array to be written in the most compact form of + /// , + /// , or + /// . + /// + /// The number of elements that will be written in the array. + public void WriteArrayHeader(int count) => this.WriteArrayHeader((uint)count); + + /// + /// Write the length of the next array to be written in the most compact form of + /// , + /// , or + /// . + /// + /// The number of elements that will be written in the array. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void WriteArrayHeader(uint count) + { + if (count <= MessagePackRange.MaxFixArrayCount) + { + Span span = this.writer.GetSpan(1); + span[0] = (byte)(MessagePackCode.MinFixArray | count); + this.writer.Advance(1); + } + else if (count <= ushort.MaxValue) + { + Span span = this.writer.GetSpan(3); + span[0] = MessagePackCode.Array16; + WriteBigEndian((ushort)count, span.Slice(1)); + this.writer.Advance(3); + } + else + { + Span span = this.writer.GetSpan(5); + span[0] = MessagePackCode.Array32; + WriteBigEndian(count, span.Slice(1)); + this.writer.Advance(5); + } + } + + /// + /// Write the length of the next map to be written in the most compact form of + /// , + /// , or + /// . + /// + /// The number of key=value pairs that will be written in the map. + public void WriteMapHeader(int count) => this.WriteMapHeader((uint)count); + + /// + /// Write the length of the next map to be written in the most compact form of + /// , + /// , or + /// . + /// + /// The number of key=value pairs that will be written in the map. + public void WriteMapHeader(uint count) + { + if (count <= MessagePackRange.MaxFixMapCount) + { + Span span = this.writer.GetSpan(1); + span[0] = (byte)(MessagePackCode.MinFixMap | count); + this.writer.Advance(1); + } + else if (count <= ushort.MaxValue) + { + Span span = this.writer.GetSpan(3); + span[0] = MessagePackCode.Map16; + WriteBigEndian((ushort)count, span.Slice(1)); + this.writer.Advance(3); + } + else + { + Span span = this.writer.GetSpan(5); + span[0] = MessagePackCode.Map32; + WriteBigEndian(count, span.Slice(1)); + this.writer.Advance(5); + } + } + + /// + /// Writes a value using a 1-byte code when possible, otherwise as . + /// + /// The value. + public void Write(byte value) + { + if (value <= MessagePackCode.MaxFixInt) + { + Span span = this.writer.GetSpan(1); + span[0] = value; + this.writer.Advance(1); + } + else + { + this.WriteUInt8(value); + } + } + + /// + /// Writes a value using . + /// + /// The value. + public void WriteUInt8(byte value) + { + Span span = this.writer.GetSpan(2); + span[0] = MessagePackCode.UInt8; + span[1] = value; + this.writer.Advance(2); + } + + /// + /// Writes an 8-bit value using a 1-byte code when possible, otherwise as . + /// + /// The value. + public void Write(sbyte value) + { + if (value < MessagePackRange.MinFixNegativeInt) + { + this.WriteInt8(value); + } + else + { + Span span = this.writer.GetSpan(1); + span[0] = unchecked((byte)value); + this.writer.Advance(1); + } + } + + /// + /// Writes an 8-bit value using . + /// + /// The value. + public void WriteInt8(sbyte value) + { + Span span = this.writer.GetSpan(2); + span[0] = MessagePackCode.Int8; + span[1] = unchecked((byte)value); + this.writer.Advance(2); + } + + /// + /// Writes a value using a 1-byte code when possible, otherwise as or . + /// + /// The value. + public void Write(ushort value) + { + if (value <= MessagePackRange.MaxFixPositiveInt) + { + Span span = this.writer.GetSpan(1); + span[0] = unchecked((byte)value); + this.writer.Advance(1); + } + else if (value <= byte.MaxValue) + { + Span span = this.writer.GetSpan(2); + span[0] = MessagePackCode.UInt8; + span[1] = unchecked((byte)value); + this.writer.Advance(2); + } + else + { + this.WriteUInt16(value); + } + } + + /// + /// Writes a value using . + /// + /// The value. + public void WriteUInt16(ushort value) + { + Span span = this.writer.GetSpan(3); + span[0] = MessagePackCode.UInt16; + WriteBigEndian(value, span.Slice(1)); + this.writer.Advance(3); + } + + /// + /// Writes a using a built-in 1-byte code when within specific MessagePack-supported ranges, + /// or the most compact of + /// , + /// , + /// , or + /// . + /// + /// The value to write. + public void Write(short value) + { + if (value >= 0) + { + this.Write((ushort)value); + } + else + { + // negative int(use int) + if (value >= MessagePackRange.MinFixNegativeInt) + { + Span span = this.writer.GetSpan(1); + span[0] = unchecked((byte)value); + this.writer.Advance(1); + } + else if (value >= sbyte.MinValue) + { + Span span = this.writer.GetSpan(2); + span[0] = MessagePackCode.Int8; + span[1] = unchecked((byte)value); + this.writer.Advance(2); + } + else + { + this.WriteInt16(value); + } + } + } + + /// + /// Writes a using . + /// + /// The value to write. + public void WriteInt16(short value) + { + Span span = this.writer.GetSpan(3); + span[0] = MessagePackCode.Int16; + WriteBigEndian(value, span.Slice(1)); + this.writer.Advance(3); + } + + /// + /// Writes an using a built-in 1-byte code when within specific MessagePack-supported ranges, + /// or the most compact of + /// , + /// , or + /// . + /// + /// The value to write. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void Write(uint value) + { + if (value <= MessagePackRange.MaxFixPositiveInt) + { + Span span = this.writer.GetSpan(1); + span[0] = unchecked((byte)value); + this.writer.Advance(1); + } + else if (value <= byte.MaxValue) + { + Span span = this.writer.GetSpan(2); + span[0] = MessagePackCode.UInt8; + span[1] = unchecked((byte)value); + this.writer.Advance(2); + } + else if (value <= ushort.MaxValue) + { + Span span = this.writer.GetSpan(3); + span[0] = MessagePackCode.UInt16; + WriteBigEndian((ushort)value, span.Slice(1)); + this.writer.Advance(3); + } + else + { + this.WriteUInt32(value); + } + } + + /// + /// Writes an using . + /// + /// The value to write. + public void WriteUInt32(uint value) + { + Span span = this.writer.GetSpan(5); + span[0] = MessagePackCode.UInt32; + WriteBigEndian(value, span.Slice(1)); + this.writer.Advance(5); + } + + /// + /// Writes an using a built-in 1-byte code when within specific MessagePack-supported ranges, + /// or the most compact of + /// , + /// , + /// , + /// , + /// , + /// . + /// + /// The value to write. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void Write(int value) + { + if (value >= 0) + { + this.Write((uint)value); + } + else + { + // negative int(use int) + if (value >= MessagePackRange.MinFixNegativeInt) + { + Span span = this.writer.GetSpan(1); + span[0] = unchecked((byte)value); + this.writer.Advance(1); + } + else if (value >= sbyte.MinValue) + { + Span span = this.writer.GetSpan(2); + span[0] = MessagePackCode.Int8; + span[1] = unchecked((byte)value); + this.writer.Advance(2); + } + else if (value >= short.MinValue) + { + Span span = this.writer.GetSpan(3); + span[0] = MessagePackCode.Int16; + WriteBigEndian((short)value, span.Slice(1)); + this.writer.Advance(3); + } + else + { + this.WriteInt32(value); + } + } + } + + /// + /// Writes an using . + /// + /// The value to write. + public void WriteInt32(int value) + { + Span span = this.writer.GetSpan(5); + span[0] = MessagePackCode.Int32; + WriteBigEndian(value, span.Slice(1)); + this.writer.Advance(5); + } + + /// + /// Writes an using a built-in 1-byte code when within specific MessagePack-supported ranges, + /// or the most compact of + /// , + /// , + /// , + /// , + /// , + /// . + /// + /// The value to write. + public void Write(ulong value) + { + if (value <= MessagePackRange.MaxFixPositiveInt) + { + Span span = this.writer.GetSpan(1); + span[0] = unchecked((byte)value); + this.writer.Advance(1); + } + else if (value <= byte.MaxValue) + { + Span span = this.writer.GetSpan(2); + span[0] = MessagePackCode.UInt8; + span[1] = unchecked((byte)value); + this.writer.Advance(2); + } + else if (value <= ushort.MaxValue) + { + Span span = this.writer.GetSpan(3); + span[0] = MessagePackCode.UInt16; + WriteBigEndian((ushort)value, span.Slice(1)); + this.writer.Advance(3); + } + else if (value <= uint.MaxValue) + { + Span span = this.writer.GetSpan(5); + span[0] = MessagePackCode.UInt32; + WriteBigEndian((uint)value, span.Slice(1)); + this.writer.Advance(5); + } + else + { + this.WriteUInt64(value); + } + } + + /// + /// Writes an using . + /// + /// The value to write. + public void WriteUInt64(ulong value) + { + Span span = this.writer.GetSpan(9); + span[0] = MessagePackCode.UInt64; + WriteBigEndian(value, span.Slice(1)); + this.writer.Advance(9); + } + + /// + /// Writes an using a built-in 1-byte code when within specific MessagePack-supported ranges, + /// or the most compact of + /// , + /// , + /// , + /// , + /// , + /// , + /// , + /// . + /// + /// The value to write. + public void Write(long value) + { + if (value >= 0) + { + this.Write((ulong)value); + } + else + { + // negative int(use int) + if (value >= MessagePackRange.MinFixNegativeInt) + { + Span span = this.writer.GetSpan(1); + span[0] = unchecked((byte)value); + this.writer.Advance(1); + } + else if (value >= sbyte.MinValue) + { + Span span = this.writer.GetSpan(2); + span[0] = MessagePackCode.Int8; + span[1] = unchecked((byte)value); + this.writer.Advance(2); + } + else if (value >= short.MinValue) + { + Span span = this.writer.GetSpan(3); + span[0] = MessagePackCode.Int16; + WriteBigEndian((short)value, span.Slice(1)); + this.writer.Advance(3); + } + else if (value >= int.MinValue) + { + Span span = this.writer.GetSpan(5); + span[0] = MessagePackCode.Int32; + WriteBigEndian((int)value, span.Slice(1)); + this.writer.Advance(5); + } + else + { + this.WriteInt64(value); + } + } + } + + /// + /// Writes a using . + /// + /// The value to write. + public void WriteInt64(long value) + { + Span span = this.writer.GetSpan(9); + span[0] = MessagePackCode.Int64; + WriteBigEndian(value, span.Slice(1)); + this.writer.Advance(9); + } + + /// + /// Writes a value using either or . + /// + /// The value. + public void Write(bool value) + { + Span span = this.writer.GetSpan(1); + span[0] = value ? MessagePackCode.True : MessagePackCode.False; + this.writer.Advance(1); + } + + /// + /// Writes a value using a 1-byte code when possible, otherwise as or . + /// + /// The value. + public void Write(char value) => this.Write((ushort)value); + + /// + /// Writes a value. + /// + /// The value. + public void Write(float value) + { + Span span = this.writer.GetSpan(5); + span[0] = MessagePackCode.Float32; + WriteBigEndian(value, span.Slice(1)); + this.writer.Advance(5); + } + + /// + /// Writes a value. + /// + /// The value. + public void Write(double value) + { + Span span = this.writer.GetSpan(9); + span[0] = MessagePackCode.Float64; + WriteBigEndian(value, span.Slice(1)); + this.writer.Advance(9); + } + + /// + /// Writes a using the message code . + /// + /// The value to write. + /// Thrown when is true because the old spec does not define a format. + public void Write(DateTime dateTime) + { + if (this.OldSpec) + { + throw new NotSupportedException($"The MsgPack spec does not define a format for {nameof(DateTime)} in {nameof(this.OldSpec)} mode. Turn off {nameof(this.OldSpec)} mode or use NativeDateTimeFormatter."); + } + else + { + // Timestamp spec + // https://github.com/msgpack/msgpack/pull/209 + // FixExt4(-1) => seconds | [1970-01-01 00:00:00 UTC, 2106-02-07 06:28:16 UTC) range + // FixExt8(-1) => nanoseconds + seconds | [1970-01-01 00:00:00.000000000 UTC, 2514-05-30 01:53:04.000000000 UTC) range + // Ext8(12,-1) => nanoseconds + seconds | [-584554047284-02-23 16:59:44 UTC, 584554051223-11-09 07:00:16.000000000 UTC) range + + // The spec requires UTC. Convert to UTC if we're sure the value was expressed as Local time. + // If it's Unspecified, we want to leave it alone since .NET will change the value when we convert + // and we simply don't know, so we should leave it as-is. + if (dateTime.Kind == DateTimeKind.Local) + { + dateTime = dateTime.ToUniversalTime(); + } + + var secondsSinceBclEpoch = dateTime.Ticks / TimeSpan.TicksPerSecond; + var seconds = secondsSinceBclEpoch - DateTimeConstants.BclSecondsAtUnixEpoch; + var nanoseconds = (dateTime.Ticks % TimeSpan.TicksPerSecond) * DateTimeConstants.NanosecondsPerTick; + + // reference pseudo code. + /* + struct timespec { + long tv_sec; // seconds + long tv_nsec; // nanoseconds + } time; + if ((time.tv_sec >> 34) == 0) + { + uint64_t data64 = (time.tv_nsec << 34) | time.tv_sec; + if (data & 0xffffffff00000000L == 0) + { + // timestamp 32 + uint32_t data32 = data64; + serialize(0xd6, -1, data32) + } + else + { + // timestamp 64 + serialize(0xd7, -1, data64) + } + } + else + { + // timestamp 96 + serialize(0xc7, 12, -1, time.tv_nsec, time.tv_sec) + } + */ + + if ((seconds >> 34) == 0) + { + var data64 = unchecked((ulong)((nanoseconds << 34) | seconds)); + if ((data64 & 0xffffffff00000000L) == 0) + { + // timestamp 32(seconds in 32-bit unsigned int) + var data32 = (UInt32)data64; + Span span = this.writer.GetSpan(6); + span[0] = MessagePackCode.FixExt4; + span[1] = unchecked((byte)ReservedMessagePackExtensionTypeCode.DateTime); + WriteBigEndian(data32, span.Slice(2)); + this.writer.Advance(6); + } + else + { + // timestamp 64(nanoseconds in 30-bit unsigned int | seconds in 34-bit unsigned int) + Span span = this.writer.GetSpan(10); + span[0] = MessagePackCode.FixExt8; + span[1] = unchecked((byte)ReservedMessagePackExtensionTypeCode.DateTime); + WriteBigEndian(data64, span.Slice(2)); + this.writer.Advance(10); + } + } + else + { + // timestamp 96( nanoseconds in 32-bit unsigned int | seconds in 64-bit signed int ) + Span span = this.writer.GetSpan(15); + span[0] = MessagePackCode.Ext8; + span[1] = 12; + span[2] = unchecked((byte)ReservedMessagePackExtensionTypeCode.DateTime); + WriteBigEndian((uint)nanoseconds, span.Slice(3)); + WriteBigEndian(seconds, span.Slice(7)); + this.writer.Advance(15); + } + } + } + + /// + /// Writes a [], prefixed with a length encoded as the smallest fitting from: + /// , + /// , + /// , + /// or if is null. + /// + /// The array of bytes to write. May be null. + public void Write(byte[] src) + { + if (src == null) + { + this.WriteNil(); + } + else + { + this.Write(src.AsSpan()); + } + } + + /// + /// Writes a span of bytes, prefixed with a length encoded as the smallest fitting from: + /// , + /// , or + /// . + /// + /// The span of bytes to write. + /// + /// When is true, the msgpack code used is , or instead. + /// + public void Write(ReadOnlySpan src) + { + int length = (int)src.Length; + this.WriteBinHeader(length); + var span = this.writer.GetSpan(length); + src.CopyTo(span); + this.writer.Advance(length); + } + + /// + /// Writes a sequence of bytes, prefixed with a length encoded as the smallest fitting from: + /// , + /// , or + /// . + /// + /// The span of bytes to write. + /// + /// When is true, the msgpack code used is , or instead. + /// + public void Write(in ReadOnlySequence src) + { + int length = (int)src.Length; + this.WriteBinHeader(length); + var span = this.writer.GetSpan(length); + src.CopyTo(span); + this.writer.Advance(length); + } + + /// + /// Writes the header that precedes a raw binary sequence with a length encoded as the smallest fitting from: + /// , + /// , or + /// . + /// + /// The length of bytes that will be written next. + /// + /// + /// The caller should use or + /// after calling this method to actually write the content. + /// Alternatively a single call to or will take care of the header and content in one call. + /// + /// + /// When is true, the msgpack code used is , or instead. + /// + /// + public void WriteBinHeader(int length) + { + if (this.OldSpec) + { + this.WriteStringHeader(length); + return; + } + + // When we write the header, we'll ask for all the space we need for the payload as well + // as that may help ensure we only allocate a buffer once. + if (length <= byte.MaxValue) + { + var size = length + 2; + Span span = this.writer.GetSpan(size); + + span[0] = MessagePackCode.Bin8; + span[1] = (byte)length; + + this.writer.Advance(2); + } + else if (length <= UInt16.MaxValue) + { + var size = length + 3; + Span span = this.writer.GetSpan(size); + + span[0] = MessagePackCode.Bin16; + WriteBigEndian((ushort)length, span.Slice(1)); + + this.writer.Advance(3); + } + else + { + var size = length + 5; + Span span = this.writer.GetSpan(size); + + span[0] = MessagePackCode.Bin32; + WriteBigEndian(length, span.Slice(1)); + + this.writer.Advance(5); + } + } + + /// + /// Writes out an array of bytes that (may) represent a UTF-8 encoded string, prefixed with the length using one of these message codes: + /// , + /// , + /// , or + /// . + /// + /// The bytes to write. + public void WriteString(in ReadOnlySequence utf8stringBytes) + { + var length = (int)utf8stringBytes.Length; + this.WriteStringHeader(length); + Span span = this.writer.GetSpan(length); + utf8stringBytes.CopyTo(span); + this.writer.Advance(length); + } + + /// + /// Writes out an array of bytes that (may) represent a UTF-8 encoded string, prefixed with the length using one of these message codes: + /// , + /// , + /// , or + /// . + /// + /// The bytes to write. + public void WriteString(ReadOnlySpan utf8stringBytes) + { + var length = utf8stringBytes.Length; + this.WriteStringHeader(length); + Span span = this.writer.GetSpan(length); + utf8stringBytes.CopyTo(span); + this.writer.Advance(length); + } + + /// + /// Writes out the header that may precede a UTF-8 encoded string, prefixed with the length using one of these message codes: + /// , + /// , + /// , or + /// . + /// + /// The number of bytes in the string that will follow this header. + /// + /// The caller should use or + /// after calling this method to actually write the content. + /// Alternatively a single call to or will take care of the header and content in one call. + /// + public void WriteStringHeader(int byteCount) + { + // When we write the header, we'll ask for all the space we need for the payload as well + // as that may help ensure we only allocate a buffer once. + if (byteCount <= MessagePackRange.MaxFixStringLength) + { + Span span = this.writer.GetSpan(byteCount + 1); + span[0] = (byte)(MessagePackCode.MinFixStr | byteCount); + this.writer.Advance(1); + } + else if (byteCount <= byte.MaxValue && !this.OldSpec) + { + Span span = this.writer.GetSpan(byteCount + 2); + span[0] = MessagePackCode.Str8; + span[1] = unchecked((byte)byteCount); + this.writer.Advance(2); + } + else if (byteCount <= ushort.MaxValue) + { + Span span = this.writer.GetSpan(byteCount + 3); + span[0] = MessagePackCode.Str16; + WriteBigEndian((ushort)byteCount, span.Slice(1)); + this.writer.Advance(3); + } + else + { + Span span = this.writer.GetSpan(byteCount + 5); + span[0] = MessagePackCode.Str32; + WriteBigEndian(byteCount, span.Slice(1)); + this.writer.Advance(5); + } + } + + /// + /// Writes out a , prefixed with the length using one of these message codes: + /// , + /// , + /// , + /// , + /// or if the is null. + /// + /// The value to write. May be null. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public unsafe void Write(string value) + { + if (value == null) + { + this.WriteNil(); + return; + } + + ref byte buffer = ref this.WriteString_PrepareSpan(value.Length, out int bufferSize, out int useOffset); + fixed (char* pValue = value) + fixed (byte* pBuffer = &buffer) + { + int byteCount = StringEncoding.UTF8.GetBytes(pValue, value.Length, pBuffer + useOffset, bufferSize); + this.WriteString_PostEncoding(pBuffer, useOffset, byteCount); + } + } + + /// + /// Writes out a , prefixed with the length using one of these message codes: + /// , + /// , + /// , + /// . + /// + /// The value to write. + public unsafe void Write(ReadOnlySpan value) + { + ref byte buffer = ref this.WriteString_PrepareSpan(value.Length, out int bufferSize, out int useOffset); + fixed (char* pValue = value) + fixed (byte* pBuffer = &buffer) + { + int byteCount = StringEncoding.UTF8.GetBytes(pValue, value.Length, pBuffer + useOffset, bufferSize); + this.WriteString_PostEncoding(pBuffer, useOffset, byteCount); + } + } + + /// + /// Writes the extension format header, using the smallest one of these codes: + /// , + /// , + /// , + /// , + /// , + /// , + /// , or + /// . + /// + /// The extension header. + public void WriteExtensionFormatHeader(ExtensionHeader extensionHeader) + { + int dataLength = (int)extensionHeader.Length; + byte typeCode = unchecked((byte)extensionHeader.TypeCode); + switch (dataLength) + { + case 1: + Span span = this.writer.GetSpan(2); + span[0] = MessagePackCode.FixExt1; + span[1] = unchecked(typeCode); + this.writer.Advance(2); + return; + case 2: + span = this.writer.GetSpan(2); + span[0] = MessagePackCode.FixExt2; + span[1] = unchecked(typeCode); + this.writer.Advance(2); + return; + case 4: + span = this.writer.GetSpan(2); + span[0] = MessagePackCode.FixExt4; + span[1] = unchecked(typeCode); + this.writer.Advance(2); + return; + case 8: + span = this.writer.GetSpan(2); + span[0] = MessagePackCode.FixExt8; + span[1] = unchecked(typeCode); + this.writer.Advance(2); + return; + case 16: + span = this.writer.GetSpan(2); + span[0] = MessagePackCode.FixExt16; + span[1] = unchecked(typeCode); + this.writer.Advance(2); + return; + default: + unchecked + { + if (dataLength <= byte.MaxValue) + { + span = this.writer.GetSpan(dataLength + 3); + span[0] = MessagePackCode.Ext8; + span[1] = unchecked((byte)dataLength); + span[2] = unchecked(typeCode); + this.writer.Advance(3); + } + else if (dataLength <= UInt16.MaxValue) + { + span = this.writer.GetSpan(dataLength + 4); + span[0] = MessagePackCode.Ext16; + WriteBigEndian((ushort)dataLength, span.Slice(1)); + span[3] = unchecked(typeCode); + this.writer.Advance(4); + } + else + { + span = this.writer.GetSpan(dataLength + 6); + span[0] = MessagePackCode.Ext32; + WriteBigEndian(dataLength, span.Slice(1)); + span[5] = unchecked(typeCode); + this.writer.Advance(6); + } + } + + break; + } + } + + /// + /// Writes an extension format, using the smallest one of these codes: + /// , + /// , + /// , + /// , + /// , + /// , + /// , or + /// . + /// + /// The extension data. + public void WriteExtensionFormat(ExtensionResult extensionData) + { + this.WriteExtensionFormatHeader(extensionData.Header); + this.WriteRaw(extensionData.Data); + } + + /// + /// Gets memory where raw messagepack data can be written. + /// + /// The size of the memory block required. + /// The span of memory to write to. This *may* exceed . + /// + /// After initializing the resulting memory, always follow up with a call to . + /// + /// This is similar in purpose to + /// but provides uninitialized memory for the caller to write to instead of copying initialized memory from elsewhere. + /// + /// + /// + public Span GetSpan(int length) => this.writer.GetSpan(length); + + /// + /// Commits memory previously returned from as initialized. + /// + /// The number of bytes initialized with messagepack data from the previously returned span. + /// + public void Advance(int length) => this.writer.Advance(length); + + /// + /// Writes a 16-bit integer in big endian format. + /// + /// The integer. + internal void WriteBigEndian(ushort value) + { + Span span = this.writer.GetSpan(2); + WriteBigEndian(value, span); + this.writer.Advance(2); + } + + /// + /// Writes a 32-bit integer in big endian format. + /// + /// The integer. + internal void WriteBigEndian(uint value) + { + Span span = this.writer.GetSpan(4); + WriteBigEndian(value, span); + this.writer.Advance(4); + } + + /// + /// Writes a 64-bit integer in big endian format. + /// + /// The integer. + internal void WriteBigEndian(ulong value) + { + Span span = this.writer.GetSpan(8); + WriteBigEndian(value, span); + this.writer.Advance(8); + } + + internal byte[] FlushAndGetArray() + { + if (this.writer.TryGetUncommittedSpan(out ReadOnlySpan span)) + { + return span.ToArray(); + } + else + { + if (this.writer.SequenceRental.Value == null) + { + throw new NotSupportedException("This instance was not initialized to support this operation."); + } + + this.Flush(); + byte[] result = this.writer.SequenceRental.Value.AsReadOnlySequence.ToArray(); + this.writer.SequenceRental.Dispose(); + return result; + } + } + + private static void WriteBigEndian(short value, Span span) => WriteBigEndian(unchecked((ushort)value), span); + + private static void WriteBigEndian(int value, Span span) => WriteBigEndian(unchecked((uint)value), span); + + private static void WriteBigEndian(long value, Span span) => WriteBigEndian(unchecked((ulong)value), span); + + private static void WriteBigEndian(ushort value, Span span) + { + unchecked + { + // Write to highest index first so the JIT skips bounds checks on subsequent writes. + span[1] = (byte)value; + span[0] = (byte)(value >> 8); + } + } + + private static unsafe void WriteBigEndian(ushort value, byte* span) + { + unchecked + { + span[0] = (byte)(value >> 8); + span[1] = (byte)value; + } + } + + private static void WriteBigEndian(uint value, Span span) + { + unchecked + { + // Write to highest index first so the JIT skips bounds checks on subsequent writes. + span[3] = (byte)value; + span[2] = (byte)(value >> 8); + span[1] = (byte)(value >> 16); + span[0] = (byte)(value >> 24); + } + } + + private static unsafe void WriteBigEndian(uint value, byte* span) + { + unchecked + { + span[0] = (byte)(value >> 24); + span[1] = (byte)(value >> 16); + span[2] = (byte)(value >> 8); + span[3] = (byte)value; + } + } + + private static void WriteBigEndian(ulong value, Span span) + { + unchecked + { + // Write to highest index first so the JIT skips bounds checks on subsequent writes. + span[7] = (byte)value; + span[6] = (byte)(value >> 8); + span[5] = (byte)(value >> 16); + span[4] = (byte)(value >> 24); + span[3] = (byte)(value >> 32); + span[2] = (byte)(value >> 40); + span[1] = (byte)(value >> 48); + span[0] = (byte)(value >> 56); + } + } + + private static unsafe void WriteBigEndian(float value, Span span) => WriteBigEndian(*(int*)&value, span); + + private static unsafe void WriteBigEndian(double value, Span span) => WriteBigEndian(*(long*)&value, span); + + /// + /// Estimates the length of the header required for a given string. + /// + /// The length of the string to be written, in characters. + /// Receives the guaranteed length of the returned buffer. + /// Receives the offset within the returned buffer to write the encoded string to. + /// + /// A reference to the first byte in the buffer. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private ref byte WriteString_PrepareSpan(int characterLength, out int bufferSize, out int encodedBytesOffset) + { + // MaxByteCount -> WritePrefix -> GetBytes has some overheads of `MaxByteCount` + // solves heuristic length check + + // ensure buffer by MaxByteCount(faster than GetByteCount) + bufferSize = StringEncoding.UTF8.GetMaxByteCount(characterLength) + 5; + ref byte buffer = ref this.writer.GetPointer(bufferSize); + + int useOffset; + if (characterLength <= MessagePackRange.MaxFixStringLength) + { + useOffset = 1; + } + else if (characterLength <= byte.MaxValue && !this.OldSpec) + { + useOffset = 2; + } + else if (characterLength <= ushort.MaxValue) + { + useOffset = 3; + } + else + { + useOffset = 5; + } + + encodedBytesOffset = useOffset; + return ref buffer; + } + + /// + /// Finalizes an encoding of a string. + /// + /// A pointer obtained from a prior call to . + /// The offset obtained from a prior call to . + /// The number of bytes used to actually encode the string. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private unsafe void WriteString_PostEncoding(byte* pBuffer, int estimatedOffset, int byteCount) + { + int bufferLength = estimatedOffset + byteCount; + + // move body and write prefix + if (byteCount <= MessagePackRange.MaxFixStringLength) + { + if (estimatedOffset != 1) + { + MemoryCopy(pBuffer + estimatedOffset, pBuffer + 1, byteCount, byteCount); + } + + pBuffer[0] = (byte)(MessagePackCode.MinFixStr | byteCount); + this.writer.Advance(byteCount + 1); + } + else if (byteCount <= byte.MaxValue && !this.OldSpec) + { + if (estimatedOffset != 2) + { + MemoryCopy(pBuffer + estimatedOffset, pBuffer + 2, byteCount, byteCount); + } + + pBuffer[0] = MessagePackCode.Str8; + pBuffer[1] = unchecked((byte)byteCount); + this.writer.Advance(byteCount + 2); + } + else if (byteCount <= ushort.MaxValue) + { + if (estimatedOffset != 3) + { + MemoryCopy(pBuffer + estimatedOffset, pBuffer + 3, byteCount, byteCount); + } + + pBuffer[0] = MessagePackCode.Str16; + WriteBigEndian((ushort)byteCount, pBuffer + 1); + this.writer.Advance(byteCount + 3); + } + else + { + if (estimatedOffset != 5) + { + MemoryCopy(pBuffer + estimatedOffset, pBuffer + 5, byteCount, byteCount); + } + + pBuffer[0] = MessagePackCode.Str32; + WriteBigEndian((uint)byteCount, pBuffer + 1); + this.writer.Advance(byteCount + 5); + } + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static unsafe void MemoryCopy(void* source, void* destination, long destinationSizeInBytes, long sourceBytesToCopy) + { + if (Utilities.IsMono) + { + // mono does not guarantee overlapped memcpy so for Unity and NETSTANDARD use slow path. + // https://github.com/neuecc/MessagePack-CSharp/issues/562 + var buffer = ArrayPool.Shared.Rent((int)sourceBytesToCopy); + try + { + fixed (byte* p = buffer) + { + Buffer.MemoryCopy(source, p, sourceBytesToCopy, sourceBytesToCopy); + Buffer.MemoryCopy(p, destination, destinationSizeInBytes, sourceBytesToCopy); + } + } + finally + { + ArrayPool.Shared.Return(buffer); + } + } + else + { + Buffer.MemoryCopy(source, destination, destinationSizeInBytes, sourceBytesToCopy); + } + } + } +} diff --git a/Assets/Scripts/MessagePack/MessagePackWriter.cs.meta b/Assets/Scripts/MessagePack/MessagePackWriter.cs.meta new file mode 100644 index 000000000..cee44775c --- /dev/null +++ b/Assets/Scripts/MessagePack/MessagePackWriter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3855642516b66bac99136d08d7dd7a8e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Nil.cs b/Assets/Scripts/MessagePack/Nil.cs new file mode 100644 index 000000000..9533d24dd --- /dev/null +++ b/Assets/Scripts/MessagePack/Nil.cs @@ -0,0 +1,38 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; + +namespace MessagePack +{ +#if MESSAGEPACK_INTERNAL + internal +#else + public +#endif + struct Nil : IEquatable + { + public static readonly Nil Default = default(Nil); + + public override bool Equals(object obj) + { + return obj is Nil; + } + + public bool Equals(Nil other) + { + return true; + } + + public override int GetHashCode() + { + return 0; + } + + public override string ToString() + { + return "()"; + } + } +} diff --git a/Assets/Scripts/MessagePack/Nil.cs.meta b/Assets/Scripts/MessagePack/Nil.cs.meta new file mode 100644 index 000000000..28259fa68 --- /dev/null +++ b/Assets/Scripts/MessagePack/Nil.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7a76d2880a8f9b1f7b740d0c5e62a461 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Resolvers.meta b/Assets/Scripts/MessagePack/Resolvers.meta new file mode 100644 index 000000000..ec940c559 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 65a2261e5aa0e2b47b4acee0f027c933 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Resolvers/AttributeFormatterResolver.cs b/Assets/Scripts/MessagePack/Resolvers/AttributeFormatterResolver.cs new file mode 100644 index 000000000..8532be840 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/AttributeFormatterResolver.cs @@ -0,0 +1,57 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Linq; // require UNITY_2018_3_OR_NEWER +using System.Reflection; +using MessagePack.Formatters; + +namespace MessagePack.Resolvers +{ + /// + /// Get formatter from . + /// + public sealed class AttributeFormatterResolver : IFormatterResolver + { + /// + /// The singleton instance that can be used. + /// + public static readonly AttributeFormatterResolver Instance = new AttributeFormatterResolver(); + + private AttributeFormatterResolver() + { + } + + public IMessagePackFormatter GetFormatter() + { + return FormatterCache.Formatter; + } + + private static class FormatterCache + { + public static readonly IMessagePackFormatter Formatter; + + static FormatterCache() + { +#if UNITY_2018_3_OR_NEWER && !NETFX_CORE + var attr = (MessagePackFormatterAttribute)typeof(T).GetCustomAttributes(typeof(MessagePackFormatterAttribute), true).FirstOrDefault(); +#else + MessagePackFormatterAttribute attr = typeof(T).GetTypeInfo().GetCustomAttribute(); +#endif + if (attr == null) + { + return; + } + + if (attr.Arguments == null) + { + Formatter = (IMessagePackFormatter)Activator.CreateInstance(attr.FormatterType); + } + else + { + Formatter = (IMessagePackFormatter)Activator.CreateInstance(attr.FormatterType, attr.Arguments); + } + } + } + } +} diff --git a/Assets/Scripts/MessagePack/Resolvers/AttributeFormatterResolver.cs.meta b/Assets/Scripts/MessagePack/Resolvers/AttributeFormatterResolver.cs.meta new file mode 100644 index 000000000..9bba94c8a --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/AttributeFormatterResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f1da7b0fb18e1d4e79aeb7ac56ba9607 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs b/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs new file mode 100644 index 000000000..52c3210e6 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs @@ -0,0 +1,159 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using MessagePack.Formatters; +using MessagePack.Internal; +using MessagePack.Resolvers; + +#pragma warning disable SA1403 // File may only contain a single namespace +#pragma warning disable SA1509 // Opening braces should not be preceded by blank line + +namespace MessagePack.Resolvers +{ + public sealed class BuiltinResolver : IFormatterResolver + { + /// + /// The singleton instance that can be used. + /// + public static readonly BuiltinResolver Instance = new BuiltinResolver(); + + private BuiltinResolver() + { + } + + public IMessagePackFormatter GetFormatter() + { + return FormatterCache.Formatter; + } + + private static class FormatterCache + { + public static readonly IMessagePackFormatter Formatter; + + static FormatterCache() + { + // Reduce IL2CPP code generate size(don't write long code in ) + Formatter = (IMessagePackFormatter)BuiltinResolverGetFormatterHelper.GetFormatter(typeof(T)); + } + } + } +} + +namespace MessagePack.Internal +{ + internal static class BuiltinResolverGetFormatterHelper + { + private static readonly Dictionary FormatterMap = new Dictionary() + { + // Primitive + { typeof(Int16), Int16Formatter.Instance }, + { typeof(Int32), Int32Formatter.Instance }, + { typeof(Int64), Int64Formatter.Instance }, + { typeof(UInt16), UInt16Formatter.Instance }, + { typeof(UInt32), UInt32Formatter.Instance }, + { typeof(UInt64), UInt64Formatter.Instance }, + { typeof(Single), SingleFormatter.Instance }, + { typeof(Double), DoubleFormatter.Instance }, + { typeof(bool), BooleanFormatter.Instance }, + { typeof(byte), ByteFormatter.Instance }, + { typeof(sbyte), SByteFormatter.Instance }, + { typeof(DateTime), DateTimeFormatter.Instance }, + { typeof(char), CharFormatter.Instance }, + + // Nulllable Primitive + { typeof(Int16?), NullableInt16Formatter.Instance }, + { typeof(Int32?), NullableInt32Formatter.Instance }, + { typeof(Int64?), NullableInt64Formatter.Instance }, + { typeof(UInt16?), NullableUInt16Formatter.Instance }, + { typeof(UInt32?), NullableUInt32Formatter.Instance }, + { typeof(UInt64?), NullableUInt64Formatter.Instance }, + { typeof(Single?), NullableSingleFormatter.Instance }, + { typeof(Double?), NullableDoubleFormatter.Instance }, + { typeof(bool?), NullableBooleanFormatter.Instance }, + { typeof(byte?), NullableByteFormatter.Instance }, + { typeof(sbyte?), NullableSByteFormatter.Instance }, + { typeof(DateTime?), NullableDateTimeFormatter.Instance }, + { typeof(char?), NullableCharFormatter.Instance }, + + // StandardClassLibraryFormatter + { typeof(string), NullableStringFormatter.Instance }, + { typeof(decimal), DecimalFormatter.Instance }, + { typeof(decimal?), new StaticNullableFormatter(DecimalFormatter.Instance) }, + { typeof(TimeSpan), TimeSpanFormatter.Instance }, + { typeof(TimeSpan?), new StaticNullableFormatter(TimeSpanFormatter.Instance) }, + { typeof(DateTimeOffset), DateTimeOffsetFormatter.Instance }, + { typeof(DateTimeOffset?), new StaticNullableFormatter(DateTimeOffsetFormatter.Instance) }, + { typeof(Guid), GuidFormatter.Instance }, + { typeof(Guid?), new StaticNullableFormatter(GuidFormatter.Instance) }, + { typeof(Uri), UriFormatter.Instance }, + { typeof(Version), VersionFormatter.Instance }, + { typeof(StringBuilder), StringBuilderFormatter.Instance }, + { typeof(BitArray), BitArrayFormatter.Instance }, + + // special primitive + { typeof(byte[]), ByteArrayFormatter.Instance }, + + // Nil + { typeof(Nil), NilFormatter.Instance }, + { typeof(Nil?), NullableNilFormatter.Instance }, + + // otpmitized primitive array formatter + { typeof(Int16[]), Int16ArrayFormatter.Instance }, + { typeof(Int32[]), Int32ArrayFormatter.Instance }, + { typeof(Int64[]), Int64ArrayFormatter.Instance }, + { typeof(UInt16[]), UInt16ArrayFormatter.Instance }, + { typeof(UInt32[]), UInt32ArrayFormatter.Instance }, + { typeof(UInt64[]), UInt64ArrayFormatter.Instance }, + { typeof(Single[]), SingleArrayFormatter.Instance }, + { typeof(Double[]), DoubleArrayFormatter.Instance }, + { typeof(Boolean[]), BooleanArrayFormatter.Instance }, + { typeof(SByte[]), SByteArrayFormatter.Instance }, + { typeof(DateTime[]), DateTimeArrayFormatter.Instance }, + { typeof(Char[]), CharArrayFormatter.Instance }, + { typeof(string[]), NullableStringArrayFormatter.Instance }, + + // well known collections + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + + { typeof(object[]), new ArrayFormatter() }, + { typeof(List), new ListFormatter() }, + + { typeof(ArraySegment), ByteArraySegmentFormatter.Instance }, + { typeof(ArraySegment?), new StaticNullableFormatter>(ByteArraySegmentFormatter.Instance) }, + + { typeof(System.Numerics.BigInteger), BigIntegerFormatter.Instance }, + { typeof(System.Numerics.BigInteger?), new StaticNullableFormatter(BigIntegerFormatter.Instance) }, + { typeof(System.Numerics.Complex), ComplexFormatter.Instance }, + { typeof(System.Numerics.Complex?), new StaticNullableFormatter(ComplexFormatter.Instance) }, + }; + + internal static object GetFormatter(Type t) + { + object formatter; + if (FormatterMap.TryGetValue(t, out formatter)) + { + return formatter; + } + + return null; + } + } +} diff --git a/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs.meta b/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs.meta new file mode 100644 index 000000000..d6acb9743 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/BuiltinResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 22f2bfd36b9810653baff3342b3403e7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Resolvers/CachingFormatterResolver.cs b/Assets/Scripts/MessagePack/Resolvers/CachingFormatterResolver.cs new file mode 100644 index 000000000..4f69183d0 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/CachingFormatterResolver.cs @@ -0,0 +1,38 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using MessagePack.Formatters; +using MessagePack.Internal; + +namespace MessagePack.Resolvers +{ + /// + /// A base class for classes that want to cache their responses for perf reasons. + /// + internal abstract class CachingFormatterResolver : IFormatterResolver + { + /// + /// The cache of types to their formatters. + /// + private readonly ThreadsafeTypeKeyHashTable formatters = new ThreadsafeTypeKeyHashTable(); + + /// + public IMessagePackFormatter GetFormatter() + { + if (!this.formatters.TryGetValue(typeof(T), out IMessagePackFormatter formatter)) + { + formatter = this.GetFormatterCore(); + this.formatters.TryAdd(typeof(T), formatter); + } + + return (IMessagePackFormatter)formatter; + } + + /// + /// Looks up a formatter for a type that has not been previously cached. + /// + /// The type to be formatted. + /// The formatter to use, or null if none found. + protected abstract IMessagePackFormatter GetFormatterCore(); + } +} diff --git a/Assets/Scripts/MessagePack/Resolvers/CachingFormatterResolver.cs.meta b/Assets/Scripts/MessagePack/Resolvers/CachingFormatterResolver.cs.meta new file mode 100644 index 000000000..43cc41adc --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/CachingFormatterResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 961f65a9ca79040c5b3021c7612f3c08 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Resolvers/CompositeResolver.cs b/Assets/Scripts/MessagePack/Resolvers/CompositeResolver.cs new file mode 100644 index 000000000..daec23554 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/CompositeResolver.cs @@ -0,0 +1,108 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using MessagePack.Formatters; +using MessagePack.Internal; + +namespace MessagePack.Resolvers +{ + /// + /// Represents a collection of formatters and resolvers acting as one. + /// + /// + /// This class is not thread-safe for mutations. It is thread-safe when not being written to. + /// + public static class CompositeResolver + { + private static readonly ReadOnlyDictionary EmptyFormattersByType = new ReadOnlyDictionary(new Dictionary()); + + /// + /// Initializes a new instance of an with the specified formatters and sub-resolvers. + /// + /// + /// A list of instances of to prefer (above the ). + /// The formatters are searched in the order given, so if two formatters support serializing the same type, the first one is used. + /// May not be null, but may be . + /// + /// + /// A list of resolvers to use for serializing types for which does not include a formatter. + /// The resolvers are searched in the order given, so if two resolvers support serializing the same type, the first one is used. + /// May not be null, but may be . + /// + /// + /// An instance of . + /// + public static IFormatterResolver Create(IReadOnlyList formatters, IReadOnlyList resolvers) + { + if (formatters is null) + { + throw new ArgumentNullException(nameof(formatters)); + } + + if (resolvers is null) + { + throw new ArgumentNullException(nameof(resolvers)); + } + + // Make a copy of the resolvers list provided by the caller to guard against them changing it later. + var immutableFormatters = formatters.ToArray(); + var immutableResolvers = resolvers.ToArray(); + + return new CachingResolver(immutableFormatters, immutableResolvers); + } + + public static IFormatterResolver Create(params IFormatterResolver[] resolvers) => Create(Array.Empty(), resolvers); + + public static IFormatterResolver Create(params IMessagePackFormatter[] formatters) => Create(formatters, Array.Empty()); + + private class CachingResolver : IFormatterResolver + { + private readonly ThreadsafeTypeKeyHashTable formattersCache = new ThreadsafeTypeKeyHashTable(); + private readonly IMessagePackFormatter[] subFormatters; + private readonly IFormatterResolver[] subResolvers; + + /// + /// Initializes a new instance of the class. + /// + internal CachingResolver(IMessagePackFormatter[] subFormatters, IFormatterResolver[] subResolvers) + { + this.subFormatters = subFormatters ?? throw new ArgumentNullException(nameof(subFormatters)); + this.subResolvers = subResolvers ?? throw new ArgumentNullException(nameof(subResolvers)); + } + + public IMessagePackFormatter GetFormatter() + { + if (!this.formattersCache.TryGetValue(typeof(T), out IMessagePackFormatter formatter)) + { + foreach (var subFormatter in this.subFormatters) + { + if (subFormatter is IMessagePackFormatter) + { + formatter = subFormatter; + goto CACHE; + } + } + + foreach (IFormatterResolver resolver in this.subResolvers) + { + formatter = resolver.GetFormatter(); + if (formatter != null) + { + goto CACHE; + } + } + +// when not found, cache null. +CACHE: + this.formattersCache.TryAdd(typeof(T), formatter); + } + + return (IMessagePackFormatter)formatter; + } + } + } +} diff --git a/Assets/Scripts/MessagePack/Resolvers/CompositeResolver.cs.meta b/Assets/Scripts/MessagePack/Resolvers/CompositeResolver.cs.meta new file mode 100644 index 000000000..119460e57 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/CompositeResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ed6833da3299a096c923be585b3372a1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Resolvers/ContractlessReflectionObjectResolver.cs b/Assets/Scripts/MessagePack/Resolvers/ContractlessReflectionObjectResolver.cs new file mode 100644 index 000000000..04b9e5e05 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/ContractlessReflectionObjectResolver.cs @@ -0,0 +1,302 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Collections.Generic; +using System.Text; +using MessagePack.Formatters; +using MessagePack.Internal; + +namespace MessagePack.Resolvers +{ + // MEMO: Not completely implemented. + + ////public static class ContractlessReflectionObjectResolver + ////{ + //// // TODO:CamelCase Option? AllowPrivate? + //// public static readonly IFormatterResolver Default = new DefaultResolver(); + //// public static readonly IFormatterResolver Contractless = new ContractlessResolver(); + //// public static readonly IFormatterResolver ContractlessForceStringKey = new ContractlessForceStringResolver(); + + //// class DefaultResolver : IFormatterResolver + //// { + //// const bool ForceStringKey = false; + //// const bool Contractless = false; + //// const bool AllowPrivate = false; + + //// public IMessagePackFormatter GetFormatter() + //// { + //// return Cache.formatter; + //// } + + //// static class Cache + //// { + //// public static readonly IMessagePackFormatter formatter; + + //// static Cache() + //// { + //// var metaInfo = ObjectSerializationInfo.CreateOrNull(typeof(T), ForceStringKey, Contractless, AllowPrivate); + //// if (metaInfo != null) + //// { + //// formatter = new ReflectionObjectFormatter(metaInfo); + //// } + //// } + //// } + //// } + + //// class ContractlessResolver : IFormatterResolver + //// { + //// const bool ForceStringKey = false; + //// const bool Contractless = true; + //// const bool AllowPrivate = false; + + //// public IMessagePackFormatter GetFormatter() + //// { + //// return Cache.formatter; + //// } + + //// static class Cache + //// { + //// public static readonly IMessagePackFormatter formatter; + + //// static Cache() + //// { + //// var metaInfo = ObjectSerializationInfo.CreateOrNull(typeof(T), ForceStringKey, Contractless, AllowPrivate); + //// if (metaInfo != null) + //// { + //// formatter = new ReflectionObjectFormatter(metaInfo); + //// } + //// } + //// } + //// } + + //// class ContractlessForceStringResolver : IFormatterResolver + //// { + //// const bool ForceStringKey = true; + //// const bool Contractless = true; + //// const bool AllowPrivate = false; + + //// public IMessagePackFormatter GetFormatter() + //// { + //// return Cache.formatter; + //// } + + //// static class Cache + //// { + //// public static readonly IMessagePackFormatter formatter; + + //// static Cache() + //// { + //// var metaInfo = ObjectSerializationInfo.CreateOrNull(typeof(T), ForceStringKey, Contractless, AllowPrivate); + //// if (metaInfo != null) + //// { + //// formatter = new ReflectionObjectFormatter(metaInfo); + //// } + //// } + //// } + //// } + + ////} + + ////public class ReflectionObjectFormatter : IMessagePackFormatter + ////{ + //// readonly ObjectSerializationInfo metaInfo; + + //// // for write + //// readonly byte[][] writeMemberNames; + //// readonly ObjectSerializationInfo.EmittableMember[] writeMembers; + + //// // for read + //// readonly int[] constructorParameterIndexes; + //// readonly AutomataDictionary mapMemberDictionary; + //// readonly ObjectSerializationInfo.EmittableMember[] readMembers; + + //// internal ReflectionObjectFormatter(ObjectSerializationInfo metaInfo) + //// { + //// this.metaInfo = metaInfo; + + //// // for write + //// { + //// var memberNameList = new List(metaInfo.Members.Length); + //// var emmitableMemberList = new List(metaInfo.Members.Length); + //// foreach (var item in metaInfo.Members) + //// { + //// if (item.IsWritable) + //// { + //// emmitableMemberList.Add(item); + //// memberNameList.Add(Encoding.UTF8.GetBytes(item.Name)); + //// } + //// } + //// this.writeMemberNames = memberNameList.ToArray(); + //// this.writeMembers = emmitableMemberList.ToArray(); + //// } + //// // for read + //// { + //// var automata = new AutomataDictionary(); + //// var emmitableMemberList = new List(metaInfo.Members.Length); + //// int index = 0; + //// foreach (var item in metaInfo.Members) + //// { + //// if (item.IsReadable) + //// { + //// emmitableMemberList.Add(item); + //// automata.Add(item.Name, index++); + //// } + //// } + //// this.readMembers = emmitableMemberList.ToArray(); + //// this.mapMemberDictionary = automata; + //// } + //// } + + //// public void Serialize(ref MessagePackWriter writer, T value, MessagePackSerializerOptions options) + //// { + //// // reduce generic method size, avoid write code in type. + //// if (metaInfo.IsIntKey) + //// { + //// return ReflectionObjectFormatterHelper.WriteArraySerialize(metaInfo, writeMembers, ref bytes, offset, value, formatterResolver); + //// } + //// else + //// { + //// return ReflectionObjectFormatterHelper.WriteMapSerialize(metaInfo, writeMembers, writeMemberNames, ref bytes, offset, value, formatterResolver); + //// } + //// } + + //// public T Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + //// { + //// return (T)ReflectionObjectFormatterHelper.Deserialize(metaInfo, readMembers, constructorParameterIndexes, mapMemberDictionary, bytes, offset, formatterResolver, out readSize); + //// } + ////} + + ////internal static class ReflectionObjectFormatterHelper + ////{ + //// internal static int WriteArraySerialize(ObjectSerializationInfo metaInfo, ObjectSerializationInfo.EmittableMember[] writeMembers, ref byte[] bytes, int offset, object value, IFormatterResolver formatterResolver) + //// { + //// var startOffset = offset; + + //// offset += MessagePackBinary.WriteArrayHeader(ref bytes, offset, writeMembers.Length); + //// foreach (var item in metaInfo.Members) + //// { + //// if (item == null) + //// { + //// offset += MessagePackBinary.WriteNil(ref bytes, offset); + //// } + //// else + //// { + //// var memberValue = item.ReflectionLoadValue(value); + //// offset += MessagePackSerializer.NonGeneric.Serialize(item.Type, ref bytes, offset, memberValue, formatterResolver); + //// } + //// } + + //// return offset - startOffset; + //// } + + //// internal static int WriteMapSerialize(ObjectSerializationInfo metaInfo, ObjectSerializationInfo.EmittableMember[] writeMembers, byte[][] memberNames, ref byte[] bytes, int offset, object value, IFormatterResolver formatterResolver) + //// { + //// var startOffset = offset; + + //// offset += MessagePackBinary.WriteMapHeader(ref bytes, offset, writeMembers.Length); + + //// for (int i = 0; i < writeMembers.Length; i++) + //// { + //// offset += MessagePackBinary.WriteStringBytes(ref bytes, offset, memberNames[i]); + //// var memberValue = writeMembers[i].ReflectionLoadValue(value); + //// offset += MessagePackSerializer.NonGeneric.Serialize(writeMembers[i].Type, ref bytes, offset, memberValue, formatterResolver); + //// } + + //// return offset - startOffset; + //// } + + //// internal static object Deserialize(ObjectSerializationInfo metaInfo, ObjectSerializationInfo.EmittableMember[] readMembers, int[] constructorParameterIndexes, AutomataDictionary mapMemberDictionary, byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize) + //// { + //// var startOffset = offset; + //// object[] parameters = null; + + //// var headerType = MessagePackBinary.GetMessagePackType(bytes, offset); + //// if (headerType == MessagePackType.Nil) + //// { + //// readSize = 1; + //// return null; + //// } + //// else if (headerType == MessagePackType.Array) + //// { + //// var arraySize = MessagePackBinary.ReadArrayHeader(bytes, offset, out readSize); + //// offset += readSize; + + //// // ReadValues + //// parameters = new object[arraySize]; + //// for (int i = 0; i < arraySize; i++) + //// { + //// var info = readMembers[i]; + //// if (info != null) + //// { + //// parameters[i] = MessagePackSerializer.NonGeneric.Deserialize(info.Type, bytes, offset, formatterResolver, out readSize); + //// offset += readSize; + //// } + //// else + //// { + //// offset += MessagePackBinary.ReadNextBlock(bytes, offset); + //// } + //// } + //// } + //// else if (headerType == MessagePackType.Map) + //// { + //// var mapSize = MessagePackBinary.ReadMapHeader(bytes, offset, out readSize); + //// offset += readSize; + + //// // ReadValues + //// parameters = new object[mapSize]; + //// for (int i = 0; i < mapSize; i++) + //// { + //// var rawPropName = MessagePackBinary.ReadStringSegment(bytes, offset, out readSize); + //// offset += readSize; + + //// int index; + //// if (mapMemberDictionary.TryGetValue(rawPropName.Array, rawPropName.Offset, rawPropName.Count, out index)) + //// { + //// var info = readMembers[index]; + //// parameters[index] = MessagePackSerializer.NonGeneric.Deserialize(info.Type, bytes, offset, formatterResolver, out readSize); + //// offset += readSize; + //// } + //// else + //// { + //// offset += MessagePackBinary.ReadNextBlock(bytes, offset); + //// } + //// } + //// } + //// else + //// { + //// throw new MessagePackSerializationException("Invalid MessagePackType:" + MessagePackCode.ToFormatName(bytes[offset])); + //// } + + //// // CreateObject + //// object result = null; + //// if (constructorParameterIndexes.Length == 0) + //// { + //// result = Activator.CreateInstance(metaInfo.Type); + //// } + //// else + //// { + //// var args = new object[constructorParameterIndexes.Length]; + //// for (int i = 0; i < constructorParameterIndexes.Length; i++) + //// { + //// args[i] = parameters[constructorParameterIndexes[i]]; + //// } + + //// result = Activator.CreateInstance(metaInfo.Type, args); + //// } + + //// // SetMembers + //// for (int i = 0; i < readMembers.Length; i++) + //// { + //// var info = readMembers[i]; + //// if (info != null) + //// { + //// info.ReflectionStoreValue(result, parameters[i]); + //// } + //// } + + //// readSize = offset - startOffset; + //// return result; + //// } + ////} +} diff --git a/Assets/Scripts/MessagePack/Resolvers/ContractlessReflectionObjectResolver.cs.meta b/Assets/Scripts/MessagePack/Resolvers/ContractlessReflectionObjectResolver.cs.meta new file mode 100644 index 000000000..e5eb91669 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/ContractlessReflectionObjectResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 953431b29940de61a8da84acda591d9e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Resolvers/DynamicEnumAsStringResolver.cs b/Assets/Scripts/MessagePack/Resolvers/DynamicEnumAsStringResolver.cs new file mode 100644 index 000000000..f31bb2ac9 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/DynamicEnumAsStringResolver.cs @@ -0,0 +1,73 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Reflection; +using MessagePack.Formatters; +using MessagePack.Internal; + +namespace MessagePack.Resolvers +{ + public sealed class DynamicEnumAsStringResolver : IFormatterResolver + { + /// + /// The singleton instance that can be used. + /// + public static readonly DynamicEnumAsStringResolver Instance; + + /// + /// A instance with this formatter pre-configured. + /// + public static readonly MessagePackSerializerOptions Options; + + static DynamicEnumAsStringResolver() + { + Instance = new DynamicEnumAsStringResolver(); + Options = new MessagePackSerializerOptions(Instance); + } + + private DynamicEnumAsStringResolver() + { + } + + public IMessagePackFormatter GetFormatter() + { + return FormatterCache.Formatter; + } + + private static class FormatterCache + { + public static readonly IMessagePackFormatter Formatter; + + static FormatterCache() + { + TypeInfo ti = typeof(T).GetTypeInfo(); + + if (ti.IsNullable()) + { + // build underlying type and use wrapped formatter. + ti = ti.GenericTypeArguments[0].GetTypeInfo(); + if (!ti.IsEnum) + { + return; + } + + var innerFormatter = DynamicEnumAsStringResolver.Instance.GetFormatterDynamic(ti.AsType()); + if (innerFormatter == null) + { + return; + } + + Formatter = (IMessagePackFormatter)Activator.CreateInstance(typeof(StaticNullableFormatter<>).MakeGenericType(ti.AsType()), new object[] { innerFormatter }); + return; + } + else if (!ti.IsEnum) + { + return; + } + + Formatter = (IMessagePackFormatter)(object)new EnumAsStringFormatter(); + } + } + } +} diff --git a/Assets/Scripts/MessagePack/Resolvers/DynamicEnumAsStringResolver.cs.meta b/Assets/Scripts/MessagePack/Resolvers/DynamicEnumAsStringResolver.cs.meta new file mode 100644 index 000000000..148e98eb8 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/DynamicEnumAsStringResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 54a09685d140ed621bbd779af8f4e6cc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Resolvers/DynamicEnumResolver.cs b/Assets/Scripts/MessagePack/Resolvers/DynamicEnumResolver.cs new file mode 100644 index 000000000..07ccaa7f6 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/DynamicEnumResolver.cs @@ -0,0 +1,129 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +#if !(UNITY_2018_3_OR_NEWER && NET_STANDARD_2_0) + +using System; +using System.Buffers; +using System.Reflection; +using System.Reflection.Emit; +using System.Threading; +using MessagePack.Formatters; +using MessagePack.Internal; + +namespace MessagePack.Resolvers +{ + /// + /// EnumResolver by dynamic code generation, serialized underlying type. + /// + public sealed class DynamicEnumResolver : IFormatterResolver + { + /// + /// The singleton instance that can be used. + /// + public static readonly DynamicEnumResolver Instance = new DynamicEnumResolver(); + + private const string ModuleName = "MessagePack.Resolvers.DynamicEnumResolver"; + + private static readonly DynamicAssembly DynamicAssembly; + + private static int nameSequence = 0; + + private DynamicEnumResolver() + { + } + + static DynamicEnumResolver() + { + DynamicAssembly = new DynamicAssembly(ModuleName); + } + +#if NETFRAMEWORK + public AssemblyBuilder Save() + { + return DynamicAssembly.Save(); + } +#endif + + public IMessagePackFormatter GetFormatter() + { + return FormatterCache.Formatter; + } + + private static class FormatterCache + { + public static readonly IMessagePackFormatter Formatter; + + static FormatterCache() + { + TypeInfo ti = typeof(T).GetTypeInfo(); + if (ti.IsNullable()) + { + // build underlying type and use wrapped formatter. + ti = ti.GenericTypeArguments[0].GetTypeInfo(); + if (!ti.IsEnum) + { + return; + } + + var innerFormatter = DynamicEnumResolver.Instance.GetFormatterDynamic(ti.AsType()); + if (innerFormatter == null) + { + return; + } + + Formatter = (IMessagePackFormatter)Activator.CreateInstance(typeof(StaticNullableFormatter<>).MakeGenericType(ti.AsType()), new object[] { innerFormatter }); + return; + } + else if (!ti.IsEnum) + { + return; + } + + TypeInfo formatterTypeInfo = BuildType(typeof(T)); + Formatter = (IMessagePackFormatter)Activator.CreateInstance(formatterTypeInfo.AsType()); + } + } + + private static TypeInfo BuildType(Type enumType) + { + Type underlyingType = Enum.GetUnderlyingType(enumType); + Type formatterType = typeof(IMessagePackFormatter<>).MakeGenericType(enumType); + + TypeBuilder typeBuilder = DynamicAssembly.DefineType("MessagePack.Formatters." + enumType.FullName.Replace(".", "_") + "Formatter" + Interlocked.Increment(ref nameSequence), TypeAttributes.Public | TypeAttributes.Sealed, null, new[] { formatterType }); + + // void Serialize(ref MessagePackWriter writer, T value, MessagePackSerializerOptions options); + { + MethodBuilder method = typeBuilder.DefineMethod( + "Serialize", + MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual, + null, + new Type[] { typeof(MessagePackWriter).MakeByRefType(), enumType, typeof(MessagePackSerializerOptions) }); + + ILGenerator il = method.GetILGenerator(); + il.Emit(OpCodes.Ldarg_1); + il.Emit(OpCodes.Ldarg_2); + il.Emit(OpCodes.Call, typeof(MessagePackWriter).GetRuntimeMethod(nameof(MessagePackWriter.Write), new[] { underlyingType })); + il.Emit(OpCodes.Ret); + } + + // T Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options); + { + MethodBuilder method = typeBuilder.DefineMethod( + "Deserialize", + MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual, + enumType, + new Type[] { typeof(MessagePackReader).MakeByRefType(), typeof(MessagePackSerializerOptions) }); + + ILGenerator il = method.GetILGenerator(); + il.Emit(OpCodes.Ldarg_1); + il.Emit(OpCodes.Call, typeof(MessagePackReader).GetRuntimeMethod("Read" + underlyingType.Name, Type.EmptyTypes)); + il.Emit(OpCodes.Ret); + } + + return typeBuilder.CreateTypeInfo(); + } + } +} + +#endif diff --git a/Assets/Scripts/MessagePack/Resolvers/DynamicEnumResolver.cs.meta b/Assets/Scripts/MessagePack/Resolvers/DynamicEnumResolver.cs.meta new file mode 100644 index 000000000..0a79f17c7 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/DynamicEnumResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 56f454cdc164d6a03bcb2dd11fa9e73a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Resolvers/DynamicGenericResolver.cs b/Assets/Scripts/MessagePack/Resolvers/DynamicGenericResolver.cs new file mode 100644 index 000000000..94d72820c --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/DynamicGenericResolver.cs @@ -0,0 +1,284 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using System.Threading.Tasks; +using MessagePack.Formatters; +using MessagePack.Internal; + +#pragma warning disable SA1403 // File may only contain a single namespace + +namespace MessagePack.Resolvers +{ + public sealed class DynamicGenericResolver : IFormatterResolver + { + /// + /// The singleton instance that can be used. + /// + public static readonly DynamicGenericResolver Instance = new DynamicGenericResolver(); + + private DynamicGenericResolver() + { + } + + public IMessagePackFormatter GetFormatter() + { + return FormatterCache.Formatter; + } + + private static class FormatterCache + { + public static readonly IMessagePackFormatter Formatter; + + static FormatterCache() + { + Formatter = (IMessagePackFormatter)DynamicGenericResolverGetFormatterHelper.GetFormatter(typeof(T)); + } + } + } +} + +namespace MessagePack.Internal +{ + internal static class DynamicGenericResolverGetFormatterHelper + { + private static readonly Dictionary FormatterMap = new Dictionary() + { + { typeof(List<>), typeof(ListFormatter<>) }, + { typeof(LinkedList<>), typeof(LinkedListFormatter<>) }, + { typeof(Queue<>), typeof(QueueFormatter<>) }, + { typeof(Stack<>), typeof(StackFormatter<>) }, + { typeof(HashSet<>), typeof(HashSetFormatter<>) }, + { typeof(ReadOnlyCollection<>), typeof(ReadOnlyCollectionFormatter<>) }, + { typeof(IList<>), typeof(InterfaceListFormatter2<>) }, + { typeof(ICollection<>), typeof(InterfaceCollectionFormatter2<>) }, + { typeof(IEnumerable<>), typeof(InterfaceEnumerableFormatter<>) }, + { typeof(Dictionary<,>), typeof(DictionaryFormatter<,>) }, + { typeof(IDictionary<,>), typeof(InterfaceDictionaryFormatter<,>) }, + { typeof(SortedDictionary<,>), typeof(SortedDictionaryFormatter<,>) }, + { typeof(SortedList<,>), typeof(SortedListFormatter<,>) }, + { typeof(ILookup<,>), typeof(InterfaceLookupFormatter<,>) }, + { typeof(IGrouping<,>), typeof(InterfaceGroupingFormatter<,>) }, + { typeof(ObservableCollection<>), typeof(ObservableCollectionFormatter<>) }, + { typeof(ReadOnlyObservableCollection<>), typeof(ReadOnlyObservableCollectionFormatter<>) }, + { typeof(IReadOnlyList<>), typeof(InterfaceReadOnlyListFormatter<>) }, + { typeof(IReadOnlyCollection<>), typeof(InterfaceReadOnlyCollectionFormatter<>) }, + { typeof(ISet<>), typeof(InterfaceSetFormatter<>) }, + { typeof(System.Collections.Concurrent.ConcurrentBag<>), typeof(ConcurrentBagFormatter<>) }, + { typeof(System.Collections.Concurrent.ConcurrentQueue<>), typeof(ConcurrentQueueFormatter<>) }, + { typeof(System.Collections.Concurrent.ConcurrentStack<>), typeof(ConcurrentStackFormatter<>) }, + { typeof(ReadOnlyDictionary<,>), typeof(ReadOnlyDictionaryFormatter<,>) }, + { typeof(IReadOnlyDictionary<,>), typeof(InterfaceReadOnlyDictionaryFormatter<,>) }, + { typeof(System.Collections.Concurrent.ConcurrentDictionary<,>), typeof(ConcurrentDictionaryFormatter<,>) }, + { typeof(Lazy<>), typeof(LazyFormatter<>) }, + }; + + // Reduce IL2CPP code generate size(don't write long code in ) + internal static object GetFormatter(Type t) + { + TypeInfo ti = t.GetTypeInfo(); + + if (t.IsArray) + { + var rank = t.GetArrayRank(); + if (rank == 1) + { + if (t.GetElementType() == typeof(byte)) + { + // byte[] is also supported in builtin formatter. + return ByteArrayFormatter.Instance; + } + + return Activator.CreateInstance(typeof(ArrayFormatter<>).MakeGenericType(t.GetElementType())); + } + else if (rank == 2) + { + return Activator.CreateInstance(typeof(TwoDimensionalArrayFormatter<>).MakeGenericType(t.GetElementType())); + } + else if (rank == 3) + { + return Activator.CreateInstance(typeof(ThreeDimensionalArrayFormatter<>).MakeGenericType(t.GetElementType())); + } + else if (rank == 4) + { + return Activator.CreateInstance(typeof(FourDimensionalArrayFormatter<>).MakeGenericType(t.GetElementType())); + } + else + { + return null; // not supported built-in + } + } + else if (ti.IsGenericType) + { + Type genericType = ti.GetGenericTypeDefinition(); + TypeInfo genericTypeInfo = genericType.GetTypeInfo(); + var isNullable = genericTypeInfo.IsNullable(); + Type nullableElementType = isNullable ? ti.GenericTypeArguments[0] : null; + + if (genericType == typeof(KeyValuePair<,>)) + { + return CreateInstance(typeof(KeyValuePairFormatter<,>), ti.GenericTypeArguments); + } + + // Tuple + else if (ti.FullName.StartsWith("System.Tuple")) + { + Type tupleFormatterType = null; + switch (ti.GenericTypeArguments.Length) + { + case 1: + tupleFormatterType = typeof(TupleFormatter<>); + break; + case 2: + tupleFormatterType = typeof(TupleFormatter<,>); + break; + case 3: + tupleFormatterType = typeof(TupleFormatter<,,>); + break; + case 4: + tupleFormatterType = typeof(TupleFormatter<,,,>); + break; + case 5: + tupleFormatterType = typeof(TupleFormatter<,,,,>); + break; + case 6: + tupleFormatterType = typeof(TupleFormatter<,,,,,>); + break; + case 7: + tupleFormatterType = typeof(TupleFormatter<,,,,,,>); + break; + case 8: + tupleFormatterType = typeof(TupleFormatter<,,,,,,,>); + break; + default: + break; + } + + return CreateInstance(tupleFormatterType, ti.GenericTypeArguments); + } + + // ValueTuple + else if (ti.FullName.StartsWith("System.ValueTuple")) + { + Type tupleFormatterType = null; + switch (ti.GenericTypeArguments.Length) + { + case 1: + tupleFormatterType = typeof(ValueTupleFormatter<>); + break; + case 2: + tupleFormatterType = typeof(ValueTupleFormatter<,>); + break; + case 3: + tupleFormatterType = typeof(ValueTupleFormatter<,,>); + break; + case 4: + tupleFormatterType = typeof(ValueTupleFormatter<,,,>); + break; + case 5: + tupleFormatterType = typeof(ValueTupleFormatter<,,,,>); + break; + case 6: + tupleFormatterType = typeof(ValueTupleFormatter<,,,,,>); + break; + case 7: + tupleFormatterType = typeof(ValueTupleFormatter<,,,,,,>); + break; + case 8: + tupleFormatterType = typeof(ValueTupleFormatter<,,,,,,,>); + break; + default: + break; + } + + return CreateInstance(tupleFormatterType, ti.GenericTypeArguments); + } + + // ArraySegement + else if (genericType == typeof(ArraySegment<>)) + { + if (ti.GenericTypeArguments[0] == typeof(byte)) + { + return ByteArraySegmentFormatter.Instance; + } + else + { + return CreateInstance(typeof(ArraySegmentFormatter<>), ti.GenericTypeArguments); + } + } + + // Standard Nullable + else if (isNullable) + { + return CreateInstance(typeof(NullableFormatter<>), new[] { nullableElementType }); + } + + // Mapped formatter + else + { + Type formatterType; + if (FormatterMap.TryGetValue(genericType, out formatterType)) + { + return CreateInstance(formatterType, ti.GenericTypeArguments); + } + + // generic collection + else if (ti.GenericTypeArguments.Length == 1 + && ti.ImplementedInterfaces.Any(x => x.GetTypeInfo().IsConstructedGenericType() && x.GetGenericTypeDefinition() == typeof(ICollection<>)) + && ti.DeclaredConstructors.Any(x => x.GetParameters().Length == 0)) + { + Type elemType = ti.GenericTypeArguments[0]; + return CreateInstance(typeof(GenericCollectionFormatter<,>), new[] { elemType, t }); + } + + // generic dictionary + else if (ti.GenericTypeArguments.Length == 2 + && ti.ImplementedInterfaces.Any(x => x.GetTypeInfo().IsConstructedGenericType() && x.GetGenericTypeDefinition() == typeof(IDictionary<,>)) + && ti.DeclaredConstructors.Any(x => x.GetParameters().Length == 0)) + { + Type keyType = ti.GenericTypeArguments[0]; + Type valueType = ti.GenericTypeArguments[1]; + return CreateInstance(typeof(GenericDictionaryFormatter<,,>), new[] { keyType, valueType, t }); + } + } + } + else if (ti.IsEnum) + { + return CreateInstance(typeof(GenericEnumFormatter<>), new[] { t }); + } + else + { + // NonGeneric Collection + if (t == typeof(IList)) + { + return NonGenericInterfaceListFormatter.Instance; + } + else if (t == typeof(IDictionary)) + { + return NonGenericInterfaceDictionaryFormatter.Instance; + } + + if (typeof(IList).GetTypeInfo().IsAssignableFrom(ti) && ti.DeclaredConstructors.Any(x => x.GetParameters().Length == 0)) + { + return Activator.CreateInstance(typeof(NonGenericListFormatter<>).MakeGenericType(t)); + } + else if (typeof(IDictionary).GetTypeInfo().IsAssignableFrom(ti) && ti.DeclaredConstructors.Any(x => x.GetParameters().Length == 0)) + { + return Activator.CreateInstance(typeof(NonGenericDictionaryFormatter<>).MakeGenericType(t)); + } + } + + return null; + } + + private static object CreateInstance(Type genericType, Type[] genericTypeArguments, params object[] arguments) + { + return Activator.CreateInstance(genericType.MakeGenericType(genericTypeArguments), arguments); + } + } +} diff --git a/Assets/Scripts/MessagePack/Resolvers/DynamicGenericResolver.cs.meta b/Assets/Scripts/MessagePack/Resolvers/DynamicGenericResolver.cs.meta new file mode 100644 index 000000000..ce3133db6 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/DynamicGenericResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c97d6b550962b8536b1363db3bd98cae +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs b/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs new file mode 100644 index 000000000..90a6772ed --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs @@ -0,0 +1,2071 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +#if !(UNITY_2018_3_OR_NEWER && NET_STANDARD_2_0) + +using System; +using System.Buffers; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Reflection.Emit; +using System.Runtime.Serialization; +using System.Text.RegularExpressions; +using System.Threading; +using MessagePack.Formatters; +using MessagePack.Internal; + +#pragma warning disable SA1403 // File may only contain a single namespace + +namespace MessagePack.Resolvers +{ + /// + /// ObjectResolver by dynamic code generation. + /// + public sealed class DynamicObjectResolver : IFormatterResolver + { + private const string ModuleName = "MessagePack.Resolvers.DynamicObjectResolver"; + + /// + /// The singleton instance that can be used. + /// + public static readonly DynamicObjectResolver Instance; + + /// + /// A instance with this formatter pre-configured. + /// + public static readonly MessagePackSerializerOptions Options; + + internal static readonly DynamicAssembly DynamicAssembly; + + static DynamicObjectResolver() + { + Instance = new DynamicObjectResolver(); + Options = new MessagePackSerializerOptions(Instance); + DynamicAssembly = new DynamicAssembly(ModuleName); + } + + private DynamicObjectResolver() + { + } + +#if NETFRAMEWORK + public AssemblyBuilder Save() + { + return DynamicAssembly.Save(); + } +#endif + + public IMessagePackFormatter GetFormatter() + { + return FormatterCache.Formatter; + } + + private static class FormatterCache + { + public static readonly IMessagePackFormatter Formatter; + + static FormatterCache() + { + TypeInfo ti = typeof(T).GetTypeInfo(); + + if (ti.IsInterface) + { + return; + } + + if (ti.IsNullable()) + { + ti = ti.GenericTypeArguments[0].GetTypeInfo(); + + var innerFormatter = DynamicObjectResolver.Instance.GetFormatterDynamic(ti.AsType()); + if (innerFormatter == null) + { + return; + } + + Formatter = (IMessagePackFormatter)Activator.CreateInstance(typeof(StaticNullableFormatter<>).MakeGenericType(ti.AsType()), new object[] { innerFormatter }); + return; + } + + if (ti.IsAnonymous()) + { + Formatter = (IMessagePackFormatter)DynamicObjectTypeBuilder.BuildFormatterToDynamicMethod(typeof(T), true, true, false); + return; + } + + TypeInfo formatterTypeInfo = DynamicObjectTypeBuilder.BuildType(DynamicAssembly, typeof(T), false, false); + if (formatterTypeInfo == null) + { + return; + } + + Formatter = (IMessagePackFormatter)Activator.CreateInstance(formatterTypeInfo.AsType()); + } + } + } + + /// + /// ObjectResolver by dynamic code generation, allow private member. + /// + public sealed class DynamicObjectResolverAllowPrivate : IFormatterResolver + { + public static readonly DynamicObjectResolverAllowPrivate Instance = new DynamicObjectResolverAllowPrivate(); + + private DynamicObjectResolverAllowPrivate() + { + } + + public IMessagePackFormatter GetFormatter() + { + return FormatterCache.Formatter; + } + + private static class FormatterCache + { + internal static readonly IMessagePackFormatter Formatter; + + static FormatterCache() + { + TypeInfo ti = typeof(T).GetTypeInfo(); + + if (ti.IsInterface) + { + return; + } + + if (ti.IsNullable()) + { + ti = ti.GenericTypeArguments[0].GetTypeInfo(); + + var innerFormatter = DynamicObjectResolverAllowPrivate.Instance.GetFormatterDynamic(ti.AsType()); + if (innerFormatter == null) + { + return; + } + + Formatter = (IMessagePackFormatter)Activator.CreateInstance(typeof(StaticNullableFormatter<>).MakeGenericType(ti.AsType()), new object[] { innerFormatter }); + return; + } + + if (ti.IsAnonymous()) + { + Formatter = (IMessagePackFormatter)DynamicObjectTypeBuilder.BuildFormatterToDynamicMethod(typeof(T), true, true, false); + } + else + { + Formatter = (IMessagePackFormatter)DynamicObjectTypeBuilder.BuildFormatterToDynamicMethod(typeof(T), false, false, true); + } + } + } + } + + /// + /// ObjectResolver by dynamic code generation, no needs MessagePackObject attribute and serialized key as string. + /// + public sealed class DynamicContractlessObjectResolver : IFormatterResolver + { + public static readonly DynamicContractlessObjectResolver Instance = new DynamicContractlessObjectResolver(); + + private const string ModuleName = "MessagePack.Resolvers.DynamicContractlessObjectResolver"; + + private static readonly DynamicAssembly DynamicAssembly; + + private DynamicContractlessObjectResolver() + { + } + + static DynamicContractlessObjectResolver() + { + DynamicAssembly = new DynamicAssembly(ModuleName); + } + +#if NETFRAMEWORK + public AssemblyBuilder Save() + { + return DynamicAssembly.Save(); + } +#endif + + public IMessagePackFormatter GetFormatter() + { + return FormatterCache.Formatter; + } + + private static class FormatterCache + { + public static readonly IMessagePackFormatter Formatter; + + static FormatterCache() + { + if (typeof(T) == typeof(object)) + { + return; + } + + TypeInfo ti = typeof(T).GetTypeInfo(); + + if (ti.IsInterface) + { + return; + } + + if (ti.IsNullable()) + { + ti = ti.GenericTypeArguments[0].GetTypeInfo(); + + var innerFormatter = DynamicContractlessObjectResolver.Instance.GetFormatterDynamic(ti.AsType()); + if (innerFormatter == null) + { + return; + } + + Formatter = (IMessagePackFormatter)Activator.CreateInstance(typeof(StaticNullableFormatter<>).MakeGenericType(ti.AsType()), new object[] { innerFormatter }); + return; + } + + if (ti.IsAnonymous()) + { + Formatter = (IMessagePackFormatter)DynamicObjectTypeBuilder.BuildFormatterToDynamicMethod(typeof(T), true, true, false); + return; + } + + TypeInfo formatterTypeInfo = DynamicObjectTypeBuilder.BuildType(DynamicAssembly, typeof(T), true, true); + if (formatterTypeInfo == null) + { + return; + } + + Formatter = (IMessagePackFormatter)Activator.CreateInstance(formatterTypeInfo.AsType()); + } + } + } + + /// + /// ObjectResolver by dynamic code generation, no needs MessagePackObject attribute and serialized key as string, allow private member. + /// + public sealed class DynamicContractlessObjectResolverAllowPrivate : IFormatterResolver + { + public static readonly DynamicContractlessObjectResolverAllowPrivate Instance = new DynamicContractlessObjectResolverAllowPrivate(); + + public IMessagePackFormatter GetFormatter() + { + return FormatterCache.Formatter; + } + + private static class FormatterCache + { + internal static readonly IMessagePackFormatter Formatter; + + static FormatterCache() + { + if (typeof(T) == typeof(object)) + { + return; + } + + TypeInfo ti = typeof(T).GetTypeInfo(); + + if (ti.IsInterface) + { + return; + } + + if (ti.IsNullable()) + { + ti = ti.GenericTypeArguments[0].GetTypeInfo(); + + var innerFormatter = DynamicContractlessObjectResolverAllowPrivate.Instance.GetFormatterDynamic(ti.AsType()); + if (innerFormatter == null) + { + return; + } + + Formatter = (IMessagePackFormatter)Activator.CreateInstance(typeof(StaticNullableFormatter<>).MakeGenericType(ti.AsType()), new object[] { innerFormatter }); + return; + } + + if (ti.IsAnonymous()) + { + Formatter = (IMessagePackFormatter)DynamicObjectTypeBuilder.BuildFormatterToDynamicMethod(typeof(T), true, true, false); + } + else + { + Formatter = (IMessagePackFormatter)DynamicObjectTypeBuilder.BuildFormatterToDynamicMethod(typeof(T), true, true, true); + } + } + } + } +} + +namespace MessagePack.Internal +{ + internal static class DynamicObjectTypeBuilder + { +#if !UNITY_2018_3_OR_NEWER + private static readonly Regex SubtractFullNameRegex = new Regex(@", Version=\d+.\d+.\d+.\d+, Culture=\w+, PublicKeyToken=\w+", RegexOptions.Compiled); +#else + static readonly Regex SubtractFullNameRegex = new Regex(@", Version=\d+.\d+.\d+.\d+, Culture=\w+, PublicKeyToken=\w+"); +#endif + + private static int nameSequence = 0; + + private static HashSet ignoreTypes = new HashSet + { + { typeof(object) }, + { typeof(short) }, + { typeof(int) }, + { typeof(long) }, + { typeof(ushort) }, + { typeof(uint) }, + { typeof(ulong) }, + { typeof(float) }, + { typeof(double) }, + { typeof(bool) }, + { typeof(byte) }, + { typeof(sbyte) }, + { typeof(decimal) }, + { typeof(char) }, + { typeof(string) }, + { typeof(System.Guid) }, + { typeof(System.TimeSpan) }, + { typeof(System.DateTime) }, + { typeof(System.DateTimeOffset) }, + { typeof(MessagePack.Nil) }, + }; + + public static TypeInfo BuildType(DynamicAssembly assembly, Type type, bool forceStringKey, bool contractless) + { + if (ignoreTypes.Contains(type)) + { + return null; + } + + var serializationInfo = MessagePack.Internal.ObjectSerializationInfo.CreateOrNull(type, forceStringKey, contractless, false); + if (serializationInfo == null) + { + return null; + } + + if (!(type.IsPublic || type.IsNestedPublic)) + { + throw new MessagePackSerializationException("Building dynamic formatter only allows public type. Type: " + type.FullName); + } + + Type formatterType = typeof(IMessagePackFormatter<>).MakeGenericType(type); + TypeBuilder typeBuilder = assembly.DefineType("MessagePack.Formatters." + SubtractFullNameRegex.Replace(type.FullName, string.Empty).Replace(".", "_") + "Formatter" + Interlocked.Increment(ref nameSequence), TypeAttributes.Public | TypeAttributes.Sealed, null, new[] { formatterType }); + + FieldBuilder stringByteKeysField = null; + Dictionary customFormatterLookup = null; + + // string key needs string->int mapper for deserialize switch statement + if (serializationInfo.IsStringKey) + { + ConstructorBuilder method = typeBuilder.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, Type.EmptyTypes); + stringByteKeysField = typeBuilder.DefineField("stringByteKeys", typeof(byte[][]), FieldAttributes.Private | FieldAttributes.InitOnly); + + ILGenerator il = method.GetILGenerator(); + BuildConstructor(type, serializationInfo, method, stringByteKeysField, il); + customFormatterLookup = BuildCustomFormatterField(typeBuilder, serializationInfo, il); + il.Emit(OpCodes.Ret); + } + else + { + ConstructorBuilder method = typeBuilder.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, Type.EmptyTypes); + ILGenerator il = method.GetILGenerator(); + il.EmitLoadThis(); + il.Emit(OpCodes.Call, objectCtor); + customFormatterLookup = BuildCustomFormatterField(typeBuilder, serializationInfo, il); + il.Emit(OpCodes.Ret); + } + + { + MethodBuilder method = typeBuilder.DefineMethod( + "Serialize", + MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual, + returnType: null, + parameterTypes: new Type[] { typeof(MessagePackWriter).MakeByRefType(), type, typeof(MessagePackSerializerOptions) }); + method.DefineParameter(1, ParameterAttributes.None, "writer"); + method.DefineParameter(2, ParameterAttributes.None, "value"); + method.DefineParameter(3, ParameterAttributes.None, "options"); + + ILGenerator il = method.GetILGenerator(); + BuildSerialize( + type, + serializationInfo, + il, + () => + { + il.EmitLoadThis(); + il.EmitLdfld(stringByteKeysField); + }, + (index, member) => + { + FieldInfo fi; + if (!customFormatterLookup.TryGetValue(member, out fi)) + { + return null; + } + + return () => + { + il.EmitLoadThis(); + il.EmitLdfld(fi); + }; + }, + 1); + } + + { + MethodBuilder method = typeBuilder.DefineMethod( + "Deserialize", + MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual, + type, + new Type[] { refMessagePackReader, typeof(MessagePackSerializerOptions) }); + method.DefineParameter(1, ParameterAttributes.None, "reader"); + method.DefineParameter(2, ParameterAttributes.None, "options"); + + ILGenerator il = method.GetILGenerator(); + BuildDeserialize( + type, + serializationInfo, + il, + (index, member) => + { + FieldInfo fi; + if (!customFormatterLookup.TryGetValue(member, out fi)) + { + return null; + } + + return () => + { + il.EmitLoadThis(); + il.EmitLdfld(fi); + }; + }, + 1); // firstArgIndex:0 is this. + } + + return typeBuilder.CreateTypeInfo(); + } + + public static object BuildFormatterToDynamicMethod(Type type, bool forceStringKey, bool contractless, bool allowPrivate) + { + var serializationInfo = ObjectSerializationInfo.CreateOrNull(type, forceStringKey, contractless, allowPrivate); + if (serializationInfo == null) + { + return null; + } + + // internal delegate void AnonymousSerializeFunc(byte[][] stringByteKeysField, object[] customFormatters, ref MessagePackWriter writer, T value, MessagePackSerializerOptions options); + // internal delegate T AnonymousDeserializeFunc(object[] customFormatters, ref MessagePackReader reader, MessagePackSerializerOptions options); + var serialize = new DynamicMethod("Serialize", null, new[] { typeof(byte[][]), typeof(object[]), typeof(MessagePackWriter).MakeByRefType(), type, typeof(MessagePackSerializerOptions) }, type, true); + DynamicMethod deserialize = null; + + List stringByteKeysField = new List(); + List serializeCustomFormatters = new List(); + List deserializeCustomFormatters = new List(); + + if (serializationInfo.IsStringKey) + { + var i = 0; + foreach (ObjectSerializationInfo.EmittableMember item in serializationInfo.Members.Where(x => x.IsReadable)) + { + stringByteKeysField.Add(Utilities.GetWriterBytes(item.StringKey, (ref MessagePackWriter writer, string arg) => writer.Write(arg))); + i++; + } + } + + foreach (ObjectSerializationInfo.EmittableMember item in serializationInfo.Members.Where(x => x.IsReadable)) + { + MessagePackFormatterAttribute attr = item.GetMessagePackFormatterAttribute(); + if (attr != null) + { + var formatter = Activator.CreateInstance(attr.FormatterType, attr.Arguments); + serializeCustomFormatters.Add(formatter); + } + else + { + serializeCustomFormatters.Add(null); + } + } + + foreach (ObjectSerializationInfo.EmittableMember item in serializationInfo.Members) + { + // not only for writable because for use ctor. + MessagePackFormatterAttribute attr = item.GetMessagePackFormatterAttribute(); + if (attr != null) + { + var formatter = Activator.CreateInstance(attr.FormatterType, attr.Arguments); + deserializeCustomFormatters.Add(formatter); + } + else + { + deserializeCustomFormatters.Add(null); + } + } + + { + ILGenerator il = serialize.GetILGenerator(); + BuildSerialize( + type, + serializationInfo, + il, + () => + { + il.EmitLdarg(0); + }, + (index, member) => + { + if (serializeCustomFormatters.Count == 0) + { + return null; + } + + if (serializeCustomFormatters[index] == null) + { + return null; + } + + return () => + { + il.EmitLdarg(1); // read object[] + il.EmitLdc_I4(index); + il.Emit(OpCodes.Ldelem_Ref); // object + il.Emit(OpCodes.Castclass, serializeCustomFormatters[index].GetType()); + }; + }, + 2); // 0, 1 is parameter. + } + + if (serializationInfo.IsStruct || serializationInfo.BestmatchConstructor != null) + { + deserialize = new DynamicMethod("Deserialize", type, new[] { typeof(object[]), refMessagePackReader, typeof(MessagePackSerializerOptions) }, type, true); + + ILGenerator il = deserialize.GetILGenerator(); + BuildDeserialize( + type, + serializationInfo, + il, + (index, member) => + { + if (deserializeCustomFormatters.Count == 0) + { + return null; + } + + if (deserializeCustomFormatters[index] == null) + { + return null; + } + + return () => + { + il.EmitLdarg(0); // read object[] + il.EmitLdc_I4(index); + il.Emit(OpCodes.Ldelem_Ref); // object + il.Emit(OpCodes.Castclass, deserializeCustomFormatters[index].GetType()); + }; + }, + 1); + } + + object serializeDelegate = serialize.CreateDelegate(typeof(AnonymousSerializeFunc<>).MakeGenericType(type)); + object deserializeDelegate = (deserialize == null) + ? (object)null + : (object)deserialize.CreateDelegate(typeof(AnonymousDeserializeFunc<>).MakeGenericType(type)); + var resultFormatter = Activator.CreateInstance( + typeof(AnonymousSerializableFormatter<>).MakeGenericType(type), + new[] { stringByteKeysField.ToArray(), serializeCustomFormatters.ToArray(), deserializeCustomFormatters.ToArray(), serializeDelegate, deserializeDelegate }); + return resultFormatter; + } + + private static void BuildConstructor(Type type, ObjectSerializationInfo info, ConstructorInfo method, FieldBuilder stringByteKeysField, ILGenerator il) + { + il.EmitLoadThis(); + il.Emit(OpCodes.Call, objectCtor); + + var writeCount = info.Members.Count(x => x.IsReadable); + il.EmitLoadThis(); + il.EmitLdc_I4(writeCount); + il.Emit(OpCodes.Newarr, typeof(byte[])); + + var i = 0; + foreach (ObjectSerializationInfo.EmittableMember item in info.Members.Where(x => x.IsReadable)) + { + il.Emit(OpCodes.Dup); + il.EmitLdc_I4(i); + il.Emit(OpCodes.Ldstr, item.StringKey); + il.EmitCall(CodeGenHelpersTypeInfo.GetEncodedStringBytes); + il.Emit(OpCodes.Stelem_Ref); + i++; + } + + il.Emit(OpCodes.Stfld, stringByteKeysField); + } + + private static Dictionary BuildCustomFormatterField(TypeBuilder builder, ObjectSerializationInfo info, ILGenerator il) + { + Dictionary dict = new Dictionary(); + foreach (ObjectSerializationInfo.EmittableMember item in info.Members.Where(x => x.IsReadable || x.IsWritable)) + { + MessagePackFormatterAttribute attr = item.GetMessagePackFormatterAttribute(); + if (attr != null) + { + FieldBuilder f = builder.DefineField(item.Name + "_formatter", attr.FormatterType, FieldAttributes.Private | FieldAttributes.InitOnly); + + var bindingFlags = (int)(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + + LocalBuilder attrVar = il.DeclareLocal(typeof(MessagePackFormatterAttribute)); + + il.Emit(OpCodes.Ldtoken, info.Type); + il.EmitCall(EmitInfo.GetTypeFromHandle); + il.Emit(OpCodes.Ldstr, item.Name); + il.EmitLdc_I4(bindingFlags); + if (item.IsProperty) + { + il.EmitCall(EmitInfo.TypeGetProperty); + } + else + { + il.EmitCall(EmitInfo.TypeGetField); + } + + il.EmitTrue(); + il.EmitCall(EmitInfo.GetCustomAttributeMessagePackFormatterAttribute); + il.EmitStloc(attrVar); + + il.EmitLoadThis(); + + il.EmitLdloc(attrVar); + il.EmitCall(EmitInfo.MessagePackFormatterAttr.FormatterType); + il.EmitLdloc(attrVar); + il.EmitCall(EmitInfo.MessagePackFormatterAttr.Arguments); + il.EmitCall(EmitInfo.ActivatorCreateInstance); + + il.Emit(OpCodes.Castclass, attr.FormatterType); + il.Emit(OpCodes.Stfld, f); + + dict.Add(item, f); + } + } + + return dict; + } + + // void Serialize(ref [arg:1]MessagePackWriter writer, [arg:2]T value, [arg:3]MessagePackSerializerOptions options); + private static void BuildSerialize(Type type, ObjectSerializationInfo info, ILGenerator il, Action emitStringByteKeys, Func tryEmitLoadCustomFormatter, int firstArgIndex) + { + var argWriter = new ArgumentField(il, firstArgIndex); + var argValue = new ArgumentField(il, firstArgIndex + 1, type); + var argOptions = new ArgumentField(il, firstArgIndex + 2); + + // if(value == null) return WriteNil + if (type.GetTypeInfo().IsClass) + { + Label elseBody = il.DefineLabel(); + + argValue.EmitLoad(); + il.Emit(OpCodes.Brtrue_S, elseBody); + argWriter.EmitLoad(); + il.EmitCall(MessagePackWriterTypeInfo.WriteNil); + il.Emit(OpCodes.Ret); + + il.MarkLabel(elseBody); + } + + // IMessagePackSerializationCallbackReceiver.OnBeforeSerialize() + if (type.GetTypeInfo().ImplementedInterfaces.Any(x => x == typeof(IMessagePackSerializationCallbackReceiver))) + { + // call directly + MethodInfo[] runtimeMethods = type.GetRuntimeMethods().Where(x => x.Name == "OnBeforeSerialize").ToArray(); + if (runtimeMethods.Length == 1) + { + argValue.EmitLoad(); + il.Emit(OpCodes.Call, runtimeMethods[0]); // don't use EmitCall helper(must use 'Call') + } + else + { + argValue.EmitLdarg(); // force ldarg + il.EmitBoxOrDoNothing(type); + il.EmitCall(onBeforeSerialize); + } + } + + // IFormatterResolver resolver = options.Resolver; + LocalBuilder localResolver = il.DeclareLocal(typeof(IFormatterResolver)); + argOptions.EmitLoad(); + il.EmitCall(getResolverFromOptions); + il.EmitStloc(localResolver); + + if (info.IsIntKey) + { + // use Array + var maxKey = info.Members.Where(x => x.IsReadable).Select(x => x.IntKey).DefaultIfEmpty(-1).Max(); + var intKeyMap = info.Members.Where(x => x.IsReadable).ToDictionary(x => x.IntKey); + + var len = maxKey + 1; + argWriter.EmitLoad(); + il.EmitLdc_I4(len); + il.EmitCall(MessagePackWriterTypeInfo.WriteArrayHeader); + + var index = 0; + for (int i = 0; i <= maxKey; i++) + { + ObjectSerializationInfo.EmittableMember member; + if (intKeyMap.TryGetValue(i, out member)) + { + EmitSerializeValue(il, type.GetTypeInfo(), member, index++, tryEmitLoadCustomFormatter, argWriter, argValue, argOptions, localResolver); + } + else + { + // Write Nil as Blanc + argWriter.EmitLoad(); + il.EmitCall(MessagePackWriterTypeInfo.WriteNil); + } + } + } + else + { + // use Map + var writeCount = info.Members.Count(x => x.IsReadable); + + argWriter.EmitLoad(); + il.EmitLdc_I4(writeCount); + ////if (writeCount <= MessagePackRange.MaxFixMapCount) + ////{ + //// il.EmitCall(MessagePackWriterTypeInfo.WriteFixedMapHeaderUnsafe); + ////} + ////else + { + il.EmitCall(MessagePackWriterTypeInfo.WriteMapHeader); + } + + var index = 0; + foreach (ObjectSerializationInfo.EmittableMember item in info.Members.Where(x => x.IsReadable)) + { + argWriter.EmitLoad(); + emitStringByteKeys(); + il.EmitLdc_I4(index); + il.Emit(OpCodes.Ldelem_Ref); + il.Emit(OpCodes.Call, ReadOnlySpanFromByteArray); // convert byte[] to ReadOnlySpan + + // Optimize, WriteRaw(Unity, large) or UnsafeMemory32/64.WriteRawX +#if !UNITY_2018_3_OR_NEWER + var valueLen = CodeGenHelpers.GetEncodedStringBytes(item.StringKey).Length; + if (valueLen <= MessagePackRange.MaxFixStringLength) + { + if (UnsafeMemory.Is32Bit) + { + il.EmitCall(typeof(UnsafeMemory32).GetRuntimeMethod("WriteRaw" + valueLen, new[] { typeof(MessagePackWriter).MakeByRefType(), typeof(ReadOnlySpan) })); + } + else + { + il.EmitCall(typeof(UnsafeMemory64).GetRuntimeMethod("WriteRaw" + valueLen, new[] { typeof(MessagePackWriter).MakeByRefType(), typeof(ReadOnlySpan) })); + } + } + else +#endif + { + il.EmitCall(MessagePackWriterTypeInfo.WriteRaw); + } + + EmitSerializeValue(il, type.GetTypeInfo(), item, index, tryEmitLoadCustomFormatter, argWriter, argValue, argOptions, localResolver); + index++; + } + } + + il.Emit(OpCodes.Ret); + } + + private static void EmitSerializeValue(ILGenerator il, TypeInfo type, ObjectSerializationInfo.EmittableMember member, int index, Func tryEmitLoadCustomFormatter, ArgumentField argWriter, ArgumentField argValue, ArgumentField argOptions, LocalBuilder localResolver) + { + Label endLabel = il.DefineLabel(); + Type t = member.Type; + Action emitter = tryEmitLoadCustomFormatter(index, member); + if (emitter != null) + { + emitter(); + argWriter.EmitLoad(); + argValue.EmitLoad(); + member.EmitLoadValue(il); + argOptions.EmitLoad(); + il.EmitCall(getSerialize(t)); + } + else if (IsOptimizeTargetType(t)) + { + if (!t.GetTypeInfo().IsValueType) + { + // As a nullable type (e.g. byte[] and string) we need to call WriteNil for null values. + Label writeNonNilValueLabel = il.DefineLabel(); + LocalBuilder memberValue = il.DeclareLocal(t); + argValue.EmitLoad(); + member.EmitLoadValue(il); + il.Emit(OpCodes.Dup); + il.EmitStloc(memberValue); + il.Emit(OpCodes.Brtrue, writeNonNilValueLabel); + argWriter.EmitLoad(); + il.EmitCall(MessagePackWriterTypeInfo.WriteNil); + il.Emit(OpCodes.Br, endLabel); + + il.MarkLabel(writeNonNilValueLabel); + argWriter.EmitLoad(); + il.EmitLdloc(memberValue); + } + else + { + argWriter.EmitLoad(); + argValue.EmitLoad(); + member.EmitLoadValue(il); + } + + if (t == typeof(byte[])) + { + il.EmitCall(ReadOnlySpanFromByteArray); + il.EmitCall(MessagePackWriterTypeInfo.WriteBytes); + } + else + { + il.EmitCall(typeof(MessagePackWriter).GetRuntimeMethod("Write", new Type[] { t })); + } + } + else + { + il.EmitLdloc(localResolver); + il.Emit(OpCodes.Call, getFormatterWithVerify.MakeGenericMethod(t)); + + argWriter.EmitLoad(); + argValue.EmitLoad(); + member.EmitLoadValue(il); + argOptions.EmitLoad(); + il.EmitCall(getSerialize(t)); + } + + il.MarkLabel(endLabel); + } + + // T Deserialize([arg:1]ref MessagePackReader reader, [arg:2]MessagePackSerializerOptions options); + private static void BuildDeserialize(Type type, ObjectSerializationInfo info, ILGenerator il, Func tryEmitLoadCustomFormatter, int firstArgIndex) + { + var reader = new ArgumentField(il, firstArgIndex, @ref: true); + var argOptions = new ArgumentField(il, firstArgIndex + 1); + + // if(reader.TryReadNil()) { return null; } + Label falseLabel = il.DefineLabel(); + reader.EmitLdarg(); + il.EmitCall(MessagePackReaderTypeInfo.TryReadNil); + il.Emit(OpCodes.Brfalse_S, falseLabel); + if (type.GetTypeInfo().IsClass) + { + il.Emit(OpCodes.Ldnull); + il.Emit(OpCodes.Ret); + } + else + { + il.Emit(OpCodes.Ldstr, "typecode is null, struct not supported"); + il.Emit(OpCodes.Newobj, messagePackSerializationExceptionMessageOnlyConstructor); + il.Emit(OpCodes.Throw); + } + + il.MarkLabel(falseLabel); + + // options.Security.DepthStep(ref reader); + argOptions.EmitLoad(); + il.EmitCall(getSecurityFromOptions); + reader.EmitLdarg(); + il.EmitCall(securityDepthStep); + + // var length = ReadMapHeader(ref byteSequence); + LocalBuilder length = il.DeclareLocal(typeof(int)); // [loc:1] + reader.EmitLdarg(); + + if (info.IsIntKey) + { + il.EmitCall(MessagePackReaderTypeInfo.ReadArrayHeader); + } + else + { + il.EmitCall(MessagePackReaderTypeInfo.ReadMapHeader); + } + + il.EmitStloc(length); + + // make local fields + Label? gotoDefault = null; + DeserializeInfo[] infoList; + if (info.IsIntKey) + { + var maxKey = info.Members.Select(x => x.IntKey).DefaultIfEmpty(-1).Max(); + var len = maxKey + 1; + var intKeyMap = info.Members.ToDictionary(x => x.IntKey); + + infoList = Enumerable.Range(0, len) + .Select(x => + { + ObjectSerializationInfo.EmittableMember member; + if (intKeyMap.TryGetValue(x, out member)) + { + return new DeserializeInfo + { + MemberInfo = member, + LocalField = il.DeclareLocal(member.Type), + SwitchLabel = il.DefineLabel(), + }; + } + else + { + // return null MemberInfo, should filter null + if (gotoDefault == null) + { + gotoDefault = il.DefineLabel(); + } + + return new DeserializeInfo + { + MemberInfo = null, + LocalField = null, + SwitchLabel = gotoDefault.Value, + }; + } + }) + .ToArray(); + } + else + { + infoList = info.Members + .Select(item => new DeserializeInfo + { + MemberInfo = item, + LocalField = il.DeclareLocal(item.Type), + //// SwitchLabel = il.DefineLabel() + }) + .ToArray(); + } + + // IFormatterResolver resolver = options.Resolver; + LocalBuilder localResolver = il.DeclareLocal(typeof(IFormatterResolver)); + argOptions.EmitLoad(); + il.EmitCall(getResolverFromOptions); + il.EmitStloc(localResolver); + + // Read Loop(for var i = 0; i < length; i++) + if (info.IsStringKey) + { + var automata = new AutomataDictionary(); + for (int i = 0; i < info.Members.Length; i++) + { + automata.Add(info.Members[i].StringKey, i); + } + + LocalBuilder buffer = il.DeclareLocal(typeof(ReadOnlySpan)); + LocalBuilder longKey = il.DeclareLocal(typeof(ulong)); + + // for (int i = 0; i < len; i++) + il.EmitIncrementFor(length, forILocal => + { + Label readNext = il.DefineLabel(); + Label loopEnd = il.DefineLabel(); + + reader.EmitLdarg(); + il.EmitCall(ReadStringSpan); + il.EmitStloc(buffer); + + // gen automata name lookup + automata.EmitMatch( + il, + buffer, + longKey, + x => + { + var i = x.Value; + if (infoList[i].MemberInfo != null) + { + EmitDeserializeValue(il, infoList[i], i, tryEmitLoadCustomFormatter, reader, argOptions, localResolver); + il.Emit(OpCodes.Br, loopEnd); + } + else + { + il.Emit(OpCodes.Br, readNext); + } + }, + () => + { + il.Emit(OpCodes.Br, readNext); + }); + + il.MarkLabel(readNext); + reader.EmitLdarg(); + il.EmitCall(MessagePackReaderTypeInfo.Skip); + + il.MarkLabel(loopEnd); + }); + } + else + { + LocalBuilder key = il.DeclareLocal(typeof(int)); + Label switchDefault = il.DefineLabel(); + + il.EmitIncrementFor(length, forILocal => + { + Label loopEnd = il.DefineLabel(); + + il.EmitLdloc(forILocal); + il.EmitStloc(key); + + // switch... local = Deserialize + il.EmitLdloc(key); + + il.Emit(OpCodes.Switch, infoList.Select(x => x.SwitchLabel).ToArray()); + + il.MarkLabel(switchDefault); + + // default, only read. reader.ReadNextBlock(); + reader.EmitLdarg(); + il.EmitCall(MessagePackReaderTypeInfo.Skip); + il.Emit(OpCodes.Br, loopEnd); + + if (gotoDefault != null) + { + il.MarkLabel(gotoDefault.Value); + il.Emit(OpCodes.Br, switchDefault); + } + + var i = 0; + foreach (DeserializeInfo item in infoList) + { + if (item.MemberInfo != null) + { + il.MarkLabel(item.SwitchLabel); + EmitDeserializeValue(il, item, i++, tryEmitLoadCustomFormatter, reader, argOptions, localResolver); + il.Emit(OpCodes.Br, loopEnd); + } + } + + il.MarkLabel(loopEnd); + }); + } + + // create result object + LocalBuilder structLocal = EmitNewObject(il, type, info, infoList); + + // IMessagePackSerializationCallbackReceiver.OnAfterDeserialize() + if (type.GetTypeInfo().ImplementedInterfaces.Any(x => x == typeof(IMessagePackSerializationCallbackReceiver))) + { + // call directly + MethodInfo[] runtimeMethods = type.GetRuntimeMethods().Where(x => x.Name == "OnAfterDeserialize").ToArray(); + if (runtimeMethods.Length == 1) + { + if (info.IsClass) + { + il.Emit(OpCodes.Dup); + } + else + { + il.EmitLdloca(structLocal); + } + + il.Emit(OpCodes.Call, runtimeMethods[0]); // don't use EmitCall helper(must use 'Call') + } + else + { + if (info.IsStruct) + { + il.EmitLdloc(structLocal); + il.Emit(OpCodes.Box, type); + } + else + { + il.Emit(OpCodes.Dup); + } + + il.EmitCall(onAfterDeserialize); + } + } + + // reader.Depth--; + reader.EmitLdarg(); + il.Emit(OpCodes.Dup); + il.EmitCall(readerDepthGet); + il.Emit(OpCodes.Ldc_I4_1); + il.Emit(OpCodes.Sub_Ovf); + il.EmitCall(readerDepthSet); + + if (info.IsStruct) + { + il.Emit(OpCodes.Ldloc, structLocal); + } + + il.Emit(OpCodes.Ret); + } + + private static void EmitDeserializeValue(ILGenerator il, DeserializeInfo info, int index, Func tryEmitLoadCustomFormatter, ArgumentField argReader, ArgumentField argOptions, LocalBuilder localResolver) + { + Label storeLabel = il.DefineLabel(); + ObjectSerializationInfo.EmittableMember member = info.MemberInfo; + Type t = member.Type; + Action emitter = tryEmitLoadCustomFormatter(index, member); + if (emitter != null) + { + emitter(); + argReader.EmitLdarg(); + argOptions.EmitLoad(); + il.EmitCall(getDeserialize(t)); + } + else if (IsOptimizeTargetType(t)) + { + if (!t.GetTypeInfo().IsValueType) + { + // As a nullable type (e.g. byte[] and string) we need to first call TryReadNil + // if (reader.TryReadNil()) + Label readNonNilValueLabel = il.DefineLabel(); + argReader.EmitLdarg(); + il.EmitCall(MessagePackReaderTypeInfo.TryReadNil); + il.Emit(OpCodes.Brfalse_S, readNonNilValueLabel); + il.Emit(OpCodes.Ldnull); + il.Emit(OpCodes.Br, storeLabel); + + il.MarkLabel(readNonNilValueLabel); + } + + argReader.EmitLdarg(); + if (t == typeof(byte[])) + { + LocalBuilder local = il.DeclareLocal(typeof(ReadOnlySequence?)); + il.EmitCall(MessagePackReaderTypeInfo.ReadBytes); + il.EmitStloc(local); + il.EmitLdloca(local); + il.EmitCall(ArrayFromNullableReadOnlySequence); + } + else + { + il.EmitCall(MessagePackReaderTypeInfo.TypeInfo.GetDeclaredMethods("Read" + t.Name).First(x => x.GetParameters().Length == 0)); + } + } + else + { + il.EmitLdloc(localResolver); + il.EmitCall(getFormatterWithVerify.MakeGenericMethod(t)); + argReader.EmitLdarg(); + argOptions.EmitLoad(); + il.EmitCall(getDeserialize(t)); + } + + il.MarkLabel(storeLabel); + il.EmitStloc(info.LocalField); + } + + private static LocalBuilder EmitNewObject(ILGenerator il, Type type, ObjectSerializationInfo info, DeserializeInfo[] members) + { + if (info.IsClass) + { + foreach (ObjectSerializationInfo.EmittableMember item in info.ConstructorParameters) + { + DeserializeInfo local = members.First(x => x.MemberInfo == item); + il.EmitLdloc(local.LocalField); + } + + il.Emit(OpCodes.Newobj, info.BestmatchConstructor); + + foreach (DeserializeInfo item in members.Where(x => x.MemberInfo != null && x.MemberInfo.IsWritable)) + { + il.Emit(OpCodes.Dup); + il.EmitLdloc(item.LocalField); + item.MemberInfo.EmitStoreValue(il); + } + + return null; + } + else + { + LocalBuilder result = il.DeclareLocal(type); + if (info.BestmatchConstructor == null) + { + il.Emit(OpCodes.Ldloca, result); + il.Emit(OpCodes.Initobj, type); + } + else + { + foreach (ObjectSerializationInfo.EmittableMember item in info.ConstructorParameters) + { + DeserializeInfo local = members.First(x => x.MemberInfo == item); + il.EmitLdloc(local.LocalField); + } + + il.Emit(OpCodes.Newobj, info.BestmatchConstructor); + il.Emit(OpCodes.Stloc, result); + } + + foreach (DeserializeInfo item in members.Where(x => x.MemberInfo != null && x.MemberInfo.IsWritable)) + { + il.EmitLdloca(result); + il.EmitLdloc(item.LocalField); + item.MemberInfo.EmitStoreValue(il); + } + + return result; // struct returns local result field + } + } + + private static bool IsOptimizeTargetType(Type type) + { + return type == typeof(Int16) + || type == typeof(Int32) + || type == typeof(Int64) + || type == typeof(UInt16) + || type == typeof(UInt32) + || type == typeof(UInt64) + || type == typeof(Single) + || type == typeof(Double) + || type == typeof(bool) + || type == typeof(byte) + || type == typeof(sbyte) + || type == typeof(char) + || type == typeof(byte[]) + + // Do not include types that resolvers are allowed to modify. + ////|| type == typeof(DateTime) // OldSpec has no support, so for that and perf reasons a .NET native DateTime resolver exists. + ////|| type == typeof(string) // https://github.com/Cysharp/MasterMemory provides custom formatter for string interning. + ; + } + +#pragma warning disable SA1311 // Static readonly fields should begin with upper-case letter + + // EmitInfos... + private static readonly Type refMessagePackReader = typeof(MessagePackReader).MakeByRefType(); + + private static readonly MethodInfo ReadOnlySpanFromByteArray = typeof(ReadOnlySpan).GetRuntimeMethod("op_Implicit", new[] { typeof(byte[]) }); + private static readonly MethodInfo ReadStringSpan = typeof(CodeGenHelpers).GetRuntimeMethod(nameof(CodeGenHelpers.ReadStringSpan), new[] { typeof(MessagePackReader).MakeByRefType() }); + private static readonly MethodInfo ArrayFromNullableReadOnlySequence = typeof(CodeGenHelpers).GetRuntimeMethod(nameof(CodeGenHelpers.GetArrayFromNullableSequence), new[] { typeof(ReadOnlySequence?).MakeByRefType() }); + + private static readonly MethodInfo getFormatterWithVerify = typeof(FormatterResolverExtensions).GetRuntimeMethods().First(x => x.Name == nameof(FormatterResolverExtensions.GetFormatterWithVerify)); + private static readonly MethodInfo getResolverFromOptions = typeof(MessagePackSerializerOptions).GetRuntimeProperty(nameof(MessagePackSerializerOptions.Resolver)).GetMethod; + private static readonly MethodInfo getSecurityFromOptions = typeof(MessagePackSerializerOptions).GetRuntimeProperty(nameof(MessagePackSerializerOptions.Security)).GetMethod; + private static readonly MethodInfo securityDepthStep = typeof(MessagePackSecurity).GetRuntimeMethod(nameof(MessagePackSecurity.DepthStep), new[] { typeof(MessagePackReader).MakeByRefType() }); + private static readonly MethodInfo readerDepthGet = typeof(MessagePackReader).GetRuntimeProperty(nameof(MessagePackReader.Depth)).GetMethod; + private static readonly MethodInfo readerDepthSet = typeof(MessagePackReader).GetRuntimeProperty(nameof(MessagePackReader.Depth)).SetMethod; + private static readonly Func getSerialize = t => typeof(IMessagePackFormatter<>).MakeGenericType(t).GetRuntimeMethod(nameof(IMessagePackFormatter.Serialize), new[] { typeof(MessagePackWriter).MakeByRefType(), t, typeof(MessagePackSerializerOptions) }); + private static readonly Func getDeserialize = t => typeof(IMessagePackFormatter<>).MakeGenericType(t).GetRuntimeMethod(nameof(IMessagePackFormatter.Deserialize), new[] { refMessagePackReader, typeof(MessagePackSerializerOptions) }); + //// static readonly ConstructorInfo dictionaryConstructor = typeof(ByteArrayStringHashTable).GetTypeInfo().DeclaredConstructors.First(x => { var p = x.GetParameters(); return p.Length == 1 && p[0].ParameterType == typeof(int); }); + //// static readonly MethodInfo dictionaryAdd = typeof(ByteArrayStringHashTable).GetRuntimeMethod("Add", new[] { typeof(string), typeof(int) }); + //// static readonly MethodInfo dictionaryTryGetValue = typeof(ByteArrayStringHashTable).GetRuntimeMethod("TryGetValue", new[] { typeof(ArraySegment), refInt }); + private static readonly ConstructorInfo messagePackSerializationExceptionMessageOnlyConstructor = typeof(MessagePackSerializationException).GetTypeInfo().DeclaredConstructors.First(x => + { + ParameterInfo[] p = x.GetParameters(); + return p.Length == 1 && p[0].ParameterType == typeof(string); + }); + + private static readonly MethodInfo onBeforeSerialize = typeof(IMessagePackSerializationCallbackReceiver).GetRuntimeMethod(nameof(IMessagePackSerializationCallbackReceiver.OnBeforeSerialize), Type.EmptyTypes); + private static readonly MethodInfo onAfterDeserialize = typeof(IMessagePackSerializationCallbackReceiver).GetRuntimeMethod(nameof(IMessagePackSerializationCallbackReceiver.OnAfterDeserialize), Type.EmptyTypes); + + private static readonly ConstructorInfo objectCtor = typeof(object).GetTypeInfo().DeclaredConstructors.First(x => x.GetParameters().Length == 0); + +#pragma warning restore SA1311 // Static readonly fields should begin with upper-case letter + + /// + /// Helps match parameters when searching a method when the parameter is a generic type. + /// + private static bool Matches(MethodInfo m, int parameterIndex, Type desiredType) + { + ParameterInfo[] parameters = m.GetParameters(); + return parameters.Length > parameterIndex + ////&& parameters[0].ParameterType.IsGenericType // returns false for some bizarre reason + && parameters[parameterIndex].ParameterType.Name == desiredType.Name + && parameters[parameterIndex].ParameterType.Namespace == desiredType.Namespace; + } + + internal static class MessagePackWriterTypeInfo + { + internal static readonly TypeInfo TypeInfo = typeof(MessagePackWriter).GetTypeInfo(); + + internal static readonly MethodInfo WriteMapHeader = typeof(MessagePackWriter).GetRuntimeMethod(nameof(MessagePackWriter.WriteMapHeader), new[] { typeof(int) }); + internal static readonly MethodInfo WriteArrayHeader = typeof(MessagePackWriter).GetRuntimeMethod(nameof(MessagePackWriter.WriteArrayHeader), new[] { typeof(int) }); + internal static readonly MethodInfo WriteBytes = typeof(MessagePackWriter).GetRuntimeMethod(nameof(MessagePackWriter.Write), new[] { typeof(ReadOnlySpan) }); + internal static readonly MethodInfo WriteNil = typeof(MessagePackWriter).GetRuntimeMethod(nameof(MessagePackWriter.WriteNil), Type.EmptyTypes); + internal static readonly MethodInfo WriteRaw = typeof(MessagePackWriter).GetRuntimeMethod(nameof(MessagePackWriter.WriteRaw), new[] { typeof(ReadOnlySpan) }); + } + + internal static class MessagePackReaderTypeInfo + { + internal static readonly TypeInfo TypeInfo = typeof(MessagePackReader).GetTypeInfo(); + + internal static readonly MethodInfo ReadArrayHeader = typeof(MessagePackReader).GetRuntimeMethod(nameof(MessagePackReader.ReadArrayHeader), Type.EmptyTypes); + internal static readonly MethodInfo ReadMapHeader = typeof(MessagePackReader).GetRuntimeMethod(nameof(MessagePackReader.ReadMapHeader), Type.EmptyTypes); + internal static readonly MethodInfo ReadBytes = typeof(MessagePackReader).GetRuntimeMethod(nameof(MessagePackReader.ReadBytes), Type.EmptyTypes); + internal static readonly MethodInfo TryReadNil = typeof(MessagePackReader).GetRuntimeMethod(nameof(MessagePackReader.TryReadNil), Type.EmptyTypes); + internal static readonly MethodInfo Skip = typeof(MessagePackReader).GetRuntimeMethod(nameof(MessagePackReader.Skip), Type.EmptyTypes); + } + + internal static class CodeGenHelpersTypeInfo + { + public static readonly MethodInfo GetEncodedStringBytes = typeof(CodeGenHelpers).GetRuntimeMethod(nameof(CodeGenHelpers.GetEncodedStringBytes), new[] { typeof(string) }); + } + + internal static class EmitInfo + { + public static readonly MethodInfo GetTypeFromHandle = ExpressionUtility.GetMethodInfo(() => Type.GetTypeFromHandle(default(RuntimeTypeHandle))); + public static readonly MethodInfo TypeGetProperty = ExpressionUtility.GetMethodInfo((Type t) => t.GetTypeInfo().GetProperty(default(string), default(BindingFlags))); + public static readonly MethodInfo TypeGetField = ExpressionUtility.GetMethodInfo((Type t) => t.GetTypeInfo().GetField(default(string), default(BindingFlags))); + public static readonly MethodInfo GetCustomAttributeMessagePackFormatterAttribute = ExpressionUtility.GetMethodInfo(() => CustomAttributeExtensions.GetCustomAttribute(default(MemberInfo), default(bool))); + public static readonly MethodInfo ActivatorCreateInstance = ExpressionUtility.GetMethodInfo(() => Activator.CreateInstance(default(Type), default(object[]))); + + internal static class MessagePackFormatterAttr + { + internal static readonly MethodInfo FormatterType = ExpressionUtility.GetPropertyInfo((MessagePackFormatterAttribute attr) => attr.FormatterType).GetGetMethod(); + internal static readonly MethodInfo Arguments = ExpressionUtility.GetPropertyInfo((MessagePackFormatterAttribute attr) => attr.Arguments).GetGetMethod(); + } + } + + private class DeserializeInfo + { + public ObjectSerializationInfo.EmittableMember MemberInfo { get; set; } + + public LocalBuilder LocalField { get; set; } + + public Label SwitchLabel { get; set; } + } + } + + internal delegate void AnonymousSerializeFunc(byte[][] stringByteKeysField, object[] customFormatters, ref MessagePackWriter writer, T value, MessagePackSerializerOptions options); + + internal delegate T AnonymousDeserializeFunc(object[] customFormatters, ref MessagePackReader reader, MessagePackSerializerOptions options); + + internal class AnonymousSerializableFormatter : IMessagePackFormatter + { + private readonly byte[][] stringByteKeysField; + private readonly object[] serializeCustomFormatters; + private readonly object[] deserializeCustomFormatters; + private readonly AnonymousSerializeFunc serialize; + private readonly AnonymousDeserializeFunc deserialize; + + public AnonymousSerializableFormatter(byte[][] stringByteKeysField, object[] serializeCustomFormatters, object[] deserializeCustomFormatters, AnonymousSerializeFunc serialize, AnonymousDeserializeFunc deserialize) + { + this.stringByteKeysField = stringByteKeysField; + this.serializeCustomFormatters = serializeCustomFormatters; + this.deserializeCustomFormatters = deserializeCustomFormatters; + this.serialize = serialize; + this.deserialize = deserialize; + } + + public void Serialize(ref MessagePackWriter writer, T value, MessagePackSerializerOptions options) + { + if (this.serialize == null) + { + throw new MessagePackSerializationException(this.GetType().Name + " does not support Serialize."); + } + + this.serialize(this.stringByteKeysField, this.serializeCustomFormatters, ref writer, value, options); + } + + public T Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (this.deserialize == null) + { + throw new MessagePackSerializationException(this.GetType().Name + " does not support Deserialize."); + } + + return this.deserialize(this.deserializeCustomFormatters, ref reader, options); + } + } + + internal class ObjectSerializationInfo + { + public Type Type { get; set; } + + public bool IsIntKey { get; set; } + + public bool IsStringKey + { + get { return !this.IsIntKey; } + } + + public bool IsClass { get; set; } + + public bool IsStruct + { + get { return !this.IsClass; } + } + + public ConstructorInfo BestmatchConstructor { get; set; } + + public EmittableMember[] ConstructorParameters { get; set; } + + public EmittableMember[] Members { get; set; } + + private ObjectSerializationInfo() + { + } + + public static ObjectSerializationInfo CreateOrNull(Type type, bool forceStringKey, bool contractless, bool allowPrivate) + { + TypeInfo ti = type.GetTypeInfo(); + var isClass = ti.IsClass || ti.IsInterface || ti.IsAbstract; + var isStruct = ti.IsValueType; + + MessagePackObjectAttribute contractAttr = ti.GetCustomAttributes().FirstOrDefault(); + DataContractAttribute dataContractAttr = ti.GetCustomAttribute(); + if (contractAttr == null && dataContractAttr == null && !forceStringKey && !contractless) + { + return null; + } + + var isIntKey = true; + var intMembers = new Dictionary(); + var stringMembers = new Dictionary(); + + if (forceStringKey || contractless || (contractAttr != null && contractAttr.KeyAsPropertyName)) + { + // All public members are serialize target except [Ignore] member. + isIntKey = !(forceStringKey || (contractAttr != null && contractAttr.KeyAsPropertyName)); + + var hiddenIntKey = 0; + + // Group the properties and fields by name to qualify members of the same name + // (declared with the 'new' keyword) with the declaring type. + IEnumerable> membersByName = type.GetRuntimeProperties() + .Concat(type.GetRuntimeFields().Cast()) + .OrderBy(m => m.DeclaringType, OrderBaseTypesBeforeDerivedTypes.Instance) + .GroupBy(m => m.Name); + foreach (var memberGroup in membersByName) + { + bool firstMemberByName = true; + foreach (MemberInfo item in memberGroup) + { + if (item.GetCustomAttribute(true) != null) + { + continue; + } + + if (item.GetCustomAttribute(true) != null) + { + continue; + } + + EmittableMember member; + if (item is PropertyInfo property) + { + if (property.IsIndexer()) + { + continue; + } + + MethodInfo getMethod = property.GetGetMethod(true); + MethodInfo setMethod = property.GetSetMethod(true); + + member = new EmittableMember + { + PropertyInfo = property, + IsReadable = (getMethod != null) && (allowPrivate || getMethod.IsPublic) && !getMethod.IsStatic, + IsWritable = (setMethod != null) && (allowPrivate || setMethod.IsPublic) && !setMethod.IsStatic, + StringKey = firstMemberByName ? item.Name : $"{item.DeclaringType.FullName}.{item.Name}", + }; + } + else if (item is FieldInfo field) + { + if (item.GetCustomAttribute(true) != null) + { + continue; + } + + if (field.IsStatic) + { + continue; + } + + member = new EmittableMember + { + FieldInfo = field, + IsReadable = allowPrivate || field.IsPublic, + IsWritable = allowPrivate || (field.IsPublic && !field.IsInitOnly), + StringKey = firstMemberByName ? item.Name : $"{item.DeclaringType.FullName}.{item.Name}", + }; + } + else + { + throw new MessagePackSerializationException("unexpected member type"); + } + + if (!member.IsReadable && !member.IsWritable) + { + continue; + } + + member.IntKey = hiddenIntKey++; + if (isIntKey) + { + intMembers.Add(member.IntKey, member); + } + else + { + stringMembers.Add(member.StringKey, member); + } + + firstMemberByName = false; + } + } + } + else + { + // Public members with KeyAttribute except [Ignore] member. + var searchFirst = true; + var hiddenIntKey = 0; + + foreach (PropertyInfo item in type.GetRuntimeProperties()) + { + if (item.GetCustomAttribute(true) != null) + { + continue; + } + + if (item.GetCustomAttribute(true) != null) + { + continue; + } + + if (item.IsIndexer()) + { + continue; + } + + MethodInfo getMethod = item.GetGetMethod(true); + MethodInfo setMethod = item.GetSetMethod(true); + + var member = new EmittableMember + { + PropertyInfo = item, + IsReadable = (getMethod != null) && (allowPrivate || getMethod.IsPublic) && !getMethod.IsStatic, + IsWritable = (setMethod != null) && (allowPrivate || setMethod.IsPublic) && !setMethod.IsStatic, + }; + if (!member.IsReadable && !member.IsWritable) + { + continue; + } + + KeyAttribute key; + if (contractAttr != null) + { + // MessagePackObjectAttribute + key = item.GetCustomAttribute(true); + if (key == null) + { + throw new MessagePackDynamicObjectResolverException("all public members must mark KeyAttribute or IgnoreMemberAttribute." + " type: " + type.FullName + " member:" + item.Name); + } + + member.IsExplicitContract = true; + if (key.IntKey == null && key.StringKey == null) + { + throw new MessagePackDynamicObjectResolverException("both IntKey and StringKey are null." + " type: " + type.FullName + " member:" + item.Name); + } + } + else + { + // DataContractAttribute + DataMemberAttribute pseudokey = item.GetCustomAttribute(true); + if (pseudokey == null) + { + // This member has no DataMemberAttribute nor IgnoreMemberAttribute. + // But the type *did* have a DataContractAttribute on it, so no attribute implies the member should not be serialized. + continue; + } + + member.IsExplicitContract = true; + + // use Order first + if (pseudokey.Order != -1) + { + key = new KeyAttribute(pseudokey.Order); + } + else if (pseudokey.Name != null) + { + key = new KeyAttribute(pseudokey.Name); + } + else + { + key = new KeyAttribute(item.Name); // use property name + } + } + + if (searchFirst) + { + searchFirst = false; + isIntKey = key.IntKey != null; + } + else + { + if ((isIntKey && key.IntKey == null) || (!isIntKey && key.StringKey == null)) + { + throw new MessagePackDynamicObjectResolverException("all members key type must be same." + " type: " + type.FullName + " member:" + item.Name); + } + } + + if (isIntKey) + { + member.IntKey = key.IntKey.Value; + if (intMembers.ContainsKey(member.IntKey)) + { + throw new MessagePackDynamicObjectResolverException("key is duplicated, all members key must be unique." + " type: " + type.FullName + " member:" + item.Name); + } + + intMembers.Add(member.IntKey, member); + } + else + { + member.StringKey = key.StringKey; + if (stringMembers.ContainsKey(member.StringKey)) + { + throw new MessagePackDynamicObjectResolverException("key is duplicated, all members key must be unique." + " type: " + type.FullName + " member:" + item.Name); + } + + member.IntKey = hiddenIntKey++; + stringMembers.Add(member.StringKey, member); + } + } + + foreach (FieldInfo item in type.GetRuntimeFields()) + { + if (item.GetCustomAttribute(true) != null) + { + continue; + } + + if (item.GetCustomAttribute(true) != null) + { + continue; + } + + if (item.GetCustomAttribute(true) != null) + { + continue; + } + + if (item.IsStatic) + { + continue; + } + + var member = new EmittableMember + { + FieldInfo = item, + IsReadable = allowPrivate || item.IsPublic, + IsWritable = allowPrivate || (item.IsPublic && !item.IsInitOnly), + }; + if (!member.IsReadable && !member.IsWritable) + { + continue; + } + + KeyAttribute key; + if (contractAttr != null) + { + // MessagePackObjectAttribute + key = item.GetCustomAttribute(true); + if (key == null) + { + throw new MessagePackDynamicObjectResolverException("all public members must mark KeyAttribute or IgnoreMemberAttribute." + " type: " + type.FullName + " member:" + item.Name); + } + + member.IsExplicitContract = true; + if (key.IntKey == null && key.StringKey == null) + { + throw new MessagePackDynamicObjectResolverException("both IntKey and StringKey are null." + " type: " + type.FullName + " member:" + item.Name); + } + } + else + { + // DataContractAttribute + DataMemberAttribute pseudokey = item.GetCustomAttribute(true); + if (pseudokey == null) + { + // This member has no DataMemberAttribute nor IgnoreMemberAttribute. + // But the type *did* have a DataContractAttribute on it, so no attribute implies the member should not be serialized. + continue; + } + + member.IsExplicitContract = true; + + // use Order first + if (pseudokey.Order != -1) + { + key = new KeyAttribute(pseudokey.Order); + } + else if (pseudokey.Name != null) + { + key = new KeyAttribute(pseudokey.Name); + } + else + { + key = new KeyAttribute(item.Name); // use property name + } + } + + if (searchFirst) + { + searchFirst = false; + isIntKey = key.IntKey != null; + } + else + { + if ((isIntKey && key.IntKey == null) || (!isIntKey && key.StringKey == null)) + { + throw new MessagePackDynamicObjectResolverException("all members key type must be same." + " type: " + type.FullName + " member:" + item.Name); + } + } + + if (isIntKey) + { + member.IntKey = key.IntKey.Value; + if (intMembers.ContainsKey(member.IntKey)) + { + throw new MessagePackDynamicObjectResolverException("key is duplicated, all members key must be unique." + " type: " + type.FullName + " member:" + item.Name); + } + + intMembers.Add(member.IntKey, member); + } + else + { + member.StringKey = key.StringKey; + if (stringMembers.ContainsKey(member.StringKey)) + { + throw new MessagePackDynamicObjectResolverException("key is duplicated, all members key must be unique." + " type: " + type.FullName + " member:" + item.Name); + } + + member.IntKey = hiddenIntKey++; + stringMembers.Add(member.StringKey, member); + } + } + } + + // GetConstructor + IEnumerator ctorEnumerator = null; + ConstructorInfo ctor = ti.DeclaredConstructors.SingleOrDefault(x => x.GetCustomAttribute(false) != null); + if (ctor == null) + { + ctorEnumerator = + ti.DeclaredConstructors.Where(x => x.IsPublic).OrderByDescending(x => x.GetParameters().Length) + .GetEnumerator(); + + if (ctorEnumerator.MoveNext()) + { + ctor = ctorEnumerator.Current; + } + } + + // struct allows null ctor + if (ctor == null && !isStruct) + { + throw new MessagePackDynamicObjectResolverException("can't find public constructor. type:" + type.FullName); + } + + var constructorParameters = new List(); + if (ctor != null) + { + ILookup> constructorLookupDictionary = stringMembers.ToLookup(x => x.Key, x => x, StringComparer.OrdinalIgnoreCase); + do + { + constructorParameters.Clear(); + var ctorParamIndex = 0; + foreach (ParameterInfo item in ctor.GetParameters()) + { + EmittableMember paramMember; + if (isIntKey) + { + if (intMembers.TryGetValue(ctorParamIndex, out paramMember)) + { + if ((item.ParameterType == paramMember.Type || + item.ParameterType.GetTypeInfo().IsAssignableFrom(paramMember.Type)) + && paramMember.IsReadable) + { + constructorParameters.Add(paramMember); + } + else + { + if (ctorEnumerator != null) + { + ctor = null; + continue; + } + else + { + throw new MessagePackDynamicObjectResolverException("can't find matched constructor parameter, parameterType mismatch. type:" + type.FullName + " parameterIndex:" + ctorParamIndex + " paramterType:" + item.ParameterType.Name); + } + } + } + else + { + if (ctorEnumerator != null) + { + ctor = null; + continue; + } + else + { + throw new MessagePackDynamicObjectResolverException("can't find matched constructor parameter, index not found. type:" + type.FullName + " parameterIndex:" + ctorParamIndex); + } + } + } + else + { + IEnumerable> hasKey = constructorLookupDictionary[item.Name]; + var len = hasKey.Count(); + if (len != 0) + { + if (len != 1) + { + if (ctorEnumerator != null) + { + ctor = null; + continue; + } + else + { + throw new MessagePackDynamicObjectResolverException("duplicate matched constructor parameter name:" + type.FullName + " parameterName:" + item.Name + " paramterType:" + item.ParameterType.Name); + } + } + + paramMember = hasKey.First().Value; + if (item.ParameterType == paramMember.Type && paramMember.IsReadable) + { + constructorParameters.Add(paramMember); + } + else + { + if (ctorEnumerator != null) + { + ctor = null; + continue; + } + else + { + throw new MessagePackDynamicObjectResolverException("can't find matched constructor parameter, parameterType mismatch. type:" + type.FullName + " parameterName:" + item.Name + " paramterType:" + item.ParameterType.Name); + } + } + } + else + { + if (ctorEnumerator != null) + { + ctor = null; + continue; + } + else + { + throw new MessagePackDynamicObjectResolverException("can't find matched constructor parameter, index not found. type:" + type.FullName + " parameterName:" + item.Name); + } + } + } + + ctorParamIndex++; + } + } + while (TryGetNextConstructor(ctorEnumerator, ref ctor)); + + if (ctor == null) + { + throw new MessagePackDynamicObjectResolverException("can't find matched constructor. type:" + type.FullName); + } + } + + EmittableMember[] members; + if (isIntKey) + { + members = intMembers.Values.OrderBy(x => x.IntKey).ToArray(); + } + else + { + members = stringMembers.Values + .OrderBy(x => + { + DataMemberAttribute attr = x.GetDataMemberAttribute(); + if (attr == null) + { + return int.MaxValue; + } + + return attr.Order; + }) + .ToArray(); + } + + return new ObjectSerializationInfo + { + Type = type, + IsClass = isClass, + BestmatchConstructor = ctor, + ConstructorParameters = constructorParameters.ToArray(), + IsIntKey = isIntKey, + Members = members.Where(m => m.IsExplicitContract || constructorParameters.Contains(m) || m.IsWritable).ToArray(), + }; + } + + private static bool TryGetNextConstructor(IEnumerator ctorEnumerator, ref ConstructorInfo ctor) + { + if (ctorEnumerator == null || ctor != null) + { + return false; + } + + if (ctorEnumerator.MoveNext()) + { + ctor = ctorEnumerator.Current; + return true; + } + else + { + ctor = null; + return false; + } + } + + public class EmittableMember + { + public bool IsProperty + { + get { return this.PropertyInfo != null; } + } + + public bool IsField + { + get { return this.FieldInfo != null; } + } + + public bool IsWritable { get; set; } + + public bool IsReadable { get; set; } + + public int IntKey { get; set; } + + public string StringKey { get; set; } + + public Type Type + { + get { return this.IsField ? this.FieldInfo.FieldType : this.PropertyInfo.PropertyType; } + } + + public FieldInfo FieldInfo { get; set; } + + public PropertyInfo PropertyInfo { get; set; } + + public string Name + { + get + { + return this.IsProperty ? this.PropertyInfo.Name : this.FieldInfo.Name; + } + } + + public bool IsValueType + { + get + { + MemberInfo mi = this.IsProperty ? (MemberInfo)this.PropertyInfo : this.FieldInfo; + return mi.DeclaringType.GetTypeInfo().IsValueType; + } + } + + /// + /// Gets or sets a value indicating whether this member is explicitly opted in with an attribute. + /// + public bool IsExplicitContract { get; set; } + + public MessagePackFormatterAttribute GetMessagePackFormatterAttribute() + { + if (this.IsProperty) + { + return (MessagePackFormatterAttribute)this.PropertyInfo.GetCustomAttribute(true); + } + else + { + return (MessagePackFormatterAttribute)this.FieldInfo.GetCustomAttribute(true); + } + } + + public DataMemberAttribute GetDataMemberAttribute() + { + if (this.IsProperty) + { + return (DataMemberAttribute)this.PropertyInfo.GetCustomAttribute(true); + } + else + { + return (DataMemberAttribute)this.FieldInfo.GetCustomAttribute(true); + } + } + + public void EmitLoadValue(ILGenerator il) + { + if (this.IsProperty) + { + il.EmitCall(this.PropertyInfo.GetGetMethod(true)); + } + else + { + il.Emit(OpCodes.Ldfld, this.FieldInfo); + } + } + + public void EmitStoreValue(ILGenerator il) + { + if (this.IsProperty) + { + il.EmitCall(this.PropertyInfo.GetSetMethod(true)); + } + else + { + il.Emit(OpCodes.Stfld, this.FieldInfo); + } + } + + ////public object ReflectionLoadValue(object value) + ////{ + //// if (IsProperty) + //// { + //// return PropertyInfo.GetValue(value, null); + //// } + //// else + //// { + //// return FieldInfo.GetValue(value); + //// } + ////} + + ////public void ReflectionStoreValue(object obj, object value) + ////{ + //// if (IsProperty) + //// { + //// PropertyInfo.SetValue(obj, value, null); + //// } + //// else + //// { + //// FieldInfo.SetValue(obj, value); + //// } + ////} + } + + private class OrderBaseTypesBeforeDerivedTypes : IComparer + { + internal static readonly OrderBaseTypesBeforeDerivedTypes Instance = new OrderBaseTypesBeforeDerivedTypes(); + + private OrderBaseTypesBeforeDerivedTypes() + { + } + + public int Compare(Type x, Type y) + { + return + x.IsEquivalentTo(y) ? 0 : + x.IsAssignableFrom(y) ? -1 : + y.IsAssignableFrom(x) ? 1 : + 0; + } + } + } + + internal class MessagePackDynamicObjectResolverException : MessagePackSerializationException + { + public MessagePackDynamicObjectResolverException(string message) + : base(message) + { + } + } +} + +#endif diff --git a/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs.meta b/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs.meta new file mode 100644 index 000000000..b5c92ca2d --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/DynamicObjectResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 14db1290355a2f56a919749640cbcc7c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Resolvers/DynamicUnionResolver.cs b/Assets/Scripts/MessagePack/Resolvers/DynamicUnionResolver.cs new file mode 100644 index 000000000..f5d33966e --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/DynamicUnionResolver.cs @@ -0,0 +1,517 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +#if !(UNITY_2018_3_OR_NEWER && NET_STANDARD_2_0) + +using System; +using System.Buffers; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Reflection.Emit; +using System.Text.RegularExpressions; +using System.Threading; +using MessagePack.Formatters; +using MessagePack.Internal; + +#pragma warning disable SA1403 // File may only contain a single namespace +#pragma warning disable SA1509 // Opening braces should not be preceded by blank line + +namespace MessagePack.Resolvers +{ + /// + /// UnionResolver by dynamic code generation. + /// + public sealed class DynamicUnionResolver : IFormatterResolver + { + private const string ModuleName = "MessagePack.Resolvers.DynamicUnionResolver"; + + /// + /// The singleton instance that can be used. + /// + public static readonly DynamicUnionResolver Instance; + + /// + /// A instance with this formatter pre-configured. + /// + public static readonly MessagePackSerializerOptions Options; + + private static readonly DynamicAssembly DynamicAssembly; +#if !UNITY_2018_3_OR_NEWER + private static readonly Regex SubtractFullNameRegex = new Regex(@", Version=\d+.\d+.\d+.\d+, Culture=\w+, PublicKeyToken=\w+", RegexOptions.Compiled); +#else + private static readonly Regex SubtractFullNameRegex = new Regex(@", Version=\d+.\d+.\d+.\d+, Culture=\w+, PublicKeyToken=\w+"); +#endif + + private static int nameSequence = 0; + + static DynamicUnionResolver() + { + Instance = new DynamicUnionResolver(); + Options = new MessagePackSerializerOptions(Instance); + DynamicAssembly = new DynamicAssembly(ModuleName); + } + + private DynamicUnionResolver() + { + } + +#if NETFRAMEWORK + public AssemblyBuilder Save() + { + return DynamicAssembly.Save(); + } +#endif + + public IMessagePackFormatter GetFormatter() + { + return FormatterCache.Formatter; + } + + private static class FormatterCache + { + public static readonly IMessagePackFormatter Formatter; + + static FormatterCache() + { + TypeInfo ti = typeof(T).GetTypeInfo(); + if (ti.IsNullable()) + { + ti = ti.GenericTypeArguments[0].GetTypeInfo(); + + var innerFormatter = DynamicUnionResolver.Instance.GetFormatterDynamic(ti.AsType()); + if (innerFormatter == null) + { + return; + } + + Formatter = (IMessagePackFormatter)Activator.CreateInstance(typeof(StaticNullableFormatter<>).MakeGenericType(ti.AsType()), new object[] { innerFormatter }); + return; + } + + TypeInfo formatterTypeInfo = BuildType(typeof(T)); + if (formatterTypeInfo == null) + { + return; + } + + Formatter = (IMessagePackFormatter)Activator.CreateInstance(formatterTypeInfo.AsType()); + } + } + + private static TypeInfo BuildType(Type type) + { + TypeInfo ti = type.GetTypeInfo(); + + // order by key(important for use jump-table of switch) + UnionAttribute[] unionAttrs = ti.GetCustomAttributes().OrderBy(x => x.Key).ToArray(); + + if (unionAttrs.Length == 0) + { + return null; + } + + if (!ti.IsInterface && !ti.IsAbstract) + { + throw new MessagePackDynamicUnionResolverException("Union can only be interface or abstract class. Type:" + type.Name); + } + + var checker1 = new HashSet(); + var checker2 = new HashSet(); + foreach (UnionAttribute item in unionAttrs) + { + if (!checker1.Add(item.Key)) + { + throw new MessagePackDynamicUnionResolverException("Same union key has found. Type:" + type.Name + " Key:" + item.Key); + } + + if (!checker2.Add(item.SubType)) + { + throw new MessagePackDynamicUnionResolverException("Same union subType has found. Type:" + type.Name + " SubType: " + item.SubType); + } + } + + Type formatterType = typeof(IMessagePackFormatter<>).MakeGenericType(type); + TypeBuilder typeBuilder = DynamicAssembly.DefineType("MessagePack.Formatters." + SubtractFullNameRegex.Replace(type.FullName, string.Empty).Replace(".", "_") + "Formatter" + +Interlocked.Increment(ref nameSequence), TypeAttributes.Public | TypeAttributes.Sealed, null, new[] { formatterType }); + + FieldBuilder typeToKeyAndJumpMap = null; // Dictionary> + FieldBuilder keyToJumpMap = null; // Dictionary + + // create map dictionary + { + ConstructorBuilder method = typeBuilder.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, Type.EmptyTypes); + typeToKeyAndJumpMap = typeBuilder.DefineField("typeToKeyAndJumpMap", typeof(Dictionary>), FieldAttributes.Private | FieldAttributes.InitOnly); + keyToJumpMap = typeBuilder.DefineField("keyToJumpMap", typeof(Dictionary), FieldAttributes.Private | FieldAttributes.InitOnly); + + ILGenerator il = method.GetILGenerator(); + BuildConstructor(type, unionAttrs, method, typeToKeyAndJumpMap, keyToJumpMap, il); + } + + { + MethodBuilder method = typeBuilder.DefineMethod( + "Serialize", + MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual | MethodAttributes.HideBySig | MethodAttributes.NewSlot, + null, + new Type[] { typeof(MessagePackWriter).MakeByRefType(), type, typeof(MessagePackSerializerOptions) }); + + ILGenerator il = method.GetILGenerator(); + BuildSerialize(type, unionAttrs, method, typeToKeyAndJumpMap, il); + } + + { + MethodBuilder method = typeBuilder.DefineMethod( + "Deserialize", + MethodAttributes.Public | MethodAttributes.Final | MethodAttributes.Virtual | MethodAttributes.HideBySig | MethodAttributes.NewSlot, + type, + new Type[] { refMessagePackReader, typeof(MessagePackSerializerOptions) }); + + ILGenerator il = method.GetILGenerator(); + BuildDeserialize(type, unionAttrs, method, keyToJumpMap, il); + } + + return typeBuilder.CreateTypeInfo(); + } + + private static void BuildConstructor(Type type, UnionAttribute[] infos, ConstructorInfo method, FieldBuilder typeToKeyAndJumpMap, FieldBuilder keyToJumpMap, ILGenerator il) + { + il.EmitLdarg(0); + il.Emit(OpCodes.Call, objectCtor); + + { + il.EmitLdarg(0); + il.EmitLdc_I4(infos.Length); + il.Emit(OpCodes.Ldsfld, runtimeTypeHandleEqualityComparer); + il.Emit(OpCodes.Newobj, typeMapDictionaryConstructor); + + var index = 0; + foreach (UnionAttribute item in infos) + { + il.Emit(OpCodes.Dup); + il.Emit(OpCodes.Ldtoken, item.SubType); + il.EmitLdc_I4(item.Key); + il.EmitLdc_I4(index); + il.Emit(OpCodes.Newobj, intIntKeyValuePairConstructor); + il.EmitCall(typeMapDictionaryAdd); + + index++; + } + + il.Emit(OpCodes.Stfld, typeToKeyAndJumpMap); + } + + { + il.EmitLdarg(0); + il.EmitLdc_I4(infos.Length); + il.Emit(OpCodes.Newobj, keyMapDictionaryConstructor); + + var index = 0; + foreach (UnionAttribute item in infos) + { + il.Emit(OpCodes.Dup); + il.EmitLdc_I4(item.Key); + il.EmitLdc_I4(index); + il.EmitCall(keyMapDictionaryAdd); + + index++; + } + + il.Emit(OpCodes.Stfld, keyToJumpMap); + } + + il.Emit(OpCodes.Ret); + } + + // void Serialize([arg:1]MessagePackWriter writer, [arg:2]T value, [arg:3]MessagePackSerializerOptions options); + private static void BuildSerialize(Type type, UnionAttribute[] infos, MethodBuilder method, FieldBuilder typeToKeyAndJumpMap, ILGenerator il) + { + // if(value == null) return WriteNil + Label elseBody = il.DefineLabel(); + Label notFoundType = il.DefineLabel(); + + il.EmitLdarg(2); + il.Emit(OpCodes.Brtrue_S, elseBody); + il.Emit(OpCodes.Br, notFoundType); + il.MarkLabel(elseBody); + + // IFormatterResolver resolver = options.Resolver; + LocalBuilder localResolver = il.DeclareLocal(typeof(IFormatterResolver)); + il.EmitLdarg(3); + il.EmitCall(getResolverFromOptions); + il.EmitStloc(localResolver); + + LocalBuilder keyPair = il.DeclareLocal(typeof(KeyValuePair)); + + il.EmitLoadThis(); + il.EmitLdfld(typeToKeyAndJumpMap); + il.EmitLdarg(2); + il.EmitCall(objectGetType); + il.EmitCall(getTypeHandle); + il.EmitLdloca(keyPair); + il.EmitCall(typeMapDictionaryTryGetValue); + il.Emit(OpCodes.Brfalse, notFoundType); + + // writer.WriteArrayHeader(2, false); + il.EmitLdarg(1); + il.EmitLdc_I4(2); + il.EmitCall(MessagePackWriterTypeInfo.WriteArrayHeader); + + // writer.Write(keyPair.Key) + il.EmitLdarg(1); + il.EmitLdloca(keyPair); + il.EmitCall(intIntKeyValuePairGetKey); + il.EmitCall(MessagePackWriterTypeInfo.WriteInt32); + + Label loopEnd = il.DefineLabel(); + + // switch-case (offset += resolver.GetFormatter.Serialize(with cast) + var switchLabels = infos.Select(x => new { Label = il.DefineLabel(), Attr = x }).ToArray(); + il.EmitLdloca(keyPair); + il.EmitCall(intIntKeyValuePairGetValue); + il.Emit(OpCodes.Switch, switchLabels.Select(x => x.Label).ToArray()); + il.Emit(OpCodes.Br, loopEnd); // default + + foreach (var item in switchLabels) + { + il.MarkLabel(item.Label); + il.EmitLdloc(localResolver); + il.Emit(OpCodes.Call, getFormatterWithVerify.MakeGenericMethod(item.Attr.SubType)); + + il.EmitLdarg(1); + il.EmitLdarg(2); + if (item.Attr.SubType.GetTypeInfo().IsValueType) + { + il.Emit(OpCodes.Unbox_Any, item.Attr.SubType); + } + else + { + il.Emit(OpCodes.Castclass, item.Attr.SubType); + } + + il.EmitLdarg(3); + il.Emit(OpCodes.Callvirt, getSerialize(item.Attr.SubType)); + + il.Emit(OpCodes.Br, loopEnd); + } + + // return; + il.MarkLabel(loopEnd); + il.Emit(OpCodes.Ret); + + // else, return WriteNil + il.MarkLabel(notFoundType); + il.EmitLdarg(1); + il.EmitCall(MessagePackWriterTypeInfo.WriteNil); + il.Emit(OpCodes.Ret); + } + + // T Deserialize([arg:1]ref MessagePackReader reader, [arg:2]MessagePackSerializerOptions options); + private static void BuildDeserialize(Type type, UnionAttribute[] infos, MethodBuilder method, FieldBuilder keyToJumpMap, ILGenerator il) + { + // if(MessagePackBinary.TryReadNil()) { return null; } + Label falseLabel = il.DefineLabel(); + il.EmitLdarg(1); + il.EmitCall(MessagePackReaderTypeInfo.TryReadNil); + il.Emit(OpCodes.Brfalse_S, falseLabel); + + il.Emit(OpCodes.Ldnull); + il.Emit(OpCodes.Ret); + + il.MarkLabel(falseLabel); + + // IFormatterResolver resolver = options.Resolver; + LocalBuilder localResolver = il.DeclareLocal(typeof(IFormatterResolver)); + il.EmitLdarg(2); + il.EmitCall(getResolverFromOptions); + il.EmitStloc(localResolver); + + // read-array header and validate, reader.ReadArrayHeader() != 2) throw; + Label rightLabel = il.DefineLabel(); + var writer = new ArgumentField(il, 1); + writer.EmitLdarg(); + il.EmitCall(MessagePackReaderTypeInfo.ReadArrayHeader); + il.EmitLdc_I4(2); + il.Emit(OpCodes.Beq_S, rightLabel); + il.Emit(OpCodes.Ldstr, "Invalid Union data was detected. Type:" + type.FullName); + il.Emit(OpCodes.Newobj, invalidOperationExceptionConstructor); + il.Emit(OpCodes.Throw); + + il.MarkLabel(rightLabel); + + // read key + LocalBuilder key = il.DeclareLocal(typeof(int)); + writer.EmitLdarg(); + il.EmitCall(MessagePackReaderTypeInfo.ReadInt32); + il.EmitStloc(key); + + // is-sequential don't need else convert key to jump-table value + if (!IsZeroStartSequential(infos)) + { + Label endKeyMapGet = il.DefineLabel(); + il.EmitLdarg(0); + il.EmitLdfld(keyToJumpMap); + il.EmitLdloc(key); + il.EmitLdloca(key); + il.EmitCall(keyMapDictionaryTryGetValue); + il.Emit(OpCodes.Brtrue_S, endKeyMapGet); + il.EmitLdc_I4(-1); + il.EmitStloc(key); + + il.MarkLabel(endKeyMapGet); + } + + // switch->read + LocalBuilder result = il.DeclareLocal(type); + Label loopEnd = il.DefineLabel(); + il.Emit(OpCodes.Ldnull); + il.EmitStloc(result); + il.Emit(OpCodes.Ldloc, key); + + var switchLabels = infos.Select(x => new { Label = il.DefineLabel(), Attr = x }).ToArray(); + il.Emit(OpCodes.Switch, switchLabels.Select(x => x.Label).ToArray()); + + // default + writer.EmitLdarg(); + il.EmitCall(MessagePackReaderTypeInfo.Skip); + il.Emit(OpCodes.Br, loopEnd); + + foreach (var item in switchLabels) + { + il.MarkLabel(item.Label); + il.EmitLdloc(localResolver); + il.EmitCall(getFormatterWithVerify.MakeGenericMethod(item.Attr.SubType)); + il.EmitLdarg(1); + il.EmitLdarg(2); + il.EmitCall(getDeserialize(item.Attr.SubType)); + if (item.Attr.SubType.GetTypeInfo().IsValueType) + { + il.Emit(OpCodes.Box, item.Attr.SubType); + } + + il.Emit(OpCodes.Stloc, result); + il.Emit(OpCodes.Br, loopEnd); + } + + il.MarkLabel(loopEnd); + + il.Emit(OpCodes.Ldloc, result); + il.Emit(OpCodes.Ret); + } + + private static bool IsZeroStartSequential(UnionAttribute[] infos) + { + for (int i = 0; i < infos.Length; i++) + { + if (infos[i].Key != i) + { + return false; + } + } + + return true; + } + +#pragma warning disable SA1311 // Static readonly fields should begin with upper-case letter + + // EmitInfos... + private static readonly Type refMessagePackReader = typeof(MessagePackReader).MakeByRefType(); + private static readonly Type refKvp = typeof(KeyValuePair).MakeByRefType(); + private static readonly MethodInfo getFormatterWithVerify = typeof(FormatterResolverExtensions).GetRuntimeMethods().First(x => x.Name == "GetFormatterWithVerify"); + private static readonly MethodInfo getResolverFromOptions = typeof(MessagePackSerializerOptions).GetRuntimeProperty(nameof(MessagePackSerializerOptions.Resolver)).GetMethod; + + private static readonly Func getSerialize = t => typeof(IMessagePackFormatter<>).MakeGenericType(t).GetRuntimeMethod("Serialize", new[] { typeof(MessagePackWriter).MakeByRefType(), t, typeof(MessagePackSerializerOptions) }); + private static readonly Func getDeserialize = t => typeof(IMessagePackFormatter<>).MakeGenericType(t).GetRuntimeMethod("Deserialize", new[] { typeof(MessagePackReader).MakeByRefType(), typeof(MessagePackSerializerOptions) }); + + private static readonly FieldInfo runtimeTypeHandleEqualityComparer = typeof(RuntimeTypeHandleEqualityComparer).GetRuntimeField("Default"); + private static readonly ConstructorInfo intIntKeyValuePairConstructor = typeof(KeyValuePair).GetTypeInfo().DeclaredConstructors.First(x => x.GetParameters().Length == 2); + private static readonly ConstructorInfo typeMapDictionaryConstructor = typeof(Dictionary>).GetTypeInfo().DeclaredConstructors.First(x => + { + ParameterInfo[] p = x.GetParameters(); + return p.Length == 2 && p[0].ParameterType == typeof(int); + }); + + private static readonly MethodInfo typeMapDictionaryAdd = typeof(Dictionary>).GetRuntimeMethod("Add", new[] { typeof(RuntimeTypeHandle), typeof(KeyValuePair) }); + private static readonly MethodInfo typeMapDictionaryTryGetValue = typeof(Dictionary>).GetRuntimeMethod("TryGetValue", new[] { typeof(RuntimeTypeHandle), refKvp }); + + private static readonly ConstructorInfo keyMapDictionaryConstructor = typeof(Dictionary).GetTypeInfo().DeclaredConstructors.First(x => + { + ParameterInfo[] p = x.GetParameters(); + return p.Length == 1 && p[0].ParameterType == typeof(int); + }); + + private static readonly MethodInfo keyMapDictionaryAdd = typeof(Dictionary).GetRuntimeMethod("Add", new[] { typeof(int), typeof(int) }); + private static readonly MethodInfo keyMapDictionaryTryGetValue = typeof(Dictionary).GetRuntimeMethod("TryGetValue", new[] { typeof(int), typeof(int).MakeByRefType() }); + + private static readonly MethodInfo objectGetType = typeof(object).GetRuntimeMethod("GetType", Type.EmptyTypes); + private static readonly MethodInfo getTypeHandle = typeof(Type).GetRuntimeProperty("TypeHandle").GetGetMethod(); + + private static readonly MethodInfo intIntKeyValuePairGetKey = typeof(KeyValuePair).GetRuntimeProperty("Key").GetGetMethod(); + private static readonly MethodInfo intIntKeyValuePairGetValue = typeof(KeyValuePair).GetRuntimeProperty("Value").GetGetMethod(); + + private static readonly ConstructorInfo invalidOperationExceptionConstructor = typeof(System.InvalidOperationException).GetTypeInfo().DeclaredConstructors.First( + x => + { + ParameterInfo[] p = x.GetParameters(); + return p.Length == 1 && p[0].ParameterType == typeof(string); + }); + + private static readonly ConstructorInfo objectCtor = typeof(object).GetTypeInfo().DeclaredConstructors.First(x => x.GetParameters().Length == 0); + +#pragma warning restore SA1311 // Static readonly fields should begin with upper-case letter + + private static class MessagePackReaderTypeInfo + { + internal static readonly TypeInfo ReaderTypeInfo = typeof(MessagePackReader).GetTypeInfo(); + + internal static readonly MethodInfo ReadBytes = typeof(MessagePackReader).GetRuntimeMethod(nameof(MessagePackReader.ReadBytes), Type.EmptyTypes); + internal static readonly MethodInfo ReadInt32 = typeof(MessagePackReader).GetRuntimeMethod(nameof(MessagePackReader.ReadInt32), Type.EmptyTypes); + internal static readonly MethodInfo ReadString = typeof(MessagePackReader).GetRuntimeMethod(nameof(MessagePackReader.ReadString), Type.EmptyTypes); + internal static readonly MethodInfo TryReadNil = typeof(MessagePackReader).GetRuntimeMethod(nameof(MessagePackReader.TryReadNil), Type.EmptyTypes); + internal static readonly MethodInfo Skip = typeof(MessagePackReader).GetRuntimeMethod(nameof(MessagePackReader.Skip), Type.EmptyTypes); + internal static readonly MethodInfo ReadArrayHeader = typeof(MessagePackReader).GetRuntimeMethod(nameof(MessagePackReader.ReadArrayHeader), Type.EmptyTypes); + internal static readonly MethodInfo ReadMapHeader = typeof(MessagePackReader).GetRuntimeMethod(nameof(MessagePackReader.ReadMapHeader), Type.EmptyTypes); + } + + private static class MessagePackWriterTypeInfo + { + internal static readonly TypeInfo WriterTypeInfo = typeof(MessagePackWriter).GetTypeInfo(); + + internal static readonly MethodInfo WriteArrayHeader = typeof(MessagePackWriter).GetRuntimeMethod(nameof(MessagePackWriter.WriteArrayHeader), new[] { typeof(int) }); + internal static readonly MethodInfo WriteInt32 = typeof(MessagePackWriter).GetRuntimeMethod(nameof(MessagePackWriter.Write), new[] { typeof(int) }); + internal static readonly MethodInfo WriteNil = typeof(MessagePackWriter).GetRuntimeMethod(nameof(MessagePackWriter.WriteNil), Type.EmptyTypes); + } + } +} + +namespace MessagePack.Internal +{ + // RuntimeTypeHandle can embed directly by OpCodes.Ldtoken + // It does not implements IEquatable(but GetHashCode and Equals is implemented) so needs this to avoid boxing. + public class RuntimeTypeHandleEqualityComparer : IEqualityComparer + { + public static readonly IEqualityComparer Default = new RuntimeTypeHandleEqualityComparer(); + + private RuntimeTypeHandleEqualityComparer() + { + } + + public bool Equals(RuntimeTypeHandle x, RuntimeTypeHandle y) + { + return x.Equals(y); + } + + public int GetHashCode(RuntimeTypeHandle obj) + { + return obj.GetHashCode(); + } + } + + internal class MessagePackDynamicUnionResolverException : MessagePackSerializationException + { + public MessagePackDynamicUnionResolverException(string message) + : base(message) + { + } + } +} + +#endif diff --git a/Assets/Scripts/MessagePack/Resolvers/DynamicUnionResolver.cs.meta b/Assets/Scripts/MessagePack/Resolvers/DynamicUnionResolver.cs.meta new file mode 100644 index 000000000..17bfde860 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/DynamicUnionResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 90ad303c7072b2339bba5b667f71b34c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Resolvers/NativeDateTimeResolver.cs b/Assets/Scripts/MessagePack/Resolvers/NativeDateTimeResolver.cs new file mode 100644 index 000000000..4e236314e --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/NativeDateTimeResolver.cs @@ -0,0 +1,73 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using MessagePack.Formatters; +using MessagePack.Internal; + +#pragma warning disable SA1403 // File may only contain a single namespace + +namespace MessagePack.Resolvers +{ + public sealed class NativeDateTimeResolver : IFormatterResolver + { + /// + /// The singleton instance that can be used. + /// + public static readonly NativeDateTimeResolver Instance; + + /// + /// A instance with this formatter pre-configured. + /// + public static readonly MessagePackSerializerOptions Options; + + static NativeDateTimeResolver() + { + Instance = new NativeDateTimeResolver(); + Options = new MessagePackSerializerOptions(Instance); + } + + private NativeDateTimeResolver() + { + } + + public IMessagePackFormatter GetFormatter() + { + return FormatterCache.Formatter; + } + + private static class FormatterCache + { + public static readonly IMessagePackFormatter Formatter; + + static FormatterCache() + { + Formatter = (IMessagePackFormatter)NativeDateTimeResolverGetFormatterHelper.GetFormatter(typeof(T)); + } + } + } +} + +namespace MessagePack.Internal +{ + internal static class NativeDateTimeResolverGetFormatterHelper + { + internal static object GetFormatter(Type t) + { + if (t == typeof(DateTime)) + { + return NativeDateTimeFormatter.Instance; + } + else if (t == typeof(DateTime?)) + { + return new StaticNullableFormatter(NativeDateTimeFormatter.Instance); + } + else if (t == typeof(DateTime[])) + { + return NativeDateTimeArrayFormatter.Instance; + } + + return null; + } + } +} diff --git a/Assets/Scripts/MessagePack/Resolvers/NativeDateTimeResolver.cs.meta b/Assets/Scripts/MessagePack/Resolvers/NativeDateTimeResolver.cs.meta new file mode 100644 index 000000000..74ee705c9 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/NativeDateTimeResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bee453915d14c4376a4cf68b338f7f4a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Resolvers/NativeDecimalResolver.cs b/Assets/Scripts/MessagePack/Resolvers/NativeDecimalResolver.cs new file mode 100644 index 000000000..725fba1f1 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/NativeDecimalResolver.cs @@ -0,0 +1,49 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using MessagePack.Formatters; + +namespace MessagePack.Resolvers +{ + public sealed class NativeDecimalResolver : IFormatterResolver + { + /// + /// The singleton instance that can be used. + /// + public static readonly NativeDecimalResolver Instance = new NativeDecimalResolver(); + + private NativeDecimalResolver() + { + } + + public IMessagePackFormatter GetFormatter() + { + return FormatterCache.Formatter; + } + + private static object GetFormatterHelper(Type t) + { + if (t == typeof(Decimal)) + { + return NativeDecimalFormatter.Instance; + } + else if (t == typeof(Decimal?)) + { + return new StaticNullableFormatter(NativeDecimalFormatter.Instance); + } + + return null; + } + + private static class FormatterCache + { + public static readonly IMessagePackFormatter Formatter; + + static FormatterCache() + { + Formatter = (IMessagePackFormatter)GetFormatterHelper(typeof(T)); + } + } + } +} diff --git a/Assets/Scripts/MessagePack/Resolvers/NativeDecimalResolver.cs.meta b/Assets/Scripts/MessagePack/Resolvers/NativeDecimalResolver.cs.meta new file mode 100644 index 000000000..204a97639 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/NativeDecimalResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 058b6071c8115560499afd0cc97e2fbd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Resolvers/NativeGuidResolver.cs b/Assets/Scripts/MessagePack/Resolvers/NativeGuidResolver.cs new file mode 100644 index 000000000..34081b1f8 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/NativeGuidResolver.cs @@ -0,0 +1,49 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using MessagePack.Formatters; + +namespace MessagePack.Resolvers +{ + public sealed class NativeGuidResolver : IFormatterResolver + { + /// + /// The singleton instance that can be used. + /// + public static readonly NativeGuidResolver Instance = new NativeGuidResolver(); + + private NativeGuidResolver() + { + } + + public IMessagePackFormatter GetFormatter() + { + return FormatterCache.Formatter; + } + + private static object GetFormatterHelper(Type t) + { + if (t == typeof(Guid)) + { + return NativeGuidFormatter.Instance; + } + else if (t == typeof(Guid?)) + { + return new StaticNullableFormatter(NativeGuidFormatter.Instance); + } + + return null; + } + + private static class FormatterCache + { + public static readonly IMessagePackFormatter Formatter; + + static FormatterCache() + { + Formatter = (IMessagePackFormatter)GetFormatterHelper(typeof(T)); + } + } + } +} diff --git a/Assets/Scripts/MessagePack/Resolvers/NativeGuidResolver.cs.meta b/Assets/Scripts/MessagePack/Resolvers/NativeGuidResolver.cs.meta new file mode 100644 index 000000000..f790df07f --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/NativeGuidResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a800419f557b36754a52fca66a1ed462 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Resolvers/PrimitiveObjectResolver.cs b/Assets/Scripts/MessagePack/Resolvers/PrimitiveObjectResolver.cs new file mode 100644 index 000000000..5c2859996 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/PrimitiveObjectResolver.cs @@ -0,0 +1,81 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using MessagePack.Formatters; + +namespace MessagePack.Resolvers +{ + public sealed class PrimitiveObjectResolver : IFormatterResolver + { + /// + /// The singleton instance that can be used. + /// + public static readonly PrimitiveObjectResolver Instance; + + /// + /// A instance with this formatter pre-configured. + /// + public static readonly MessagePackSerializerOptions Options; + + static PrimitiveObjectResolver() + { + Instance = new PrimitiveObjectResolver(); + Options = new MessagePackSerializerOptions(Instance); + } + + private PrimitiveObjectResolver() + { + } + + public IMessagePackFormatter GetFormatter() + { + return FormatterCache.Formatter; + } + + private static class FormatterCache + { + public static readonly IMessagePackFormatter Formatter; + + static FormatterCache() + { + Formatter = (typeof(T) == typeof(object)) + ? (IMessagePackFormatter)(object)PrimitiveObjectFormatter.Instance + : null; + } + } + } + + ////#if !UNITY_2018_3_OR_NEWER + + //// /// + //// /// In `object`, when serializing resolve by concrete type and when deserializing use primitive. + //// /// + //// public sealed class DynamicObjectTypeFallbackResolver : IFormatterResolver + //// { + //// public static readonly DynamicObjectTypeFallbackResolver Instance = new DynamicObjectTypeFallbackResolver(); + + //// DynamicObjectTypeFallbackResolver() + //// { + + //// } + + //// public IMessagePackFormatter GetFormatter() + //// { + //// return FormatterCache.formatter; + //// } + + //// static class FormatterCache + //// { + //// public static readonly IMessagePackFormatter formatter; + + //// static FormatterCache() + //// { + //// formatter = (typeof(T) == typeof(object)) + //// ? (IMessagePackFormatter)(object)DynamicObjectTypeFallbackFormatter.Instance + //// : null; + //// } + //// } + //// } + + ////#endif +} diff --git a/Assets/Scripts/MessagePack/Resolvers/PrimitiveObjectResolver.cs.meta b/Assets/Scripts/MessagePack/Resolvers/PrimitiveObjectResolver.cs.meta new file mode 100644 index 000000000..4b805b067 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/PrimitiveObjectResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5b5a40f7f1c67953c8b8066277e196f6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Resolvers/StandardResolver.cs b/Assets/Scripts/MessagePack/Resolvers/StandardResolver.cs new file mode 100644 index 000000000..e67cefef6 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/StandardResolver.cs @@ -0,0 +1,305 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Linq; +using MessagePack.Formatters; +using MessagePack.Internal; +using MessagePack.Resolvers; + +#pragma warning disable SA1403 // File may only contain a single namespace + +namespace MessagePack.Resolvers +{ + /// + /// Default composited resolver, builtin -> attribute -> dynamic enum -> dynamic generic -> dynamic union -> dynamic object -> primitive. + /// + public sealed class StandardResolver : IFormatterResolver + { + /// + /// The singleton instance that can be used. + /// + public static readonly StandardResolver Instance; + + /// + /// A instance with this formatter pre-configured. + /// + public static readonly MessagePackSerializerOptions Options; + + private static readonly IFormatterResolver[] Resolvers = StandardResolverHelper.DefaultResolvers.Concat(new IFormatterResolver[] + { +#if !ENABLE_IL2CPP && !NET_STANDARD_2_0 + DynamicObjectResolver.Instance, // Try Object +#endif + }).ToArray(); + + static StandardResolver() + { + Instance = new StandardResolver(); + Options = new MessagePackSerializerOptions(Instance); + } + + private StandardResolver() + { + } + + public IMessagePackFormatter GetFormatter() + { + return FormatterCache.Formatter; + } + + private static class FormatterCache + { + public static readonly IMessagePackFormatter Formatter; + + static FormatterCache() + { + if (typeof(T) == typeof(object)) + { + // final fallback +#if !ENABLE_IL2CPP + Formatter = (IMessagePackFormatter)DynamicObjectTypeFallbackFormatter.Instance; +#else + Formatter = PrimitiveObjectResolver.Instance.GetFormatter(); +#endif + } + else + { + foreach (IFormatterResolver item in Resolvers) + { + IMessagePackFormatter f = item.GetFormatter(); + if (f != null) + { + Formatter = f; + return; + } + } + } + } + } + } + + public sealed class ContractlessStandardResolver : IFormatterResolver + { + /// + /// The singleton instance that can be used. + /// + public static readonly ContractlessStandardResolver Instance; + + /// + /// A instance with this formatter pre-configured. + /// + public static readonly MessagePackSerializerOptions Options; + + private static readonly IFormatterResolver[] Resolvers = StandardResolverHelper.DefaultResolvers.Concat(new IFormatterResolver[] + { +#if !ENABLE_IL2CPP && !NET_STANDARD_2_0 + DynamicObjectResolver.Instance, // Try Object + DynamicContractlessObjectResolver.Instance, // Serializes keys as strings +#endif + }).ToArray(); + + static ContractlessStandardResolver() + { + Instance = new ContractlessStandardResolver(); + Options = new MessagePackSerializerOptions(Instance); + } + + private ContractlessStandardResolver() + { + } + + public IMessagePackFormatter GetFormatter() + { + return FormatterCache.Formatter; + } + + private static class FormatterCache + { + public static readonly IMessagePackFormatter Formatter; + + static FormatterCache() + { + if (typeof(T) == typeof(object)) + { + // final fallback +#if !ENABLE_IL2CPP + Formatter = (IMessagePackFormatter)DynamicObjectTypeFallbackFormatter.Instance; +#else + Formatter = PrimitiveObjectResolver.Instance.GetFormatter(); +#endif + } + else + { + foreach (IFormatterResolver item in Resolvers) + { + IMessagePackFormatter f = item.GetFormatter(); + if (f != null) + { + Formatter = f; + return; + } + } + } + } + } + } + + public sealed class StandardResolverAllowPrivate : IFormatterResolver + { + /// + /// The singleton instance that can be used. + /// + public static readonly StandardResolverAllowPrivate Instance; + + /// + /// A instance with this formatter pre-configured. + /// + public static readonly MessagePackSerializerOptions Options; + + private static readonly IFormatterResolver[] Resolvers = StandardResolverHelper.DefaultResolvers.Concat(new IFormatterResolver[] + { +#if !ENABLE_IL2CPP && !NET_STANDARD_2_0 + DynamicObjectResolverAllowPrivate.Instance, // Try Object +#endif + }).ToArray(); + + static StandardResolverAllowPrivate() + { + Instance = new StandardResolverAllowPrivate(); + Options = new MessagePackSerializerOptions(Instance); + } + + private StandardResolverAllowPrivate() + { + } + + public IMessagePackFormatter GetFormatter() + { + return FormatterCache.Formatter; + } + + private static class FormatterCache + { + public static readonly IMessagePackFormatter Formatter; + + static FormatterCache() + { + if (typeof(T) == typeof(object)) + { + // final fallback +#if !ENABLE_IL2CPP + Formatter = (IMessagePackFormatter)DynamicObjectTypeFallbackFormatter.Instance; +#else + Formatter = PrimitiveObjectResolver.Instance.GetFormatter(); +#endif + } + else + { + foreach (IFormatterResolver item in Resolvers) + { + IMessagePackFormatter f = item.GetFormatter(); + if (f != null) + { + Formatter = f; + return; + } + } + } + } + } + } + + public sealed class ContractlessStandardResolverAllowPrivate : IFormatterResolver + { + /// + /// The singleton instance that can be used. + /// + public static readonly ContractlessStandardResolverAllowPrivate Instance; + + /// + /// A instance with this formatter pre-configured. + /// + public static readonly MessagePackSerializerOptions Options; + + private static readonly IFormatterResolver[] Resolvers = StandardResolverHelper.DefaultResolvers.Concat(new IFormatterResolver[] + { +#if !ENABLE_IL2CPP && !NET_STANDARD_2_0 + DynamicObjectResolverAllowPrivate.Instance, // Try Object + DynamicContractlessObjectResolverAllowPrivate.Instance, // Serializes keys as strings +#endif + }).ToArray(); + + static ContractlessStandardResolverAllowPrivate() + { + Instance = new ContractlessStandardResolverAllowPrivate(); + Options = new MessagePackSerializerOptions(Instance); + } + + private ContractlessStandardResolverAllowPrivate() + { + } + + public IMessagePackFormatter GetFormatter() + { + return FormatterCache.Formatter; + } + + private static class FormatterCache + { + public static readonly IMessagePackFormatter Formatter; + + static FormatterCache() + { + if (typeof(T) == typeof(object)) + { + // final fallback +#if !ENABLE_IL2CPP + Formatter = (IMessagePackFormatter)DynamicObjectTypeFallbackFormatter.Instance; +#else + Formatter = PrimitiveObjectResolver.Instance.GetFormatter(); +#endif + } + else + { + foreach (IFormatterResolver item in Resolvers) + { + IMessagePackFormatter f = item.GetFormatter(); + if (f != null) + { + Formatter = f; + return; + } + } + } + } + } + } +} + +namespace MessagePack.Internal +{ + internal static class StandardResolverHelper + { + public static readonly IFormatterResolver[] DefaultResolvers = new IFormatterResolver[] + { + BuiltinResolver.Instance, // Try Builtin + AttributeFormatterResolver.Instance, // Try use [MessagePackFormatter] + +#if UNITY_2018_3_OR_NEWER + MessagePack.Unity.UnityResolver.Instance, +#endif + +#if !ENABLE_IL2CPP && !NET_STANDARD_2_0 + DynamicEnumResolver.Instance, // Try Enum +#endif + +#if !ENABLE_IL2CPP + DynamicGenericResolver.Instance, // Try Array, Tuple, Collection, Enum(Generic Fallback) +#endif + +#if !ENABLE_IL2CPP && !NET_STANDARD_2_0 + DynamicUnionResolver.Instance, // Try Union(Interface) +#endif + }; + } +} diff --git a/Assets/Scripts/MessagePack/Resolvers/StandardResolver.cs.meta b/Assets/Scripts/MessagePack/Resolvers/StandardResolver.cs.meta new file mode 100644 index 000000000..a2d232750 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/StandardResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2273a153a02536bb1809f799fbfb2ceb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Resolvers/StaticCompositeResolver.cs b/Assets/Scripts/MessagePack/Resolvers/StaticCompositeResolver.cs new file mode 100644 index 000000000..ba0084c59 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/StaticCompositeResolver.cs @@ -0,0 +1,149 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Collections.Generic; +using MessagePack.Formatters; + +namespace MessagePack.Resolvers +{ + /// + /// Singleton version of CompositeResolver, which be able to register a collection of formatters and resolvers to a single instance. + /// + public class StaticCompositeResolver : IFormatterResolver + { + public static readonly StaticCompositeResolver Instance = new StaticCompositeResolver(); + + private bool freezed; + private IReadOnlyList formatters; + private IReadOnlyList resolvers; + + private StaticCompositeResolver() + { + formatters = Array.Empty(); + resolvers = Array.Empty(); + } + + /// + /// Initializes a singleton instance with the specified formatters. + /// This method can only call before use StaticCompositeResolver.Instance.GetFormatter. + /// If call twice in the Register methods, registered formatters and resolvers will be overridden. + /// + /// + /// A list of instances of . + /// The formatters are searched in the order given, so if two formatters support serializing the same type, the first one is used. + /// + public void Register(params IMessagePackFormatter[] formatters) + { + if (this.freezed) + { + throw new InvalidOperationException("Register must call on startup(before use GetFormatter)."); + } + + if (this.formatters is null) + { + throw new ArgumentNullException(nameof(formatters)); + } + + this.formatters = formatters; + this.resolvers = Array.Empty(); + } + + /// + /// Initializes a singleton instance with the specified formatters and sub-resolvers. + /// This method can only call before use StaticCompositeResolver.Instance.GetFormatter. + /// If call twice in the Register methods, registered formatters and resolvers will be overridden. + /// + /// + /// A list of resolvers to use for serializing types. + /// The resolvers are searched in the order given, so if two resolvers support serializing the same type, the first one is used. + /// + public void Register(params IFormatterResolver[] resolvers) + { + if (this.freezed) + { + throw new InvalidOperationException("Register must call on startup(before use GetFormatter)."); + } + + if (resolvers is null) + { + throw new ArgumentNullException(nameof(resolvers)); + } + + this.formatters = Array.Empty(); + this.resolvers = resolvers; + } + + /// + /// Initializes a singleton instance with the specified formatters and sub-resolvers. + /// This method can only call before use StaticCompositeResolver.Instance.GetFormatter. + /// If call twice in the Register methods, registered formatters and resolvers will be overridden. + /// + /// + /// A list of instances of . + /// The formatters are searched in the order given, so if two formatters support serializing the same type, the first one is used. + /// + /// + /// A list of resolvers to use for serializing types for which does not include a formatter. + /// The resolvers are searched in the order given, so if two resolvers support serializing the same type, the first one is used. + /// + public void Register(IReadOnlyList formatters, IReadOnlyList resolvers) + { + if (this.freezed) + { + throw new InvalidOperationException("Register must call on startup(before use GetFormatter)."); + } + + if (formatters is null) + { + throw new ArgumentNullException(nameof(formatters)); + } + + if (resolvers is null) + { + throw new ArgumentNullException(nameof(resolvers)); + } + + this.formatters = formatters; + this.resolvers = resolvers; + } + + /// + /// Gets an instance that can serialize or deserialize some type . + /// + /// The type of value to be serialized or deserialized. + /// A formatter, if this resolver supplies one for type ; otherwise null. + public IMessagePackFormatter GetFormatter() + { + return Cache.Formatter; + } + + private static class Cache + { + public static readonly IMessagePackFormatter Formatter; + + static Cache() + { + Instance.freezed = true; + foreach (var item in Instance.formatters) + { + if (item is IMessagePackFormatter f) + { + Formatter = f; + return; + } + } + + foreach (var item in Instance.resolvers) + { + var f = item.GetFormatter(); + if (f != null) + { + Formatter = f; + return; + } + } + } + } + } +} diff --git a/Assets/Scripts/MessagePack/Resolvers/StaticCompositeResolver.cs.meta b/Assets/Scripts/MessagePack/Resolvers/StaticCompositeResolver.cs.meta new file mode 100644 index 000000000..62d918ea8 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/StaticCompositeResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 26c258a5a36d7dbf99caf4e98a7cbd53 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Resolvers/TypelessContractlessStandardResolver.cs b/Assets/Scripts/MessagePack/Resolvers/TypelessContractlessStandardResolver.cs new file mode 100644 index 000000000..df789b9ef --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/TypelessContractlessStandardResolver.cs @@ -0,0 +1,84 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +#if !UNITY_2018_3_OR_NEWER +using System; +using System.Collections.Generic; +using MessagePack.Formatters; +using MessagePack.Internal; + +namespace MessagePack.Resolvers +{ + /// + /// Embeds the full name of .NET types for typed fields/collection items + /// Preserves .NET timezone. + /// + public sealed class TypelessContractlessStandardResolver : IFormatterResolver + { + /// + /// The singleton instance that can be used. + /// + public static readonly TypelessContractlessStandardResolver Instance; + + /// + /// A instance with this formatter pre-configured. + /// + public static readonly MessagePackSerializerOptions Options; + + /// + /// A *private* list of resolvers. If we ever want to expose any of these (so the user can adjust settings, etc.) + /// then we must make this an instance collection instead of a static collection so that each consumer can have their own settings. + /// + private static readonly IReadOnlyList Resolvers = new IFormatterResolver[] + { + NativeDateTimeResolver.Instance, // Native c# DateTime format, preserving timezone + ForceSizePrimitiveObjectResolver.Instance, // Preserve particular integer types + BuiltinResolver.Instance, // Try Builtin + AttributeFormatterResolver.Instance, // Try use [MessagePackFormatter] +#if !ENABLE_IL2CPP + DynamicEnumResolver.Instance, // Try Enum + DynamicGenericResolver.Instance, // Try Array, Tuple, Collection + DynamicUnionResolver.Instance, // Try Union(Interface) + DynamicObjectResolver.Instance, // Try Object +#endif + DynamicContractlessObjectResolverAllowPrivate.Instance, // Serializes keys as strings + TypelessObjectResolver.Instance, + }; + + static TypelessContractlessStandardResolver() + { + Instance = new TypelessContractlessStandardResolver(); + Options = new MessagePackSerializerOptions(Instance); + } + + private readonly ResolverCache resolverCache = new ResolverCache(Resolvers); + + public IMessagePackFormatter GetFormatter() => this.resolverCache.GetFormatter(); + + private class ResolverCache : CachingFormatterResolver + { + private readonly IReadOnlyList resolvers; + + internal ResolverCache(IReadOnlyList resolvers) + { + this.resolvers = resolvers ?? throw new ArgumentNullException(nameof(resolvers)); + } + + protected override IMessagePackFormatter GetFormatterCore() + { + foreach (IFormatterResolver item in this.resolvers) + { + IMessagePackFormatter f = item.GetFormatter(); + if (f != null) + { + return f; + } + } + + return null; + } + } + } +} + +#endif diff --git a/Assets/Scripts/MessagePack/Resolvers/TypelessContractlessStandardResolver.cs.meta b/Assets/Scripts/MessagePack/Resolvers/TypelessContractlessStandardResolver.cs.meta new file mode 100644 index 000000000..5b44fb822 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/TypelessContractlessStandardResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d4b1e4648b37d6308ac35a0e31148ab0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Resolvers/TypelessObjectResolver.cs b/Assets/Scripts/MessagePack/Resolvers/TypelessObjectResolver.cs new file mode 100644 index 000000000..cb670e089 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/TypelessObjectResolver.cs @@ -0,0 +1,142 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Collections.Generic; +using MessagePack.Formatters; +using MessagePack.Internal; + +namespace MessagePack.Resolvers +{ +#if !UNITY_2018_3_OR_NEWER + + /// + /// Used for `object` fields/collections, ex: var arr = new object[] { 1, "a", new Model() }; + /// The runtime type of value in object field, should be covered by one of resolvers in complex/standard resolver. + /// should be placed before DynamicObjectTypeFallbackResolver and in resolvers list. + /// Deserializer uses Namespace.TypeName, AssemblyName to get runtime type in destination app, so that combination must be present in destination app. + /// Serialized binary is valid MessagePack binary used ext-format and custom typecode(100). + /// Inside ext - assembly qualified type name, and serialized object. + /// + public sealed class TypelessObjectResolver : IFormatterResolver + { + public static readonly IFormatterResolver Instance = new TypelessObjectResolver(); + + private static readonly IFormatterResolver[] Resolvers = new IFormatterResolver[] + { + ForceSizePrimitiveObjectResolver.Instance, + ContractlessStandardResolverAllowPrivate.Instance, + }; + + private TypelessObjectResolver() + { + } + + /// + public IMessagePackFormatter GetFormatter() + { + if (typeof(T) == typeof(object)) + { + return (IMessagePackFormatter)TypelessFormatter.Instance; + } + else + { + foreach (IFormatterResolver item in Resolvers) + { + IMessagePackFormatter f = item.GetFormatter(); + if (f != null) + { + return f; + } + } + + return null; + } + } + } + + /* helpers for TypelessFormatter */ + + internal sealed class ForceSizePrimitiveObjectResolver : IFormatterResolver + { + /// + /// The singleton instance that can be used. + /// + public static readonly ForceSizePrimitiveObjectResolver Instance; + + /// + /// A instance with this formatter pre-configured. + /// + public static readonly MessagePackSerializerOptions Options; + + static ForceSizePrimitiveObjectResolver() + { + Instance = new ForceSizePrimitiveObjectResolver(); + Options = new MessagePackSerializerOptions(Instance); + } + + private ForceSizePrimitiveObjectResolver() + { + } + + public IMessagePackFormatter GetFormatter() + { + return FormatterCache.Formatter; + } + + private static class FormatterCache + { + public static readonly IMessagePackFormatter Formatter; + + static FormatterCache() + { + Formatter = (IMessagePackFormatter)Helper.GetFormatter(typeof(T)); + } + } + + private static class Helper + { + private static readonly Dictionary FormatterMap = new Dictionary() + { + // Primitive + { typeof(Int16), ForceInt16BlockFormatter.Instance }, + { typeof(Int32), ForceInt32BlockFormatter.Instance }, + { typeof(Int64), ForceInt64BlockFormatter.Instance }, + { typeof(UInt16), ForceUInt16BlockFormatter.Instance }, + { typeof(UInt32), ForceUInt32BlockFormatter.Instance }, + { typeof(UInt64), ForceUInt64BlockFormatter.Instance }, + { typeof(byte), ForceByteBlockFormatter.Instance }, + { typeof(sbyte), ForceSByteBlockFormatter.Instance }, + + // Nullable Primitive + { typeof(Int16?), NullableForceInt16BlockFormatter.Instance }, + { typeof(Int32?), NullableForceInt32BlockFormatter.Instance }, + { typeof(Int64?), NullableForceInt64BlockFormatter.Instance }, + { typeof(UInt16?), NullableForceUInt16BlockFormatter.Instance }, + { typeof(UInt32?), NullableForceUInt32BlockFormatter.Instance }, + { typeof(UInt64?), NullableForceUInt64BlockFormatter.Instance }, + { typeof(byte?), NullableForceByteBlockFormatter.Instance }, + { typeof(sbyte?), NullableForceSByteBlockFormatter.Instance }, + + // optimized primitive array formatter + { typeof(Int16[]), ForceInt16BlockArrayFormatter.Instance }, + { typeof(Int32[]), ForceInt32BlockArrayFormatter.Instance }, + { typeof(Int64[]), ForceInt64BlockArrayFormatter.Instance }, + { typeof(UInt16[]), ForceUInt16BlockArrayFormatter.Instance }, + { typeof(UInt32[]), ForceUInt32BlockArrayFormatter.Instance }, + { typeof(UInt64[]), ForceUInt64BlockArrayFormatter.Instance }, + { typeof(SByte[]), ForceSByteBlockArrayFormatter.Instance }, + }; + + public static object GetFormatter(Type type) + { + object formatter; + return FormatterMap.TryGetValue(type, out formatter) + ? formatter + : null; + } + } + } + +#endif +} diff --git a/Assets/Scripts/MessagePack/Resolvers/TypelessObjectResolver.cs.meta b/Assets/Scripts/MessagePack/Resolvers/TypelessObjectResolver.cs.meta new file mode 100644 index 000000000..870673c62 --- /dev/null +++ b/Assets/Scripts/MessagePack/Resolvers/TypelessObjectResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 857aa0d32f3e2955491df1c9d5bb6f5d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/SequencePool.cs b/Assets/Scripts/MessagePack/SequencePool.cs new file mode 100644 index 000000000..7c95391a3 --- /dev/null +++ b/Assets/Scripts/MessagePack/SequencePool.cs @@ -0,0 +1,121 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; +using System.Collections.Generic; +using Nerdbank.Streams; + +namespace MessagePack +{ + /// + /// A thread-safe, alloc-free reusable object pool. + /// + internal class SequencePool + { + /// + /// A thread-safe pool of reusable objects. + /// + /// + /// We use a that allows every processor to be involved in messagepack serialization concurrently, + /// plus one nested serialization per processor (since LZ4 and sometimes other nested serializations may exist). + /// + internal static readonly SequencePool Shared = new SequencePool(Environment.ProcessorCount * 2); + + /// + /// The value to use for . + /// + /// + /// Individual users that want a different value for this can modify the setting on the rented + /// or by supplying their own . + /// + /// + /// We use 32KB so that when LZ4Codec.MaximumOutputLength is used on this length it does not require a + /// buffer that would require the Large Object Heap. + /// + private const int MinimumSpanLength = 32 * 1024; + + private readonly int maxSize; + private readonly Stack> pool = new Stack>(); + + /// + /// The array pool which we share with all objects created by this instance. + /// + /// + /// We allow 100 arrays to be shared (instead of the default 50) and reduce the max array length from the default 1MB to something more reasonable for our expected use. + /// + private readonly ArrayPool arrayPool = ArrayPool.Create(80 * 1024, 100); + + /// + /// Initializes a new instance of the class. + /// + /// The maximum size to allow the pool to grow. + internal SequencePool(int maxSize) + { + this.maxSize = maxSize; + } + + /// + /// Gets an instance of + /// This is taken from the recycled pool if one is available; otherwise a new one is created. + /// + /// The rental tracker that provides access to the object as well as a means to return it. + internal Rental Rent() + { + lock (this.pool) + { + if (this.pool.Count > 0) + { + return new Rental(this, this.pool.Pop()); + } + } + + // Configure the newly created object to share a common array pool with the other instances, + // otherwise each one will have its own ArrayPool which would likely waste a lot of memory. + return new Rental(this, new Sequence(this.arrayPool) { MinimumSpanLength = MinimumSpanLength }); + } + + private void Return(Sequence value) + { + value.Reset(); + lock (this.pool) + { + if (this.pool.Count < this.maxSize) + { + // Reset to preferred settings in case the renter changed them. + value.MinimumSpanLength = MinimumSpanLength; + + this.pool.Push(value); + } + } + } + + internal struct Rental : IDisposable + { + private readonly SequencePool owner; + + internal Rental(SequencePool owner, Sequence value) + { + this.owner = owner; + this.Value = value; + } + + /// + /// Gets the recyclable object. + /// + public Sequence Value { get; } + + /// + /// Returns the recyclable object to the pool. + /// + /// + /// The instance is cleaned first, if a clean delegate was provided. + /// It is dropped instead of being returned to the pool if the pool is already at its maximum size. + /// + public void Dispose() + { + this.owner.Return(this.Value); + } + } + } +} diff --git a/Assets/Scripts/MessagePack/SequencePool.cs.meta b/Assets/Scripts/MessagePack/SequencePool.cs.meta new file mode 100644 index 000000000..3c898c9cb --- /dev/null +++ b/Assets/Scripts/MessagePack/SequencePool.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cd6feadb8ef11ef71b6f41d1dda885d7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/SequenceReader.cs b/Assets/Scripts/MessagePack/SequenceReader.cs new file mode 100644 index 000000000..7dde28695 --- /dev/null +++ b/Assets/Scripts/MessagePack/SequenceReader.cs @@ -0,0 +1,495 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +/* Licensed to the .NET Foundation under one or more agreements. + * The .NET Foundation licenses this file to you under the MIT license. + * See the LICENSE file in the project root for more information. */ + +using System.Diagnostics; +using System.Runtime.CompilerServices; + +namespace System.Buffers +{ + internal ref partial struct SequenceReader + where T : unmanaged, IEquatable + { + /// + /// A value indicating whether we're using (as opposed to . + /// + private bool usingSequence; + + /// + /// Backing for the entire sequence when we're not using . + /// + private ReadOnlySequence sequence; + + /// + /// The position at the start of the . + /// + private SequencePosition currentPosition; + + /// + /// The position at the end of the . + /// + private SequencePosition nextPosition; + + /// + /// Backing for the entire sequence when we're not using . + /// + private ReadOnlyMemory memory; + + /// + /// A value indicating whether there is unread data remaining. + /// + private bool moreData; + + /// + /// The total number of elements in the sequence. + /// + private long length; + + /// + /// Initializes a new instance of the struct + /// over the given . + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public SequenceReader(in ReadOnlySequence sequence) + { + this.usingSequence = true; + this.CurrentSpanIndex = 0; + this.Consumed = 0; + this.sequence = sequence; + this.memory = default; + this.currentPosition = sequence.Start; + this.length = -1; + + ReadOnlySpan first = sequence.First.Span; + this.nextPosition = sequence.GetPosition(first.Length); + this.CurrentSpan = first; + this.moreData = first.Length > 0; + + if (!this.moreData && !sequence.IsSingleSegment) + { + this.moreData = true; + this.GetNextSpan(); + } + } + + /// + /// Initializes a new instance of the struct + /// over the given . + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public SequenceReader(ReadOnlyMemory memory) + { + this.usingSequence = false; + this.CurrentSpanIndex = 0; + this.Consumed = 0; + this.memory = memory; + this.CurrentSpan = memory.Span; + this.length = memory.Length; + this.moreData = memory.Length > 0; + + this.currentPosition = default; + this.nextPosition = default; + this.sequence = default; + } + + /// + /// Gets a value indicating whether there is no more data in the . + /// + public bool End => !this.moreData; + + /// + /// Gets the underlying for the reader. + /// + public ReadOnlySequence Sequence + { + get + { + if (this.sequence.IsEmpty && !this.memory.IsEmpty) + { + // We're in memory mode (instead of sequence mode). + // Lazily fill in the sequence data. + this.sequence = new ReadOnlySequence(this.memory); + this.currentPosition = this.sequence.Start; + this.nextPosition = this.sequence.End; + } + + return this.sequence; + } + } + + /// + /// Gets the current position in the . + /// + public SequencePosition Position + => this.Sequence.GetPosition(this.CurrentSpanIndex, this.currentPosition); + + /// + /// Gets the current segment in the as a span. + /// + public ReadOnlySpan CurrentSpan { get; private set; } + + /// + /// Gets the index in the . + /// + public int CurrentSpanIndex { get; private set; } + + /// + /// Gets the unread portion of the . + /// + public ReadOnlySpan UnreadSpan + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => this.CurrentSpan.Slice(this.CurrentSpanIndex); + } + + /// + /// Gets the total number of 's processed by the reader. + /// + public long Consumed { get; private set; } + + /// + /// Gets remaining 's in the reader's . + /// + public long Remaining => this.Length - this.Consumed; + + /// + /// Gets count of in the reader's . + /// + public long Length + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + if (this.length < 0) + { + // Cache the length + this.length = this.Sequence.Length; + } + + return this.length; + } + } + + /// + /// Peeks at the next value without advancing the reader. + /// + /// The next value or default if at the end. + /// False if at the end of the reader. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public bool TryPeek(out T value) + { + if (this.moreData) + { + value = this.CurrentSpan[this.CurrentSpanIndex]; + return true; + } + else + { + value = default; + return false; + } + } + + /// + /// Read the next value and advance the reader. + /// + /// The next value or default if at the end. + /// False if at the end of the reader. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public bool TryRead(out T value) + { + if (this.End) + { + value = default; + return false; + } + + value = this.CurrentSpan[this.CurrentSpanIndex]; + this.CurrentSpanIndex++; + this.Consumed++; + + if (this.CurrentSpanIndex >= this.CurrentSpan.Length) + { + if (this.usingSequence) + { + this.GetNextSpan(); + } + else + { + this.moreData = false; + } + } + + return true; + } + + /// + /// Move the reader back the specified number of items. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void Rewind(long count) + { + if (count < 0) + { + throw new ArgumentOutOfRangeException(nameof(count)); + } + + this.Consumed -= count; + + if (this.CurrentSpanIndex >= count) + { + this.CurrentSpanIndex -= (int)count; + this.moreData = true; + } + else if (this.usingSequence) + { + // Current segment doesn't have enough data, scan backward through segments + this.RetreatToPreviousSpan(this.Consumed); + } + else + { + throw new ArgumentOutOfRangeException("Rewind went past the start of the memory."); + } + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private void RetreatToPreviousSpan(long consumed) + { + Debug.Assert(this.usingSequence, "usingSequence"); + this.ResetReader(); + this.Advance(consumed); + } + + private void ResetReader() + { + Debug.Assert(this.usingSequence, "usingSequence"); + this.CurrentSpanIndex = 0; + this.Consumed = 0; + this.currentPosition = this.Sequence.Start; + this.nextPosition = this.currentPosition; + + if (this.Sequence.TryGet(ref this.nextPosition, out ReadOnlyMemory memory, advance: true)) + { + this.moreData = true; + + if (memory.Length == 0) + { + this.CurrentSpan = default; + + // No data in the first span, move to one with data + this.GetNextSpan(); + } + else + { + this.CurrentSpan = memory.Span; + } + } + else + { + // No data in any spans and at end of sequence + this.moreData = false; + this.CurrentSpan = default; + } + } + + /// + /// Get the next segment with available data, if any. + /// + private void GetNextSpan() + { + Debug.Assert(this.usingSequence, "usingSequence"); + if (!this.Sequence.IsSingleSegment) + { + SequencePosition previousNextPosition = this.nextPosition; + while (this.Sequence.TryGet(ref this.nextPosition, out ReadOnlyMemory memory, advance: true)) + { + this.currentPosition = previousNextPosition; + if (memory.Length > 0) + { + this.CurrentSpan = memory.Span; + this.CurrentSpanIndex = 0; + return; + } + else + { + this.CurrentSpan = default; + this.CurrentSpanIndex = 0; + previousNextPosition = this.nextPosition; + } + } + } + + this.moreData = false; + } + + /// + /// Move the reader ahead the specified number of items. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void Advance(long count) + { + const long TooBigOrNegative = unchecked((long)0xFFFFFFFF80000000); + if ((count & TooBigOrNegative) == 0 && this.CurrentSpan.Length - this.CurrentSpanIndex > (int)count) + { + this.CurrentSpanIndex += (int)count; + this.Consumed += count; + } + else if (this.usingSequence) + { + // Can't satisfy from the current span + this.AdvanceToNextSpan(count); + } + else if (this.CurrentSpan.Length - this.CurrentSpanIndex == (int)count) + { + this.CurrentSpanIndex += (int)count; + this.Consumed += count; + this.moreData = false; + } + else + { + throw new ArgumentOutOfRangeException(nameof(count)); + } + } + + /// + /// Unchecked helper to avoid unnecessary checks where you know count is valid. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal void AdvanceCurrentSpan(long count) + { + Debug.Assert(count >= 0, "count >= 0"); + + this.Consumed += count; + this.CurrentSpanIndex += (int)count; + if (this.usingSequence && this.CurrentSpanIndex >= this.CurrentSpan.Length) + { + this.GetNextSpan(); + } + } + + /// + /// Only call this helper if you know that you are advancing in the current span + /// with valid count and there is no need to fetch the next one. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal void AdvanceWithinSpan(long count) + { + Debug.Assert(count >= 0, "count >= 0"); + + this.Consumed += count; + this.CurrentSpanIndex += (int)count; + + Debug.Assert(this.CurrentSpanIndex < this.CurrentSpan.Length, "this.CurrentSpanIndex < this.CurrentSpan.Length"); + } + + /// + /// Move the reader ahead the specified number of items + /// if there are enough elements remaining in the sequence. + /// + /// true if there were enough elements to advance; otherwise false. + internal bool TryAdvance(long count) + { + if (this.Remaining < count) + { + return false; + } + + this.Advance(count); + return true; + } + + private void AdvanceToNextSpan(long count) + { + Debug.Assert(this.usingSequence, "usingSequence"); + if (count < 0) + { + throw new ArgumentOutOfRangeException(nameof(count)); + } + + this.Consumed += count; + while (this.moreData) + { + int remaining = this.CurrentSpan.Length - this.CurrentSpanIndex; + + if (remaining > count) + { + this.CurrentSpanIndex += (int)count; + count = 0; + break; + } + + // As there may not be any further segments we need to + // push the current index to the end of the span. + this.CurrentSpanIndex += remaining; + count -= remaining; + Debug.Assert(count >= 0, "count >= 0"); + + this.GetNextSpan(); + + if (count == 0) + { + break; + } + } + + if (count != 0) + { + // Not enough data left- adjust for where we actually ended and throw + this.Consumed -= count; + throw new ArgumentOutOfRangeException(nameof(count)); + } + } + + /// + /// Copies data from the current to the given span. + /// + /// Destination to copy to. + /// True if there is enough data to copy to the . + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public bool TryCopyTo(Span destination) + { + ReadOnlySpan firstSpan = this.UnreadSpan; + if (firstSpan.Length >= destination.Length) + { + firstSpan.Slice(0, destination.Length).CopyTo(destination); + return true; + } + + return this.TryCopyMultisegment(destination); + } + + internal bool TryCopyMultisegment(Span destination) + { + if (this.Remaining < destination.Length) + { + return false; + } + + ReadOnlySpan firstSpan = this.UnreadSpan; + Debug.Assert(firstSpan.Length < destination.Length, "firstSpan.Length < destination.Length"); + firstSpan.CopyTo(destination); + int copied = firstSpan.Length; + + SequencePosition next = this.nextPosition; + while (this.Sequence.TryGet(ref next, out ReadOnlyMemory nextSegment, true)) + { + if (nextSegment.Length > 0) + { + ReadOnlySpan nextSpan = nextSegment.Span; + int toCopy = Math.Min(nextSpan.Length, destination.Length - copied); + nextSpan.Slice(0, toCopy).CopyTo(destination.Slice(copied)); + copied += toCopy; + if (copied >= destination.Length) + { + break; + } + } + } + + return true; + } + } +} diff --git a/Assets/Scripts/MessagePack/SequenceReader.cs.meta b/Assets/Scripts/MessagePack/SequenceReader.cs.meta new file mode 100644 index 000000000..9a2303305 --- /dev/null +++ b/Assets/Scripts/MessagePack/SequenceReader.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cbb8a87bafcd3e0c9ad1efa790e7943c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/SequenceReaderExtensions.cs b/Assets/Scripts/MessagePack/SequenceReaderExtensions.cs new file mode 100644 index 000000000..e56275ac1 --- /dev/null +++ b/Assets/Scripts/MessagePack/SequenceReaderExtensions.cs @@ -0,0 +1,300 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +/* Licensed to the .NET Foundation under one or more agreements. + * The .NET Foundation licenses this file to you under the MIT license. + * See the LICENSE file in the project root for more information. */ + +using System.Buffers.Binary; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace System.Buffers +{ + internal static partial class SequenceReaderExtensions + { + /// + /// Try to read the given type out of the buffer if possible. Warning: this is dangerous to use with arbitrary + /// structs- see remarks for full details. + /// + /// + /// IMPORTANT: The read is a straight copy of bits. If a struct depends on specific state of its members to + /// behave correctly this can lead to exceptions, etc. If reading endian specific integers, use the explicit + /// overloads such as . + /// + /// + /// True if successful. will be default if failed (due to lack of space). + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static unsafe bool TryRead(ref this SequenceReader reader, out T value) + where T : unmanaged + { + ReadOnlySpan span = reader.UnreadSpan; + if (span.Length < sizeof(T)) + { + return TryReadMultisegment(ref reader, out value); + } + + value = Unsafe.ReadUnaligned(ref MemoryMarshal.GetReference(span)); + reader.Advance(sizeof(T)); + return true; + } + +#if UNITY_ANDROID + + /// + /// In Android 32bit device(armv7) + IL2CPP does not work correctly on Unsafe.ReadUnaligned. + /// Perhaps it is about memory alignment bug of Unity's IL2CPP VM. + /// For a workaround, read memory manually. + /// https://github.com/neuecc/MessagePack-CSharp/issues/748 + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static unsafe bool TryRead(ref this SequenceReader reader, out long value) + { + ReadOnlySpan span = reader.UnreadSpan; + if (span.Length < sizeof(long)) + { + return TryReadMultisegment(ref reader, out value); + } + + value = BitConverterToInt64(span); + reader.Advance(sizeof(long)); + return true; + } + + private static unsafe long BitConverterToInt64(ReadOnlySpan value) + { + if (BitConverter.IsLittleEndian) + { + int i1 = value[0] | (value[1] << 8) | (value[2] << 16) | (value[3] << 24); + int i2 = value[4] | (value[5] << 8) | (value[6] << 16) | (value[7] << 24); + return (uint)i1 | ((long)i2 << 32); + } + else + { + int i1 = (value[0] << 24) | (value[1] << 16) | (value[2] << 8) | value[3]; + int i2 = (value[4] << 24) | (value[5] << 16) | (value[6] << 8) | value[7]; + return (uint)i2 | ((long)i1 << 32); + } + } + +#endif + + private static unsafe bool TryReadMultisegment(ref SequenceReader reader, out T value) + where T : unmanaged + { + Debug.Assert(reader.UnreadSpan.Length < sizeof(T), "reader.UnreadSpan.Length < sizeof(T)"); + + // Not enough data in the current segment, try to peek for the data we need. + T buffer = default; + Span tempSpan = new Span(&buffer, sizeof(T)); + + if (!reader.TryCopyTo(tempSpan)) + { + value = default; + return false; + } + + value = Unsafe.ReadUnaligned(ref MemoryMarshal.GetReference(tempSpan)); + reader.Advance(sizeof(T)); + return true; + } + +#if UNITY_ANDROID + + private static unsafe bool TryReadMultisegment(ref SequenceReader reader, out long value) + { + Debug.Assert(reader.UnreadSpan.Length < sizeof(long), "reader.UnreadSpan.Length < sizeof(long)"); + + // Not enough data in the current segment, try to peek for the data we need. + long buffer = default; + Span tempSpan = new Span(&buffer, sizeof(long)); + + if (!reader.TryCopyTo(tempSpan)) + { + value = default; + return false; + } + + value = BitConverterToInt64(tempSpan); + reader.Advance(sizeof(long)); + return true; + } + +#endif + + /// + /// Reads an from the next position in the sequence. + /// + /// The reader to read from. + /// Receives the value read. + /// true if there was another byte in the sequence; false otherwise. + public static bool TryRead(ref this SequenceReader reader, out sbyte value) + { + if (TryRead(ref reader, out byte byteValue)) + { + value = unchecked((sbyte)byteValue); + return true; + } + + value = default; + return false; + } + + /// + /// Reads an as big endian. + /// + /// False if there wasn't enough data for an . + public static bool TryReadBigEndian(ref this SequenceReader reader, out short value) + { + if (!BitConverter.IsLittleEndian) + { + return reader.TryRead(out value); + } + + return TryReadReverseEndianness(ref reader, out value); + } + + /// + /// Reads an as big endian. + /// + /// False if there wasn't enough data for an . + public static bool TryReadBigEndian(ref this SequenceReader reader, out ushort value) + { + if (TryReadBigEndian(ref reader, out short shortValue)) + { + value = unchecked((ushort)shortValue); + return true; + } + + value = default; + return false; + } + + private static bool TryReadReverseEndianness(ref SequenceReader reader, out short value) + { + if (reader.TryRead(out value)) + { + value = BinaryPrimitives.ReverseEndianness(value); + return true; + } + + return false; + } + + /// + /// Reads an as big endian. + /// + /// False if there wasn't enough data for an . + public static bool TryReadBigEndian(ref this SequenceReader reader, out int value) + { + if (!BitConverter.IsLittleEndian) + { + return reader.TryRead(out value); + } + + return TryReadReverseEndianness(ref reader, out value); + } + + /// + /// Reads an as big endian. + /// + /// False if there wasn't enough data for an . + public static bool TryReadBigEndian(ref this SequenceReader reader, out uint value) + { + if (TryReadBigEndian(ref reader, out int intValue)) + { + value = unchecked((uint)intValue); + return true; + } + + value = default; + return false; + } + + private static bool TryReadReverseEndianness(ref SequenceReader reader, out int value) + { + if (reader.TryRead(out value)) + { + value = BinaryPrimitives.ReverseEndianness(value); + return true; + } + + return false; + } + + /// + /// Reads an as big endian. + /// + /// False if there wasn't enough data for an . + public static bool TryReadBigEndian(ref this SequenceReader reader, out long value) + { + if (!BitConverter.IsLittleEndian) + { + return reader.TryRead(out value); + } + + return TryReadReverseEndianness(ref reader, out value); + } + + /// + /// Reads an as big endian. + /// + /// False if there wasn't enough data for an . + public static bool TryReadBigEndian(ref this SequenceReader reader, out ulong value) + { + if (TryReadBigEndian(ref reader, out long longValue)) + { + value = unchecked((ulong)longValue); + return true; + } + + value = default; + return false; + } + + private static bool TryReadReverseEndianness(ref SequenceReader reader, out long value) + { + if (reader.TryRead(out value)) + { + value = BinaryPrimitives.ReverseEndianness(value); + return true; + } + + return false; + } + + /// + /// Reads a as big endian. + /// + /// False if there wasn't enough data for a . + public static unsafe bool TryReadBigEndian(ref this SequenceReader reader, out float value) + { + if (TryReadBigEndian(ref reader, out int intValue)) + { + value = *(float*)&intValue; + return true; + } + + value = default; + return false; + } + + /// + /// Reads a as big endian. + /// + /// False if there wasn't enough data for a . + public static unsafe bool TryReadBigEndian(ref this SequenceReader reader, out double value) + { + if (TryReadBigEndian(ref reader, out long longValue)) + { + value = *(double*)&longValue; + return true; + } + + value = default; + return false; + } + } +} diff --git a/Assets/Scripts/MessagePack/SequenceReaderExtensions.cs.meta b/Assets/Scripts/MessagePack/SequenceReaderExtensions.cs.meta new file mode 100644 index 000000000..6c54f4468 --- /dev/null +++ b/Assets/Scripts/MessagePack/SequenceReaderExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7badd702e46d7aef6ad8c347e9c0d0cf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/StreamPolyfillExtensions.cs b/Assets/Scripts/MessagePack/StreamPolyfillExtensions.cs new file mode 100644 index 000000000..2b6222c89 --- /dev/null +++ b/Assets/Scripts/MessagePack/StreamPolyfillExtensions.cs @@ -0,0 +1,137 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; +using System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Microsoft; + +namespace MessagePack +{ +#if !SPAN_BUILTIN + internal static class StreamPolyfillExtensions + { + /// + /// Reads from the stream into a memory buffer. + /// + /// The stream to read from. + /// The buffer to read directly into. + /// The number of bytes actually read. + internal static int Read(this Stream stream, Span buffer) + { + if (stream == null) + { + throw new ArgumentNullException(nameof(stream)); + } + + byte[] array = ArrayPool.Shared.Rent(buffer.Length); + try + { + int bytesRead = stream.Read(array, 0, buffer.Length); + new Span(array, 0, bytesRead).CopyTo(buffer); + return bytesRead; + } + finally + { + ArrayPool.Shared.Return(array); + } + } + + /// + /// Reads from the stream into a memory buffer. + /// + /// The stream to read from. + /// The buffer to read directly into. + /// A cancellation token. + /// The number of bytes actually read. + /// + /// This method shamelessly copied from the .NET Core 2.1 Stream class: https://github.com/dotnet/coreclr/blob/a113b1c803783c9d64f1f0e946ff9a853e3bc140/src/System.Private.CoreLib/shared/System/IO/Stream.cs#L366-L391. + /// + internal static ValueTask ReadAsync(this Stream stream, Memory buffer, CancellationToken cancellationToken = default) + { + if (stream == null) + { + throw new ArgumentNullException(nameof(stream)); + } + + if (MemoryMarshal.TryGetArray(buffer, out ArraySegment array)) + { + return new ValueTask(stream.ReadAsync(array.Array, array.Offset, array.Count, cancellationToken)); + } + else + { + byte[] sharedBuffer = ArrayPool.Shared.Rent(buffer.Length); + return FinishReadAsync(stream.ReadAsync(sharedBuffer, 0, buffer.Length, cancellationToken), sharedBuffer, buffer); + + async ValueTask FinishReadAsync(Task readTask, byte[] localBuffer, Memory localDestination) + { + try + { + int result = await readTask.ConfigureAwait(false); + new Span(localBuffer, 0, result).CopyTo(localDestination.Span); + return result; + } + finally + { + ArrayPool.Shared.Return(localBuffer); + } + } + } + } + + /// + /// Writes a span to the stream. + /// + /// The stream to write to. + /// The buffer to write. + internal static void Write(this Stream stream, ReadOnlySpan buffer) + { + if (stream == null) + { + throw new ArgumentNullException(nameof(stream)); + } + + var sharedBuffer = ArrayPool.Shared.Rent(buffer.Length); + try + { + buffer.CopyTo(sharedBuffer); + stream.Write(sharedBuffer, 0, buffer.Length); + } + finally + { + ArrayPool.Shared.Return(sharedBuffer); + } + } + + /// + /// Writes a span to the stream. + /// + /// The stream to write to. + /// The buffer to write. + /// A cancellation token. + internal static async ValueTask WriteAsync(this Stream stream, ReadOnlyMemory buffer, CancellationToken cancellationToken) + { + if (stream == null) + { + throw new ArgumentNullException(nameof(stream)); + } + + var sharedBuffer = ArrayPool.Shared.Rent(buffer.Length); + try + { + buffer.CopyTo(sharedBuffer); + await stream.WriteAsync(sharedBuffer, 0, buffer.Length, cancellationToken).ConfigureAwait(false); + } + finally + { + ArrayPool.Shared.Return(sharedBuffer); + } + } + } +#endif +} diff --git a/Assets/Scripts/MessagePack/StreamPolyfillExtensions.cs.meta b/Assets/Scripts/MessagePack/StreamPolyfillExtensions.cs.meta new file mode 100644 index 000000000..e015fd12e --- /dev/null +++ b/Assets/Scripts/MessagePack/StreamPolyfillExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ac9db623f6c6eb2f3aa9b726e830686f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/StringEncoding.cs b/Assets/Scripts/MessagePack/StringEncoding.cs new file mode 100644 index 000000000..db8115a39 --- /dev/null +++ b/Assets/Scripts/MessagePack/StringEncoding.cs @@ -0,0 +1,31 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Text; + +namespace MessagePack +{ + internal static class StringEncoding + { + internal static readonly Encoding UTF8 = new UTF8Encoding(false); + +#if !NETCOREAPP2_1 // Define the extension method only where an instance method does not already exist. + internal static unsafe string GetString(this Encoding encoding, ReadOnlySpan bytes) + { + if (bytes.Length == 0) + { + return string.Empty; + } + + fixed (byte* pBytes = bytes) + { + return encoding.GetString(pBytes, bytes.Length); + } + } +#endif + } +} diff --git a/Assets/Scripts/MessagePack/StringEncoding.cs.meta b/Assets/Scripts/MessagePack/StringEncoding.cs.meta new file mode 100644 index 000000000..1f29e6947 --- /dev/null +++ b/Assets/Scripts/MessagePack/StringEncoding.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d113f4a9f2be39b9cb4d38521393fd3e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/T4.meta b/Assets/Scripts/MessagePack/T4.meta new file mode 100644 index 000000000..204dd8b11 --- /dev/null +++ b/Assets/Scripts/MessagePack/T4.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 61b9a85cd8f85c2449c3fb3fdcc85f70 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/T4/ForceSizePrimitiveFormatter.cs b/Assets/Scripts/MessagePack/T4/ForceSizePrimitiveFormatter.cs new file mode 100644 index 000000000..fe05ab152 --- /dev/null +++ b/Assets/Scripts/MessagePack/T4/ForceSizePrimitiveFormatter.cs @@ -0,0 +1,793 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +/* THIS (.cs) FILE IS GENERATED. DO NOT CHANGE IT. + * CHANGE THE .tt FILE INSTEAD. */ + +using System; +using System.Buffers; + +#pragma warning disable SA1649 // File name should match first type name + +namespace MessagePack.Formatters +{ + public sealed class ForceInt16BlockFormatter : IMessagePackFormatter + { + public static readonly ForceInt16BlockFormatter Instance = new ForceInt16BlockFormatter(); + + private ForceInt16BlockFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Int16 value, MessagePackSerializerOptions options) + { + writer.WriteInt16(value); + } + + public Int16 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadInt16(); + } + } + + public sealed class NullableForceInt16BlockFormatter : IMessagePackFormatter + { + public static readonly NullableForceInt16BlockFormatter Instance = new NullableForceInt16BlockFormatter(); + + private NullableForceInt16BlockFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Int16? value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteInt16(value.Value); + } + } + + public Int16? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + return reader.ReadInt16(); + } + } + } + + public sealed class ForceInt16BlockArrayFormatter : IMessagePackFormatter + { + public static readonly ForceInt16BlockArrayFormatter Instance = new ForceInt16BlockArrayFormatter(); + + private ForceInt16BlockArrayFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Int16[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(value.Length); + for (int i = 0; i < value.Length; i++) + { + writer.WriteInt16(value[i]); + } + } + } + + public Int16[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var len = reader.ReadArrayHeader(); + var array = new Int16[len]; + options.Security.DepthStep(ref reader); + try + { + for (int i = 0; i < array.Length; i++) + { + array[i] = reader.ReadInt16(); + } + } + finally + { + reader.Depth--; + } + + return array; + } + } + } + + public sealed class ForceInt32BlockFormatter : IMessagePackFormatter + { + public static readonly ForceInt32BlockFormatter Instance = new ForceInt32BlockFormatter(); + + private ForceInt32BlockFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Int32 value, MessagePackSerializerOptions options) + { + writer.WriteInt32(value); + } + + public Int32 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadInt32(); + } + } + + public sealed class NullableForceInt32BlockFormatter : IMessagePackFormatter + { + public static readonly NullableForceInt32BlockFormatter Instance = new NullableForceInt32BlockFormatter(); + + private NullableForceInt32BlockFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Int32? value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteInt32(value.Value); + } + } + + public Int32? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + return reader.ReadInt32(); + } + } + } + + public sealed class ForceInt32BlockArrayFormatter : IMessagePackFormatter + { + public static readonly ForceInt32BlockArrayFormatter Instance = new ForceInt32BlockArrayFormatter(); + + private ForceInt32BlockArrayFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Int32[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(value.Length); + for (int i = 0; i < value.Length; i++) + { + writer.WriteInt32(value[i]); + } + } + } + + public Int32[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var len = reader.ReadArrayHeader(); + var array = new Int32[len]; + options.Security.DepthStep(ref reader); + try + { + for (int i = 0; i < array.Length; i++) + { + array[i] = reader.ReadInt32(); + } + } + finally + { + reader.Depth--; + } + + return array; + } + } + } + + public sealed class ForceInt64BlockFormatter : IMessagePackFormatter + { + public static readonly ForceInt64BlockFormatter Instance = new ForceInt64BlockFormatter(); + + private ForceInt64BlockFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Int64 value, MessagePackSerializerOptions options) + { + writer.WriteInt64(value); + } + + public Int64 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadInt64(); + } + } + + public sealed class NullableForceInt64BlockFormatter : IMessagePackFormatter + { + public static readonly NullableForceInt64BlockFormatter Instance = new NullableForceInt64BlockFormatter(); + + private NullableForceInt64BlockFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Int64? value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteInt64(value.Value); + } + } + + public Int64? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + return reader.ReadInt64(); + } + } + } + + public sealed class ForceInt64BlockArrayFormatter : IMessagePackFormatter + { + public static readonly ForceInt64BlockArrayFormatter Instance = new ForceInt64BlockArrayFormatter(); + + private ForceInt64BlockArrayFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Int64[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(value.Length); + for (int i = 0; i < value.Length; i++) + { + writer.WriteInt64(value[i]); + } + } + } + + public Int64[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var len = reader.ReadArrayHeader(); + var array = new Int64[len]; + options.Security.DepthStep(ref reader); + try + { + for (int i = 0; i < array.Length; i++) + { + array[i] = reader.ReadInt64(); + } + } + finally + { + reader.Depth--; + } + + return array; + } + } + } + + public sealed class ForceUInt16BlockFormatter : IMessagePackFormatter + { + public static readonly ForceUInt16BlockFormatter Instance = new ForceUInt16BlockFormatter(); + + private ForceUInt16BlockFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, UInt16 value, MessagePackSerializerOptions options) + { + writer.WriteUInt16(value); + } + + public UInt16 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadUInt16(); + } + } + + public sealed class NullableForceUInt16BlockFormatter : IMessagePackFormatter + { + public static readonly NullableForceUInt16BlockFormatter Instance = new NullableForceUInt16BlockFormatter(); + + private NullableForceUInt16BlockFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, UInt16? value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteUInt16(value.Value); + } + } + + public UInt16? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + return reader.ReadUInt16(); + } + } + } + + public sealed class ForceUInt16BlockArrayFormatter : IMessagePackFormatter + { + public static readonly ForceUInt16BlockArrayFormatter Instance = new ForceUInt16BlockArrayFormatter(); + + private ForceUInt16BlockArrayFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, UInt16[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(value.Length); + for (int i = 0; i < value.Length; i++) + { + writer.WriteUInt16(value[i]); + } + } + } + + public UInt16[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var len = reader.ReadArrayHeader(); + var array = new UInt16[len]; + options.Security.DepthStep(ref reader); + try + { + for (int i = 0; i < array.Length; i++) + { + array[i] = reader.ReadUInt16(); + } + } + finally + { + reader.Depth--; + } + + return array; + } + } + } + + public sealed class ForceUInt32BlockFormatter : IMessagePackFormatter + { + public static readonly ForceUInt32BlockFormatter Instance = new ForceUInt32BlockFormatter(); + + private ForceUInt32BlockFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, UInt32 value, MessagePackSerializerOptions options) + { + writer.WriteUInt32(value); + } + + public UInt32 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadUInt32(); + } + } + + public sealed class NullableForceUInt32BlockFormatter : IMessagePackFormatter + { + public static readonly NullableForceUInt32BlockFormatter Instance = new NullableForceUInt32BlockFormatter(); + + private NullableForceUInt32BlockFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, UInt32? value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteUInt32(value.Value); + } + } + + public UInt32? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + return reader.ReadUInt32(); + } + } + } + + public sealed class ForceUInt32BlockArrayFormatter : IMessagePackFormatter + { + public static readonly ForceUInt32BlockArrayFormatter Instance = new ForceUInt32BlockArrayFormatter(); + + private ForceUInt32BlockArrayFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, UInt32[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(value.Length); + for (int i = 0; i < value.Length; i++) + { + writer.WriteUInt32(value[i]); + } + } + } + + public UInt32[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var len = reader.ReadArrayHeader(); + var array = new UInt32[len]; + options.Security.DepthStep(ref reader); + try + { + for (int i = 0; i < array.Length; i++) + { + array[i] = reader.ReadUInt32(); + } + } + finally + { + reader.Depth--; + } + + return array; + } + } + } + + public sealed class ForceUInt64BlockFormatter : IMessagePackFormatter + { + public static readonly ForceUInt64BlockFormatter Instance = new ForceUInt64BlockFormatter(); + + private ForceUInt64BlockFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, UInt64 value, MessagePackSerializerOptions options) + { + writer.WriteUInt64(value); + } + + public UInt64 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadUInt64(); + } + } + + public sealed class NullableForceUInt64BlockFormatter : IMessagePackFormatter + { + public static readonly NullableForceUInt64BlockFormatter Instance = new NullableForceUInt64BlockFormatter(); + + private NullableForceUInt64BlockFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, UInt64? value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteUInt64(value.Value); + } + } + + public UInt64? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + return reader.ReadUInt64(); + } + } + } + + public sealed class ForceUInt64BlockArrayFormatter : IMessagePackFormatter + { + public static readonly ForceUInt64BlockArrayFormatter Instance = new ForceUInt64BlockArrayFormatter(); + + private ForceUInt64BlockArrayFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, UInt64[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(value.Length); + for (int i = 0; i < value.Length; i++) + { + writer.WriteUInt64(value[i]); + } + } + } + + public UInt64[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var len = reader.ReadArrayHeader(); + var array = new UInt64[len]; + options.Security.DepthStep(ref reader); + try + { + for (int i = 0; i < array.Length; i++) + { + array[i] = reader.ReadUInt64(); + } + } + finally + { + reader.Depth--; + } + + return array; + } + } + } + + public sealed class ForceByteBlockFormatter : IMessagePackFormatter + { + public static readonly ForceByteBlockFormatter Instance = new ForceByteBlockFormatter(); + + private ForceByteBlockFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Byte value, MessagePackSerializerOptions options) + { + writer.WriteUInt8(value); + } + + public Byte Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadByte(); + } + } + + public sealed class NullableForceByteBlockFormatter : IMessagePackFormatter + { + public static readonly NullableForceByteBlockFormatter Instance = new NullableForceByteBlockFormatter(); + + private NullableForceByteBlockFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Byte? value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteUInt8(value.Value); + } + } + + public Byte? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + return reader.ReadByte(); + } + } + } + + public sealed class ForceSByteBlockFormatter : IMessagePackFormatter + { + public static readonly ForceSByteBlockFormatter Instance = new ForceSByteBlockFormatter(); + + private ForceSByteBlockFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, SByte value, MessagePackSerializerOptions options) + { + writer.WriteInt8(value); + } + + public SByte Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadSByte(); + } + } + + public sealed class NullableForceSByteBlockFormatter : IMessagePackFormatter + { + public static readonly NullableForceSByteBlockFormatter Instance = new NullableForceSByteBlockFormatter(); + + private NullableForceSByteBlockFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, SByte? value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteInt8(value.Value); + } + } + + public SByte? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + return reader.ReadSByte(); + } + } + } + + public sealed class ForceSByteBlockArrayFormatter : IMessagePackFormatter + { + public static readonly ForceSByteBlockArrayFormatter Instance = new ForceSByteBlockArrayFormatter(); + + private ForceSByteBlockArrayFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, SByte[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(value.Length); + for (int i = 0; i < value.Length; i++) + { + writer.WriteInt8(value[i]); + } + } + } + + public SByte[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var len = reader.ReadArrayHeader(); + var array = new SByte[len]; + options.Security.DepthStep(ref reader); + try + { + for (int i = 0; i < array.Length; i++) + { + array[i] = reader.ReadSByte(); + } + } + finally + { + reader.Depth--; + } + + return array; + } + } + } +} diff --git a/Assets/Scripts/MessagePack/T4/ForceSizePrimitiveFormatter.cs.meta b/Assets/Scripts/MessagePack/T4/ForceSizePrimitiveFormatter.cs.meta new file mode 100644 index 000000000..55915a259 --- /dev/null +++ b/Assets/Scripts/MessagePack/T4/ForceSizePrimitiveFormatter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7eebcdcfb5f87535cb2728f1c21072c2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/T4/MessagePackReader.Integers.cs b/Assets/Scripts/MessagePack/T4/MessagePackReader.Integers.cs new file mode 100644 index 000000000..d74c394cf --- /dev/null +++ b/Assets/Scripts/MessagePack/T4/MessagePackReader.Integers.cs @@ -0,0 +1,440 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +/* THIS (.cs) FILE IS GENERATED. DO NOT CHANGE IT. + * CHANGE THE .tt FILE INSTEAD. */ + +using System; +using System.Buffers; + +namespace MessagePack +{ +#pragma warning disable SA1205 // Partial elements should declare access + ref partial struct MessagePackReader +#pragma warning restore SA1205 // Partial elements should declare access + { + /// + /// Reads an value from: + /// Some value between and , + /// Some value between and , + /// or any of the other MsgPack integer types. + /// + /// The value. + /// Thrown when the value exceeds what can be stored in the returned type. + public Byte ReadByte() + { + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte code)); + + switch (code) + { + case MessagePackCode.UInt8: + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte byteResult)); + return checked((Byte)byteResult); + case MessagePackCode.Int8: + ThrowInsufficientBufferUnless(this.reader.TryRead(out sbyte sbyteResult)); + return checked((Byte)sbyteResult); + case MessagePackCode.UInt16: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ushort ushortResult)); + return checked((Byte)ushortResult); + case MessagePackCode.Int16: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out short shortResult)); + return checked((Byte)shortResult); + case MessagePackCode.UInt32: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out uint uintResult)); + return checked((Byte)uintResult); + case MessagePackCode.Int32: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out int intResult)); + return checked((Byte)intResult); + case MessagePackCode.UInt64: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ulong ulongResult)); + return checked((Byte)ulongResult); + case MessagePackCode.Int64: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out long longResult)); + return checked((Byte)longResult); + default: + if (code >= MessagePackCode.MinNegativeFixInt && code <= MessagePackCode.MaxNegativeFixInt) + { + return checked((Byte)unchecked((sbyte)code)); + } + + if (code >= MessagePackCode.MinFixInt && code <= MessagePackCode.MaxFixInt) + { + return (Byte)code; + } + + throw ThrowInvalidCode(code); + } + } + + /// + /// Reads an value from: + /// Some value between and , + /// Some value between and , + /// or any of the other MsgPack integer types. + /// + /// The value. + /// Thrown when the value exceeds what can be stored in the returned type. + public UInt16 ReadUInt16() + { + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte code)); + + switch (code) + { + case MessagePackCode.UInt8: + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte byteResult)); + return checked((UInt16)byteResult); + case MessagePackCode.Int8: + ThrowInsufficientBufferUnless(this.reader.TryRead(out sbyte sbyteResult)); + return checked((UInt16)sbyteResult); + case MessagePackCode.UInt16: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ushort ushortResult)); + return checked((UInt16)ushortResult); + case MessagePackCode.Int16: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out short shortResult)); + return checked((UInt16)shortResult); + case MessagePackCode.UInt32: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out uint uintResult)); + return checked((UInt16)uintResult); + case MessagePackCode.Int32: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out int intResult)); + return checked((UInt16)intResult); + case MessagePackCode.UInt64: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ulong ulongResult)); + return checked((UInt16)ulongResult); + case MessagePackCode.Int64: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out long longResult)); + return checked((UInt16)longResult); + default: + if (code >= MessagePackCode.MinNegativeFixInt && code <= MessagePackCode.MaxNegativeFixInt) + { + return checked((UInt16)unchecked((sbyte)code)); + } + + if (code >= MessagePackCode.MinFixInt && code <= MessagePackCode.MaxFixInt) + { + return (UInt16)code; + } + + throw ThrowInvalidCode(code); + } + } + + /// + /// Reads an value from: + /// Some value between and , + /// Some value between and , + /// or any of the other MsgPack integer types. + /// + /// The value. + /// Thrown when the value exceeds what can be stored in the returned type. + public UInt32 ReadUInt32() + { + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte code)); + + switch (code) + { + case MessagePackCode.UInt8: + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte byteResult)); + return checked((UInt32)byteResult); + case MessagePackCode.Int8: + ThrowInsufficientBufferUnless(this.reader.TryRead(out sbyte sbyteResult)); + return checked((UInt32)sbyteResult); + case MessagePackCode.UInt16: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ushort ushortResult)); + return checked((UInt32)ushortResult); + case MessagePackCode.Int16: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out short shortResult)); + return checked((UInt32)shortResult); + case MessagePackCode.UInt32: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out uint uintResult)); + return checked((UInt32)uintResult); + case MessagePackCode.Int32: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out int intResult)); + return checked((UInt32)intResult); + case MessagePackCode.UInt64: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ulong ulongResult)); + return checked((UInt32)ulongResult); + case MessagePackCode.Int64: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out long longResult)); + return checked((UInt32)longResult); + default: + if (code >= MessagePackCode.MinNegativeFixInt && code <= MessagePackCode.MaxNegativeFixInt) + { + return checked((UInt32)unchecked((sbyte)code)); + } + + if (code >= MessagePackCode.MinFixInt && code <= MessagePackCode.MaxFixInt) + { + return (UInt32)code; + } + + throw ThrowInvalidCode(code); + } + } + + /// + /// Reads an value from: + /// Some value between and , + /// Some value between and , + /// or any of the other MsgPack integer types. + /// + /// The value. + /// Thrown when the value exceeds what can be stored in the returned type. + public UInt64 ReadUInt64() + { + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte code)); + + switch (code) + { + case MessagePackCode.UInt8: + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte byteResult)); + return checked((UInt64)byteResult); + case MessagePackCode.Int8: + ThrowInsufficientBufferUnless(this.reader.TryRead(out sbyte sbyteResult)); + return checked((UInt64)sbyteResult); + case MessagePackCode.UInt16: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ushort ushortResult)); + return checked((UInt64)ushortResult); + case MessagePackCode.Int16: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out short shortResult)); + return checked((UInt64)shortResult); + case MessagePackCode.UInt32: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out uint uintResult)); + return checked((UInt64)uintResult); + case MessagePackCode.Int32: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out int intResult)); + return checked((UInt64)intResult); + case MessagePackCode.UInt64: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ulong ulongResult)); + return checked((UInt64)ulongResult); + case MessagePackCode.Int64: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out long longResult)); + return checked((UInt64)longResult); + default: + if (code >= MessagePackCode.MinNegativeFixInt && code <= MessagePackCode.MaxNegativeFixInt) + { + return checked((UInt64)unchecked((sbyte)code)); + } + + if (code >= MessagePackCode.MinFixInt && code <= MessagePackCode.MaxFixInt) + { + return (UInt64)code; + } + + throw ThrowInvalidCode(code); + } + } + + /// + /// Reads an value from: + /// Some value between and , + /// Some value between and , + /// or any of the other MsgPack integer types. + /// + /// The value. + /// Thrown when the value exceeds what can be stored in the returned type. + public SByte ReadSByte() + { + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte code)); + + switch (code) + { + case MessagePackCode.UInt8: + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte byteResult)); + return checked((SByte)byteResult); + case MessagePackCode.Int8: + ThrowInsufficientBufferUnless(this.reader.TryRead(out sbyte sbyteResult)); + return checked((SByte)sbyteResult); + case MessagePackCode.UInt16: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ushort ushortResult)); + return checked((SByte)ushortResult); + case MessagePackCode.Int16: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out short shortResult)); + return checked((SByte)shortResult); + case MessagePackCode.UInt32: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out uint uintResult)); + return checked((SByte)uintResult); + case MessagePackCode.Int32: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out int intResult)); + return checked((SByte)intResult); + case MessagePackCode.UInt64: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ulong ulongResult)); + return checked((SByte)ulongResult); + case MessagePackCode.Int64: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out long longResult)); + return checked((SByte)longResult); + default: + if (code >= MessagePackCode.MinNegativeFixInt && code <= MessagePackCode.MaxNegativeFixInt) + { + return checked((SByte)unchecked((sbyte)code)); + } + + if (code >= MessagePackCode.MinFixInt && code <= MessagePackCode.MaxFixInt) + { + return (SByte)code; + } + + throw ThrowInvalidCode(code); + } + } + + /// + /// Reads an value from: + /// Some value between and , + /// Some value between and , + /// or any of the other MsgPack integer types. + /// + /// The value. + /// Thrown when the value exceeds what can be stored in the returned type. + public Int16 ReadInt16() + { + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte code)); + + switch (code) + { + case MessagePackCode.UInt8: + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte byteResult)); + return checked((Int16)byteResult); + case MessagePackCode.Int8: + ThrowInsufficientBufferUnless(this.reader.TryRead(out sbyte sbyteResult)); + return checked((Int16)sbyteResult); + case MessagePackCode.UInt16: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ushort ushortResult)); + return checked((Int16)ushortResult); + case MessagePackCode.Int16: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out short shortResult)); + return checked((Int16)shortResult); + case MessagePackCode.UInt32: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out uint uintResult)); + return checked((Int16)uintResult); + case MessagePackCode.Int32: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out int intResult)); + return checked((Int16)intResult); + case MessagePackCode.UInt64: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ulong ulongResult)); + return checked((Int16)ulongResult); + case MessagePackCode.Int64: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out long longResult)); + return checked((Int16)longResult); + default: + if (code >= MessagePackCode.MinNegativeFixInt && code <= MessagePackCode.MaxNegativeFixInt) + { + return checked((Int16)unchecked((sbyte)code)); + } + + if (code >= MessagePackCode.MinFixInt && code <= MessagePackCode.MaxFixInt) + { + return (Int16)code; + } + + throw ThrowInvalidCode(code); + } + } + + /// + /// Reads an value from: + /// Some value between and , + /// Some value between and , + /// or any of the other MsgPack integer types. + /// + /// The value. + /// Thrown when the value exceeds what can be stored in the returned type. + public Int32 ReadInt32() + { + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte code)); + + switch (code) + { + case MessagePackCode.UInt8: + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte byteResult)); + return checked((Int32)byteResult); + case MessagePackCode.Int8: + ThrowInsufficientBufferUnless(this.reader.TryRead(out sbyte sbyteResult)); + return checked((Int32)sbyteResult); + case MessagePackCode.UInt16: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ushort ushortResult)); + return checked((Int32)ushortResult); + case MessagePackCode.Int16: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out short shortResult)); + return checked((Int32)shortResult); + case MessagePackCode.UInt32: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out uint uintResult)); + return checked((Int32)uintResult); + case MessagePackCode.Int32: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out int intResult)); + return checked((Int32)intResult); + case MessagePackCode.UInt64: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ulong ulongResult)); + return checked((Int32)ulongResult); + case MessagePackCode.Int64: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out long longResult)); + return checked((Int32)longResult); + default: + if (code >= MessagePackCode.MinNegativeFixInt && code <= MessagePackCode.MaxNegativeFixInt) + { + return checked((Int32)unchecked((sbyte)code)); + } + + if (code >= MessagePackCode.MinFixInt && code <= MessagePackCode.MaxFixInt) + { + return (Int32)code; + } + + throw ThrowInvalidCode(code); + } + } + + /// + /// Reads an value from: + /// Some value between and , + /// Some value between and , + /// or any of the other MsgPack integer types. + /// + /// The value. + /// Thrown when the value exceeds what can be stored in the returned type. + public Int64 ReadInt64() + { + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte code)); + + switch (code) + { + case MessagePackCode.UInt8: + ThrowInsufficientBufferUnless(this.reader.TryRead(out byte byteResult)); + return checked((Int64)byteResult); + case MessagePackCode.Int8: + ThrowInsufficientBufferUnless(this.reader.TryRead(out sbyte sbyteResult)); + return checked((Int64)sbyteResult); + case MessagePackCode.UInt16: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ushort ushortResult)); + return checked((Int64)ushortResult); + case MessagePackCode.Int16: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out short shortResult)); + return checked((Int64)shortResult); + case MessagePackCode.UInt32: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out uint uintResult)); + return checked((Int64)uintResult); + case MessagePackCode.Int32: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out int intResult)); + return checked((Int64)intResult); + case MessagePackCode.UInt64: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ulong ulongResult)); + return checked((Int64)ulongResult); + case MessagePackCode.Int64: + ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out long longResult)); + return checked((Int64)longResult); + default: + if (code >= MessagePackCode.MinNegativeFixInt && code <= MessagePackCode.MaxNegativeFixInt) + { + return checked((Int64)unchecked((sbyte)code)); + } + + if (code >= MessagePackCode.MinFixInt && code <= MessagePackCode.MaxFixInt) + { + return (Int64)code; + } + + throw ThrowInvalidCode(code); + } + } + } +} diff --git a/Assets/Scripts/MessagePack/T4/MessagePackReader.Integers.cs.meta b/Assets/Scripts/MessagePack/T4/MessagePackReader.Integers.cs.meta new file mode 100644 index 000000000..2ed3587af --- /dev/null +++ b/Assets/Scripts/MessagePack/T4/MessagePackReader.Integers.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9c9a5153765d7dad39b4cc6d78e16f2c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/T4/PrimitiveFormatter.cs b/Assets/Scripts/MessagePack/T4/PrimitiveFormatter.cs new file mode 100644 index 000000000..94a3a1f9a --- /dev/null +++ b/Assets/Scripts/MessagePack/T4/PrimitiveFormatter.cs @@ -0,0 +1,1217 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +/* THIS (.cs) FILE IS GENERATED. DO NOT CHANGE IT. + * CHANGE THE .tt FILE INSTEAD. */ + +using System; +using System.Buffers; + +#pragma warning disable SA1649 // File name should match first type name + +namespace MessagePack.Formatters +{ + public sealed class Int16Formatter : IMessagePackFormatter + { + public static readonly Int16Formatter Instance = new Int16Formatter(); + + private Int16Formatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Int16 value, MessagePackSerializerOptions options) + { + writer.Write(value); + } + + public Int16 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadInt16(); + } + } + + public sealed class NullableInt16Formatter : IMessagePackFormatter + { + public static readonly NullableInt16Formatter Instance = new NullableInt16Formatter(); + + private NullableInt16Formatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Int16? value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.Write(value.Value); + } + } + + public Int16? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + return reader.ReadInt16(); + } + } + } + + public sealed class Int16ArrayFormatter : IMessagePackFormatter + { + public static readonly Int16ArrayFormatter Instance = new Int16ArrayFormatter(); + + private Int16ArrayFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Int16[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(value.Length); + for (int i = 0; i < value.Length; i++) + { + writer.Write(value[i]); + } + } + } + + public Int16[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var len = reader.ReadArrayHeader(); + var array = new Int16[len]; + for (int i = 0; i < array.Length; i++) + { + array[i] = reader.ReadInt16(); + } + + return array; + } + } + } + + public sealed class Int32Formatter : IMessagePackFormatter + { + public static readonly Int32Formatter Instance = new Int32Formatter(); + + private Int32Formatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Int32 value, MessagePackSerializerOptions options) + { + writer.Write(value); + } + + public Int32 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadInt32(); + } + } + + public sealed class NullableInt32Formatter : IMessagePackFormatter + { + public static readonly NullableInt32Formatter Instance = new NullableInt32Formatter(); + + private NullableInt32Formatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Int32? value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.Write(value.Value); + } + } + + public Int32? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + return reader.ReadInt32(); + } + } + } + + public sealed class Int32ArrayFormatter : IMessagePackFormatter + { + public static readonly Int32ArrayFormatter Instance = new Int32ArrayFormatter(); + + private Int32ArrayFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Int32[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(value.Length); + for (int i = 0; i < value.Length; i++) + { + writer.Write(value[i]); + } + } + } + + public Int32[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var len = reader.ReadArrayHeader(); + var array = new Int32[len]; + for (int i = 0; i < array.Length; i++) + { + array[i] = reader.ReadInt32(); + } + + return array; + } + } + } + + public sealed class Int64Formatter : IMessagePackFormatter + { + public static readonly Int64Formatter Instance = new Int64Formatter(); + + private Int64Formatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Int64 value, MessagePackSerializerOptions options) + { + writer.Write(value); + } + + public Int64 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadInt64(); + } + } + + public sealed class NullableInt64Formatter : IMessagePackFormatter + { + public static readonly NullableInt64Formatter Instance = new NullableInt64Formatter(); + + private NullableInt64Formatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Int64? value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.Write(value.Value); + } + } + + public Int64? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + return reader.ReadInt64(); + } + } + } + + public sealed class Int64ArrayFormatter : IMessagePackFormatter + { + public static readonly Int64ArrayFormatter Instance = new Int64ArrayFormatter(); + + private Int64ArrayFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Int64[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(value.Length); + for (int i = 0; i < value.Length; i++) + { + writer.Write(value[i]); + } + } + } + + public Int64[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var len = reader.ReadArrayHeader(); + var array = new Int64[len]; + for (int i = 0; i < array.Length; i++) + { + array[i] = reader.ReadInt64(); + } + + return array; + } + } + } + + public sealed class UInt16Formatter : IMessagePackFormatter + { + public static readonly UInt16Formatter Instance = new UInt16Formatter(); + + private UInt16Formatter() + { + } + + public void Serialize(ref MessagePackWriter writer, UInt16 value, MessagePackSerializerOptions options) + { + writer.Write(value); + } + + public UInt16 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadUInt16(); + } + } + + public sealed class NullableUInt16Formatter : IMessagePackFormatter + { + public static readonly NullableUInt16Formatter Instance = new NullableUInt16Formatter(); + + private NullableUInt16Formatter() + { + } + + public void Serialize(ref MessagePackWriter writer, UInt16? value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.Write(value.Value); + } + } + + public UInt16? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + return reader.ReadUInt16(); + } + } + } + + public sealed class UInt16ArrayFormatter : IMessagePackFormatter + { + public static readonly UInt16ArrayFormatter Instance = new UInt16ArrayFormatter(); + + private UInt16ArrayFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, UInt16[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(value.Length); + for (int i = 0; i < value.Length; i++) + { + writer.Write(value[i]); + } + } + } + + public UInt16[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var len = reader.ReadArrayHeader(); + var array = new UInt16[len]; + for (int i = 0; i < array.Length; i++) + { + array[i] = reader.ReadUInt16(); + } + + return array; + } + } + } + + public sealed class UInt32Formatter : IMessagePackFormatter + { + public static readonly UInt32Formatter Instance = new UInt32Formatter(); + + private UInt32Formatter() + { + } + + public void Serialize(ref MessagePackWriter writer, UInt32 value, MessagePackSerializerOptions options) + { + writer.Write(value); + } + + public UInt32 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadUInt32(); + } + } + + public sealed class NullableUInt32Formatter : IMessagePackFormatter + { + public static readonly NullableUInt32Formatter Instance = new NullableUInt32Formatter(); + + private NullableUInt32Formatter() + { + } + + public void Serialize(ref MessagePackWriter writer, UInt32? value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.Write(value.Value); + } + } + + public UInt32? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + return reader.ReadUInt32(); + } + } + } + + public sealed class UInt32ArrayFormatter : IMessagePackFormatter + { + public static readonly UInt32ArrayFormatter Instance = new UInt32ArrayFormatter(); + + private UInt32ArrayFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, UInt32[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(value.Length); + for (int i = 0; i < value.Length; i++) + { + writer.Write(value[i]); + } + } + } + + public UInt32[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var len = reader.ReadArrayHeader(); + var array = new UInt32[len]; + for (int i = 0; i < array.Length; i++) + { + array[i] = reader.ReadUInt32(); + } + + return array; + } + } + } + + public sealed class UInt64Formatter : IMessagePackFormatter + { + public static readonly UInt64Formatter Instance = new UInt64Formatter(); + + private UInt64Formatter() + { + } + + public void Serialize(ref MessagePackWriter writer, UInt64 value, MessagePackSerializerOptions options) + { + writer.Write(value); + } + + public UInt64 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadUInt64(); + } + } + + public sealed class NullableUInt64Formatter : IMessagePackFormatter + { + public static readonly NullableUInt64Formatter Instance = new NullableUInt64Formatter(); + + private NullableUInt64Formatter() + { + } + + public void Serialize(ref MessagePackWriter writer, UInt64? value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.Write(value.Value); + } + } + + public UInt64? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + return reader.ReadUInt64(); + } + } + } + + public sealed class UInt64ArrayFormatter : IMessagePackFormatter + { + public static readonly UInt64ArrayFormatter Instance = new UInt64ArrayFormatter(); + + private UInt64ArrayFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, UInt64[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(value.Length); + for (int i = 0; i < value.Length; i++) + { + writer.Write(value[i]); + } + } + } + + public UInt64[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var len = reader.ReadArrayHeader(); + var array = new UInt64[len]; + for (int i = 0; i < array.Length; i++) + { + array[i] = reader.ReadUInt64(); + } + + return array; + } + } + } + + public sealed class SingleFormatter : IMessagePackFormatter + { + public static readonly SingleFormatter Instance = new SingleFormatter(); + + private SingleFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Single value, MessagePackSerializerOptions options) + { + writer.Write(value); + } + + public Single Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadSingle(); + } + } + + public sealed class NullableSingleFormatter : IMessagePackFormatter + { + public static readonly NullableSingleFormatter Instance = new NullableSingleFormatter(); + + private NullableSingleFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Single? value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.Write(value.Value); + } + } + + public Single? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + return reader.ReadSingle(); + } + } + } + + public sealed class SingleArrayFormatter : IMessagePackFormatter + { + public static readonly SingleArrayFormatter Instance = new SingleArrayFormatter(); + + private SingleArrayFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Single[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(value.Length); + for (int i = 0; i < value.Length; i++) + { + writer.Write(value[i]); + } + } + } + + public Single[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var len = reader.ReadArrayHeader(); + var array = new Single[len]; + for (int i = 0; i < array.Length; i++) + { + array[i] = reader.ReadSingle(); + } + + return array; + } + } + } + + public sealed class DoubleFormatter : IMessagePackFormatter + { + public static readonly DoubleFormatter Instance = new DoubleFormatter(); + + private DoubleFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Double value, MessagePackSerializerOptions options) + { + writer.Write(value); + } + + public Double Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadDouble(); + } + } + + public sealed class NullableDoubleFormatter : IMessagePackFormatter + { + public static readonly NullableDoubleFormatter Instance = new NullableDoubleFormatter(); + + private NullableDoubleFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Double? value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.Write(value.Value); + } + } + + public Double? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + return reader.ReadDouble(); + } + } + } + + public sealed class DoubleArrayFormatter : IMessagePackFormatter + { + public static readonly DoubleArrayFormatter Instance = new DoubleArrayFormatter(); + + private DoubleArrayFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Double[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(value.Length); + for (int i = 0; i < value.Length; i++) + { + writer.Write(value[i]); + } + } + } + + public Double[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var len = reader.ReadArrayHeader(); + var array = new Double[len]; + for (int i = 0; i < array.Length; i++) + { + array[i] = reader.ReadDouble(); + } + + return array; + } + } + } + + public sealed class BooleanFormatter : IMessagePackFormatter + { + public static readonly BooleanFormatter Instance = new BooleanFormatter(); + + private BooleanFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Boolean value, MessagePackSerializerOptions options) + { + writer.Write(value); + } + + public Boolean Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadBoolean(); + } + } + + public sealed class NullableBooleanFormatter : IMessagePackFormatter + { + public static readonly NullableBooleanFormatter Instance = new NullableBooleanFormatter(); + + private NullableBooleanFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Boolean? value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.Write(value.Value); + } + } + + public Boolean? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + return reader.ReadBoolean(); + } + } + } + + public sealed class BooleanArrayFormatter : IMessagePackFormatter + { + public static readonly BooleanArrayFormatter Instance = new BooleanArrayFormatter(); + + private BooleanArrayFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Boolean[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(value.Length); + for (int i = 0; i < value.Length; i++) + { + writer.Write(value[i]); + } + } + } + + public Boolean[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var len = reader.ReadArrayHeader(); + var array = new Boolean[len]; + for (int i = 0; i < array.Length; i++) + { + array[i] = reader.ReadBoolean(); + } + + return array; + } + } + } + + public sealed class ByteFormatter : IMessagePackFormatter + { + public static readonly ByteFormatter Instance = new ByteFormatter(); + + private ByteFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Byte value, MessagePackSerializerOptions options) + { + writer.Write(value); + } + + public Byte Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadByte(); + } + } + + public sealed class NullableByteFormatter : IMessagePackFormatter + { + public static readonly NullableByteFormatter Instance = new NullableByteFormatter(); + + private NullableByteFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Byte? value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.Write(value.Value); + } + } + + public Byte? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + return reader.ReadByte(); + } + } + } + + public sealed class SByteFormatter : IMessagePackFormatter + { + public static readonly SByteFormatter Instance = new SByteFormatter(); + + private SByteFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, SByte value, MessagePackSerializerOptions options) + { + writer.Write(value); + } + + public SByte Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadSByte(); + } + } + + public sealed class NullableSByteFormatter : IMessagePackFormatter + { + public static readonly NullableSByteFormatter Instance = new NullableSByteFormatter(); + + private NullableSByteFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, SByte? value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.Write(value.Value); + } + } + + public SByte? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + return reader.ReadSByte(); + } + } + } + + public sealed class SByteArrayFormatter : IMessagePackFormatter + { + public static readonly SByteArrayFormatter Instance = new SByteArrayFormatter(); + + private SByteArrayFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, SByte[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(value.Length); + for (int i = 0; i < value.Length; i++) + { + writer.Write(value[i]); + } + } + } + + public SByte[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var len = reader.ReadArrayHeader(); + var array = new SByte[len]; + for (int i = 0; i < array.Length; i++) + { + array[i] = reader.ReadSByte(); + } + + return array; + } + } + } + + public sealed class CharFormatter : IMessagePackFormatter + { + public static readonly CharFormatter Instance = new CharFormatter(); + + private CharFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Char value, MessagePackSerializerOptions options) + { + writer.Write(value); + } + + public Char Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadChar(); + } + } + + public sealed class NullableCharFormatter : IMessagePackFormatter + { + public static readonly NullableCharFormatter Instance = new NullableCharFormatter(); + + private NullableCharFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Char? value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.Write(value.Value); + } + } + + public Char? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + return reader.ReadChar(); + } + } + } + + public sealed class CharArrayFormatter : IMessagePackFormatter + { + public static readonly CharArrayFormatter Instance = new CharArrayFormatter(); + + private CharArrayFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, Char[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(value.Length); + for (int i = 0; i < value.Length; i++) + { + writer.Write(value[i]); + } + } + } + + public Char[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var len = reader.ReadArrayHeader(); + var array = new Char[len]; + for (int i = 0; i < array.Length; i++) + { + array[i] = reader.ReadChar(); + } + + return array; + } + } + } + + public sealed class DateTimeFormatter : IMessagePackFormatter + { + public static readonly DateTimeFormatter Instance = new DateTimeFormatter(); + + private DateTimeFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, DateTime value, MessagePackSerializerOptions options) + { + writer.Write(value); + } + + public DateTime Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + return reader.ReadDateTime(); + } + } + + public sealed class NullableDateTimeFormatter : IMessagePackFormatter + { + public static readonly NullableDateTimeFormatter Instance = new NullableDateTimeFormatter(); + + private NullableDateTimeFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, DateTime? value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.Write(value.Value); + } + } + + public DateTime? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + return reader.ReadDateTime(); + } + } + } + + public sealed class DateTimeArrayFormatter : IMessagePackFormatter + { + public static readonly DateTimeArrayFormatter Instance = new DateTimeArrayFormatter(); + + private DateTimeArrayFormatter() + { + } + + public void Serialize(ref MessagePackWriter writer, DateTime[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(value.Length); + for (int i = 0; i < value.Length; i++) + { + writer.Write(value[i]); + } + } + } + + public DateTime[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var len = reader.ReadArrayHeader(); + var array = new DateTime[len]; + for (int i = 0; i < array.Length; i++) + { + array[i] = reader.ReadDateTime(); + } + + return array; + } + } + } +} diff --git a/Assets/Scripts/MessagePack/T4/PrimitiveFormatter.cs.meta b/Assets/Scripts/MessagePack/T4/PrimitiveFormatter.cs.meta new file mode 100644 index 000000000..cf10f757f --- /dev/null +++ b/Assets/Scripts/MessagePack/T4/PrimitiveFormatter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1fcb53a5d362d2e38b66d0a88d35d78f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/T4/TupleFormatter.cs b/Assets/Scripts/MessagePack/T4/TupleFormatter.cs new file mode 100644 index 000000000..e9a17419b --- /dev/null +++ b/Assets/Scripts/MessagePack/T4/TupleFormatter.cs @@ -0,0 +1,445 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +/* THIS (.cs) FILE IS GENERATED. DO NOT CHANGE IT. + * CHANGE THE .tt FILE INSTEAD. */ + +using System; +using System.Buffers; + +#pragma warning disable SA1649 // File name should match first type name + +namespace MessagePack.Formatters +{ + public sealed class TupleFormatter : IMessagePackFormatter> + { + public void Serialize(ref MessagePackWriter writer, Tuple value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(1); + + IFormatterResolver resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + } + } + + public Tuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var count = reader.ReadArrayHeader(); + if (count != 1) + { + throw new MessagePackSerializationException("Invalid Tuple count"); + } + + IFormatterResolver resolver = options.Resolver; + options.Security.DepthStep(ref reader); + try + { + T1 item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + + return new Tuple(item1); + } + finally + { + reader.Depth--; + } + } + } + } + + public sealed class TupleFormatter : IMessagePackFormatter> + { + public void Serialize(ref MessagePackWriter writer, Tuple value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(2); + + IFormatterResolver resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + } + } + + public Tuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var count = reader.ReadArrayHeader(); + if (count != 2) + { + throw new MessagePackSerializationException("Invalid Tuple count"); + } + + IFormatterResolver resolver = options.Resolver; + options.Security.DepthStep(ref reader); + try + { + T1 item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T2 item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + + return new Tuple(item1, item2); + } + finally + { + reader.Depth--; + } + } + } + } + + public sealed class TupleFormatter : IMessagePackFormatter> + { + public void Serialize(ref MessagePackWriter writer, Tuple value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(3); + + IFormatterResolver resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + } + } + + public Tuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var count = reader.ReadArrayHeader(); + if (count != 3) + { + throw new MessagePackSerializationException("Invalid Tuple count"); + } + + IFormatterResolver resolver = options.Resolver; + options.Security.DepthStep(ref reader); + try + { + T1 item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T2 item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T3 item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + + return new Tuple(item1, item2, item3); + } + finally + { + reader.Depth--; + } + } + } + } + + public sealed class TupleFormatter : IMessagePackFormatter> + { + public void Serialize(ref MessagePackWriter writer, Tuple value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(4); + + IFormatterResolver resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + } + } + + public Tuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var count = reader.ReadArrayHeader(); + if (count != 4) + { + throw new MessagePackSerializationException("Invalid Tuple count"); + } + + IFormatterResolver resolver = options.Resolver; + options.Security.DepthStep(ref reader); + try + { + T1 item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T2 item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T3 item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T4 item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + + return new Tuple(item1, item2, item3, item4); + } + finally + { + reader.Depth--; + } + } + } + } + + public sealed class TupleFormatter : IMessagePackFormatter> + { + public void Serialize(ref MessagePackWriter writer, Tuple value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(5); + + IFormatterResolver resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + } + } + + public Tuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var count = reader.ReadArrayHeader(); + if (count != 5) + { + throw new MessagePackSerializationException("Invalid Tuple count"); + } + + IFormatterResolver resolver = options.Resolver; + options.Security.DepthStep(ref reader); + try + { + T1 item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T2 item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T3 item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T4 item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T5 item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + + return new Tuple(item1, item2, item3, item4, item5); + } + finally + { + reader.Depth--; + } + } + } + } + + public sealed class TupleFormatter : IMessagePackFormatter> + { + public void Serialize(ref MessagePackWriter writer, Tuple value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(6); + + IFormatterResolver resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); + } + } + + public Tuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var count = reader.ReadArrayHeader(); + if (count != 6) + { + throw new MessagePackSerializationException("Invalid Tuple count"); + } + + IFormatterResolver resolver = options.Resolver; + options.Security.DepthStep(ref reader); + try + { + T1 item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T2 item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T3 item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T4 item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T5 item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T6 item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + + return new Tuple(item1, item2, item3, item4, item5, item6); + } + finally + { + reader.Depth--; + } + } + } + } + + public sealed class TupleFormatter : IMessagePackFormatter> + { + public void Serialize(ref MessagePackWriter writer, Tuple value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(7); + + IFormatterResolver resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item7, options); + } + } + + public Tuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var count = reader.ReadArrayHeader(); + if (count != 7) + { + throw new MessagePackSerializationException("Invalid Tuple count"); + } + + IFormatterResolver resolver = options.Resolver; + options.Security.DepthStep(ref reader); + try + { + T1 item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T2 item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T3 item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T4 item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T5 item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T6 item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T7 item7 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + + return new Tuple(item1, item2, item3, item4, item5, item6, item7); + } + finally + { + reader.Depth--; + } + } + } + } + + public sealed class TupleFormatter : IMessagePackFormatter> + { + public void Serialize(ref MessagePackWriter writer, Tuple value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + } + else + { + writer.WriteArrayHeader(8); + + IFormatterResolver resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item7, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Rest, options); + } + } + + public Tuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return default; + } + else + { + var count = reader.ReadArrayHeader(); + if (count != 8) + { + throw new MessagePackSerializationException("Invalid Tuple count"); + } + + IFormatterResolver resolver = options.Resolver; + options.Security.DepthStep(ref reader); + try + { + T1 item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T2 item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T3 item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T4 item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T5 item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T6 item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T7 item7 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + TRest item8 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + + return new Tuple(item1, item2, item3, item4, item5, item6, item7, item8); + } + finally + { + reader.Depth--; + } + } + } + } +} diff --git a/Assets/Scripts/MessagePack/T4/TupleFormatter.cs.meta b/Assets/Scripts/MessagePack/T4/TupleFormatter.cs.meta new file mode 100644 index 000000000..70eeea793 --- /dev/null +++ b/Assets/Scripts/MessagePack/T4/TupleFormatter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 21aa85f0a0973185698eec9b4ef8f3ba +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/T4/UnsafeMemory.cs b/Assets/Scripts/MessagePack/T4/UnsafeMemory.cs new file mode 100644 index 000000000..d986575f2 --- /dev/null +++ b/Assets/Scripts/MessagePack/T4/UnsafeMemory.cs @@ -0,0 +1,901 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +/* THIS (.cs) FILE IS GENERATED. DO NOT CHANGE IT. + * CHANGE THE .tt FILE INSTEAD. */ + +#if !UNITY_2018_3_OR_NEWER + +using System; +using System.Buffers; +using System.Runtime.CompilerServices; +using MessagePack.Formatters; + +namespace MessagePack.Internal +{ + public static partial class UnsafeMemory32 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw4(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw5(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 1) = *(int*)(pSrc + 1); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw6(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 2) = *(int*)(pSrc + 2); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw7(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 3) = *(int*)(pSrc + 3); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw8(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw9(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + *(int*)(pDst + 5) = *(int*)(pSrc + 5); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw10(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + *(int*)(pDst + 6) = *(int*)(pSrc + 6); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw11(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + *(int*)(pDst + 7) = *(int*)(pSrc + 7); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw12(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + *(int*)(pDst + 8) = *(int*)(pSrc + 8); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw13(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + *(int*)(pDst + 8) = *(int*)(pSrc + 8); + *(int*)(pDst + 9) = *(int*)(pSrc + 9); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw14(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + *(int*)(pDst + 8) = *(int*)(pSrc + 8); + *(int*)(pDst + 10) = *(int*)(pSrc + 10); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw15(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + *(int*)(pDst + 8) = *(int*)(pSrc + 8); + *(int*)(pDst + 11) = *(int*)(pSrc + 11); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw16(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + *(int*)(pDst + 8) = *(int*)(pSrc + 8); + *(int*)(pDst + 12) = *(int*)(pSrc + 12); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw17(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + *(int*)(pDst + 8) = *(int*)(pSrc + 8); + *(int*)(pDst + 12) = *(int*)(pSrc + 12); + *(int*)(pDst + 13) = *(int*)(pSrc + 13); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw18(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + *(int*)(pDst + 8) = *(int*)(pSrc + 8); + *(int*)(pDst + 12) = *(int*)(pSrc + 12); + *(int*)(pDst + 14) = *(int*)(pSrc + 14); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw19(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + *(int*)(pDst + 8) = *(int*)(pSrc + 8); + *(int*)(pDst + 12) = *(int*)(pSrc + 12); + *(int*)(pDst + 15) = *(int*)(pSrc + 15); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw20(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + *(int*)(pDst + 8) = *(int*)(pSrc + 8); + *(int*)(pDst + 12) = *(int*)(pSrc + 12); + *(int*)(pDst + 16) = *(int*)(pSrc + 16); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw21(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + *(int*)(pDst + 8) = *(int*)(pSrc + 8); + *(int*)(pDst + 12) = *(int*)(pSrc + 12); + *(int*)(pDst + 16) = *(int*)(pSrc + 16); + *(int*)(pDst + 17) = *(int*)(pSrc + 17); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw22(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + *(int*)(pDst + 8) = *(int*)(pSrc + 8); + *(int*)(pDst + 12) = *(int*)(pSrc + 12); + *(int*)(pDst + 16) = *(int*)(pSrc + 16); + *(int*)(pDst + 18) = *(int*)(pSrc + 18); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw23(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + *(int*)(pDst + 8) = *(int*)(pSrc + 8); + *(int*)(pDst + 12) = *(int*)(pSrc + 12); + *(int*)(pDst + 16) = *(int*)(pSrc + 16); + *(int*)(pDst + 19) = *(int*)(pSrc + 19); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw24(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + *(int*)(pDst + 8) = *(int*)(pSrc + 8); + *(int*)(pDst + 12) = *(int*)(pSrc + 12); + *(int*)(pDst + 16) = *(int*)(pSrc + 16); + *(int*)(pDst + 20) = *(int*)(pSrc + 20); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw25(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + *(int*)(pDst + 8) = *(int*)(pSrc + 8); + *(int*)(pDst + 12) = *(int*)(pSrc + 12); + *(int*)(pDst + 16) = *(int*)(pSrc + 16); + *(int*)(pDst + 20) = *(int*)(pSrc + 20); + *(int*)(pDst + 21) = *(int*)(pSrc + 21); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw26(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + *(int*)(pDst + 8) = *(int*)(pSrc + 8); + *(int*)(pDst + 12) = *(int*)(pSrc + 12); + *(int*)(pDst + 16) = *(int*)(pSrc + 16); + *(int*)(pDst + 20) = *(int*)(pSrc + 20); + *(int*)(pDst + 22) = *(int*)(pSrc + 22); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw27(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + *(int*)(pDst + 8) = *(int*)(pSrc + 8); + *(int*)(pDst + 12) = *(int*)(pSrc + 12); + *(int*)(pDst + 16) = *(int*)(pSrc + 16); + *(int*)(pDst + 20) = *(int*)(pSrc + 20); + *(int*)(pDst + 23) = *(int*)(pSrc + 23); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw28(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + *(int*)(pDst + 8) = *(int*)(pSrc + 8); + *(int*)(pDst + 12) = *(int*)(pSrc + 12); + *(int*)(pDst + 16) = *(int*)(pSrc + 16); + *(int*)(pDst + 20) = *(int*)(pSrc + 20); + *(int*)(pDst + 24) = *(int*)(pSrc + 24); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw29(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + *(int*)(pDst + 8) = *(int*)(pSrc + 8); + *(int*)(pDst + 12) = *(int*)(pSrc + 12); + *(int*)(pDst + 16) = *(int*)(pSrc + 16); + *(int*)(pDst + 20) = *(int*)(pSrc + 20); + *(int*)(pDst + 24) = *(int*)(pSrc + 24); + *(int*)(pDst + 25) = *(int*)(pSrc + 25); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw30(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + *(int*)(pDst + 8) = *(int*)(pSrc + 8); + *(int*)(pDst + 12) = *(int*)(pSrc + 12); + *(int*)(pDst + 16) = *(int*)(pSrc + 16); + *(int*)(pDst + 20) = *(int*)(pSrc + 20); + *(int*)(pDst + 24) = *(int*)(pSrc + 24); + *(int*)(pDst + 26) = *(int*)(pSrc + 26); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw31(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(int*)(pDst + 0) = *(int*)(pSrc + 0); + *(int*)(pDst + 4) = *(int*)(pSrc + 4); + *(int*)(pDst + 8) = *(int*)(pSrc + 8); + *(int*)(pDst + 12) = *(int*)(pSrc + 12); + *(int*)(pDst + 16) = *(int*)(pSrc + 16); + *(int*)(pDst + 20) = *(int*)(pSrc + 20); + *(int*)(pDst + 24) = *(int*)(pSrc + 24); + *(int*)(pDst + 27) = *(int*)(pSrc + 27); + } + + writer.Advance(src.Length); + } + } + + public static partial class UnsafeMemory64 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw8(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw9(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + *(long*)(pDst + 1) = *(long*)(pSrc + 1); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw10(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + *(long*)(pDst + 2) = *(long*)(pSrc + 2); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw11(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + *(long*)(pDst + 3) = *(long*)(pSrc + 3); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw12(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + *(long*)(pDst + 4) = *(long*)(pSrc + 4); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw13(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + *(long*)(pDst + 5) = *(long*)(pSrc + 5); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw14(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + *(long*)(pDst + 6) = *(long*)(pSrc + 6); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw15(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + *(long*)(pDst + 7) = *(long*)(pSrc + 7); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw16(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + *(long*)(pDst + 8) = *(long*)(pSrc + 8); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw17(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + *(long*)(pDst + 8) = *(long*)(pSrc + 8); + *(long*)(pDst + 9) = *(long*)(pSrc + 9); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw18(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + *(long*)(pDst + 8) = *(long*)(pSrc + 8); + *(long*)(pDst + 10) = *(long*)(pSrc + 10); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw19(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + *(long*)(pDst + 8) = *(long*)(pSrc + 8); + *(long*)(pDst + 11) = *(long*)(pSrc + 11); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw20(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + *(long*)(pDst + 8) = *(long*)(pSrc + 8); + *(long*)(pDst + 12) = *(long*)(pSrc + 12); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw21(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + *(long*)(pDst + 8) = *(long*)(pSrc + 8); + *(long*)(pDst + 13) = *(long*)(pSrc + 13); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw22(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + *(long*)(pDst + 8) = *(long*)(pSrc + 8); + *(long*)(pDst + 14) = *(long*)(pSrc + 14); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw23(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + *(long*)(pDst + 8) = *(long*)(pSrc + 8); + *(long*)(pDst + 15) = *(long*)(pSrc + 15); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw24(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + *(long*)(pDst + 8) = *(long*)(pSrc + 8); + *(long*)(pDst + 16) = *(long*)(pSrc + 16); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw25(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + *(long*)(pDst + 8) = *(long*)(pSrc + 8); + *(long*)(pDst + 16) = *(long*)(pSrc + 16); + *(long*)(pDst + 17) = *(long*)(pSrc + 17); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw26(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + *(long*)(pDst + 8) = *(long*)(pSrc + 8); + *(long*)(pDst + 16) = *(long*)(pSrc + 16); + *(long*)(pDst + 18) = *(long*)(pSrc + 18); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw27(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + *(long*)(pDst + 8) = *(long*)(pSrc + 8); + *(long*)(pDst + 16) = *(long*)(pSrc + 16); + *(long*)(pDst + 19) = *(long*)(pSrc + 19); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw28(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + *(long*)(pDst + 8) = *(long*)(pSrc + 8); + *(long*)(pDst + 16) = *(long*)(pSrc + 16); + *(long*)(pDst + 20) = *(long*)(pSrc + 20); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw29(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + *(long*)(pDst + 8) = *(long*)(pSrc + 8); + *(long*)(pDst + 16) = *(long*)(pSrc + 16); + *(long*)(pDst + 21) = *(long*)(pSrc + 21); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw30(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + *(long*)(pDst + 8) = *(long*)(pSrc + 8); + *(long*)(pDst + 16) = *(long*)(pSrc + 16); + *(long*)(pDst + 22) = *(long*)(pSrc + 22); + } + + writer.Advance(src.Length); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void WriteRaw31(ref MessagePackWriter writer, ReadOnlySpan src) + { + Span dst = writer.GetSpan(src.Length); + + fixed (byte* pSrc = &src[0]) + fixed (byte* pDst = &dst[0]) + { + *(long*)(pDst + 0) = *(long*)(pSrc + 0); + *(long*)(pDst + 8) = *(long*)(pSrc + 8); + *(long*)(pDst + 16) = *(long*)(pSrc + 16); + *(long*)(pDst + 23) = *(long*)(pSrc + 23); + } + + writer.Advance(src.Length); + } + } +} + +#endif diff --git a/Assets/Scripts/MessagePack/T4/UnsafeMemory.cs.meta b/Assets/Scripts/MessagePack/T4/UnsafeMemory.cs.meta new file mode 100644 index 000000000..fa04ad76d --- /dev/null +++ b/Assets/Scripts/MessagePack/T4/UnsafeMemory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ba8adf167b655e2a5a091ac6af276bb3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/T4/ValueTupleFormatter.cs b/Assets/Scripts/MessagePack/T4/ValueTupleFormatter.cs new file mode 100644 index 000000000..cf78e8b01 --- /dev/null +++ b/Assets/Scripts/MessagePack/T4/ValueTupleFormatter.cs @@ -0,0 +1,390 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +/* THIS (.cs) FILE IS GENERATED. DO NOT CHANGE IT. + * CHANGE THE .tt FILE INSTEAD. */ + +using System; +using System.Buffers; + +#pragma warning disable SA1649 // File name should match first type name + +namespace MessagePack.Formatters +{ + public sealed class ValueTupleFormatter : IMessagePackFormatter> + { + public void Serialize(ref MessagePackWriter writer, ValueTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(1); + + IFormatterResolver resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + } + + public ValueTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new MessagePackSerializationException("Data is Nil, ValueTuple can not be null."); + } + else + { + var count = reader.ReadArrayHeader(); + if (count != 1) + { + throw new MessagePackSerializationException("Invalid ValueTuple count"); + } + + IFormatterResolver resolver = options.Resolver; + options.Security.DepthStep(ref reader); + try + { + T1 item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + + return new ValueTuple(item1); + } + finally + { + reader.Depth--; + } + } + } + } + + public sealed class ValueTupleFormatter : IMessagePackFormatter> + { + public void Serialize(ref MessagePackWriter writer, ValueTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(2); + + IFormatterResolver resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + } + + public ValueTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new MessagePackSerializationException("Data is Nil, ValueTuple can not be null."); + } + else + { + var count = reader.ReadArrayHeader(); + if (count != 2) + { + throw new MessagePackSerializationException("Invalid ValueTuple count"); + } + + IFormatterResolver resolver = options.Resolver; + options.Security.DepthStep(ref reader); + try + { + T1 item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T2 item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + + return new ValueTuple(item1, item2); + } + finally + { + reader.Depth--; + } + } + } + } + + public sealed class ValueTupleFormatter : IMessagePackFormatter> + { + public void Serialize(ref MessagePackWriter writer, ValueTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(3); + + IFormatterResolver resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + } + + public ValueTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new MessagePackSerializationException("Data is Nil, ValueTuple can not be null."); + } + else + { + var count = reader.ReadArrayHeader(); + if (count != 3) + { + throw new MessagePackSerializationException("Invalid ValueTuple count"); + } + + IFormatterResolver resolver = options.Resolver; + options.Security.DepthStep(ref reader); + try + { + T1 item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T2 item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T3 item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + + return new ValueTuple(item1, item2, item3); + } + finally + { + reader.Depth--; + } + } + } + } + + public sealed class ValueTupleFormatter : IMessagePackFormatter> + { + public void Serialize(ref MessagePackWriter writer, ValueTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(4); + + IFormatterResolver resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + } + + public ValueTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new MessagePackSerializationException("Data is Nil, ValueTuple can not be null."); + } + else + { + var count = reader.ReadArrayHeader(); + if (count != 4) + { + throw new MessagePackSerializationException("Invalid ValueTuple count"); + } + + IFormatterResolver resolver = options.Resolver; + options.Security.DepthStep(ref reader); + try + { + T1 item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T2 item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T3 item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T4 item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + + return new ValueTuple(item1, item2, item3, item4); + } + finally + { + reader.Depth--; + } + } + } + } + + public sealed class ValueTupleFormatter : IMessagePackFormatter> + { + public void Serialize(ref MessagePackWriter writer, ValueTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(5); + + IFormatterResolver resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + } + + public ValueTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new MessagePackSerializationException("Data is Nil, ValueTuple can not be null."); + } + else + { + var count = reader.ReadArrayHeader(); + if (count != 5) + { + throw new MessagePackSerializationException("Invalid ValueTuple count"); + } + + IFormatterResolver resolver = options.Resolver; + options.Security.DepthStep(ref reader); + try + { + T1 item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T2 item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T3 item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T4 item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T5 item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + + return new ValueTuple(item1, item2, item3, item4, item5); + } + finally + { + reader.Depth--; + } + } + } + } + + public sealed class ValueTupleFormatter : IMessagePackFormatter> + { + public void Serialize(ref MessagePackWriter writer, ValueTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(6); + + IFormatterResolver resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); + } + + public ValueTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new MessagePackSerializationException("Data is Nil, ValueTuple can not be null."); + } + else + { + var count = reader.ReadArrayHeader(); + if (count != 6) + { + throw new MessagePackSerializationException("Invalid ValueTuple count"); + } + + IFormatterResolver resolver = options.Resolver; + options.Security.DepthStep(ref reader); + try + { + T1 item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T2 item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T3 item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T4 item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T5 item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T6 item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + + return new ValueTuple(item1, item2, item3, item4, item5, item6); + } + finally + { + reader.Depth--; + } + } + } + } + + public sealed class ValueTupleFormatter : IMessagePackFormatter> + { + public void Serialize(ref MessagePackWriter writer, ValueTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(7); + + IFormatterResolver resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item7, options); + } + + public ValueTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new MessagePackSerializationException("Data is Nil, ValueTuple can not be null."); + } + else + { + var count = reader.ReadArrayHeader(); + if (count != 7) + { + throw new MessagePackSerializationException("Invalid ValueTuple count"); + } + + IFormatterResolver resolver = options.Resolver; + options.Security.DepthStep(ref reader); + try + { + T1 item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T2 item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T3 item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T4 item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T5 item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T6 item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T7 item7 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + + return new ValueTuple(item1, item2, item3, item4, item5, item6, item7); + } + finally + { + reader.Depth--; + } + } + } + } + + public sealed class ValueTupleFormatter : IMessagePackFormatter> + where TRest : struct + { + public void Serialize(ref MessagePackWriter writer, ValueTuple value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(8); + + IFormatterResolver resolver = options.Resolver; + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item7, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.Rest, options); + } + + public ValueTuple Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new MessagePackSerializationException("Data is Nil, ValueTuple can not be null."); + } + else + { + var count = reader.ReadArrayHeader(); + if (count != 8) + { + throw new MessagePackSerializationException("Invalid ValueTuple count"); + } + + IFormatterResolver resolver = options.Resolver; + options.Security.DepthStep(ref reader); + try + { + T1 item1 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T2 item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T3 item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T4 item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T5 item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T6 item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + T7 item7 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + TRest item8 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + + return new ValueTuple(item1, item2, item3, item4, item5, item6, item7, item8); + } + finally + { + reader.Depth--; + } + } + } + } +} diff --git a/Assets/Scripts/MessagePack/T4/ValueTupleFormatter.cs.meta b/Assets/Scripts/MessagePack/T4/ValueTupleFormatter.cs.meta new file mode 100644 index 000000000..eb86b6bd3 --- /dev/null +++ b/Assets/Scripts/MessagePack/T4/ValueTupleFormatter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7dd3287be759a5f388a0a1f53b283b7d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/ThisLibraryExtensionTypeCodes.cs b/Assets/Scripts/MessagePack/ThisLibraryExtensionTypeCodes.cs new file mode 100644 index 000000000..a9620bdc2 --- /dev/null +++ b/Assets/Scripts/MessagePack/ThisLibraryExtensionTypeCodes.cs @@ -0,0 +1,76 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace MessagePack +{ + /// + /// The extension type codes that this library defines for just this library. + /// + internal static class ThisLibraryExtensionTypeCodes + { + /// + /// For Unity's UnsafeBlitFormatter. + /// + internal const sbyte UnityVector2 = 30; + + /// + /// For Unity's UnsafeBlitFormatter. + /// + internal const sbyte UnityVector3 = 31; + + /// + /// For Unity's UnsafeBlitFormatter. + /// + internal const sbyte UnityVector4 = 32; + + /// + /// For Unity's UnsafeBlitFormatter. + /// + internal const sbyte UnityQuaternion = 33; + + /// + /// For Unity's UnsafeBlitFormatter. + /// + internal const sbyte UnityColor = 34; + + /// + /// For Unity's UnsafeBlitFormatter. + /// + internal const sbyte UnityBounds = 35; + + /// + /// For Unity's UnsafeBlitFormatter. + /// + internal const sbyte UnityRect = 36; + + /// + /// For Unity's UnsafeBlitFormatter. + /// + internal const sbyte UnityInt = 37; + + /// + /// For Unity's UnsafeBlitFormatter. + /// + internal const sbyte UnityFloat = 38; + + /// + /// For Unity's UnsafeBlitFormatter. + /// + internal const sbyte UnityDouble = 39; + + /// + /// The LZ4 array block compression extension. + /// + internal const sbyte Lz4BlockArray = 98; + + /// + /// The LZ4 single block compression extension. + /// + internal const sbyte Lz4Block = 99; + + /// + /// For the . + /// + internal const sbyte TypelessFormatter = 100; + } +} diff --git a/Assets/Scripts/MessagePack/ThisLibraryExtensionTypeCodes.cs.meta b/Assets/Scripts/MessagePack/ThisLibraryExtensionTypeCodes.cs.meta new file mode 100644 index 000000000..b1f008edb --- /dev/null +++ b/Assets/Scripts/MessagePack/ThisLibraryExtensionTypeCodes.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7117971732be36a9da8f6a510364b4e5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Unity.meta b/Assets/Scripts/MessagePack/Unity.meta new file mode 100644 index 000000000..277cc7122 --- /dev/null +++ b/Assets/Scripts/MessagePack/Unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a4ac8e04487a20a4f8cb5b66eee5524c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Unity/Extension.meta b/Assets/Scripts/MessagePack/Unity/Extension.meta new file mode 100644 index 000000000..6ef30848d --- /dev/null +++ b/Assets/Scripts/MessagePack/Unity/Extension.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: da809bc2e70ea85429f483b800355d89 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Unity/Extension/UnityBlitResolver.cs b/Assets/Scripts/MessagePack/Unity/Extension/UnityBlitResolver.cs new file mode 100644 index 000000000..f846da838 --- /dev/null +++ b/Assets/Scripts/MessagePack/Unity/Extension/UnityBlitResolver.cs @@ -0,0 +1,114 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Collections.Generic; +using MessagePack.Formatters; +using UnityEngine; + +namespace MessagePack.Unity.Extension +{ + /// + /// Special Resolver for Vector2[], Vector3[], Vector4[], Quaternion[], Color[], Bounds[], Rect[]. + /// + public class UnityBlitResolver : IFormatterResolver + { + public static readonly UnityBlitResolver Instance = new UnityBlitResolver(); + + private UnityBlitResolver() + { + } + + public IMessagePackFormatter GetFormatter() + { + return FormatterCache.Formatter; + } + + private static class FormatterCache + { + public static readonly IMessagePackFormatter Formatter; + + static FormatterCache() + { + Formatter = (IMessagePackFormatter)UnityBlitResolverGetFormatterHelper.GetFormatter(typeof(T)); + } + } + } + + /// + /// Special Resolver for Vector2[], Vector3[], Vector4[], Quaternion[], Color[], Bounds[], Rect[] + int[], float[], double[]. + /// + public class UnityBlitWithPrimitiveArrayResolver : IFormatterResolver + { + public static readonly UnityBlitWithPrimitiveArrayResolver Instance = new UnityBlitWithPrimitiveArrayResolver(); + + private UnityBlitWithPrimitiveArrayResolver() + { + } + + public IMessagePackFormatter GetFormatter() + { + return FormatterCache.Formatter; + } + + private static class FormatterCache + { + internal static readonly IMessagePackFormatter Formatter; + + static FormatterCache() + { + Formatter = (IMessagePackFormatter)UnityBlitWithPrimitiveResolverGetFormatterHelper.GetFormatter(typeof(T)); + if (Formatter == null) + { + Formatter = UnityBlitResolver.Instance.GetFormatter(); + } + } + } + } + + internal static class UnityBlitResolverGetFormatterHelper + { + private static readonly Dictionary FormatterMap = new Dictionary() + { + { typeof(Vector2[]), typeof(Vector2ArrayBlitFormatter) }, + { typeof(Vector3[]), typeof(Vector3ArrayBlitFormatter) }, + { typeof(Vector4[]), typeof(Vector4ArrayBlitFormatter) }, + { typeof(Quaternion[]), typeof(QuaternionArrayBlitFormatter) }, + { typeof(Color[]), typeof(ColorArrayBlitFormatter) }, + { typeof(Bounds[]), typeof(BoundsArrayBlitFormatter) }, + { typeof(Rect[]), typeof(RectArrayBlitFormatter) }, + }; + + internal static object GetFormatter(Type t) + { + Type formatterType; + if (FormatterMap.TryGetValue(t, out formatterType)) + { + return Activator.CreateInstance(formatterType); + } + + return null; + } + } + + internal static class UnityBlitWithPrimitiveResolverGetFormatterHelper + { + private static readonly Dictionary FormatterMap = new Dictionary() + { + { typeof(int[]), typeof(IntArrayBlitFormatter) }, + { typeof(float[]), typeof(FloatArrayBlitFormatter) }, + { typeof(double[]), typeof(DoubleArrayBlitFormatter) }, + }; + + internal static object GetFormatter(Type t) + { + Type formatterType; + if (FormatterMap.TryGetValue(t, out formatterType)) + { + return Activator.CreateInstance(formatterType); + } + + return null; + } + } +} diff --git a/Assets/Scripts/MessagePack/Unity/Extension/UnityBlitResolver.cs.meta b/Assets/Scripts/MessagePack/Unity/Extension/UnityBlitResolver.cs.meta new file mode 100644 index 000000000..0f641f434 --- /dev/null +++ b/Assets/Scripts/MessagePack/Unity/Extension/UnityBlitResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ef834ed39aa3bf457860be80e97a5d9c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Unity/Extension/UnsafeBlitFormatter.cs b/Assets/Scripts/MessagePack/Unity/Extension/UnsafeBlitFormatter.cs new file mode 100644 index 000000000..3682b032d --- /dev/null +++ b/Assets/Scripts/MessagePack/Unity/Extension/UnsafeBlitFormatter.cs @@ -0,0 +1,179 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Text; +using MessagePack.Formatters; +using UnityEngine; + +#pragma warning disable SA1402 // multiple types in a file +#pragma warning disable SA1649 // file name matches type name + +namespace MessagePack.Unity.Extension +{ + // use ext instead of ArrayFormatter to extremely boost up performance. + // Layout: [extHeader, byteSize(integer), isLittleEndian(bool), bytes()] + // Used Ext:30~36 + public abstract class UnsafeBlitFormatterBase : IMessagePackFormatter + where T : struct + { + protected abstract sbyte TypeCode { get; } + + protected void CopyDeserializeUnsafe(ReadOnlySpan src, Span dest) => src.CopyTo(MemoryMarshal.Cast(dest)); + + public void Serialize(ref MessagePackWriter writer, T[] value, MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + return; + } + + var byteLen = value.Length * Marshal.SizeOf(); + + writer.WriteExtensionFormatHeader(new ExtensionHeader(this.TypeCode, byteLen)); + writer.Write(byteLen); // write original header(not array header) + writer.Write(BitConverter.IsLittleEndian); + writer.WriteRaw(MemoryMarshal.Cast(value)); + } + + public T[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return null; + } + + ExtensionHeader header = reader.ReadExtensionFormatHeader(); + if (header.TypeCode != this.TypeCode) + { + throw new InvalidOperationException("Invalid typeCode."); + } + + var byteLength = reader.ReadInt32(); + var isLittleEndian = reader.ReadBoolean(); + + // Allocate a T[] that we will return. We'll then cast the T[] as byte[] so we can copy the byte sequence directly into it. + var result = new T[byteLength / Marshal.SizeOf()]; + Span resultAsBytes = MemoryMarshal.Cast(result); + reader.ReadRaw(byteLength).CopyTo(resultAsBytes); + + // Reverse the byte order if necessary. + if (isLittleEndian != BitConverter.IsLittleEndian) + { + for (int i = 0, j = resultAsBytes.Length - 1; i < j; i++, j--) + { + byte tmp = resultAsBytes[i]; + resultAsBytes[i] = resultAsBytes[j]; + resultAsBytes[j] = tmp; + } + } + + return result; + } + } + + public class Vector2ArrayBlitFormatter : UnsafeBlitFormatterBase + { + protected override sbyte TypeCode + { + get + { + return ThisLibraryExtensionTypeCodes.UnityVector2; + } + } + } + + public class Vector3ArrayBlitFormatter : UnsafeBlitFormatterBase + { + protected override sbyte TypeCode + { + get + { + return ThisLibraryExtensionTypeCodes.UnityVector3; + } + } + } + + public class Vector4ArrayBlitFormatter : UnsafeBlitFormatterBase + { + protected override sbyte TypeCode + { + get + { + return ThisLibraryExtensionTypeCodes.UnityVector4; + } + } + } + + public class QuaternionArrayBlitFormatter : UnsafeBlitFormatterBase + { + protected override sbyte TypeCode + { + get + { + return ThisLibraryExtensionTypeCodes.UnityQuaternion; + } + } + } + + public class ColorArrayBlitFormatter : UnsafeBlitFormatterBase + { + protected override sbyte TypeCode + { + get + { + return ThisLibraryExtensionTypeCodes.UnityColor; + } + } + } + + public class BoundsArrayBlitFormatter : UnsafeBlitFormatterBase + { + protected override sbyte TypeCode + { + get + { + return ThisLibraryExtensionTypeCodes.UnityBounds; + } + } + } + + public class RectArrayBlitFormatter : UnsafeBlitFormatterBase + { + protected override sbyte TypeCode + { + get + { + return ThisLibraryExtensionTypeCodes.UnityRect; + } + } + } + + public class IntArrayBlitFormatter : UnsafeBlitFormatterBase + { + protected override sbyte TypeCode + { + get { return ThisLibraryExtensionTypeCodes.UnityInt; } + } + } + + public class FloatArrayBlitFormatter : UnsafeBlitFormatterBase + { + protected override sbyte TypeCode + { + get { return ThisLibraryExtensionTypeCodes.UnityFloat; } + } + } + + public class DoubleArrayBlitFormatter : UnsafeBlitFormatterBase + { + protected override sbyte TypeCode + { + get { return ThisLibraryExtensionTypeCodes.UnityDouble; } + } + } +} diff --git a/Assets/Scripts/MessagePack/Unity/Extension/UnsafeBlitFormatter.cs.meta b/Assets/Scripts/MessagePack/Unity/Extension/UnsafeBlitFormatter.cs.meta new file mode 100644 index 000000000..6265e2a99 --- /dev/null +++ b/Assets/Scripts/MessagePack/Unity/Extension/UnsafeBlitFormatter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2955ae5d4f31948548df2c805124f4c6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Unity/Formatters.cs b/Assets/Scripts/MessagePack/Unity/Formatters.cs new file mode 100644 index 000000000..e3b0876fe --- /dev/null +++ b/Assets/Scripts/MessagePack/Unity/Formatters.cs @@ -0,0 +1,1135 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; +using MessagePack; +using MessagePack.Formatters; + +#pragma warning disable SA1312 // variable naming +#pragma warning disable SA1402 // one type per file +#pragma warning disable SA1649 // file name matches type name + +namespace MessagePack.Unity +{ + public sealed class Vector2Formatter : global::MessagePack.Formatters.IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, global::UnityEngine.Vector2 value, global::MessagePack.MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(2); + writer.Write(value.x); + writer.Write(value.y); + } + + public global::UnityEngine.Vector2 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new InvalidOperationException("typecode is null, struct not supported"); + } + + var length = reader.ReadArrayHeader(); + var x = default(float); + var y = default(float); + for (int i = 0; i < length; i++) + { + var key = i; + switch (key) + { + case 0: + x = reader.ReadSingle(); + break; + case 1: + y = reader.ReadSingle(); + break; + default: + reader.Skip(); + break; + } + } + + var result = new global::UnityEngine.Vector2(x, y); + return result; + } + } + + public sealed class Vector3Formatter : global::MessagePack.Formatters.IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, global::UnityEngine.Vector3 value, global::MessagePack.MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(3); + writer.Write(value.x); + writer.Write(value.y); + writer.Write(value.z); + } + + public global::UnityEngine.Vector3 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new InvalidOperationException("typecode is null, struct not supported"); + } + + var length = reader.ReadArrayHeader(); + var x = default(float); + var y = default(float); + var z = default(float); + for (int i = 0; i < length; i++) + { + var key = i; + switch (key) + { + case 0: + x = reader.ReadSingle(); + break; + case 1: + y = reader.ReadSingle(); + break; + case 2: + z = reader.ReadSingle(); + break; + default: + reader.Skip(); + break; + } + } + + var result = new global::UnityEngine.Vector3(x, y, z); + return result; + } + } + + public sealed class Vector4Formatter : global::MessagePack.Formatters.IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, global::UnityEngine.Vector4 value, global::MessagePack.MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(4); + writer.Write(value.x); + writer.Write(value.y); + writer.Write(value.z); + writer.Write(value.w); + } + + public global::UnityEngine.Vector4 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new InvalidOperationException("typecode is null, struct not supported"); + } + + var length = reader.ReadArrayHeader(); + var x = default(float); + var y = default(float); + var z = default(float); + var w = default(float); + for (int i = 0; i < length; i++) + { + var key = i; + switch (key) + { + case 0: + x = reader.ReadSingle(); + break; + case 1: + y = reader.ReadSingle(); + break; + case 2: + z = reader.ReadSingle(); + break; + case 3: + w = reader.ReadSingle(); + break; + default: + reader.Skip(); + break; + } + } + + var result = new global::UnityEngine.Vector4(x, y, z, w); + return result; + } + } + + public sealed class QuaternionFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, global::UnityEngine.Quaternion value, global::MessagePack.MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(4); + writer.Write(value.x); + writer.Write(value.y); + writer.Write(value.z); + writer.Write(value.w); + } + + public global::UnityEngine.Quaternion Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new InvalidOperationException("typecode is null, struct not supported"); + } + + var length = reader.ReadArrayHeader(); + var x = default(float); + var y = default(float); + var z = default(float); + var w = default(float); + for (int i = 0; i < length; i++) + { + var key = i; + switch (key) + { + case 0: + x = reader.ReadSingle(); + break; + case 1: + y = reader.ReadSingle(); + break; + case 2: + z = reader.ReadSingle(); + break; + case 3: + w = reader.ReadSingle(); + break; + default: + reader.Skip(); + break; + } + } + + var result = new global::UnityEngine.Quaternion(x, y, z, w); + return result; + } + } + + public sealed class ColorFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, global::UnityEngine.Color value, global::MessagePack.MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(4); + writer.Write(value.r); + writer.Write(value.g); + writer.Write(value.b); + writer.Write(value.a); + } + + public global::UnityEngine.Color Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new InvalidOperationException("typecode is null, struct not supported"); + } + + var length = reader.ReadArrayHeader(); + var r = default(float); + var g = default(float); + var b = default(float); + var a = default(float); + for (int i = 0; i < length; i++) + { + var key = i; + switch (key) + { + case 0: + r = reader.ReadSingle(); + break; + case 1: + g = reader.ReadSingle(); + break; + case 2: + b = reader.ReadSingle(); + break; + case 3: + a = reader.ReadSingle(); + break; + default: + reader.Skip(); + break; + } + } + + var result = new global::UnityEngine.Color(r, g, b, a); + return result; + } + } + + public sealed class BoundsFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, global::UnityEngine.Bounds value, global::MessagePack.MessagePackSerializerOptions options) + { + IFormatterResolver resolver = options.Resolver; + writer.WriteArrayHeader(2); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.center, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.size, options); + } + + public global::UnityEngine.Bounds Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new InvalidOperationException("typecode is null, struct not supported"); + } + + IFormatterResolver resolver = options.Resolver; + var length = reader.ReadArrayHeader(); + var center = default(global::UnityEngine.Vector3); + var size = default(global::UnityEngine.Vector3); + for (int i = 0; i < length; i++) + { + var key = i; + switch (key) + { + case 0: + center = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + size = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + var result = new global::UnityEngine.Bounds(center, size); + return result; + } + } + + public sealed class RectFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, global::UnityEngine.Rect value, global::MessagePack.MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(4); + writer.Write(value.x); + writer.Write(value.y); + writer.Write(value.width); + writer.Write(value.height); + } + + public global::UnityEngine.Rect Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new InvalidOperationException("typecode is null, struct not supported"); + } + + var length = reader.ReadArrayHeader(); + var x = default(float); + var y = default(float); + var width = default(float); + var height = default(float); + for (int i = 0; i < length; i++) + { + var key = i; + switch (key) + { + case 0: + x = reader.ReadSingle(); + break; + case 1: + y = reader.ReadSingle(); + break; + case 2: + width = reader.ReadSingle(); + break; + case 3: + height = reader.ReadSingle(); + break; + default: + reader.Skip(); + break; + } + } + + var result = new global::UnityEngine.Rect(x, y, width, height); + return result; + } + } + + // additional + public sealed class WrapModeFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, global::UnityEngine.WrapMode value, global::MessagePack.MessagePackSerializerOptions options) + { + writer.Write((int)value); + } + + public global::UnityEngine.WrapMode Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + return (global::UnityEngine.WrapMode)reader.ReadInt32(); + } + } + + public sealed class GradientModeFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, global::UnityEngine.GradientMode value, global::MessagePack.MessagePackSerializerOptions options) + { + writer.Write((int)value); + } + + public global::UnityEngine.GradientMode Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + return (global::UnityEngine.GradientMode)reader.ReadInt32(); + } + } + + public sealed class KeyframeFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, global::UnityEngine.Keyframe value, global::MessagePack.MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(4); + writer.Write(value.time); + writer.Write(value.value); + writer.Write(value.inTangent); + writer.Write(value.outTangent); + } + + public global::UnityEngine.Keyframe Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new InvalidOperationException("typecode is null, struct not supported"); + } + + var length = reader.ReadArrayHeader(); + var __time__ = default(float); + var __value__ = default(float); + var __inTangent__ = default(float); + var __outTangent__ = default(float); + for (int i = 0; i < length; i++) + { + var key = i; + switch (key) + { + case 0: + __time__ = reader.ReadSingle(); + break; + case 1: + __value__ = reader.ReadSingle(); + break; + case 2: + __inTangent__ = reader.ReadSingle(); + break; + case 3: + __outTangent__ = reader.ReadSingle(); + break; + default: + reader.Skip(); + break; + } + } + + var ____result = new global::UnityEngine.Keyframe(__time__, __value__, __inTangent__, __outTangent__); + ____result.time = __time__; + ____result.value = __value__; + ____result.inTangent = __inTangent__; + ____result.outTangent = __outTangent__; + return ____result; + } + } + + public sealed class AnimationCurveFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, global::UnityEngine.AnimationCurve value, global::MessagePack.MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + return; + } + + IFormatterResolver resolver = options.Resolver; + writer.WriteArrayHeader(3); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.keys, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.postWrapMode, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.preWrapMode, options); + } + + public global::UnityEngine.AnimationCurve Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + return null; + } + + IFormatterResolver resolver = options.Resolver; + var length = reader.ReadArrayHeader(); + var __keys__ = default(global::UnityEngine.Keyframe[]); + var __postWrapMode__ = default(global::UnityEngine.WrapMode); + var __preWrapMode__ = default(global::UnityEngine.WrapMode); + for (int i = 0; i < length; i++) + { + var key = i; + switch (key) + { + case 0: + __keys__ = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + __postWrapMode__ = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 2: + __preWrapMode__ = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + var ____result = new global::UnityEngine.AnimationCurve(); + ____result.keys = __keys__; + ____result.postWrapMode = __postWrapMode__; + ____result.preWrapMode = __preWrapMode__; + return ____result; + } + } + + public sealed class Matrix4x4Formatter : global::MessagePack.Formatters.IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, global::UnityEngine.Matrix4x4 value, global::MessagePack.MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(16); + writer.Write(value.m00); + writer.Write(value.m10); + writer.Write(value.m20); + writer.Write(value.m30); + writer.Write(value.m01); + writer.Write(value.m11); + writer.Write(value.m21); + writer.Write(value.m31); + writer.Write(value.m02); + writer.Write(value.m12); + writer.Write(value.m22); + writer.Write(value.m32); + writer.Write(value.m03); + writer.Write(value.m13); + writer.Write(value.m23); + writer.Write(value.m33); + } + + public global::UnityEngine.Matrix4x4 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new InvalidOperationException("typecode is null, struct not supported"); + } + + var length = reader.ReadArrayHeader(); + var __m00__ = default(float); + var __m10__ = default(float); + var __m20__ = default(float); + var __m30__ = default(float); + var __m01__ = default(float); + var __m11__ = default(float); + var __m21__ = default(float); + var __m31__ = default(float); + var __m02__ = default(float); + var __m12__ = default(float); + var __m22__ = default(float); + var __m32__ = default(float); + var __m03__ = default(float); + var __m13__ = default(float); + var __m23__ = default(float); + var __m33__ = default(float); + for (int i = 0; i < length; i++) + { + var key = i; + switch (key) + { + case 0: + __m00__ = reader.ReadSingle(); + break; + case 1: + __m10__ = reader.ReadSingle(); + break; + case 2: + __m20__ = reader.ReadSingle(); + break; + case 3: + __m30__ = reader.ReadSingle(); + break; + case 4: + __m01__ = reader.ReadSingle(); + break; + case 5: + __m11__ = reader.ReadSingle(); + break; + case 6: + __m21__ = reader.ReadSingle(); + break; + case 7: + __m31__ = reader.ReadSingle(); + break; + case 8: + __m02__ = reader.ReadSingle(); + break; + case 9: + __m12__ = reader.ReadSingle(); + break; + case 10: + __m22__ = reader.ReadSingle(); + break; + case 11: + __m32__ = reader.ReadSingle(); + break; + case 12: + __m03__ = reader.ReadSingle(); + break; + case 13: + __m13__ = reader.ReadSingle(); + break; + case 14: + __m23__ = reader.ReadSingle(); + break; + case 15: + __m33__ = reader.ReadSingle(); + break; + default: + reader.Skip(); + break; + } + } + + var ____result = default(global::UnityEngine.Matrix4x4); + ____result.m00 = __m00__; + ____result.m10 = __m10__; + ____result.m20 = __m20__; + ____result.m30 = __m30__; + ____result.m01 = __m01__; + ____result.m11 = __m11__; + ____result.m21 = __m21__; + ____result.m31 = __m31__; + ____result.m02 = __m02__; + ____result.m12 = __m12__; + ____result.m22 = __m22__; + ____result.m32 = __m32__; + ____result.m03 = __m03__; + ____result.m13 = __m13__; + ____result.m23 = __m23__; + ____result.m33 = __m33__; + return ____result; + } + } + + public sealed class GradientColorKeyFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, global::UnityEngine.GradientColorKey value, global::MessagePack.MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(2); + options.Resolver.GetFormatterWithVerify().Serialize(ref writer, value.color, options); + writer.Write(value.time); + } + + public global::UnityEngine.GradientColorKey Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new InvalidOperationException("typecode is null, struct not supported"); + } + + var length = reader.ReadArrayHeader(); + var __color__ = default(global::UnityEngine.Color); + var __time__ = default(float); + IFormatterResolver resolver = options.Resolver; + for (int i = 0; i < length; i++) + { + var key = i; + switch (key) + { + case 0: + __color__ = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + __time__ = reader.ReadSingle(); + break; + default: + reader.Skip(); + break; + } + } + + var ____result = new global::UnityEngine.GradientColorKey(__color__, __time__); + ____result.color = __color__; + ____result.time = __time__; + return ____result; + } + } + + public sealed class GradientAlphaKeyFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, global::UnityEngine.GradientAlphaKey value, global::MessagePack.MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(2); + writer.Write(value.alpha); + writer.Write(value.time); + } + + public global::UnityEngine.GradientAlphaKey Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new InvalidOperationException("typecode is null, struct not supported"); + } + + var length = reader.ReadArrayHeader(); + var __alpha__ = default(float); + var __time__ = default(float); + for (int i = 0; i < length; i++) + { + var key = i; + switch (key) + { + case 0: + __alpha__ = reader.ReadSingle(); + break; + case 1: + __time__ = reader.ReadSingle(); + break; + default: + reader.Skip(); + break; + } + } + + var ____result = new global::UnityEngine.GradientAlphaKey(__alpha__, __time__); + ____result.alpha = __alpha__; + ____result.time = __time__; + return ____result; + } + } + + public sealed class GradientFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, global::UnityEngine.Gradient value, global::MessagePack.MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + return; + } + + IFormatterResolver resolver = options.Resolver; + writer.WriteArrayHeader(3); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.colorKeys, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.alphaKeys, options); + resolver.GetFormatterWithVerify().Serialize(ref writer, value.mode, options); + } + + public global::UnityEngine.Gradient Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + return null; + } + + IFormatterResolver resolver = options.Resolver; + var length = reader.ReadArrayHeader(); + var __colorKeys__ = default(global::UnityEngine.GradientColorKey[]); + var __alphaKeys__ = default(global::UnityEngine.GradientAlphaKey[]); + var __mode__ = default(global::UnityEngine.GradientMode); + for (int i = 0; i < length; i++) + { + var key = i; + switch (key) + { + case 0: + __colorKeys__ = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + __alphaKeys__ = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 2: + __mode__ = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + var ____result = new global::UnityEngine.Gradient(); + ____result.colorKeys = __colorKeys__; + ____result.alphaKeys = __alphaKeys__; + ____result.mode = __mode__; + return ____result; + } + } + + public sealed class Color32Formatter : global::MessagePack.Formatters.IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, global::UnityEngine.Color32 value, global::MessagePack.MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(4); + writer.Write(value.r); + writer.Write(value.g); + writer.Write(value.b); + writer.Write(value.a); + } + + public global::UnityEngine.Color32 Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new InvalidOperationException("typecode is null, struct not supported"); + } + + var length = reader.ReadArrayHeader(); + var __r__ = default(byte); + var __g__ = default(byte); + var __b__ = default(byte); + var __a__ = default(byte); + for (int i = 0; i < length; i++) + { + var key = i; + switch (key) + { + case 0: + __r__ = reader.ReadByte(); + break; + case 1: + __g__ = reader.ReadByte(); + break; + case 2: + __b__ = reader.ReadByte(); + break; + case 3: + __a__ = reader.ReadByte(); + break; + default: + reader.Skip(); + break; + } + } + + var ____result = new global::UnityEngine.Color32(__r__, __g__, __b__, __a__); + ____result.r = __r__; + ____result.g = __g__; + ____result.b = __b__; + ____result.a = __a__; + return ____result; + } + } + + public sealed class RectOffsetFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, global::UnityEngine.RectOffset value, global::MessagePack.MessagePackSerializerOptions options) + { + if (value == null) + { + writer.WriteNil(); + return; + } + + writer.WriteArrayHeader(4); + writer.Write(value.left); + writer.Write(value.right); + writer.Write(value.top); + writer.Write(value.bottom); + } + + public global::UnityEngine.RectOffset Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + return null; + } + + var length = reader.ReadArrayHeader(); + var __left__ = default(int); + var __right__ = default(int); + var __top__ = default(int); + var __bottom__ = default(int); + for (int i = 0; i < length; i++) + { + var key = i; + switch (key) + { + case 0: + __left__ = reader.ReadInt32(); + break; + case 1: + __right__ = reader.ReadInt32(); + break; + case 2: + __top__ = reader.ReadInt32(); + break; + case 3: + __bottom__ = reader.ReadInt32(); + break; + default: + reader.Skip(); + break; + } + } + + var ____result = new global::UnityEngine.RectOffset(); + ____result.left = __left__; + ____result.right = __right__; + ____result.top = __top__; + ____result.bottom = __bottom__; + return ____result; + } + } + + public sealed class LayerMaskFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, global::UnityEngine.LayerMask value, global::MessagePack.MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(1); + writer.Write(value.value); + } + + public global::UnityEngine.LayerMask Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new InvalidOperationException("typecode is null, struct not supported"); + } + + var length = reader.ReadArrayHeader(); + var __value__ = default(int); + for (int i = 0; i < length; i++) + { + var key = i; + switch (key) + { + case 0: + __value__ = reader.ReadInt32(); + break; + default: + reader.Skip(); + break; + } + } + + var ____result = default(global::UnityEngine.LayerMask); + ____result.value = __value__; + return ____result; + } + } +#if UNITY_2017_2_OR_NEWER + public sealed class Vector2IntFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, global::UnityEngine.Vector2Int value, global::MessagePack.MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(2); + writer.WriteInt32(value.x); + writer.WriteInt32(value.y); + } + public global::UnityEngine.Vector2Int Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new InvalidOperationException("typecode is null, struct not supported"); + } + var length = reader.ReadArrayHeader(); + var __x__ = default(int); + var __y__ = default(int); + for (int i = 0; i < length; i++) + { + var key = i; + switch (key) + { + case 0: + __x__ = reader.ReadInt32(); + break; + case 1: + __y__ = reader.ReadInt32(); + break; + default: + reader.Skip(); + break; + } + } + + var ____result = new global::UnityEngine.Vector2Int(__x__, __y__); + ____result.x = __x__; + ____result.y = __y__; + return ____result; + } + } + + public sealed class Vector3IntFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, global::UnityEngine.Vector3Int value, global::MessagePack.MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(3); + writer.WriteInt32(value.x); + writer.WriteInt32(value.y); + writer.WriteInt32(value.z); + } + public global::UnityEngine.Vector3Int Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new InvalidOperationException("typecode is null, struct not supported"); + } + var length = reader.ReadArrayHeader(); + var __x__ = default(int); + var __y__ = default(int); + var __z__ = default(int); + for (int i = 0; i < length; i++) + { + var key = i; + switch (key) + { + case 0: + __x__ = reader.ReadInt32(); + break; + case 1: + __y__ = reader.ReadInt32(); + break; + case 2: + __z__ = reader.ReadInt32(); + break; + default: + reader.Skip(); + break; + } + } + + var ____result = new global::UnityEngine.Vector3Int(__x__, __y__, __z__); + ____result.x = __x__; + ____result.y = __y__; + ____result.z = __z__; + return ____result; + } + } + + public sealed class RangeIntFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, global::UnityEngine.RangeInt value, global::MessagePack.MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(2); + writer.WriteInt32(value.start); + writer.WriteInt32(value.length); + } + public global::UnityEngine.RangeInt Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new InvalidOperationException("typecode is null, struct not supported"); + } + var length = reader.ReadArrayHeader(); + var __start__ = default(int); + var __length__ = default(int); + for (int i = 0; i < length; i++) + { + var key = i; + switch (key) + { + case 0: + __start__ = reader.ReadInt32(); + break; + case 1: + __length__ = reader.ReadInt32(); + break; + default: + reader.Skip(); + break; + } + } + + var ____result = new global::UnityEngine.RangeInt(__start__, __length__); + ____result.start = __start__; + ____result.length = __length__; + return ____result; + } + } + + public sealed class RectIntFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, global::UnityEngine.RectInt value, global::MessagePack.MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(4); + writer.WriteInt32(value.x); + writer.WriteInt32(value.y); + writer.WriteInt32(value.width); + writer.WriteInt32(value.height); + } + public global::UnityEngine.RectInt Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new InvalidOperationException("typecode is null, struct not supported"); + } + var length = reader.ReadArrayHeader(); + var __x__ = default(int); + var __y__ = default(int); + var __width__ = default(int); + var __height__ = default(int); + for (int i = 0; i < length; i++) + { + var key = i; + switch (key) + { + case 0: + __x__ = reader.ReadInt32(); + break; + case 1: + __y__ = reader.ReadInt32(); + break; + case 2: + __width__ = reader.ReadInt32(); + break; + case 3: + __height__ = reader.ReadInt32(); + break; + default: + reader.Skip(); + break; + } + } + + var ____result = new global::UnityEngine.RectInt(__x__, __y__, __width__, __height__); + ____result.x = __x__; + ____result.y = __y__; + ____result.width = __width__; + ____result.height = __height__; + return ____result; + } + } + + public sealed class BoundsIntFormatter : global::MessagePack.Formatters.IMessagePackFormatter + { + public void Serialize(ref MessagePackWriter writer, global::UnityEngine.BoundsInt value, global::MessagePack.MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(2); + options.Resolver.GetFormatterWithVerify().Serialize(ref writer, value.position, options); + options.Resolver.GetFormatterWithVerify().Serialize(ref writer, value.size, options); + } + public global::UnityEngine.BoundsInt Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new InvalidOperationException("typecode is null, struct not supported"); + } + var length = reader.ReadArrayHeader(); + var __position__ = default(global::UnityEngine.Vector3Int); + var __size__ = default(global::UnityEngine.Vector3Int); + for (int i = 0; i < length; i++) + { + var key = i; + switch (key) + { + case 0: + __position__ = options.Resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + case 1: + __size__ = options.Resolver.GetFormatterWithVerify().Deserialize(ref reader, options); + break; + default: + reader.Skip(); + break; + } + } + + var ____result = new global::UnityEngine.BoundsInt(__position__, __size__); + ____result.position = __position__; + ____result.size = __size__; + return ____result; + } + } +#endif +} diff --git a/Assets/Scripts/MessagePack/Unity/Formatters.cs.meta b/Assets/Scripts/MessagePack/Unity/Formatters.cs.meta new file mode 100644 index 000000000..84c94b20d --- /dev/null +++ b/Assets/Scripts/MessagePack/Unity/Formatters.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bccce8bedf4b84bfd8a5b74edf3f232f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Unity/MessagePackWindow.cs b/Assets/Scripts/MessagePack/Unity/MessagePackWindow.cs new file mode 100644 index 000000000..99a58c1b3 --- /dev/null +++ b/Assets/Scripts/MessagePack/Unity/MessagePackWindow.cs @@ -0,0 +1,314 @@ +#if UNITY_EDITOR + +using System; +using System.Diagnostics; +using System.Text; +using System.Threading.Tasks; +using UnityEditor; +using UnityEngine; + +namespace MessagePack.Unity.Editor +{ + internal class MessagePackWindow : EditorWindow + { + static MessagePackWindow window; + + bool processInitialized; + + bool isDotnetInstalled; + string dotnetVersion; + + bool isInstalledMpc; + bool installingMpc; + bool invokingMpc; + + MpcArgument mpcArgument; + + [MenuItem("Window/MessagePack/CodeGenerator")] + public static void OpenWindow() + { + if (window != null) + { + window.Close(); + } + + // will called OnEnable(singleton instance will be set). + GetWindow("MessagePack CodeGen").Show(); + } + + async void OnEnable() + { + window = this; // set singleton. + try + { + var dotnet = await ProcessHelper.FindDotnetAsync(); + isDotnetInstalled = dotnet.found; + dotnetVersion = dotnet.version; + + if (isDotnetInstalled) + { + isInstalledMpc = await ProcessHelper.IsInstalledMpc(); + } + } + finally + { + mpcArgument = MpcArgument.Restore(); + processInitialized = true; + } + } + + async void OnGUI() + { + if (!processInitialized) + { + GUILayout.Label("Check .NET Core SDK/CodeGen install status."); + return; + } + if (mpcArgument == null) + { + return; + } + + if (!isDotnetInstalled) + { + GUILayout.Label(".NET Core SDK not found."); + GUILayout.Label("MessagePack CodeGen requires .NET Core Runtime."); + if (GUILayout.Button("Open .NET Core install page.")) + { + Application.OpenURL("https://dotnet.microsoft.com/download"); + } + return; + } + + if (!isInstalledMpc) + { + GUILayout.Label("MessagePack CodeGen does not instaled."); + EditorGUI.BeginDisabledGroup(installingMpc); + + if (GUILayout.Button("Install MessagePack CodeGen.")) + { + installingMpc = true; + try + { + var log = await ProcessHelper.InstallMpc(); + if (!string.IsNullOrWhiteSpace(log)) + { + UnityEngine.Debug.Log(log); + } + if (log != null && log.Contains("error")) + { + isInstalledMpc = false; + } + else + { + isInstalledMpc = true; + } + } + finally + { + installingMpc = false; + } + return; + } + + EditorGUI.EndDisabledGroup(); + return; + } + + EditorGUILayout.LabelField("-i input path(csproj or directory):"); + TextField(mpcArgument, x => x.Input, (x, y) => x.Input = y); + + EditorGUILayout.LabelField("-o output filepath(.cs) or directory(multiple):"); + TextField(mpcArgument, x => x.Output, (x, y) => x.Output = y); + + EditorGUILayout.LabelField("-m(optional) use map mode:"); + var newToggle = EditorGUILayout.Toggle(mpcArgument.UseMapMode); + if (mpcArgument.UseMapMode != newToggle) + { + mpcArgument.UseMapMode = newToggle; + mpcArgument.Save(); + } + + EditorGUILayout.LabelField("-c(optional) conditional compiler symbols(split with ','):"); + TextField(mpcArgument, x => x.ConditionalSymbol, (x, y) => x.ConditionalSymbol = y); + + EditorGUILayout.LabelField("-r(optional) generated resolver name:"); + TextField(mpcArgument, x => x.ResolverName, (x, y) => x.ResolverName = y); + + EditorGUILayout.LabelField("-n(optional) namespace root name:"); + TextField(mpcArgument, x => x.Namespace, (x, y) => x.Namespace = y); + + EditorGUILayout.LabelField("-ms(optional) Generate #if-- files by symbols, split with ','"); + TextField(mpcArgument, x => x.MultipleIfDirectiveOutputSymbols, (x, y) => x.MultipleIfDirectiveOutputSymbols = y); + + EditorGUI.BeginDisabledGroup(invokingMpc); + if (GUILayout.Button("Generate")) + { + var commnadLineArguments = mpcArgument.ToString(); + UnityEngine.Debug.Log("Generate MessagePack Files, command:" + commnadLineArguments); + + invokingMpc = true; + try + { + var log = await ProcessHelper.InvokeProcessStartAsync("dotnet", "mpc " + commnadLineArguments); + UnityEngine.Debug.Log(log); + } + finally + { + invokingMpc = false; + } + } + EditorGUI.EndDisabledGroup(); + } + + void TextField(MpcArgument args, Func getter, Action setter) + { + var current = getter(args); + var newValue = EditorGUILayout.TextField(current); + if (newValue != current) + { + setter(args, newValue); + args.Save(); + } + } + } + + internal class MpcArgument + { + public string Input; + public string Output; + public string ConditionalSymbol; + public string ResolverName; + public string Namespace; + public bool UseMapMode; + public string MultipleIfDirectiveOutputSymbols; + + static string Key => "MessagePackCodeGen." + Application.productName; + + public static MpcArgument Restore() + { + if (EditorPrefs.HasKey(Key)) + { + var json = EditorPrefs.GetString(Key); + return JsonUtility.FromJson(json); + } + else + { + return new MpcArgument(); + } + } + + public void Save() + { + var json = JsonUtility.ToJson(this); + EditorPrefs.SetString(Key, json); + } + + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("-i "); sb.Append(Input); + sb.Append(" -o "); sb.Append(Output); + if (!string.IsNullOrWhiteSpace(ConditionalSymbol)) + { + sb.Append(" -c "); sb.Append(ConditionalSymbol); + } + if (!string.IsNullOrWhiteSpace(ResolverName)) + { + sb.Append(" -r "); sb.Append(ResolverName); + } + if (UseMapMode) + { + sb.Append(" -m"); + } + if (!string.IsNullOrWhiteSpace(Namespace)) + { + sb.Append(" -n "); sb.Append(Namespace); + } + if (!string.IsNullOrWhiteSpace(MultipleIfDirectiveOutputSymbols)) + { + sb.Append(" -ms "); sb.Append(MultipleIfDirectiveOutputSymbols); + } + + return sb.ToString(); + } + } + + internal static class ProcessHelper + { + const string InstallName = "messagepack.generator"; + + public static async Task IsInstalledMpc() + { + var list = await InvokeProcessStartAsync("dotnet", "tool list -g"); + if (list.Contains(InstallName)) + { + return true; + } + else + { + return false; + } + } + + public static async Task InstallMpc() + { + return await InvokeProcessStartAsync("dotnet", "tool install --global " + InstallName); + } + + public static async Task<(bool found, string version)> FindDotnetAsync() + { + try + { + var version = await InvokeProcessStartAsync("dotnet", "--version"); + return (true, version); + } + catch + { + return (false, null); + } + } + + public static Task InvokeProcessStartAsync(string fileName, string arguments) + { + var psi = new ProcessStartInfo() + { + CreateNoWindow = true, + WindowStyle = ProcessWindowStyle.Hidden, + StandardOutputEncoding = Encoding.UTF8, + StandardErrorEncoding = Encoding.UTF8, + RedirectStandardOutput = true, + RedirectStandardError = true, + UseShellExecute = false, + FileName = fileName, + Arguments = arguments, + WorkingDirectory = Application.dataPath + }; + + Process p; + try + { + p = Process.Start(psi); + } + catch (Exception ex) + { + return Task.FromException(ex); + } + + var tcs = new TaskCompletionSource(); + p.EnableRaisingEvents = true; + p.Exited += (object sender, System.EventArgs e) => + { + var data = p.StandardOutput.ReadToEnd(); + p.Dispose(); + p = null; + + tcs.TrySetResult(data); + }; + + return tcs.Task; + } + } +} + +#endif diff --git a/Assets/Scripts/MessagePack/Unity/MessagePackWindow.cs.meta b/Assets/Scripts/MessagePack/Unity/MessagePackWindow.cs.meta new file mode 100644 index 000000000..7015fd2d2 --- /dev/null +++ b/Assets/Scripts/MessagePack/Unity/MessagePackWindow.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4e1974f6daf2611d0b8a78fe6230f4a8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Unity/UnityResolver.cs b/Assets/Scripts/MessagePack/Unity/UnityResolver.cs new file mode 100644 index 000000000..033e513be --- /dev/null +++ b/Assets/Scripts/MessagePack/Unity/UnityResolver.cs @@ -0,0 +1,200 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Collections.Generic; +using MessagePack.Formatters; +using UnityEngine; + +namespace MessagePack.Unity +{ + public class UnityResolver : IFormatterResolver + { + public static readonly UnityResolver Instance = new UnityResolver(); + + private UnityResolver() + { + } + + public IMessagePackFormatter GetFormatter() + { + return FormatterCache.Formatter; + } + + private static class FormatterCache + { + public static readonly IMessagePackFormatter Formatter; + + static FormatterCache() + { + Formatter = (IMessagePackFormatter)UnityResolveryResolverGetFormatterHelper.GetFormatter(typeof(T)); + } + } + } + + internal static class UnityResolveryResolverGetFormatterHelper + { + private static readonly Dictionary FormatterMap = new Dictionary() + { + // standard + { typeof(Vector2), new Vector2Formatter() }, + { typeof(Vector3), new Vector3Formatter() }, + { typeof(Vector4), new Vector4Formatter() }, + { typeof(Quaternion), new QuaternionFormatter() }, + { typeof(Color), new ColorFormatter() }, + { typeof(Bounds), new BoundsFormatter() }, + { typeof(Rect), new RectFormatter() }, + { typeof(Vector2?), new StaticNullableFormatter(new Vector2Formatter()) }, + { typeof(Vector3?), new StaticNullableFormatter(new Vector3Formatter()) }, + { typeof(Vector4?), new StaticNullableFormatter(new Vector4Formatter()) }, + { typeof(Quaternion?), new StaticNullableFormatter(new QuaternionFormatter()) }, + { typeof(Color?), new StaticNullableFormatter(new ColorFormatter()) }, + { typeof(Bounds?), new StaticNullableFormatter(new BoundsFormatter()) }, + { typeof(Rect?), new StaticNullableFormatter(new RectFormatter()) }, + + // standard + array + { typeof(Vector2[]), new ArrayFormatter() }, + { typeof(Vector3[]), new ArrayFormatter() }, + { typeof(Vector4[]), new ArrayFormatter() }, + { typeof(Quaternion[]), new ArrayFormatter() }, + { typeof(Color[]), new ArrayFormatter() }, + { typeof(Bounds[]), new ArrayFormatter() }, + { typeof(Rect[]), new ArrayFormatter() }, + { typeof(Vector2?[]), new ArrayFormatter() }, + { typeof(Vector3?[]), new ArrayFormatter() }, + { typeof(Vector4?[]), new ArrayFormatter() }, + { typeof(Quaternion?[]), new ArrayFormatter() }, + { typeof(Color?[]), new ArrayFormatter() }, + { typeof(Bounds?[]), new ArrayFormatter() }, + { typeof(Rect?[]), new ArrayFormatter() }, + + // standard + list + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + + // new + { typeof(AnimationCurve), new AnimationCurveFormatter() }, + { typeof(RectOffset), new RectOffsetFormatter() }, + { typeof(Gradient), new GradientFormatter() }, + { typeof(WrapMode), new WrapModeFormatter() }, + { typeof(GradientMode), new GradientModeFormatter() }, + { typeof(Keyframe), new KeyframeFormatter() }, + { typeof(Matrix4x4), new Matrix4x4Formatter() }, + { typeof(GradientColorKey), new GradientColorKeyFormatter() }, + { typeof(GradientAlphaKey), new GradientAlphaKeyFormatter() }, + { typeof(Color32), new Color32Formatter() }, + { typeof(LayerMask), new LayerMaskFormatter() }, + { typeof(WrapMode?), new StaticNullableFormatter(new WrapModeFormatter()) }, + { typeof(GradientMode?), new StaticNullableFormatter(new GradientModeFormatter()) }, + { typeof(Keyframe?), new StaticNullableFormatter(new KeyframeFormatter()) }, + { typeof(Matrix4x4?), new StaticNullableFormatter(new Matrix4x4Formatter()) }, + { typeof(GradientColorKey?), new StaticNullableFormatter(new GradientColorKeyFormatter()) }, + { typeof(GradientAlphaKey?), new StaticNullableFormatter(new GradientAlphaKeyFormatter()) }, + { typeof(Color32?), new StaticNullableFormatter(new Color32Formatter()) }, + { typeof(LayerMask?), new StaticNullableFormatter(new LayerMaskFormatter()) }, + + // new + array + { typeof(AnimationCurve[]), new ArrayFormatter() }, + { typeof(RectOffset[]), new ArrayFormatter() }, + { typeof(Gradient[]), new ArrayFormatter() }, + { typeof(WrapMode[]), new ArrayFormatter() }, + { typeof(GradientMode[]), new ArrayFormatter() }, + { typeof(Keyframe[]), new ArrayFormatter() }, + { typeof(Matrix4x4[]), new ArrayFormatter() }, + { typeof(GradientColorKey[]), new ArrayFormatter() }, + { typeof(GradientAlphaKey[]), new ArrayFormatter() }, + { typeof(Color32[]), new ArrayFormatter() }, + { typeof(LayerMask[]), new ArrayFormatter() }, + { typeof(WrapMode?[]), new ArrayFormatter() }, + { typeof(GradientMode?[]), new ArrayFormatter() }, + { typeof(Keyframe?[]), new ArrayFormatter() }, + { typeof(Matrix4x4?[]), new ArrayFormatter() }, + { typeof(GradientColorKey?[]), new ArrayFormatter() }, + { typeof(GradientAlphaKey?[]), new ArrayFormatter() }, + { typeof(Color32?[]), new ArrayFormatter() }, + { typeof(LayerMask?[]), new ArrayFormatter() }, + + // new + list + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + { typeof(List), new ListFormatter() }, + + // unity 2017.2 +#if UNITY_2017_2_OR_NEWER + + {typeof(Vector2Int), new Vector2IntFormatter()}, + {typeof(Vector3Int), new Vector3IntFormatter()}, + {typeof(RangeInt), new RangeIntFormatter()}, + {typeof(RectInt), new RectIntFormatter()}, + {typeof(BoundsInt), new BoundsIntFormatter()}, + {typeof(Vector2Int?), new StaticNullableFormatter(new Vector2IntFormatter())}, + {typeof(Vector3Int?), new StaticNullableFormatter(new Vector3IntFormatter())}, + {typeof(RangeInt?), new StaticNullableFormatter(new RangeIntFormatter())}, + {typeof(RectInt?), new StaticNullableFormatter(new RectIntFormatter())}, + {typeof(BoundsInt?), new StaticNullableFormatter(new BoundsIntFormatter())}, + // unity 2017.2 + array + {typeof(Vector2Int[]), new ArrayFormatter()}, + {typeof(Vector3Int[]), new ArrayFormatter()}, + {typeof(RangeInt[]), new ArrayFormatter()}, + {typeof(RectInt[]), new ArrayFormatter()}, + {typeof(BoundsInt[]), new ArrayFormatter()}, + {typeof(Vector2Int?[]), new ArrayFormatter()}, + {typeof(Vector3Int?[]), new ArrayFormatter()}, + {typeof(RangeInt?[]), new ArrayFormatter()}, + {typeof(RectInt?[]), new ArrayFormatter()}, + {typeof(BoundsInt?[]), new ArrayFormatter()}, + // unity 2017.2 + list + {typeof(List), new ListFormatter()}, + {typeof(List), new ListFormatter()}, + {typeof(List), new ListFormatter()}, + {typeof(List), new ListFormatter()}, + {typeof(List), new ListFormatter()}, + {typeof(List), new ListFormatter()}, + {typeof(List), new ListFormatter()}, + {typeof(List), new ListFormatter()}, + {typeof(List), new ListFormatter()}, + {typeof(List), new ListFormatter()}, + +#endif + }; + + internal static object GetFormatter(Type t) + { + object formatter; + if (FormatterMap.TryGetValue(t, out formatter)) + { + return formatter; + } + + return null; + } + } +} diff --git a/Assets/Scripts/MessagePack/Unity/UnityResolver.cs.meta b/Assets/Scripts/MessagePack/Unity/UnityResolver.cs.meta new file mode 100644 index 000000000..8e525a0ed --- /dev/null +++ b/Assets/Scripts/MessagePack/Unity/UnityResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a3b64d9daec5fd9b985abcb65adcf699 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MessagePack/Utilities.cs b/Assets/Scripts/MessagePack/Utilities.cs new file mode 100644 index 000000000..8d5a4cfe8 --- /dev/null +++ b/Assets/Scripts/MessagePack/Utilities.cs @@ -0,0 +1,47 @@ +// Copyright (c) All contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Buffers; + +namespace MessagePack +{ + /// + /// Internal utilities and extension methods for various external types. + /// + internal static class Utilities + { + /// + /// A value indicating whether we're running on mono. + /// +#if UNITY_2018_3_OR_NEWER + internal const bool IsMono = true; // hard code since we haven't tested whether mono is detected on all unity platforms. +#else + internal static readonly bool IsMono = Type.GetType("Mono.Runtime") is Type; +#endif + + internal delegate void GetWriterBytesAction(ref MessagePackWriter writer, TArg argument); + + internal static byte[] GetWriterBytes(TArg arg, GetWriterBytesAction action) + { + using (var sequenceRental = SequencePool.Shared.Rent()) + { + var writer = new MessagePackWriter(sequenceRental.Value); + action(ref writer, arg); + writer.Flush(); + return sequenceRental.Value.AsReadOnlySequence.ToArray(); + } + } + + internal static Memory GetMemoryCheckResult(this IBufferWriter bufferWriter, int size = 0) + { + var memory = bufferWriter.GetMemory(size); + if (memory.IsEmpty) + { + throw new InvalidOperationException("The underlying IBufferWriter.GetMemory(int) method returned an empty memory block, which is not allowed. This is a bug in " + bufferWriter.GetType().FullName); + } + + return memory; + } + } +} diff --git a/Assets/Scripts/MessagePack/Utilities.cs.meta b/Assets/Scripts/MessagePack/Utilities.cs.meta new file mode 100644 index 000000000..66859785b --- /dev/null +++ b/Assets/Scripts/MessagePack/Utilities.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 908e893ec90c3e0a4acd036922925d17 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ServerShared.meta b/Assets/Scripts/ServerShared.meta new file mode 100644 index 000000000..fe3f5b75b --- /dev/null +++ b/Assets/Scripts/ServerShared.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3d2ae7035758eb24e8de727837afd13d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ServerShared/ChatApp.Shared.Unity.asmdef b/Assets/Scripts/ServerShared/ChatApp.Shared.Unity.asmdef new file mode 100644 index 000000000..7a7f4faa0 --- /dev/null +++ b/Assets/Scripts/ServerShared/ChatApp.Shared.Unity.asmdef @@ -0,0 +1,15 @@ +{ + "name": "ChatApp.Shared.Unity", + "references": [ + "MessagePack", + "MagicOnion.Abstractions" + ], + "optionalUnityReferences": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [] +} \ No newline at end of file diff --git a/Assets/Scripts/ServerShared/ChatApp.Shared.Unity.asmdef.meta b/Assets/Scripts/ServerShared/ChatApp.Shared.Unity.asmdef.meta new file mode 100644 index 000000000..eb73969ac --- /dev/null +++ b/Assets/Scripts/ServerShared/ChatApp.Shared.Unity.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6c33754198bab0b49a95ca89f14de1a5 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ServerShared/Hubs.meta b/Assets/Scripts/ServerShared/Hubs.meta new file mode 100644 index 000000000..acfd04827 --- /dev/null +++ b/Assets/Scripts/ServerShared/Hubs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2e0485c6f6dee60498657a6f1f50ea69 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ServerShared/Hubs/IChatHub.cs b/Assets/Scripts/ServerShared/Hubs/IChatHub.cs new file mode 100644 index 000000000..726ab9837 --- /dev/null +++ b/Assets/Scripts/ServerShared/Hubs/IChatHub.cs @@ -0,0 +1,25 @@ +using ChatApp.Shared.MessagePackObjects; +using MagicOnion; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace ChatApp.Shared.Hubs +{ + /// + /// Client -> Server API (Streaming) + /// + public interface IChatHub : IStreamingHub + { + Task JoinAsync(JoinRequest request); + + Task LeaveAsync(); + + Task SendMessageAsync(string message); + + Task GenerateException(string message); + + // It is not called because it is a method as a sample of arguments. + Task SampleMethod(List sampleList, Dictionary sampleDictionary); + } +} diff --git a/Assets/Scripts/ServerShared/Hubs/IChatHub.cs.meta b/Assets/Scripts/ServerShared/Hubs/IChatHub.cs.meta new file mode 100644 index 000000000..63ac8eba4 --- /dev/null +++ b/Assets/Scripts/ServerShared/Hubs/IChatHub.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2080c15c13ba0c14aa0682bec9550f33 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ServerShared/Hubs/IChatHubReceiver.cs b/Assets/Scripts/ServerShared/Hubs/IChatHubReceiver.cs new file mode 100644 index 000000000..b8b21eeb0 --- /dev/null +++ b/Assets/Scripts/ServerShared/Hubs/IChatHubReceiver.cs @@ -0,0 +1,16 @@ +using ChatApp.Shared.MessagePackObjects; + +namespace ChatApp.Shared.Hubs +{ + /// + /// Server -> Client API + /// + public interface IChatHubReceiver + { + void OnJoin(string name); + + void OnLeave(string name); + + void OnSendMessage(MessageResponse message); + } +} diff --git a/Assets/Scripts/ServerShared/Hubs/IChatHubReceiver.cs.meta b/Assets/Scripts/ServerShared/Hubs/IChatHubReceiver.cs.meta new file mode 100644 index 000000000..5cddfe740 --- /dev/null +++ b/Assets/Scripts/ServerShared/Hubs/IChatHubReceiver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4857e2640847cd94f90257e00ec6854f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ServerShared/MessagePackObjects.meta b/Assets/Scripts/ServerShared/MessagePackObjects.meta new file mode 100644 index 000000000..bd88047a4 --- /dev/null +++ b/Assets/Scripts/ServerShared/MessagePackObjects.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3dfb982d047b6c348836f49863993e1d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ServerShared/MessagePackObjects/Requests.cs b/Assets/Scripts/ServerShared/MessagePackObjects/Requests.cs new file mode 100644 index 000000000..2ae6fa030 --- /dev/null +++ b/Assets/Scripts/ServerShared/MessagePackObjects/Requests.cs @@ -0,0 +1,17 @@ +using MessagePack; + +namespace ChatApp.Shared.MessagePackObjects +{ + /// + /// Room participation information + /// + [MessagePackObject] + public struct JoinRequest + { + [Key(0)] + public string RoomName { get; set; } + + [Key(1)] + public string UserName { get; set; } + } +} diff --git a/Assets/Scripts/ServerShared/MessagePackObjects/Requests.cs.meta b/Assets/Scripts/ServerShared/MessagePackObjects/Requests.cs.meta new file mode 100644 index 000000000..543972522 --- /dev/null +++ b/Assets/Scripts/ServerShared/MessagePackObjects/Requests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 00baa3467159d704dae9afbac3f4729b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ServerShared/MessagePackObjects/Responses.cs b/Assets/Scripts/ServerShared/MessagePackObjects/Responses.cs new file mode 100644 index 000000000..082d1c37b --- /dev/null +++ b/Assets/Scripts/ServerShared/MessagePackObjects/Responses.cs @@ -0,0 +1,17 @@ +using MessagePack; + +namespace ChatApp.Shared.MessagePackObjects +{ + /// + /// Message information + /// + [MessagePackObject] + public struct MessageResponse + { + [Key(0)] + public string UserName { get; set; } + + [Key(1)] + public string Message { get; set; } + } +} diff --git a/Assets/Scripts/ServerShared/MessagePackObjects/Responses.cs.meta b/Assets/Scripts/ServerShared/MessagePackObjects/Responses.cs.meta new file mode 100644 index 000000000..a8d8ee8d6 --- /dev/null +++ b/Assets/Scripts/ServerShared/MessagePackObjects/Responses.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ba2df8e833f170640b371a83db3df1ef +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ServerShared/Services.meta b/Assets/Scripts/ServerShared/Services.meta new file mode 100644 index 000000000..85e2d12c2 --- /dev/null +++ b/Assets/Scripts/ServerShared/Services.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fab80ed56c97e934c9e7a836f31caa64 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ServerShared/Services/IChatService.cs b/Assets/Scripts/ServerShared/Services/IChatService.cs new file mode 100644 index 000000000..0dce7b9d0 --- /dev/null +++ b/Assets/Scripts/ServerShared/Services/IChatService.cs @@ -0,0 +1,14 @@ +using MagicOnion; +using MessagePack; + +namespace ChatApp.Shared.Services +{ + /// + /// Client -> Server API + /// + public interface IChatService : IService + { + UnaryResult GenerateException(string message); + UnaryResult SendReportAsync(string message); + } +} diff --git a/Assets/Scripts/ServerShared/Services/IChatService.cs.meta b/Assets/Scripts/ServerShared/Services/IChatService.cs.meta new file mode 100644 index 000000000..d69c973b3 --- /dev/null +++ b/Assets/Scripts/ServerShared/Services/IChatService.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1319521a7dd3e5048b28683232e79387 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Economy.Server/ChatHub.cs b/Economy.Server/ChatHub.cs new file mode 100644 index 000000000..36e0c7fe2 --- /dev/null +++ b/Economy.Server/ChatHub.cs @@ -0,0 +1,62 @@ +using ChatApp.Shared.Hubs; +using ChatApp.Shared.MessagePackObjects; +using MagicOnion.Server.Hubs; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace ChatApp.Server +{ + /// + /// Chat server processing. + /// One class instance for one connection. + /// + public class ChatHub : StreamingHubBase, IChatHub + { + private IGroup room; + private string myName; + + public async Task JoinAsync(JoinRequest request) + { + this.room = await this.Group.AddAsync(request.RoomName); + + this.myName = request.UserName; + + this.Broadcast(this.room).OnJoin(request.UserName); + } + + + public async Task LeaveAsync() + { + await this.room.RemoveAsync(this.Context); + + this.Broadcast(this.room).OnLeave(this.myName); + } + + public async Task SendMessageAsync(string message) + { + var response = new MessageResponse { UserName = this.myName, Message = message }; + this.Broadcast(this.room).OnSendMessage(response); + + await Task.CompletedTask; + } + + public Task GenerateException(string message) + { + throw new Exception(message); + } + + // It is not called because it is a method as a sample of arguments. + public Task SampleMethod(List sampleList, Dictionary sampleDictionary) + { + throw new System.NotImplementedException(); + } + + protected override ValueTask OnDisconnected() + { + // handle disconnection if needed. + // on disconnecting, if automatically removed this connection from group. + return CompletedTask; + } + } +} diff --git a/Economy.Server/ChatService.cs b/Economy.Server/ChatService.cs new file mode 100644 index 000000000..b89646caf --- /dev/null +++ b/Economy.Server/ChatService.cs @@ -0,0 +1,22 @@ +using ChatApp.Shared.Services; +using MagicOnion; +using MagicOnion.Server; +using MessagePack; + +namespace ChatApp.Server +{ + public class ChatService : ServiceBase, IChatService + { + public UnaryResult GenerateException(string message) + { + throw new System.NotImplementedException(); + } + + public UnaryResult SendReportAsync(string message) + { + Logger.Debug($"{message}"); + + return UnaryResult(Nil.Default); + } + } +} diff --git a/Economy.Server/Program.cs b/Economy.Server/Program.cs new file mode 100644 index 000000000..7943e4994 --- /dev/null +++ b/Economy.Server/Program.cs @@ -0,0 +1,23 @@ +using Grpc.Core; +using MagicOnion.Hosting; +using MagicOnion.Server; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; + +namespace ChatApp.Server +{ + class Program + { + static async Task Main(string[] args) + { + GrpcEnvironment.SetLogger(new Grpc.Core.Logging.ConsoleLogger()); + + await MagicOnionHost.CreateDefaultBuilder() + .UseMagicOnion() + .RunConsoleAsync(); + } + } +} diff --git a/Economy.Server/appsettings.json b/Economy.Server/appsettings.json new file mode 100644 index 000000000..4420c2645 --- /dev/null +++ b/Economy.Server/appsettings.json @@ -0,0 +1,18 @@ +{ + "MagicOnion": { + "ServerPorts": [ + { + "Host": "0.0.0.0", + "Port": 12345, + "UseInsecureConnection": true + } + ] + }, + "Logging": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} \ No newline at end of file diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Economy.Server.deps.json b/Economy.Server/bin/Debug/netcoreapp3.1/Economy.Server.deps.json new file mode 100644 index 000000000..2dce3f97a --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Economy.Server.deps.json @@ -0,0 +1,1069 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v3.1", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v3.1": { + "Economy.Server/1.0.0": { + "dependencies": { + "Economy.Shared": "1.0.0", + "MagicOnion.Hosting": "3.0.9" + }, + "runtime": { + "Economy.Server.dll": {} + } + }, + "Grpc/2.23.0": { + "dependencies": { + "Grpc.Core": "2.23.0" + } + }, + "Grpc.Core/2.23.0": { + "dependencies": { + "Grpc.Core.Api": "2.25.0", + "System.Memory": "4.5.3" + }, + "runtime": { + "lib/netstandard2.0/Grpc.Core.dll": { + "assemblyVersion": "2.0.0.0", + "fileVersion": "2.23.0.0" + } + }, + "runtimeTargets": { + "runtimes/linux/native/libgrpc_csharp_ext.x64.so": { + "rid": "linux", + "assetType": "native", + "fileVersion": "0.0.0.0" + }, + "runtimes/linux/native/libgrpc_csharp_ext.x86.so": { + "rid": "linux", + "assetType": "native", + "fileVersion": "0.0.0.0" + }, + "runtimes/osx/native/libgrpc_csharp_ext.x64.dylib": { + "rid": "osx", + "assetType": "native", + "fileVersion": "0.0.0.0" + }, + "runtimes/osx/native/libgrpc_csharp_ext.x86.dylib": { + "rid": "osx", + "assetType": "native", + "fileVersion": "0.0.0.0" + }, + "runtimes/win/native/grpc_csharp_ext.x64.dll": { + "rid": "win", + "assetType": "native", + "fileVersion": "0.0.0.0" + }, + "runtimes/win/native/grpc_csharp_ext.x86.dll": { + "rid": "win", + "assetType": "native", + "fileVersion": "0.0.0.0" + } + } + }, + "Grpc.Core.Api/2.25.0": { + "dependencies": { + "System.Memory": "4.5.3" + }, + "runtime": { + "lib/netstandard2.0/Grpc.Core.Api.dll": { + "assemblyVersion": "2.0.0.0", + "fileVersion": "2.25.0.0" + } + } + }, + "MagicOnion/3.0.9": { + "dependencies": { + "Grpc": "2.23.0", + "MagicOnion.Abstractions": "3.0.9", + "MessagePack": "2.1.80", + "System.Buffers": "4.5.0", + "System.Collections.Immutable": "1.5.0", + "System.Runtime.CompilerServices.Unsafe": "4.5.2", + "System.Threading.Tasks.Extensions": "4.5.3", + "System.Threading.Tasks.Parallel": "4.3.0" + }, + "runtime": { + "lib/netstandard2.0/MagicOnion.dll": { + "assemblyVersion": "3.0.9.0", + "fileVersion": "3.0.9.0" + } + } + }, + "MagicOnion.Abstractions/3.0.9": { + "dependencies": { + "Grpc.Core.Api": "2.25.0", + "MessagePack": "2.1.80" + }, + "runtime": { + "lib/netstandard2.0/MagicOnion.Abstractions.dll": { + "assemblyVersion": "3.0.9.0", + "fileVersion": "3.0.9.0" + } + } + }, + "MagicOnion.Hosting/3.0.9": { + "dependencies": { + "MagicOnion": "3.0.9", + "Microsoft.Extensions.Configuration.EnvironmentVariables": "3.1.0", + "Microsoft.Extensions.Configuration.Json": "3.1.0", + "Microsoft.Extensions.Configuration.UserSecrets": "3.1.0", + "Microsoft.Extensions.Hosting": "3.1.0", + "Microsoft.Extensions.Logging.Configuration": "3.1.0", + "Microsoft.Extensions.Options.ConfigurationExtensions": "3.1.0" + }, + "runtime": { + "lib/netstandard2.1/MagicOnion.Hosting.dll": { + "assemblyVersion": "3.0.9.0", + "fileVersion": "3.0.9.0" + } + } + }, + "MessagePack/2.1.80": { + "dependencies": { + "MessagePack.Annotations": "2.1.80", + "Microsoft.Bcl.AsyncInterfaces": "1.0.0", + "System.Memory": "4.5.3", + "System.Reflection.Emit": "4.6.0", + "System.Reflection.Emit.Lightweight": "4.6.0", + "System.Runtime.CompilerServices.Unsafe": "4.5.2", + "System.Threading.Tasks.Extensions": "4.5.3" + }, + "runtime": { + "lib/netcoreapp2.1/MessagePack.dll": { + "assemblyVersion": "2.1.0.0", + "fileVersion": "2.1.80.35179" + } + } + }, + "MessagePack.Annotations/2.1.80": { + "runtime": { + "lib/netstandard2.0/MessagePack.Annotations.dll": { + "assemblyVersion": "2.1.0.0", + "fileVersion": "2.1.80.35179" + } + } + }, + "Microsoft.Bcl.AsyncInterfaces/1.0.0": { + "runtime": { + "lib/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "4.700.19.46214" + } + } + }, + "Microsoft.Extensions.Configuration/3.1.0": { + "dependencies": { + "Microsoft.Extensions.Configuration.Abstractions": "3.1.0" + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.Configuration.Abstractions/3.1.0": { + "dependencies": { + "Microsoft.Extensions.Primitives": "3.1.0" + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.Abstractions.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.Configuration.Binder/3.1.0": { + "dependencies": { + "Microsoft.Extensions.Configuration": "3.1.0" + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.Binder.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.Configuration.CommandLine/3.1.0": { + "dependencies": { + "Microsoft.Extensions.Configuration": "3.1.0" + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.CommandLine.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.Configuration.EnvironmentVariables/3.1.0": { + "dependencies": { + "Microsoft.Extensions.Configuration": "3.1.0" + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.EnvironmentVariables.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.Configuration.FileExtensions/3.1.0": { + "dependencies": { + "Microsoft.Extensions.Configuration": "3.1.0", + "Microsoft.Extensions.FileProviders.Physical": "3.1.0" + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.FileExtensions.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.Configuration.Json/3.1.0": { + "dependencies": { + "Microsoft.Extensions.Configuration": "3.1.0", + "Microsoft.Extensions.Configuration.FileExtensions": "3.1.0" + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.Json.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.Configuration.UserSecrets/3.1.0": { + "dependencies": { + "Microsoft.Extensions.Configuration.Json": "3.1.0" + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.UserSecrets.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.DependencyInjection/3.1.0": { + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "3.1.0" + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.DependencyInjection.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.DependencyInjection.Abstractions/3.1.0": { + "runtime": { + "lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.FileProviders.Abstractions/3.1.0": { + "dependencies": { + "Microsoft.Extensions.Primitives": "3.1.0" + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.FileProviders.Abstractions.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.FileProviders.Physical/3.1.0": { + "dependencies": { + "Microsoft.Extensions.FileProviders.Abstractions": "3.1.0", + "Microsoft.Extensions.FileSystemGlobbing": "3.1.0" + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.FileProviders.Physical.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.FileSystemGlobbing/3.1.0": { + "runtime": { + "lib/netstandard2.0/Microsoft.Extensions.FileSystemGlobbing.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.Hosting/3.1.0": { + "dependencies": { + "Microsoft.Extensions.Configuration": "3.1.0", + "Microsoft.Extensions.Configuration.CommandLine": "3.1.0", + "Microsoft.Extensions.Configuration.EnvironmentVariables": "3.1.0", + "Microsoft.Extensions.Configuration.UserSecrets": "3.1.0", + "Microsoft.Extensions.DependencyInjection": "3.1.0", + "Microsoft.Extensions.FileProviders.Physical": "3.1.0", + "Microsoft.Extensions.Hosting.Abstractions": "3.1.0", + "Microsoft.Extensions.Logging": "3.1.0", + "Microsoft.Extensions.Logging.Console": "3.1.0", + "Microsoft.Extensions.Logging.Debug": "3.1.0", + "Microsoft.Extensions.Logging.EventLog": "3.1.0", + "Microsoft.Extensions.Logging.EventSource": "3.1.0" + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Hosting.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.Hosting.Abstractions/3.1.0": { + "dependencies": { + "Microsoft.Extensions.Configuration.Abstractions": "3.1.0", + "Microsoft.Extensions.DependencyInjection.Abstractions": "3.1.0", + "Microsoft.Extensions.FileProviders.Abstractions": "3.1.0", + "Microsoft.Extensions.Logging.Abstractions": "3.1.0" + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Hosting.Abstractions.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.Logging/3.1.0": { + "dependencies": { + "Microsoft.Extensions.Configuration.Binder": "3.1.0", + "Microsoft.Extensions.DependencyInjection": "3.1.0", + "Microsoft.Extensions.Logging.Abstractions": "3.1.0", + "Microsoft.Extensions.Options": "3.1.0" + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.Logging.Abstractions/3.1.0": { + "runtime": { + "lib/netstandard2.0/Microsoft.Extensions.Logging.Abstractions.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.Logging.Configuration/3.1.0": { + "dependencies": { + "Microsoft.Extensions.Logging": "3.1.0", + "Microsoft.Extensions.Options.ConfigurationExtensions": "3.1.0" + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.Configuration.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.Logging.Console/3.1.0": { + "dependencies": { + "Microsoft.Extensions.Configuration.Abstractions": "3.1.0", + "Microsoft.Extensions.Logging": "3.1.0", + "Microsoft.Extensions.Logging.Configuration": "3.1.0" + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.Console.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.Logging.Debug/3.1.0": { + "dependencies": { + "Microsoft.Extensions.Logging": "3.1.0" + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.Debug.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.Logging.EventLog/3.1.0": { + "dependencies": { + "Microsoft.Extensions.Logging": "3.1.0", + "System.Diagnostics.EventLog": "4.7.0" + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.EventLog.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.Logging.EventSource/3.1.0": { + "dependencies": { + "Microsoft.Extensions.Logging": "3.1.0" + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.EventSource.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.Options/3.1.0": { + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "3.1.0", + "Microsoft.Extensions.Primitives": "3.1.0" + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Options.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.Options.ConfigurationExtensions/3.1.0": { + "dependencies": { + "Microsoft.Extensions.Configuration.Abstractions": "3.1.0", + "Microsoft.Extensions.Configuration.Binder": "3.1.0", + "Microsoft.Extensions.DependencyInjection.Abstractions": "3.1.0", + "Microsoft.Extensions.Options": "3.1.0" + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Options.ConfigurationExtensions.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.Extensions.Primitives/3.1.0": { + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Primitives.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.100.19.56504" + } + } + }, + "Microsoft.NETCore.Platforms/3.1.0": {}, + "Microsoft.NETCore.Targets/1.1.0": {}, + "Microsoft.Win32.Registry/4.7.0": { + "dependencies": { + "System.Security.AccessControl": "4.7.0", + "System.Security.Principal.Windows": "4.7.0" + } + }, + "System.Buffers/4.5.0": {}, + "System.Collections/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "3.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Collections.Concurrent/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Diagnostics.Tracing": "4.3.0", + "System.Globalization": "4.3.0", + "System.Reflection": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "System.Collections.Immutable/1.5.0": {}, + "System.Diagnostics.Debug/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "3.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Diagnostics.EventLog/4.7.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "3.1.0", + "Microsoft.Win32.Registry": "4.7.0", + "System.Security.Principal.Windows": "4.7.0" + }, + "runtime": { + "lib/netstandard2.0/System.Diagnostics.EventLog.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.700.19.56404" + } + }, + "runtimeTargets": { + "runtimes/win/lib/netcoreapp2.0/System.Diagnostics.EventLog.dll": { + "rid": "win", + "assetType": "runtime", + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.700.19.56404" + } + } + }, + "System.Diagnostics.Tracing/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "3.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Globalization/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "3.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.IO/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "3.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "System.Memory/4.5.3": {}, + "System.Reflection/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "3.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.IO": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.Emit/4.6.0": {}, + "System.Reflection.Emit.Lightweight/4.6.0": {}, + "System.Reflection.Primitives/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "3.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Resources.ResourceManager/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "3.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Globalization": "4.3.0", + "System.Reflection": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Runtime/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "3.1.0", + "Microsoft.NETCore.Targets": "1.1.0" + } + }, + "System.Runtime.CompilerServices.Unsafe/4.5.2": {}, + "System.Runtime.Extensions/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "3.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Security.AccessControl/4.7.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "3.1.0", + "System.Security.Principal.Windows": "4.7.0" + } + }, + "System.Security.Principal.Windows/4.7.0": {}, + "System.Text.Encoding/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "3.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Threading/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "System.Threading.Tasks/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "3.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Threading.Tasks.Extensions/4.5.3": {}, + "System.Threading.Tasks.Parallel/4.3.0": { + "dependencies": { + "System.Collections.Concurrent": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Diagnostics.Tracing": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "Economy.Shared/1.0.0": { + "dependencies": { + "MagicOnion.Abstractions": "3.0.9" + }, + "runtime": { + "Economy.Shared.dll": {} + } + } + } + }, + "libraries": { + "Economy.Server/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "Grpc/2.23.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-h2L2SQBI7Y8cQ/TKXFSSEL+bxOA4FtF907DxL8AuVomEmuZG2IemKye9U5cFgx3hq9h7RpP30XyBsG+Se0Mp9w==", + "path": "grpc/2.23.0", + "hashPath": "grpc.2.23.0.nupkg.sha512" + }, + "Grpc.Core/2.23.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-42H3YNdzsT1CHb+woJxHjwcPj8SQk0jcDIMk2YLiryClShTq7x9EOYYdrxmAYyiMt0UkWuWRG6z857zVB/8zpQ==", + "path": "grpc.core/2.23.0", + "hashPath": "grpc.core.2.23.0.nupkg.sha512" + }, + "Grpc.Core.Api/2.25.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ax4qg0k4ZTlWf8PtZoU/hfbwWkgtCRIucVqqgXrRd9HYyieuilZtX6h55SwoFeW8sdNQs950gEkR5XHGStR0lQ==", + "path": "grpc.core.api/2.25.0", + "hashPath": "grpc.core.api.2.25.0.nupkg.sha512" + }, + "MagicOnion/3.0.9": { + "type": "package", + "serviceable": true, + "sha512": "sha512-WesAXQnCC66ZkegdUCZHCI3eDpGdxt11x3eXC5NBPPo3zIh1IWClfMEVAEO9quPuMKlEi/ej24WTNC0JC6JP0A==", + "path": "magiconion/3.0.9", + "hashPath": "magiconion.3.0.9.nupkg.sha512" + }, + "MagicOnion.Abstractions/3.0.9": { + "type": "package", + "serviceable": true, + "sha512": "sha512-fKImfu81sBP6NbaRlZI5+TouYEg14SYoHCvcqc7Oqn5kjm/CcyKnMtsbIdRlblWj9agbqP3bqt3cURI9Bt7QSQ==", + "path": "magiconion.abstractions/3.0.9", + "hashPath": "magiconion.abstractions.3.0.9.nupkg.sha512" + }, + "MagicOnion.Hosting/3.0.9": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ktg3TZ3Ip9mPOwOuwjhbDB23VTuq4X4/vDdKHEvFRQYMURs30Vg1IBWBFIISPhi27xdz1NZzN7m1zhXFlswo9g==", + "path": "magiconion.hosting/3.0.9", + "hashPath": "magiconion.hosting.3.0.9.nupkg.sha512" + }, + "MessagePack/2.1.80": { + "type": "package", + "serviceable": true, + "sha512": "sha512-gEOcbTp5iLNojD57FEaHxWPvxtmQK0HJB0HiMnfBFZubpUvT/JbeHqqn2KAdl94bTw/P8mxi0WaQawzkxIG4gw==", + "path": "messagepack/2.1.80", + "hashPath": "messagepack.2.1.80.nupkg.sha512" + }, + "MessagePack.Annotations/2.1.80": { + "type": "package", + "serviceable": true, + "sha512": "sha512-tpEQqydFReJlJ5HfU+YVCkMS/Vf6OFzswCH4RazvfNqC/8iUD7ztFQJ/eeRt9zpQ5RMHlabR+ULqW4Zo6oqYog==", + "path": "messagepack.annotations/2.1.80", + "hashPath": "messagepack.annotations.2.1.80.nupkg.sha512" + }, + "Microsoft.Bcl.AsyncInterfaces/1.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-K63Y4hORbBcKLWH5wnKgzyn7TOfYzevIEwIedQHBIkmkEBA9SCqgvom+XTuE+fAFGvINGkhFItaZ2dvMGdT5iw==", + "path": "microsoft.bcl.asyncinterfaces/1.0.0", + "hashPath": "microsoft.bcl.asyncinterfaces.1.0.0.nupkg.sha512" + }, + "Microsoft.Extensions.Configuration/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Lu41BWNmwhKr6LgyQvcYBOge0pPvmiaK8R5UHXX4//wBhonJyWcT2OK1mqYfEM5G7pTf31fPrpIHOT6sN7EGOA==", + "path": "microsoft.extensions.configuration/3.1.0", + "hashPath": "microsoft.extensions.configuration.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.Configuration.Abstractions/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ESz6bVoDQX7sgWdKHF6G9Pq672T8k+19AFb/txDXwdz7MoqaNQj2/in3agm/3qae9V+WvQZH86LLTNVo0it8vQ==", + "path": "microsoft.extensions.configuration.abstractions/3.1.0", + "hashPath": "microsoft.extensions.configuration.abstractions.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.Configuration.Binder/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-o9eELDBfNkR7sUtYysFZ1Q7BQ1mYt27DMkups/3vu7xgPyOpMD+iAfrBZFzUXT2iw0fmFb8s1gfNBZS+IgjKdQ==", + "path": "microsoft.extensions.configuration.binder/3.1.0", + "hashPath": "microsoft.extensions.configuration.binder.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.Configuration.CommandLine/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-KDjz4HBw549oW4Y1eQAImAugCSYn84KXwgGZtgMqEwctvkdxZo0ObZC5QQI/YvX21U+DArR9+NfWZ3MxD9MhPA==", + "path": "microsoft.extensions.configuration.commandline/3.1.0", + "hashPath": "microsoft.extensions.configuration.commandline.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.Configuration.EnvironmentVariables/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-WryksPlAFFRMWIGpFwDDbrVSD/kSO7P7fRRzBHh6vEIrgflsM8tpPCcgIvKszH4fz4vcuapih9RMdiiJ2VS7aw==", + "path": "microsoft.extensions.configuration.environmentvariables/3.1.0", + "hashPath": "microsoft.extensions.configuration.environmentvariables.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.Configuration.FileExtensions/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-OjRJIkVxUFiVkr9a39AqVThft9QHoef4But5pDCydJOXJ4D/SkmzuW1tm6J2IXynxj6qfeAz9QTnzQAvOcGvzg==", + "path": "microsoft.extensions.configuration.fileextensions/3.1.0", + "hashPath": "microsoft.extensions.configuration.fileextensions.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.Configuration.Json/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-gBpBE1GoaCf1PKYC7u0Bd4mVZ/eR2bnOvn7u8GBXEy3JGar6sC3UVpVfTB9w+biLPtzcukZynBG9uchSBbLTNQ==", + "path": "microsoft.extensions.configuration.json/3.1.0", + "hashPath": "microsoft.extensions.configuration.json.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.Configuration.UserSecrets/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ZS71TEcxggal3Koh2qHo6s7aNLhwpW2veNCKaxB6nPJabdZBU/sExhszd6JjuCeYMFxDHL1ygJ/N+ghKSrFNDQ==", + "path": "microsoft.extensions.configuration.usersecrets/3.1.0", + "hashPath": "microsoft.extensions.configuration.usersecrets.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.DependencyInjection/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-KVkv3aF2MQpmGFRh4xRx2CNbc2sjDFk+lH4ySrjWSOS+XoY1Xc+sJphw3N0iYOpoeCCq8976ceVYDH8sdx2qIQ==", + "path": "microsoft.extensions.dependencyinjection/3.1.0", + "hashPath": "microsoft.extensions.dependencyinjection.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.DependencyInjection.Abstractions/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-44rDtOf1JXXAFpNT2EXMExaDm/4OJ2RXOL9i9lE4bK427nzC7Exphv+beB6IgluyE2GIoo8zezTStMXI7MQ8WA==", + "path": "microsoft.extensions.dependencyinjection.abstractions/3.1.0", + "hashPath": "microsoft.extensions.dependencyinjection.abstractions.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.FileProviders.Abstractions/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-G3iBMOnn3tETEUvkE9J3a23wQpRkiXZp73zR0XNlicjLFhkeWW1FCaC2bTjrgHhPi2KO6x0BXnHvVuJPIlygBQ==", + "path": "microsoft.extensions.fileproviders.abstractions/3.1.0", + "hashPath": "microsoft.extensions.fileproviders.abstractions.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.FileProviders.Physical/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-KsvgrYp2fhNXoD9gqSu8jPK9Sbvaa7SqNtsLqHugJkCwFmgRvdz76z6Jz2tlFlC7wyMTZxwwtRF8WAorRQWTEA==", + "path": "microsoft.extensions.fileproviders.physical/3.1.0", + "hashPath": "microsoft.extensions.fileproviders.physical.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.FileSystemGlobbing/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-tK5HZOmVv0kUYkonMjuSsxR0CBk+Rd/69QU3eOMv9FvODGZ2d0SR+7R+n8XIgBcCCoCHJBSsI4GPRaoN3Le4rA==", + "path": "microsoft.extensions.filesystemglobbing/3.1.0", + "hashPath": "microsoft.extensions.filesystemglobbing.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.Hosting/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-oM5Zd2eI8tbY+5hR/ZusdS/mcYb25XVLMEohl6rZv8NcfeSEqlZG5YVo81DQGnWhB1OB2nHMVgXj6RN3tEqAqQ==", + "path": "microsoft.extensions.hosting/3.1.0", + "hashPath": "microsoft.extensions.hosting.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.Hosting.Abstractions/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-LiOP1ceFaPBxaE28SOjtORzOVCJk33TT5VQ/Cg5EoatZh1dxpPAgAV/0ruzWKQE7WAHU3F1H9Z6rFgsQwIb9uQ==", + "path": "microsoft.extensions.hosting.abstractions/3.1.0", + "hashPath": "microsoft.extensions.hosting.abstractions.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.Logging/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-P+8sKQ8L4ooL79sxxqwFPxGGC3aBrUDLB/dZqhs4J0XjTyrkeeyJQ4D4nzJB6OnAhy78HIIgQ/RbD6upOXLynw==", + "path": "microsoft.extensions.logging/3.1.0", + "hashPath": "microsoft.extensions.logging.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.Logging.Abstractions/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-jjo4YXRx6MIpv6DiRxJjSpl+sPP0+5VW0clMEdLyIAz44PPwrDTFrd5PZckIxIXl1kKZ2KK6IL2nkt0+ug2MQg==", + "path": "microsoft.extensions.logging.abstractions/3.1.0", + "hashPath": "microsoft.extensions.logging.abstractions.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.Logging.Configuration/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-yW3nIoNM3T5iZg8bRViiCN4+vIU/02l+mlWSvKqWnr0Fd5Uk1zKdT9jBWKEcJhRIWKVWWSpFWXnM5yWoIAy1Eg==", + "path": "microsoft.extensions.logging.configuration/3.1.0", + "hashPath": "microsoft.extensions.logging.configuration.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.Logging.Console/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-lkqVlnQqfqr8nmrpy7EnISXy192NEaIb0Xh4zaO8XS/QMiC3RqOAxxeq89JPSmjw+YfecwcikV8UB+NacdgRDg==", + "path": "microsoft.extensions.logging.console/3.1.0", + "hashPath": "microsoft.extensions.logging.console.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.Logging.Debug/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-pTuUb46wKuZD2nuvzmlHQfbm9sUAiOg1x1pe1fzxDHaocXaZQDjKGYYZifnTLeJk35OSi8ouEIcbuKLVF16yfg==", + "path": "microsoft.extensions.logging.debug/3.1.0", + "hashPath": "microsoft.extensions.logging.debug.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.Logging.EventLog/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-9m5orA0YkzN6DGZIMqMi0SYel2LPhQitaUSMhA9Rocu6k6ZTYJvhqaRYACC4uhpymPyOf0fQaAGK13sqPWi9MA==", + "path": "microsoft.extensions.logging.eventlog/3.1.0", + "hashPath": "microsoft.extensions.logging.eventlog.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.Logging.EventSource/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-HT5UXDPIQFBZob4rF/jwErm/tawmThqhyDdlxLv+VFEAdsgq7/XwMqWLlF59aPvK+ypI0sneV2GUlB4KfWPuSA==", + "path": "microsoft.extensions.logging.eventsource/3.1.0", + "hashPath": "microsoft.extensions.logging.eventsource.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.Options/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-9b6JHY7TAXrSfZ6EEGf+j8XnqKIiMPErfmaNXhJYSCb+BUW2H4RtzkNJvwLJzwgzqBP0wtTjyA6Uw4BPPdmkMw==", + "path": "microsoft.extensions.options/3.1.0", + "hashPath": "microsoft.extensions.options.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.Options.ConfigurationExtensions/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-tx6gMKE3rDspA1YZT8SlQJmyt1BaBSl6mNjB3g0ZO6m3NnoavCifXkGeBuDk9Ae4XjW8C+dty52p+0u38jPRIQ==", + "path": "microsoft.extensions.options.configurationextensions/3.1.0", + "hashPath": "microsoft.extensions.options.configurationextensions.3.1.0.nupkg.sha512" + }, + "Microsoft.Extensions.Primitives/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-LEKAnX7lhUhSoIc2XraCTK3M4IU/LdVUzCe464Sa4+7F4ZJuXHHRzZli2mDbiT4xzAZhgqXbvfnb5+CNDcQFfg==", + "path": "microsoft.extensions.primitives/3.1.0", + "hashPath": "microsoft.extensions.primitives.3.1.0.nupkg.sha512" + }, + "Microsoft.NETCore.Platforms/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-z7aeg8oHln2CuNulfhiLYxCVMPEwBl3rzicjvIX+4sUuCwvXw5oXQEtbiU2c0z4qYL5L3Kmx0mMA/+t/SbY67w==", + "path": "microsoft.netcore.platforms/3.1.0", + "hashPath": "microsoft.netcore.platforms.3.1.0.nupkg.sha512" + }, + "Microsoft.NETCore.Targets/1.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg==", + "path": "microsoft.netcore.targets/1.1.0", + "hashPath": "microsoft.netcore.targets.1.1.0.nupkg.sha512" + }, + "Microsoft.Win32.Registry/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-KSrRMb5vNi0CWSGG1++id2ZOs/1QhRqROt+qgbEAdQuGjGrFcl4AOl4/exGPUYz2wUnU42nvJqon1T3U0kPXLA==", + "path": "microsoft.win32.registry/4.7.0", + "hashPath": "microsoft.win32.registry.4.7.0.nupkg.sha512" + }, + "System.Buffers/4.5.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-pL2ChpaRRWI/p4LXyy4RgeWlYF2sgfj/pnVMvBqwNFr5cXg7CXNnWZWxrOONLg8VGdFB8oB+EG2Qw4MLgTOe+A==", + "path": "system.buffers/4.5.0", + "hashPath": "system.buffers.4.5.0.nupkg.sha512" + }, + "System.Collections/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3Dcj85/TBdVpL5Zr+gEEBUuFe2icOnLalmEh9hfck1PTYbbyWuZgh4fmm2ysCLTrqLQw6t3TgTyJ+VLp+Qb+Lw==", + "path": "system.collections/4.3.0", + "hashPath": "system.collections.4.3.0.nupkg.sha512" + }, + "System.Collections.Concurrent/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ztl69Xp0Y/UXCL+3v3tEU+lIy+bvjKNUmopn1wep/a291pVPK7dxBd6T7WnlQqRog+d1a/hSsgRsmFnIBKTPLQ==", + "path": "system.collections.concurrent/4.3.0", + "hashPath": "system.collections.concurrent.4.3.0.nupkg.sha512" + }, + "System.Collections.Immutable/1.5.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-EXKiDFsChZW0RjrZ4FYHu9aW6+P4MCgEDCklsVseRfhoO0F+dXeMSsMRAlVXIo06kGJ/zv+2w1a2uc2+kxxSaQ==", + "path": "system.collections.immutable/1.5.0", + "hashPath": "system.collections.immutable.1.5.0.nupkg.sha512" + }, + "System.Diagnostics.Debug/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ZUhUOdqmaG5Jk3Xdb8xi5kIyQYAA4PnTNlHx1mu9ZY3qv4ELIdKbnL/akbGaKi2RnNUWaZsAs31rvzFdewTj2g==", + "path": "system.diagnostics.debug/4.3.0", + "hashPath": "system.diagnostics.debug.4.3.0.nupkg.sha512" + }, + "System.Diagnostics.EventLog/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-iDoKGQcRwX0qwY+eAEkaJGae0d/lHlxtslO+t8pJWAUxlvY3tqLtVOPnW2UU4cFjP0Y/L1QBqhkZfSyGqVMR2w==", + "path": "system.diagnostics.eventlog/4.7.0", + "hashPath": "system.diagnostics.eventlog.4.7.0.nupkg.sha512" + }, + "System.Diagnostics.Tracing/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-rswfv0f/Cqkh78rA5S8eN8Neocz234+emGCtTF3lxPY96F+mmmUen6tbn0glN6PMvlKQb9bPAY5e9u7fgPTkKw==", + "path": "system.diagnostics.tracing/4.3.0", + "hashPath": "system.diagnostics.tracing.4.3.0.nupkg.sha512" + }, + "System.Globalization/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-kYdVd2f2PAdFGblzFswE4hkNANJBKRmsfa2X5LG2AcWE1c7/4t0pYae1L8vfZ5xvE2nK/R9JprtToA61OSHWIg==", + "path": "system.globalization/4.3.0", + "hashPath": "system.globalization.4.3.0.nupkg.sha512" + }, + "System.IO/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3qjaHvxQPDpSOYICjUoTsmoq5u6QJAFRUITgeT/4gqkF1bajbSmb1kwSxEA8AHlofqgcKJcM8udgieRNhaJ5Cg==", + "path": "system.io/4.3.0", + "hashPath": "system.io.4.3.0.nupkg.sha512" + }, + "System.Memory/4.5.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3oDzvc/zzetpTKWMShs1AADwZjQ/36HnsufHRPcOjyRAAMLDlu2iD33MBI2opxnezcVUtXyqDXXjoFMOU9c7SA==", + "path": "system.memory/4.5.3", + "hashPath": "system.memory.4.5.3.nupkg.sha512" + }, + "System.Reflection/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-KMiAFoW7MfJGa9nDFNcfu+FpEdiHpWgTcS2HdMpDvt9saK3y/G4GwprPyzqjFH9NTaGPQeWNHU+iDlDILj96aQ==", + "path": "system.reflection/4.3.0", + "hashPath": "system.reflection.4.3.0.nupkg.sha512" + }, + "System.Reflection.Emit/4.6.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-qAo4jyXtC9i71iElngX7P2r+zLaiHzxKwf66sc3X91tL5Ks6fnQ1vxL04o7ZSm3sYfLExySL7GN8aTpNYpU1qw==", + "path": "system.reflection.emit/4.6.0", + "hashPath": "system.reflection.emit.4.6.0.nupkg.sha512" + }, + "System.Reflection.Emit.Lightweight/4.6.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-j/V5HVvxvBQ7uubYD0PptQW2KGsi1Pc2kZ9yfwLixv3ADdjL/4M78KyC5e+ymW612DY8ZE4PFoZmWpoNmN2mqg==", + "path": "system.reflection.emit.lightweight/4.6.0", + "hashPath": "system.reflection.emit.lightweight.4.6.0.nupkg.sha512" + }, + "System.Reflection.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-5RXItQz5As4xN2/YUDxdpsEkMhvw3e6aNveFXUn4Hl/udNTCNhnKp8lT9fnc3MhvGKh1baak5CovpuQUXHAlIA==", + "path": "system.reflection.primitives/4.3.0", + "hashPath": "system.reflection.primitives.4.3.0.nupkg.sha512" + }, + "System.Resources.ResourceManager/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-/zrcPkkWdZmI4F92gL/TPumP98AVDu/Wxr3CSJGQQ+XN6wbRZcyfSKVoPo17ilb3iOr0cCRqJInGwNMolqhS8A==", + "path": "system.resources.resourcemanager/4.3.0", + "hashPath": "system.resources.resourcemanager.4.3.0.nupkg.sha512" + }, + "System.Runtime/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==", + "path": "system.runtime/4.3.0", + "hashPath": "system.runtime.4.3.0.nupkg.sha512" + }, + "System.Runtime.CompilerServices.Unsafe/4.5.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-wprSFgext8cwqymChhrBLu62LMg/1u92bU+VOwyfBimSPVFXtsNqEWC92Pf9ofzJFlk4IHmJA75EDJn1b2goAQ==", + "path": "system.runtime.compilerservices.unsafe/4.5.2", + "hashPath": "system.runtime.compilerservices.unsafe.4.5.2.nupkg.sha512" + }, + "System.Runtime.Extensions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-guW0uK0fn5fcJJ1tJVXYd7/1h5F+pea1r7FLSOz/f8vPEqbR2ZAknuRDvTQ8PzAilDveOxNjSfr0CHfIQfFk8g==", + "path": "system.runtime.extensions/4.3.0", + "hashPath": "system.runtime.extensions.4.3.0.nupkg.sha512" + }, + "System.Security.AccessControl/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-JECvTt5aFF3WT3gHpfofL2MNNP6v84sxtXxpqhLBCcDRzqsPBmHhQ6shv4DwwN2tRlzsUxtb3G9M3763rbXKDg==", + "path": "system.security.accesscontrol/4.7.0", + "hashPath": "system.security.accesscontrol.4.7.0.nupkg.sha512" + }, + "System.Security.Principal.Windows/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ojD0PX0XhneCsUbAZVKdb7h/70vyYMDYs85lwEI+LngEONe/17A0cFaRFqZU+sOEidcVswYWikYOQ9PPfjlbtQ==", + "path": "system.security.principal.windows/4.7.0", + "hashPath": "system.security.principal.windows.4.7.0.nupkg.sha512" + }, + "System.Text.Encoding/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-BiIg+KWaSDOITze6jGQynxg64naAPtqGHBwDrLaCtixsa5bKiR8dpPOHA7ge3C0JJQizJE+sfkz1wV+BAKAYZw==", + "path": "system.text.encoding/4.3.0", + "hashPath": "system.text.encoding.4.3.0.nupkg.sha512" + }, + "System.Threading/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-VkUS0kOBcUf3Wwm0TSbrevDDZ6BlM+b/HRiapRFWjM5O0NS0LviG0glKmFK+hhPDd1XFeSdU1GmlLhb2CoVpIw==", + "path": "system.threading/4.3.0", + "hashPath": "system.threading.4.3.0.nupkg.sha512" + }, + "System.Threading.Tasks/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==", + "path": "system.threading.tasks/4.3.0", + "hashPath": "system.threading.tasks.4.3.0.nupkg.sha512" + }, + "System.Threading.Tasks.Extensions/4.5.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-+MvhNtcvIbqmhANyKu91jQnvIRVSTiaOiFNfKWwXGHG48YAb4I/TyH8spsySiPYla7gKal5ZnF3teJqZAximyQ==", + "path": "system.threading.tasks.extensions/4.5.3", + "hashPath": "system.threading.tasks.extensions.4.5.3.nupkg.sha512" + }, + "System.Threading.Tasks.Parallel/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-cbjBNZHf/vQCfcdhzx7knsiygoCKgxL8mZOeocXZn5gWhCdzHIq6bYNKWX0LAJCWYP7bds4yBK8p06YkP0oa0g==", + "path": "system.threading.tasks.parallel/4.3.0", + "hashPath": "system.threading.tasks.parallel.4.3.0.nupkg.sha512" + }, + "Economy.Shared/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + } + } +} \ No newline at end of file diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Economy.Server.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Economy.Server.dll new file mode 100644 index 000000000..5d57509d8 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Economy.Server.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6a46eaa6ec808a9574d3f35d7ffe8e054e71de1079ef40f10fd98a4ef55a7185 +size 10240 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Economy.Server.exe b/Economy.Server/bin/Debug/netcoreapp3.1/Economy.Server.exe new file mode 100644 index 000000000..ba9790516 Binary files /dev/null and b/Economy.Server/bin/Debug/netcoreapp3.1/Economy.Server.exe differ diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Economy.Server.runtimeconfig.dev.json b/Economy.Server/bin/Debug/netcoreapp3.1/Economy.Server.runtimeconfig.dev.json new file mode 100644 index 000000000..0e6ed13f4 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Economy.Server.runtimeconfig.dev.json @@ -0,0 +1,9 @@ +{ + "runtimeOptions": { + "additionalProbingPaths": [ + "C:\\Users\\rwvens\\.dotnet\\store\\|arch|\\|tfm|", + "C:\\Users\\rwvens\\.nuget\\packages", + "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" + ] + } +} \ No newline at end of file diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Economy.Server.runtimeconfig.json b/Economy.Server/bin/Debug/netcoreapp3.1/Economy.Server.runtimeconfig.json new file mode 100644 index 000000000..bc456d786 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Economy.Server.runtimeconfig.json @@ -0,0 +1,9 @@ +{ + "runtimeOptions": { + "tfm": "netcoreapp3.1", + "framework": { + "name": "Microsoft.NETCore.App", + "version": "3.1.0" + } + } +} \ No newline at end of file diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Economy.Shared.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Economy.Shared.dll new file mode 100644 index 000000000..7b675e3a3 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Economy.Shared.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ca1d4c0c68f6b21705d37d36cb7dbb4003901104da6fc4d587423f0f2f441b4 +size 5632 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Grpc.Core.Api.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Grpc.Core.Api.dll new file mode 100644 index 000000000..52ac9f907 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Grpc.Core.Api.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cd50c5638aacdfdb808ac364b0553ecc497ddafd35048e76d0fcc2a3b3825def +size 48624 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Grpc.Core.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Grpc.Core.dll new file mode 100644 index 000000000..a2e349675 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Grpc.Core.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a20a8c7c1f56e06dc29ae447623dc2bb2915ff9081d62ad61d5345ef23cb490e +size 468976 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/MagicOnion.Abstractions.dll b/Economy.Server/bin/Debug/netcoreapp3.1/MagicOnion.Abstractions.dll new file mode 100644 index 000000000..3974dbc50 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/MagicOnion.Abstractions.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:db36de9cd1ba239a1a98d09d9024b193e966a7ab8efcc032bca5bb93d86b488d +size 14848 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/MagicOnion.Hosting.dll b/Economy.Server/bin/Debug/netcoreapp3.1/MagicOnion.Hosting.dll new file mode 100644 index 000000000..942a34a4c --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/MagicOnion.Hosting.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9d74f2604046d2ed776370024f575d3573f90848cd456bbe737283c004c7f652 +size 32256 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/MagicOnion.dll b/Economy.Server/bin/Debug/netcoreapp3.1/MagicOnion.dll new file mode 100644 index 000000000..8872d2057 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/MagicOnion.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b6d5536cbfd1cd7f6ef1272f0d3d9b0427029bd240a18bc11fc92ad1c8194a49 +size 221184 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/MessagePack.Annotations.dll b/Economy.Server/bin/Debug/netcoreapp3.1/MessagePack.Annotations.dll new file mode 100644 index 000000000..60d763930 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/MessagePack.Annotations.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c3a9c03fc831efe60f2e8d5b6083fcce82c9e151fa4277c7be8be862ea1b7798 +size 8704 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/MessagePack.dll b/Economy.Server/bin/Debug/netcoreapp3.1/MessagePack.dll new file mode 100644 index 000000000..46d7b974b --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/MessagePack.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:69ddf9adafa70bfb7b5ae2e23a108a33a40ec01611ef29e2dff83ec422eab8e8 +size 271872 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Bcl.AsyncInterfaces.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Bcl.AsyncInterfaces.dll new file mode 100644 index 000000000..864ce1c5b --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Bcl.AsyncInterfaces.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:364b4fbe6e82ac45b2fadea44a296d2adb816ffc93f5355cc78874d7fce817e4 +size 14712 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.Abstractions.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.Abstractions.dll new file mode 100644 index 000000000..6835f331a --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.Abstractions.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:acdd5138212945896612a4dbe21ce518d911457efeb40062d7c2c8caa9b1a591 +size 21368 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.Binder.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.Binder.dll new file mode 100644 index 000000000..c78bdc4b0 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.Binder.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:829ba94ca857bfa854a7922aed494dcb45a8c060a0433a571433188365ec1c00 +size 25464 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.CommandLine.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.CommandLine.dll new file mode 100644 index 000000000..3630a11b5 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.CommandLine.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:344efac6b684f8cb5918c3c71816c8ffbbdf454ed306344889c97b77afa166fc +size 19832 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.EnvironmentVariables.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.EnvironmentVariables.dll new file mode 100644 index 000000000..51dd21b7f --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.EnvironmentVariables.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7df38712f30f6fbcf7f722d62f613fe2443a8852b9738ba9f758ae70310aa6fb +size 20856 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.FileExtensions.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.FileExtensions.dll new file mode 100644 index 000000000..3492b8171 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.FileExtensions.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a8ab397ef1f400d1267070ee6e674fbdb1d7debb0efcd82b1ef27309f3b19603 +size 22904 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.Json.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.Json.dll new file mode 100644 index 000000000..4bb2a3002 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.Json.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:54a4b3cc1ac25ba2dfc45dea21aca40c8ace2a4d5398accffbdbf475852d8170 +size 21880 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.UserSecrets.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.UserSecrets.dll new file mode 100644 index 000000000..e4116657c --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.UserSecrets.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:125d24a1b39f66121645da91a3acc644132aaa5bf088b014fb62171a72462d02 +size 20856 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.dll new file mode 100644 index 000000000..b1f153dee --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Configuration.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:89beb6776277b3785ce7eed029beecec075c14aed8f61770be3b821ca4f1bca8 +size 27512 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.DependencyInjection.Abstractions.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.DependencyInjection.Abstractions.dll new file mode 100644 index 000000000..30b703f9c --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.DependencyInjection.Abstractions.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b12db9299b54c424a99a8ddf049d6c77e13c0d8f5a654c6d7cd49f5c43f89633 +size 37752 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.DependencyInjection.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.DependencyInjection.dll new file mode 100644 index 000000000..5a7c82516 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.DependencyInjection.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a5b6aaac6614a4a8030594f3942f08d02815f0a0c9da4567fd091c26cb71cb5 +size 72568 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.FileProviders.Abstractions.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.FileProviders.Abstractions.dll new file mode 100644 index 000000000..173ecd0a8 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.FileProviders.Abstractions.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7ba91740956b40c1b7b60815de7d5a74edf30157752d91d9875853b3d8a613d7 +size 17784 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.FileProviders.Physical.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.FileProviders.Physical.dll new file mode 100644 index 000000000..3843f996f --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.FileProviders.Physical.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f1c63627f313d3f8560dd765a20df274a848919c6c0e25d15e9a93463edd75e +size 35704 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.FileSystemGlobbing.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.FileSystemGlobbing.dll new file mode 100644 index 000000000..d53dbb8bb --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.FileSystemGlobbing.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:985a88da3c4481563b6b0ffa8c6e8e30aa19b72deb2e6821dcd43763f093b2ce +size 39288 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Hosting.Abstractions.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Hosting.Abstractions.dll new file mode 100644 index 000000000..bb1af4e78 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Hosting.Abstractions.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:252240d8589a4c52691a3f583dd52a0cf0ea3c015e19b684ed20b8eac1c66418 +size 25464 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Hosting.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Hosting.dll new file mode 100644 index 000000000..6b0cd191d --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Hosting.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f8b01dd112d832682fb4fb30c9ed80f79137fc4dca1500175d51a774a15021f2 +size 41336 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Logging.Abstractions.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Logging.Abstractions.dll new file mode 100644 index 000000000..619b0ece3 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Logging.Abstractions.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:04c07f84d516a134d6cfc3787e725427629126b1c250e1b013552177ef6cc4ed +size 48504 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Logging.Configuration.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Logging.Configuration.dll new file mode 100644 index 000000000..f51b8c301 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Logging.Configuration.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c3b6be60af01a173c3a0be337569367c1d57daedd84aad761fe6cb5c9900b2d +size 20344 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Logging.Console.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Logging.Console.dll new file mode 100644 index 000000000..36be9c745 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Logging.Console.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f7ad398b6e5be5edecbacbaa911500445a26c5793a1c22b385f67323c0c483c0 +size 28024 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Logging.Debug.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Logging.Debug.dll new file mode 100644 index 000000000..6ccb40ae3 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Logging.Debug.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e9296fdf7ded110dd7db971c74473100ad587959f2e40bf8db26637c8706d7c0 +size 17784 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Logging.EventLog.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Logging.EventLog.dll new file mode 100644 index 000000000..2724a505b --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Logging.EventLog.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f9117cc178324088c703dbbc522facb56812807f08d7d3da9807abe2cf887160 +size 21880 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Logging.EventSource.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Logging.EventSource.dll new file mode 100644 index 000000000..149f4bba8 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Logging.EventSource.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:912a6688e48f6a46688fb4966ccd2495994f7e2dc332a84a34b9fc8544ccf25e +size 29560 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Logging.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Logging.dll new file mode 100644 index 000000000..5e6b0950b --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Logging.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c28bbb58b76486d7c4bb416c3ce63cb8ec58030c4203dc496e9c6dc2804cb95c +size 34168 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Options.ConfigurationExtensions.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Options.ConfigurationExtensions.dll new file mode 100644 index 000000000..100824c10 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Options.ConfigurationExtensions.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c734f81583217c04a3774641b8dc3425b1106929762274bb1af24265f212a011 +size 18296 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Options.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Options.dll new file mode 100644 index 000000000..ccd7d5a95 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Options.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9cc498d811082c4c58487c171ba6e9ff2078b27b159e1d3a7200f166c46f1598 +size 50552 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Primitives.dll b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Primitives.dll new file mode 100644 index 000000000..76026cea9 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/Microsoft.Extensions.Primitives.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b6bd49b64088690dd79c25ed4e316a9902d8354509d6e1a1f19e1b4e8d6b2b2 +size 38776 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/System.Diagnostics.EventLog.dll b/Economy.Server/bin/Debug/netcoreapp3.1/System.Diagnostics.EventLog.dll new file mode 100644 index 000000000..1ebc9ff2e --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/System.Diagnostics.EventLog.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:10997f3bd7b4b4afbeb1a4e5fb118977de11a6696f968c0df22071b2052f512a +size 49256 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/runtimes/linux/native/libgrpc_csharp_ext.x64.so b/Economy.Server/bin/Debug/netcoreapp3.1/runtimes/linux/native/libgrpc_csharp_ext.x64.so new file mode 100644 index 000000000..8e5a05661 Binary files /dev/null and b/Economy.Server/bin/Debug/netcoreapp3.1/runtimes/linux/native/libgrpc_csharp_ext.x64.so differ diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/runtimes/linux/native/libgrpc_csharp_ext.x86.so b/Economy.Server/bin/Debug/netcoreapp3.1/runtimes/linux/native/libgrpc_csharp_ext.x86.so new file mode 100644 index 000000000..9e8ed1926 Binary files /dev/null and b/Economy.Server/bin/Debug/netcoreapp3.1/runtimes/linux/native/libgrpc_csharp_ext.x86.so differ diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/runtimes/osx/native/libgrpc_csharp_ext.x64.dylib b/Economy.Server/bin/Debug/netcoreapp3.1/runtimes/osx/native/libgrpc_csharp_ext.x64.dylib new file mode 100644 index 000000000..377b3e59f --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/runtimes/osx/native/libgrpc_csharp_ext.x64.dylib @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e8a273f488d2344f1974e37a6b706b5516061986462f4f67ab30b56adb5ce387 +size 4141528 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/runtimes/osx/native/libgrpc_csharp_ext.x86.dylib b/Economy.Server/bin/Debug/netcoreapp3.1/runtimes/osx/native/libgrpc_csharp_ext.x86.dylib new file mode 100644 index 000000000..434e13580 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/runtimes/osx/native/libgrpc_csharp_ext.x86.dylib @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cba63d8710a1f2396a383e8f8bcbcac5b8503ccb0140ab0c699fe1963bd4f3ac +size 3602436 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/runtimes/win/lib/netcoreapp2.0/System.Diagnostics.EventLog.dll b/Economy.Server/bin/Debug/netcoreapp3.1/runtimes/win/lib/netcoreapp2.0/System.Diagnostics.EventLog.dll new file mode 100644 index 000000000..c340867f5 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/runtimes/win/lib/netcoreapp2.0/System.Diagnostics.EventLog.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:540cac956e50c979bb9ef15d7c80f96f685fccf6dfd2b5add979c8c0253bc85c +size 129608 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/runtimes/win/native/grpc_csharp_ext.x64.dll b/Economy.Server/bin/Debug/netcoreapp3.1/runtimes/win/native/grpc_csharp_ext.x64.dll new file mode 100644 index 000000000..f8b4faedf --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/runtimes/win/native/grpc_csharp_ext.x64.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:39081cee108a66cfc592a1e7df53106278b4704b07e769fea0b24af4703cbe50 +size 4297200 diff --git a/Economy.Server/bin/Debug/netcoreapp3.1/runtimes/win/native/grpc_csharp_ext.x86.dll b/Economy.Server/bin/Debug/netcoreapp3.1/runtimes/win/native/grpc_csharp_ext.x86.dll new file mode 100644 index 000000000..724d11562 --- /dev/null +++ b/Economy.Server/bin/Debug/netcoreapp3.1/runtimes/win/native/grpc_csharp_ext.x86.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:50dfb7eae3b511d4a84cd0562cd4fe7f36d289022722cdcff2d231ab04e36129 +size 3251696 diff --git a/Economy.Server/obj/Debug/netcoreapp3.1/Economy.Server.AssemblyInfo.cs b/Economy.Server/obj/Debug/netcoreapp3.1/Economy.Server.AssemblyInfo.cs new file mode 100644 index 000000000..245144a22 --- /dev/null +++ b/Economy.Server/obj/Debug/netcoreapp3.1/Economy.Server.AssemblyInfo.cs @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("Economy.Server")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyProductAttribute("Economy.Server")] +[assembly: System.Reflection.AssemblyTitleAttribute("Economy.Server")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Generated by the MSBuild WriteCodeFragment class. + diff --git a/Economy.Server/obj/Debug/netcoreapp3.1/Economy.Server.AssemblyInfoInputs.cache b/Economy.Server/obj/Debug/netcoreapp3.1/Economy.Server.AssemblyInfoInputs.cache new file mode 100644 index 000000000..f4eee02b7 --- /dev/null +++ b/Economy.Server/obj/Debug/netcoreapp3.1/Economy.Server.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +12c88651412949f40a1a35da8dd0e4390916233c diff --git a/Economy.Server/obj/Debug/netcoreapp3.1/Economy.Server.assets.cache b/Economy.Server/obj/Debug/netcoreapp3.1/Economy.Server.assets.cache new file mode 100644 index 000000000..c36b652c6 Binary files /dev/null and b/Economy.Server/obj/Debug/netcoreapp3.1/Economy.Server.assets.cache differ diff --git a/Economy.Server/obj/Debug/netcoreapp3.1/Economy.Server.csproj.CopyComplete b/Economy.Server/obj/Debug/netcoreapp3.1/Economy.Server.csproj.CopyComplete new file mode 100644 index 000000000..e69de29bb diff --git a/Economy.Server/obj/Debug/netcoreapp3.1/Economy.Server.csproj.FileListAbsolute.txt b/Economy.Server/obj/Debug/netcoreapp3.1/Economy.Server.csproj.FileListAbsolute.txt new file mode 100644 index 000000000..843024625 --- /dev/null +++ b/Economy.Server/obj/Debug/netcoreapp3.1/Economy.Server.csproj.FileListAbsolute.txt @@ -0,0 +1,55 @@ +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Economy.Server.exe +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Economy.Server.deps.json +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Economy.Server.runtimeconfig.json +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Economy.Server.runtimeconfig.dev.json +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Economy.Server.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Economy.Server.pdb +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Grpc.Core.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Grpc.Core.Api.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\MagicOnion.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\MagicOnion.Abstractions.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\MagicOnion.Hosting.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\MessagePack.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\MessagePack.Annotations.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Bcl.AsyncInterfaces.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Configuration.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Configuration.Abstractions.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Configuration.Binder.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Configuration.CommandLine.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Configuration.EnvironmentVariables.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Configuration.FileExtensions.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Configuration.Json.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Configuration.UserSecrets.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.DependencyInjection.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.DependencyInjection.Abstractions.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.FileProviders.Abstractions.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.FileProviders.Physical.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.FileSystemGlobbing.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Hosting.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Hosting.Abstractions.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Logging.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Logging.Abstractions.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Logging.Configuration.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Logging.Console.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Logging.Debug.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Logging.EventLog.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Logging.EventSource.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Options.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Options.ConfigurationExtensions.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Primitives.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\System.Diagnostics.EventLog.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\runtimes\linux\native\libgrpc_csharp_ext.x64.so +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\runtimes\linux\native\libgrpc_csharp_ext.x86.so +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\runtimes\osx\native\libgrpc_csharp_ext.x64.dylib +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\runtimes\osx\native\libgrpc_csharp_ext.x86.dylib +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\runtimes\win\native\grpc_csharp_ext.x64.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\runtimes\win\native\grpc_csharp_ext.x86.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\runtimes\win\lib\netcoreapp2.0\System.Diagnostics.EventLog.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Economy.Shared.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Economy.Shared.pdb +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\obj\Debug\netcoreapp3.1\Economy.Server.csprojAssemblyReference.cache +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\obj\Debug\netcoreapp3.1\Economy.Server.AssemblyInfoInputs.cache +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\obj\Debug\netcoreapp3.1\Economy.Server.AssemblyInfo.cs +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\obj\Debug\netcoreapp3.1\Economy.Server.csproj.CopyComplete +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\obj\Debug\netcoreapp3.1\Economy.Server.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\obj\Debug\netcoreapp3.1\Economy.Server.pdb diff --git a/Economy.Server/obj/Debug/netcoreapp3.1/Economy.Server.csprojAssemblyReference.cache b/Economy.Server/obj/Debug/netcoreapp3.1/Economy.Server.csprojAssemblyReference.cache new file mode 100644 index 000000000..35f7bbd49 Binary files /dev/null and b/Economy.Server/obj/Debug/netcoreapp3.1/Economy.Server.csprojAssemblyReference.cache differ diff --git a/Economy.Server/obj/Debug/netcoreapp3.1/Economy.Server.dll b/Economy.Server/obj/Debug/netcoreapp3.1/Economy.Server.dll new file mode 100644 index 000000000..5d57509d8 --- /dev/null +++ b/Economy.Server/obj/Debug/netcoreapp3.1/Economy.Server.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6a46eaa6ec808a9574d3f35d7ffe8e054e71de1079ef40f10fd98a4ef55a7185 +size 10240 diff --git a/Economy.Server/obj/Debug/netcoreapp3.1/Economy.Server.exe b/Economy.Server/obj/Debug/netcoreapp3.1/Economy.Server.exe new file mode 100644 index 000000000..ba9790516 Binary files /dev/null and b/Economy.Server/obj/Debug/netcoreapp3.1/Economy.Server.exe differ diff --git a/Economy.Server/obj/Economy.Server.csproj.nuget.cache b/Economy.Server/obj/Economy.Server.csproj.nuget.cache new file mode 100644 index 000000000..a8dab798c --- /dev/null +++ b/Economy.Server/obj/Economy.Server.csproj.nuget.cache @@ -0,0 +1,5 @@ +{ + "version": 1, + "dgSpecHash": "uBAwXYTSs+khlmrWxH7BK1PyKx8a57wF7Nzb4vQyXRpSm2MLDADjxJOabiRD7Aiila2J4b6Avlec6cvNaBaWRQ==", + "success": true +} \ No newline at end of file diff --git a/Economy.Server/obj/Economy.Server.csproj.nuget.dgspec.json b/Economy.Server/obj/Economy.Server.csproj.nuget.dgspec.json new file mode 100644 index 000000000..8e16e0994 --- /dev/null +++ b/Economy.Server/obj/Economy.Server.csproj.nuget.dgspec.json @@ -0,0 +1,141 @@ +{ + "format": 1, + "restore": { + "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Server\\Economy.Server.csproj": {} + }, + "projects": { + "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Server\\Economy.Server.csproj": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Server\\Economy.Server.csproj", + "projectName": "Economy.Server", + "projectPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Server\\Economy.Server.csproj", + "packagesPath": "C:\\Users\\rwvens\\.nuget\\packages\\", + "outputPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Server\\obj\\", + "projectStyle": "PackageReference", + "fallbackFolders": [ + "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" + ], + "configFilePaths": [ + "C:\\Users\\rwvens\\AppData\\Roaming\\NuGet\\NuGet.Config" + ], + "originalTargetFrameworks": [ + "netcoreapp3.1" + ], + "sources": { + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "netcoreapp3.1": { + "projectReferences": { + "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj": { + "projectPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj" + } + } + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "netcoreapp3.1": { + "dependencies": { + "MagicOnion.Hosting": { + "target": "Package", + "version": "[3.0.9, )" + } + }, + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.102\\RuntimeIdentifierGraph.json" + } + } + }, + "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj", + "projectName": "Economy.Shared", + "projectPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj", + "packagesPath": "C:\\Users\\rwvens\\.nuget\\packages\\", + "outputPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\obj\\", + "projectStyle": "PackageReference", + "fallbackFolders": [ + "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" + ], + "configFilePaths": [ + "C:\\Users\\rwvens\\AppData\\Roaming\\NuGet\\NuGet.Config" + ], + "originalTargetFrameworks": [ + "netstandard2.0" + ], + "sources": { + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "netstandard2.0": { + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "netstandard2.0": { + "dependencies": { + "MagicOnion.Abstractions": { + "target": "Package", + "version": "[3.0.0, )" + }, + "MagicOnion.MSBuild.Tasks": { + "suppressParent": "All", + "target": "Package", + "version": "[3.0.0, )" + }, + "MessagePack.MSBuild.Tasks": { + "suppressParent": "All", + "target": "Package", + "version": "[2.0.323, )" + }, + "NETStandard.Library": { + "suppressParent": "All", + "target": "Package", + "version": "[2.0.3, )", + "autoReferenced": true + } + }, + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48" + ], + "assetTargetFallback": true, + "warn": true, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.102\\RuntimeIdentifierGraph.json" + } + } + } + } +} \ No newline at end of file diff --git a/Economy.Server/obj/Economy.Server.csproj.nuget.g.props b/Economy.Server/obj/Economy.Server.csproj.nuget.g.props new file mode 100644 index 000000000..4dbae12aa --- /dev/null +++ b/Economy.Server/obj/Economy.Server.csproj.nuget.g.props @@ -0,0 +1,15 @@ + + + + True + NuGet + $(MSBuildThisFileDirectory)project.assets.json + $(UserProfile)\.nuget\packages\ + C:\Users\rwvens\.nuget\packages\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder + PackageReference + 5.3.0 + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + + \ No newline at end of file diff --git a/Economy.Server/obj/Economy.Server.csproj.nuget.g.targets b/Economy.Server/obj/Economy.Server.csproj.nuget.g.targets new file mode 100644 index 000000000..53cfaa19b --- /dev/null +++ b/Economy.Server/obj/Economy.Server.csproj.nuget.g.targets @@ -0,0 +1,6 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + + \ No newline at end of file diff --git a/Economy.Server/obj/project.assets.json b/Economy.Server/obj/project.assets.json new file mode 100644 index 000000000..b69390e75 --- /dev/null +++ b/Economy.Server/obj/project.assets.json @@ -0,0 +1,2982 @@ +{ + "version": 3, + "targets": { + ".NETCoreApp,Version=v3.1": { + "Grpc/2.23.0": { + "type": "package", + "dependencies": { + "Grpc.Core": "2.23.0" + } + }, + "Grpc.Core/2.23.0": { + "type": "package", + "dependencies": { + "Grpc.Core.Api": "2.23.0", + "System.Memory": "4.5.3" + }, + "compile": { + "lib/netstandard2.0/Grpc.Core.dll": {} + }, + "runtime": { + "lib/netstandard2.0/Grpc.Core.dll": {} + }, + "runtimeTargets": { + "runtimes/linux/native/libgrpc_csharp_ext.x64.so": { + "assetType": "native", + "rid": "linux" + }, + "runtimes/linux/native/libgrpc_csharp_ext.x86.so": { + "assetType": "native", + "rid": "linux" + }, + "runtimes/osx/native/libgrpc_csharp_ext.x64.dylib": { + "assetType": "native", + "rid": "osx" + }, + "runtimes/osx/native/libgrpc_csharp_ext.x86.dylib": { + "assetType": "native", + "rid": "osx" + }, + "runtimes/win/native/grpc_csharp_ext.x64.dll": { + "assetType": "native", + "rid": "win" + }, + "runtimes/win/native/grpc_csharp_ext.x86.dll": { + "assetType": "native", + "rid": "win" + } + } + }, + "Grpc.Core.Api/2.25.0": { + "type": "package", + "dependencies": { + "System.Memory": "4.5.3" + }, + "compile": { + "lib/netstandard2.0/Grpc.Core.Api.dll": {} + }, + "runtime": { + "lib/netstandard2.0/Grpc.Core.Api.dll": {} + } + }, + "MagicOnion/3.0.9": { + "type": "package", + "dependencies": { + "Grpc": "2.23.0", + "MagicOnion.Abstractions": "3.0.9", + "MessagePack": "2.1.80", + "System.Buffers": "4.5.0", + "System.Collections.Immutable": "1.5.0", + "System.Runtime.CompilerServices.Unsafe": "4.5.2", + "System.Threading.Tasks.Extensions": "4.5.3", + "System.Threading.Tasks.Parallel": "4.3.0" + }, + "compile": { + "lib/netstandard2.0/MagicOnion.dll": {} + }, + "runtime": { + "lib/netstandard2.0/MagicOnion.dll": {} + } + }, + "MagicOnion.Abstractions/3.0.9": { + "type": "package", + "dependencies": { + "Grpc.Core.Api": "2.25.0", + "MessagePack": "2.1.80" + }, + "compile": { + "lib/netstandard2.0/MagicOnion.Abstractions.dll": {} + }, + "runtime": { + "lib/netstandard2.0/MagicOnion.Abstractions.dll": {} + } + }, + "MagicOnion.Hosting/3.0.9": { + "type": "package", + "dependencies": { + "MagicOnion": "3.0.9", + "Microsoft.Extensions.Configuration.EnvironmentVariables": "3.1.0", + "Microsoft.Extensions.Configuration.Json": "3.1.0", + "Microsoft.Extensions.Configuration.UserSecrets": "3.1.0", + "Microsoft.Extensions.Hosting": "3.1.0", + "Microsoft.Extensions.Logging.Configuration": "3.1.0", + "Microsoft.Extensions.Options.ConfigurationExtensions": "3.1.0" + }, + "compile": { + "lib/netstandard2.1/MagicOnion.Hosting.dll": {} + }, + "runtime": { + "lib/netstandard2.1/MagicOnion.Hosting.dll": {} + } + }, + "MessagePack/2.1.80": { + "type": "package", + "dependencies": { + "MessagePack.Annotations": "2.1.80", + "Microsoft.Bcl.AsyncInterfaces": "1.0.0", + "System.Memory": "4.5.3", + "System.Reflection.Emit": "4.6.0", + "System.Reflection.Emit.Lightweight": "4.6.0", + "System.Runtime.CompilerServices.Unsafe": "4.5.2", + "System.Threading.Tasks.Extensions": "4.5.3" + }, + "compile": { + "lib/netcoreapp2.1/MessagePack.dll": {} + }, + "runtime": { + "lib/netcoreapp2.1/MessagePack.dll": {} + } + }, + "MessagePack.Annotations/2.1.80": { + "type": "package", + "compile": { + "lib/netstandard2.0/MessagePack.Annotations.dll": {} + }, + "runtime": { + "lib/netstandard2.0/MessagePack.Annotations.dll": {} + } + }, + "Microsoft.Bcl.AsyncInterfaces/1.0.0": { + "type": "package", + "compile": { + "ref/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.dll": {} + }, + "runtime": { + "lib/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.dll": {} + } + }, + "Microsoft.Extensions.Configuration/3.1.0": { + "type": "package", + "dependencies": { + "Microsoft.Extensions.Configuration.Abstractions": "3.1.0" + }, + "compile": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.dll": {} + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.dll": {} + } + }, + "Microsoft.Extensions.Configuration.Abstractions/3.1.0": { + "type": "package", + "dependencies": { + "Microsoft.Extensions.Primitives": "3.1.0" + }, + "compile": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.Abstractions.dll": {} + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.Abstractions.dll": {} + } + }, + "Microsoft.Extensions.Configuration.Binder/3.1.0": { + "type": "package", + "dependencies": { + "Microsoft.Extensions.Configuration": "3.1.0" + }, + "compile": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.Binder.dll": {} + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.Binder.dll": {} + } + }, + "Microsoft.Extensions.Configuration.CommandLine/3.1.0": { + "type": "package", + "dependencies": { + "Microsoft.Extensions.Configuration": "3.1.0" + }, + "compile": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.CommandLine.dll": {} + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.CommandLine.dll": {} + } + }, + "Microsoft.Extensions.Configuration.EnvironmentVariables/3.1.0": { + "type": "package", + "dependencies": { + "Microsoft.Extensions.Configuration": "3.1.0" + }, + "compile": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.EnvironmentVariables.dll": {} + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.EnvironmentVariables.dll": {} + } + }, + "Microsoft.Extensions.Configuration.FileExtensions/3.1.0": { + "type": "package", + "dependencies": { + "Microsoft.Extensions.Configuration": "3.1.0", + "Microsoft.Extensions.FileProviders.Physical": "3.1.0" + }, + "compile": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.FileExtensions.dll": {} + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.FileExtensions.dll": {} + } + }, + "Microsoft.Extensions.Configuration.Json/3.1.0": { + "type": "package", + "dependencies": { + "Microsoft.Extensions.Configuration": "3.1.0", + "Microsoft.Extensions.Configuration.FileExtensions": "3.1.0" + }, + "compile": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.Json.dll": {} + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.Json.dll": {} + } + }, + "Microsoft.Extensions.Configuration.UserSecrets/3.1.0": { + "type": "package", + "dependencies": { + "Microsoft.Extensions.Configuration.Json": "3.1.0" + }, + "compile": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.UserSecrets.dll": {} + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.UserSecrets.dll": {} + }, + "build": { + "build/netstandard2.0/_._": {} + } + }, + "Microsoft.Extensions.DependencyInjection/3.1.0": { + "type": "package", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "3.1.0" + }, + "compile": { + "lib/netcoreapp3.1/Microsoft.Extensions.DependencyInjection.dll": {} + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.DependencyInjection.dll": {} + } + }, + "Microsoft.Extensions.DependencyInjection.Abstractions/3.1.0": { + "type": "package", + "compile": { + "lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll": {} + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll": {} + } + }, + "Microsoft.Extensions.FileProviders.Abstractions/3.1.0": { + "type": "package", + "dependencies": { + "Microsoft.Extensions.Primitives": "3.1.0" + }, + "compile": { + "lib/netcoreapp3.1/Microsoft.Extensions.FileProviders.Abstractions.dll": {} + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.FileProviders.Abstractions.dll": {} + } + }, + "Microsoft.Extensions.FileProviders.Physical/3.1.0": { + "type": "package", + "dependencies": { + "Microsoft.Extensions.FileProviders.Abstractions": "3.1.0", + "Microsoft.Extensions.FileSystemGlobbing": "3.1.0" + }, + "compile": { + "lib/netcoreapp3.1/Microsoft.Extensions.FileProviders.Physical.dll": {} + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.FileProviders.Physical.dll": {} + } + }, + "Microsoft.Extensions.FileSystemGlobbing/3.1.0": { + "type": "package", + "compile": { + "lib/netstandard2.0/Microsoft.Extensions.FileSystemGlobbing.dll": {} + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Extensions.FileSystemGlobbing.dll": {} + } + }, + "Microsoft.Extensions.Hosting/3.1.0": { + "type": "package", + "dependencies": { + "Microsoft.Extensions.Configuration": "3.1.0", + "Microsoft.Extensions.Configuration.CommandLine": "3.1.0", + "Microsoft.Extensions.Configuration.EnvironmentVariables": "3.1.0", + "Microsoft.Extensions.Configuration.UserSecrets": "3.1.0", + "Microsoft.Extensions.DependencyInjection": "3.1.0", + "Microsoft.Extensions.FileProviders.Physical": "3.1.0", + "Microsoft.Extensions.Hosting.Abstractions": "3.1.0", + "Microsoft.Extensions.Logging": "3.1.0", + "Microsoft.Extensions.Logging.Console": "3.1.0", + "Microsoft.Extensions.Logging.Debug": "3.1.0", + "Microsoft.Extensions.Logging.EventLog": "3.1.0", + "Microsoft.Extensions.Logging.EventSource": "3.1.0" + }, + "compile": { + "lib/netcoreapp3.1/Microsoft.Extensions.Hosting.dll": {} + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Hosting.dll": {} + } + }, + "Microsoft.Extensions.Hosting.Abstractions/3.1.0": { + "type": "package", + "dependencies": { + "Microsoft.Extensions.Configuration.Abstractions": "3.1.0", + "Microsoft.Extensions.DependencyInjection.Abstractions": "3.1.0", + "Microsoft.Extensions.FileProviders.Abstractions": "3.1.0", + "Microsoft.Extensions.Logging.Abstractions": "3.1.0" + }, + "compile": { + "lib/netcoreapp3.1/Microsoft.Extensions.Hosting.Abstractions.dll": {} + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Hosting.Abstractions.dll": {} + } + }, + "Microsoft.Extensions.Logging/3.1.0": { + "type": "package", + "dependencies": { + "Microsoft.Extensions.Configuration.Binder": "3.1.0", + "Microsoft.Extensions.DependencyInjection": "3.1.0", + "Microsoft.Extensions.Logging.Abstractions": "3.1.0", + "Microsoft.Extensions.Options": "3.1.0" + }, + "compile": { + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.dll": {} + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.dll": {} + } + }, + "Microsoft.Extensions.Logging.Abstractions/3.1.0": { + "type": "package", + "compile": { + "lib/netstandard2.0/Microsoft.Extensions.Logging.Abstractions.dll": {} + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Extensions.Logging.Abstractions.dll": {} + } + }, + "Microsoft.Extensions.Logging.Configuration/3.1.0": { + "type": "package", + "dependencies": { + "Microsoft.Extensions.Logging": "3.1.0", + "Microsoft.Extensions.Options.ConfigurationExtensions": "3.1.0" + }, + "compile": { + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.Configuration.dll": {} + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.Configuration.dll": {} + } + }, + "Microsoft.Extensions.Logging.Console/3.1.0": { + "type": "package", + "dependencies": { + "Microsoft.Extensions.Configuration.Abstractions": "3.1.0", + "Microsoft.Extensions.Logging": "3.1.0", + "Microsoft.Extensions.Logging.Configuration": "3.1.0" + }, + "compile": { + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.Console.dll": {} + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.Console.dll": {} + } + }, + "Microsoft.Extensions.Logging.Debug/3.1.0": { + "type": "package", + "dependencies": { + "Microsoft.Extensions.Logging": "3.1.0" + }, + "compile": { + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.Debug.dll": {} + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.Debug.dll": {} + } + }, + "Microsoft.Extensions.Logging.EventLog/3.1.0": { + "type": "package", + "dependencies": { + "Microsoft.Extensions.Logging": "3.1.0", + "System.Diagnostics.EventLog": "4.7.0" + }, + "compile": { + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.EventLog.dll": {} + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.EventLog.dll": {} + } + }, + "Microsoft.Extensions.Logging.EventSource/3.1.0": { + "type": "package", + "dependencies": { + "Microsoft.Extensions.Logging": "3.1.0" + }, + "compile": { + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.EventSource.dll": {} + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.EventSource.dll": {} + } + }, + "Microsoft.Extensions.Options/3.1.0": { + "type": "package", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "3.1.0", + "Microsoft.Extensions.Primitives": "3.1.0" + }, + "compile": { + "lib/netcoreapp3.1/Microsoft.Extensions.Options.dll": {} + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Options.dll": {} + } + }, + "Microsoft.Extensions.Options.ConfigurationExtensions/3.1.0": { + "type": "package", + "dependencies": { + "Microsoft.Extensions.Configuration.Abstractions": "3.1.0", + "Microsoft.Extensions.Configuration.Binder": "3.1.0", + "Microsoft.Extensions.DependencyInjection.Abstractions": "3.1.0", + "Microsoft.Extensions.Options": "3.1.0" + }, + "compile": { + "lib/netcoreapp3.1/Microsoft.Extensions.Options.ConfigurationExtensions.dll": {} + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Options.ConfigurationExtensions.dll": {} + } + }, + "Microsoft.Extensions.Primitives/3.1.0": { + "type": "package", + "compile": { + "lib/netcoreapp3.1/Microsoft.Extensions.Primitives.dll": {} + }, + "runtime": { + "lib/netcoreapp3.1/Microsoft.Extensions.Primitives.dll": {} + } + }, + "Microsoft.NETCore.Platforms/3.1.0": { + "type": "package", + "compile": { + "lib/netstandard1.0/_._": {} + }, + "runtime": { + "lib/netstandard1.0/_._": {} + } + }, + "Microsoft.NETCore.Targets/1.1.0": { + "type": "package", + "compile": { + "lib/netstandard1.0/_._": {} + }, + "runtime": { + "lib/netstandard1.0/_._": {} + } + }, + "Microsoft.Win32.Registry/4.7.0": { + "type": "package", + "dependencies": { + "System.Security.AccessControl": "4.7.0", + "System.Security.Principal.Windows": "4.7.0" + }, + "compile": { + "ref/netstandard2.0/_._": {} + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Win32.Registry.dll": {} + }, + "runtimeTargets": { + "runtimes/unix/lib/netstandard2.0/Microsoft.Win32.Registry.dll": { + "assetType": "runtime", + "rid": "unix" + }, + "runtimes/win/lib/netstandard2.0/Microsoft.Win32.Registry.dll": { + "assetType": "runtime", + "rid": "win" + } + } + }, + "System.Buffers/4.5.0": { + "type": "package", + "compile": { + "ref/netcoreapp2.0/_._": {} + }, + "runtime": { + "lib/netcoreapp2.0/_._": {} + } + }, + "System.Collections/4.3.0": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + }, + "compile": { + "ref/netstandard1.3/_._": {} + } + }, + "System.Collections.Concurrent/4.3.0": { + "type": "package", + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Diagnostics.Tracing": "4.3.0", + "System.Globalization": "4.3.0", + "System.Reflection": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0", + "System.Threading.Tasks": "4.3.0" + }, + "compile": { + "ref/netstandard1.3/System.Collections.Concurrent.dll": {} + }, + "runtime": { + "lib/netstandard1.3/System.Collections.Concurrent.dll": {} + } + }, + "System.Collections.Immutable/1.5.0": { + "type": "package", + "compile": { + "lib/netstandard2.0/System.Collections.Immutable.dll": {} + }, + "runtime": { + "lib/netstandard2.0/System.Collections.Immutable.dll": {} + } + }, + "System.Diagnostics.Debug/4.3.0": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + }, + "compile": { + "ref/netstandard1.3/_._": {} + } + }, + "System.Diagnostics.EventLog/4.7.0": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "3.1.0", + "Microsoft.Win32.Registry": "4.7.0", + "System.Security.Principal.Windows": "4.7.0" + }, + "compile": { + "ref/netstandard2.0/System.Diagnostics.EventLog.dll": {} + }, + "runtime": { + "lib/netstandard2.0/System.Diagnostics.EventLog.dll": {} + }, + "runtimeTargets": { + "runtimes/win/lib/netcoreapp2.0/System.Diagnostics.EventLog.dll": { + "assetType": "runtime", + "rid": "win" + } + } + }, + "System.Diagnostics.Tracing/4.3.0": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + }, + "compile": { + "ref/netstandard1.5/_._": {} + } + }, + "System.Globalization/4.3.0": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + }, + "compile": { + "ref/netstandard1.3/_._": {} + } + }, + "System.IO/4.3.0": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading.Tasks": "4.3.0" + }, + "compile": { + "ref/netstandard1.5/_._": {} + } + }, + "System.Memory/4.5.3": { + "type": "package", + "compile": { + "ref/netcoreapp2.1/_._": {} + }, + "runtime": { + "lib/netcoreapp2.1/_._": {} + } + }, + "System.Reflection/4.3.0": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.IO": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + }, + "compile": { + "ref/netstandard1.5/_._": {} + } + }, + "System.Reflection.Emit/4.6.0": { + "type": "package", + "compile": { + "ref/netcoreapp2.0/_._": {} + }, + "runtime": { + "lib/netcoreapp2.0/_._": {} + } + }, + "System.Reflection.Emit.Lightweight/4.6.0": { + "type": "package", + "compile": { + "ref/netcoreapp2.0/_._": {} + }, + "runtime": { + "lib/netcoreapp2.0/_._": {} + } + }, + "System.Reflection.Primitives/4.3.0": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + }, + "compile": { + "ref/netstandard1.0/_._": {} + } + }, + "System.Resources.ResourceManager/4.3.0": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Globalization": "4.3.0", + "System.Reflection": "4.3.0", + "System.Runtime": "4.3.0" + }, + "compile": { + "ref/netstandard1.0/_._": {} + } + }, + "System.Runtime/4.3.0": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0" + }, + "compile": { + "ref/netstandard1.5/System.Runtime.dll": {} + } + }, + "System.Runtime.CompilerServices.Unsafe/4.5.2": { + "type": "package", + "compile": { + "ref/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": {} + }, + "runtime": { + "lib/netcoreapp2.0/System.Runtime.CompilerServices.Unsafe.dll": {} + } + }, + "System.Runtime.Extensions/4.3.0": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + }, + "compile": { + "ref/netstandard1.5/_._": {} + } + }, + "System.Security.AccessControl/4.7.0": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "3.1.0", + "System.Security.Principal.Windows": "4.7.0" + }, + "compile": { + "ref/netstandard2.0/_._": {} + }, + "runtime": { + "lib/netstandard2.0/System.Security.AccessControl.dll": {} + }, + "runtimeTargets": { + "runtimes/win/lib/netcoreapp2.0/System.Security.AccessControl.dll": { + "assetType": "runtime", + "rid": "win" + } + } + }, + "System.Security.Principal.Windows/4.7.0": { + "type": "package", + "compile": { + "ref/netcoreapp3.0/System.Security.Principal.Windows.dll": {} + }, + "runtime": { + "lib/netstandard2.0/System.Security.Principal.Windows.dll": {} + }, + "runtimeTargets": { + "runtimes/unix/lib/netcoreapp2.1/System.Security.Principal.Windows.dll": { + "assetType": "runtime", + "rid": "unix" + }, + "runtimes/win/lib/netcoreapp2.1/System.Security.Principal.Windows.dll": { + "assetType": "runtime", + "rid": "win" + } + } + }, + "System.Text.Encoding/4.3.0": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + }, + "compile": { + "ref/netstandard1.3/_._": {} + } + }, + "System.Threading/4.3.0": { + "type": "package", + "dependencies": { + "System.Runtime": "4.3.0", + "System.Threading.Tasks": "4.3.0" + }, + "compile": { + "ref/netstandard1.3/_._": {} + }, + "runtime": { + "lib/netstandard1.3/System.Threading.dll": {} + } + }, + "System.Threading.Tasks/4.3.0": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + }, + "compile": { + "ref/netstandard1.3/System.Threading.Tasks.dll": {} + } + }, + "System.Threading.Tasks.Extensions/4.5.3": { + "type": "package", + "compile": { + "ref/netcoreapp2.1/_._": {} + }, + "runtime": { + "lib/netcoreapp2.1/_._": {} + } + }, + "System.Threading.Tasks.Parallel/4.3.0": { + "type": "package", + "dependencies": { + "System.Collections.Concurrent": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Diagnostics.Tracing": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0", + "System.Threading.Tasks": "4.3.0" + }, + "compile": { + "ref/netstandard1.1/System.Threading.Tasks.Parallel.dll": {} + }, + "runtime": { + "lib/netstandard1.3/System.Threading.Tasks.Parallel.dll": {} + } + }, + "Economy.Shared/1.0.0": { + "type": "project", + "framework": ".NETStandard,Version=v2.0", + "dependencies": { + "MagicOnion.Abstractions": "3.0.0" + }, + "compile": { + "bin/placeholder/Economy.Shared.dll": {} + }, + "runtime": { + "bin/placeholder/Economy.Shared.dll": {} + } + } + } + }, + "libraries": { + "Grpc/2.23.0": { + "sha512": "h2L2SQBI7Y8cQ/TKXFSSEL+bxOA4FtF907DxL8AuVomEmuZG2IemKye9U5cFgx3hq9h7RpP30XyBsG+Se0Mp9w==", + "type": "package", + "path": "grpc/2.23.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "grpc.2.23.0.nupkg.sha512", + "grpc.nuspec" + ] + }, + "Grpc.Core/2.23.0": { + "sha512": "42H3YNdzsT1CHb+woJxHjwcPj8SQk0jcDIMk2YLiryClShTq7x9EOYYdrxmAYyiMt0UkWuWRG6z857zVB/8zpQ==", + "type": "package", + "path": "grpc.core/2.23.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "build/MonoAndroid10/Grpc.Core.targets", + "build/Xamarin.iOS10/Grpc.Core.targets", + "build/net45/Grpc.Core.targets", + "grpc.core.2.23.0.nupkg.sha512", + "grpc.core.nuspec", + "lib/net45/Grpc.Core.dll", + "lib/net45/Grpc.Core.pdb", + "lib/net45/Grpc.Core.xml", + "lib/netstandard1.5/Grpc.Core.dll", + "lib/netstandard1.5/Grpc.Core.pdb", + "lib/netstandard1.5/Grpc.Core.xml", + "lib/netstandard2.0/Grpc.Core.dll", + "lib/netstandard2.0/Grpc.Core.pdb", + "lib/netstandard2.0/Grpc.Core.xml", + "native/android/arm64-v8a/libgrpc_csharp_ext.so", + "native/android/armeabi-v7a/libgrpc_csharp_ext.so", + "native/android/x86/libgrpc_csharp_ext.so", + "native/ios/universal/libgrpc.a", + "native/ios/universal/libgrpc_csharp_ext.a", + "runtimes/linux/native/libgrpc_csharp_ext.x64.so", + "runtimes/linux/native/libgrpc_csharp_ext.x86.so", + "runtimes/osx/native/libgrpc_csharp_ext.x64.dylib", + "runtimes/osx/native/libgrpc_csharp_ext.x86.dylib", + "runtimes/win/native/grpc_csharp_ext.x64.dll", + "runtimes/win/native/grpc_csharp_ext.x86.dll" + ] + }, + "Grpc.Core.Api/2.25.0": { + "sha512": "ax4qg0k4ZTlWf8PtZoU/hfbwWkgtCRIucVqqgXrRd9HYyieuilZtX6h55SwoFeW8sdNQs950gEkR5XHGStR0lQ==", + "type": "package", + "path": "grpc.core.api/2.25.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "grpc.core.api.2.25.0.nupkg.sha512", + "grpc.core.api.nuspec", + "lib/net45/Grpc.Core.Api.dll", + "lib/net45/Grpc.Core.Api.pdb", + "lib/net45/Grpc.Core.Api.xml", + "lib/netstandard1.5/Grpc.Core.Api.dll", + "lib/netstandard1.5/Grpc.Core.Api.pdb", + "lib/netstandard1.5/Grpc.Core.Api.xml", + "lib/netstandard2.0/Grpc.Core.Api.dll", + "lib/netstandard2.0/Grpc.Core.Api.pdb", + "lib/netstandard2.0/Grpc.Core.Api.xml" + ] + }, + "MagicOnion/3.0.9": { + "sha512": "WesAXQnCC66ZkegdUCZHCI3eDpGdxt11x3eXC5NBPPo3zIh1IWClfMEVAEO9quPuMKlEi/ej24WTNC0JC6JP0A==", + "type": "package", + "path": "magiconion/3.0.9", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "Icon.png", + "lib/netstandard2.0/MagicOnion.dll", + "lib/netstandard2.0/MagicOnion.xml", + "magiconion.3.0.9.nupkg.sha512", + "magiconion.nuspec" + ] + }, + "MagicOnion.Abstractions/3.0.9": { + "sha512": "fKImfu81sBP6NbaRlZI5+TouYEg14SYoHCvcqc7Oqn5kjm/CcyKnMtsbIdRlblWj9agbqP3bqt3cURI9Bt7QSQ==", + "type": "package", + "path": "magiconion.abstractions/3.0.9", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "Icon.png", + "lib/netstandard2.0/MagicOnion.Abstractions.dll", + "lib/netstandard2.0/MagicOnion.Abstractions.xml", + "magiconion.abstractions.3.0.9.nupkg.sha512", + "magiconion.abstractions.nuspec" + ] + }, + "MagicOnion.Hosting/3.0.9": { + "sha512": "ktg3TZ3Ip9mPOwOuwjhbDB23VTuq4X4/vDdKHEvFRQYMURs30Vg1IBWBFIISPhi27xdz1NZzN7m1zhXFlswo9g==", + "type": "package", + "path": "magiconion.hosting/3.0.9", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "Icon.png", + "lib/netstandard2.1/MagicOnion.Hosting.dll", + "lib/netstandard2.1/MagicOnion.Hosting.xml", + "magiconion.hosting.3.0.9.nupkg.sha512", + "magiconion.hosting.nuspec" + ] + }, + "MessagePack/2.1.80": { + "sha512": "gEOcbTp5iLNojD57FEaHxWPvxtmQK0HJB0HiMnfBFZubpUvT/JbeHqqn2KAdl94bTw/P8mxi0WaQawzkxIG4gw==", + "type": "package", + "path": "messagepack/2.1.80", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE", + "lib/netcoreapp2.1/MessagePack.dll", + "lib/netcoreapp2.1/MessagePack.xml", + "lib/netstandard2.0/MessagePack.dll", + "lib/netstandard2.0/MessagePack.xml", + "messagepack.2.1.80.nupkg.sha512", + "messagepack.nuspec" + ] + }, + "MessagePack.Annotations/2.1.80": { + "sha512": "tpEQqydFReJlJ5HfU+YVCkMS/Vf6OFzswCH4RazvfNqC/8iUD7ztFQJ/eeRt9zpQ5RMHlabR+ULqW4Zo6oqYog==", + "type": "package", + "path": "messagepack.annotations/2.1.80", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE", + "lib/netstandard2.0/MessagePack.Annotations.dll", + "lib/netstandard2.0/MessagePack.Annotations.xml", + "messagepack.annotations.2.1.80.nupkg.sha512", + "messagepack.annotations.nuspec" + ] + }, + "Microsoft.Bcl.AsyncInterfaces/1.0.0": { + "sha512": "K63Y4hORbBcKLWH5wnKgzyn7TOfYzevIEwIedQHBIkmkEBA9SCqgvom+XTuE+fAFGvINGkhFItaZ2dvMGdT5iw==", + "type": "package", + "path": "microsoft.bcl.asyncinterfaces/1.0.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/net461/Microsoft.Bcl.AsyncInterfaces.dll", + "lib/net461/Microsoft.Bcl.AsyncInterfaces.xml", + "lib/netstandard2.0/Microsoft.Bcl.AsyncInterfaces.dll", + "lib/netstandard2.0/Microsoft.Bcl.AsyncInterfaces.xml", + "lib/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.dll", + "lib/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.xml", + "microsoft.bcl.asyncinterfaces.1.0.0.nupkg.sha512", + "microsoft.bcl.asyncinterfaces.nuspec", + "ref/net461/Microsoft.Bcl.AsyncInterfaces.dll", + "ref/netstandard2.0/Microsoft.Bcl.AsyncInterfaces.dll", + "ref/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.dll", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "Microsoft.Extensions.Configuration/3.1.0": { + "sha512": "Lu41BWNmwhKr6LgyQvcYBOge0pPvmiaK8R5UHXX4//wBhonJyWcT2OK1mqYfEM5G7pTf31fPrpIHOT6sN7EGOA==", + "type": "package", + "path": "microsoft.extensions.configuration/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.dll", + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.xml", + "lib/netstandard2.0/Microsoft.Extensions.Configuration.dll", + "lib/netstandard2.0/Microsoft.Extensions.Configuration.xml", + "microsoft.extensions.configuration.3.1.0.nupkg.sha512", + "microsoft.extensions.configuration.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.Configuration.Abstractions/3.1.0": { + "sha512": "ESz6bVoDQX7sgWdKHF6G9Pq672T8k+19AFb/txDXwdz7MoqaNQj2/in3agm/3qae9V+WvQZH86LLTNVo0it8vQ==", + "type": "package", + "path": "microsoft.extensions.configuration.abstractions/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.Abstractions.dll", + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.Abstractions.xml", + "lib/netstandard2.0/Microsoft.Extensions.Configuration.Abstractions.dll", + "lib/netstandard2.0/Microsoft.Extensions.Configuration.Abstractions.xml", + "microsoft.extensions.configuration.abstractions.3.1.0.nupkg.sha512", + "microsoft.extensions.configuration.abstractions.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.Configuration.Binder/3.1.0": { + "sha512": "o9eELDBfNkR7sUtYysFZ1Q7BQ1mYt27DMkups/3vu7xgPyOpMD+iAfrBZFzUXT2iw0fmFb8s1gfNBZS+IgjKdQ==", + "type": "package", + "path": "microsoft.extensions.configuration.binder/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.Binder.dll", + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.Binder.xml", + "lib/netstandard2.0/Microsoft.Extensions.Configuration.Binder.dll", + "lib/netstandard2.0/Microsoft.Extensions.Configuration.Binder.xml", + "microsoft.extensions.configuration.binder.3.1.0.nupkg.sha512", + "microsoft.extensions.configuration.binder.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.Configuration.CommandLine/3.1.0": { + "sha512": "KDjz4HBw549oW4Y1eQAImAugCSYn84KXwgGZtgMqEwctvkdxZo0ObZC5QQI/YvX21U+DArR9+NfWZ3MxD9MhPA==", + "type": "package", + "path": "microsoft.extensions.configuration.commandline/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.CommandLine.dll", + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.CommandLine.xml", + "lib/netstandard2.0/Microsoft.Extensions.Configuration.CommandLine.dll", + "lib/netstandard2.0/Microsoft.Extensions.Configuration.CommandLine.xml", + "microsoft.extensions.configuration.commandline.3.1.0.nupkg.sha512", + "microsoft.extensions.configuration.commandline.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.Configuration.EnvironmentVariables/3.1.0": { + "sha512": "WryksPlAFFRMWIGpFwDDbrVSD/kSO7P7fRRzBHh6vEIrgflsM8tpPCcgIvKszH4fz4vcuapih9RMdiiJ2VS7aw==", + "type": "package", + "path": "microsoft.extensions.configuration.environmentvariables/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.EnvironmentVariables.dll", + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.EnvironmentVariables.xml", + "lib/netstandard2.0/Microsoft.Extensions.Configuration.EnvironmentVariables.dll", + "lib/netstandard2.0/Microsoft.Extensions.Configuration.EnvironmentVariables.xml", + "microsoft.extensions.configuration.environmentvariables.3.1.0.nupkg.sha512", + "microsoft.extensions.configuration.environmentvariables.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.Configuration.FileExtensions/3.1.0": { + "sha512": "OjRJIkVxUFiVkr9a39AqVThft9QHoef4But5pDCydJOXJ4D/SkmzuW1tm6J2IXynxj6qfeAz9QTnzQAvOcGvzg==", + "type": "package", + "path": "microsoft.extensions.configuration.fileextensions/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.FileExtensions.dll", + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.FileExtensions.xml", + "lib/netstandard2.0/Microsoft.Extensions.Configuration.FileExtensions.dll", + "lib/netstandard2.0/Microsoft.Extensions.Configuration.FileExtensions.xml", + "microsoft.extensions.configuration.fileextensions.3.1.0.nupkg.sha512", + "microsoft.extensions.configuration.fileextensions.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.Configuration.Json/3.1.0": { + "sha512": "gBpBE1GoaCf1PKYC7u0Bd4mVZ/eR2bnOvn7u8GBXEy3JGar6sC3UVpVfTB9w+biLPtzcukZynBG9uchSBbLTNQ==", + "type": "package", + "path": "microsoft.extensions.configuration.json/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.Json.dll", + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.Json.xml", + "lib/netstandard2.0/Microsoft.Extensions.Configuration.Json.dll", + "lib/netstandard2.0/Microsoft.Extensions.Configuration.Json.xml", + "microsoft.extensions.configuration.json.3.1.0.nupkg.sha512", + "microsoft.extensions.configuration.json.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.Configuration.UserSecrets/3.1.0": { + "sha512": "ZS71TEcxggal3Koh2qHo6s7aNLhwpW2veNCKaxB6nPJabdZBU/sExhszd6JjuCeYMFxDHL1ygJ/N+ghKSrFNDQ==", + "type": "package", + "path": "microsoft.extensions.configuration.usersecrets/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "build/netstandard2.0/Microsoft.Extensions.Configuration.UserSecrets.props", + "build/netstandard2.0/Microsoft.Extensions.Configuration.UserSecrets.targets", + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.UserSecrets.dll", + "lib/netcoreapp3.1/Microsoft.Extensions.Configuration.UserSecrets.xml", + "lib/netstandard2.0/Microsoft.Extensions.Configuration.UserSecrets.dll", + "lib/netstandard2.0/Microsoft.Extensions.Configuration.UserSecrets.xml", + "microsoft.extensions.configuration.usersecrets.3.1.0.nupkg.sha512", + "microsoft.extensions.configuration.usersecrets.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.DependencyInjection/3.1.0": { + "sha512": "KVkv3aF2MQpmGFRh4xRx2CNbc2sjDFk+lH4ySrjWSOS+XoY1Xc+sJphw3N0iYOpoeCCq8976ceVYDH8sdx2qIQ==", + "type": "package", + "path": "microsoft.extensions.dependencyinjection/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/net461/Microsoft.Extensions.DependencyInjection.dll", + "lib/net461/Microsoft.Extensions.DependencyInjection.xml", + "lib/netcoreapp3.1/Microsoft.Extensions.DependencyInjection.dll", + "lib/netcoreapp3.1/Microsoft.Extensions.DependencyInjection.xml", + "lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.dll", + "lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.xml", + "lib/netstandard2.1/Microsoft.Extensions.DependencyInjection.dll", + "lib/netstandard2.1/Microsoft.Extensions.DependencyInjection.xml", + "microsoft.extensions.dependencyinjection.3.1.0.nupkg.sha512", + "microsoft.extensions.dependencyinjection.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.DependencyInjection.Abstractions/3.1.0": { + "sha512": "44rDtOf1JXXAFpNT2EXMExaDm/4OJ2RXOL9i9lE4bK427nzC7Exphv+beB6IgluyE2GIoo8zezTStMXI7MQ8WA==", + "type": "package", + "path": "microsoft.extensions.dependencyinjection.abstractions/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll", + "lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.Abstractions.xml", + "microsoft.extensions.dependencyinjection.abstractions.3.1.0.nupkg.sha512", + "microsoft.extensions.dependencyinjection.abstractions.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.FileProviders.Abstractions/3.1.0": { + "sha512": "G3iBMOnn3tETEUvkE9J3a23wQpRkiXZp73zR0XNlicjLFhkeWW1FCaC2bTjrgHhPi2KO6x0BXnHvVuJPIlygBQ==", + "type": "package", + "path": "microsoft.extensions.fileproviders.abstractions/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netcoreapp3.1/Microsoft.Extensions.FileProviders.Abstractions.dll", + "lib/netcoreapp3.1/Microsoft.Extensions.FileProviders.Abstractions.xml", + "lib/netstandard2.0/Microsoft.Extensions.FileProviders.Abstractions.dll", + "lib/netstandard2.0/Microsoft.Extensions.FileProviders.Abstractions.xml", + "microsoft.extensions.fileproviders.abstractions.3.1.0.nupkg.sha512", + "microsoft.extensions.fileproviders.abstractions.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.FileProviders.Physical/3.1.0": { + "sha512": "KsvgrYp2fhNXoD9gqSu8jPK9Sbvaa7SqNtsLqHugJkCwFmgRvdz76z6Jz2tlFlC7wyMTZxwwtRF8WAorRQWTEA==", + "type": "package", + "path": "microsoft.extensions.fileproviders.physical/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netcoreapp3.1/Microsoft.Extensions.FileProviders.Physical.dll", + "lib/netcoreapp3.1/Microsoft.Extensions.FileProviders.Physical.xml", + "lib/netstandard2.0/Microsoft.Extensions.FileProviders.Physical.dll", + "lib/netstandard2.0/Microsoft.Extensions.FileProviders.Physical.xml", + "microsoft.extensions.fileproviders.physical.3.1.0.nupkg.sha512", + "microsoft.extensions.fileproviders.physical.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.FileSystemGlobbing/3.1.0": { + "sha512": "tK5HZOmVv0kUYkonMjuSsxR0CBk+Rd/69QU3eOMv9FvODGZ2d0SR+7R+n8XIgBcCCoCHJBSsI4GPRaoN3Le4rA==", + "type": "package", + "path": "microsoft.extensions.filesystemglobbing/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netstandard2.0/Microsoft.Extensions.FileSystemGlobbing.dll", + "lib/netstandard2.0/Microsoft.Extensions.FileSystemGlobbing.xml", + "microsoft.extensions.filesystemglobbing.3.1.0.nupkg.sha512", + "microsoft.extensions.filesystemglobbing.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.Hosting/3.1.0": { + "sha512": "oM5Zd2eI8tbY+5hR/ZusdS/mcYb25XVLMEohl6rZv8NcfeSEqlZG5YVo81DQGnWhB1OB2nHMVgXj6RN3tEqAqQ==", + "type": "package", + "path": "microsoft.extensions.hosting/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netcoreapp3.1/Microsoft.Extensions.Hosting.dll", + "lib/netcoreapp3.1/Microsoft.Extensions.Hosting.xml", + "lib/netstandard2.0/Microsoft.Extensions.Hosting.dll", + "lib/netstandard2.0/Microsoft.Extensions.Hosting.xml", + "lib/netstandard2.1/Microsoft.Extensions.Hosting.dll", + "lib/netstandard2.1/Microsoft.Extensions.Hosting.xml", + "microsoft.extensions.hosting.3.1.0.nupkg.sha512", + "microsoft.extensions.hosting.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.Hosting.Abstractions/3.1.0": { + "sha512": "LiOP1ceFaPBxaE28SOjtORzOVCJk33TT5VQ/Cg5EoatZh1dxpPAgAV/0ruzWKQE7WAHU3F1H9Z6rFgsQwIb9uQ==", + "type": "package", + "path": "microsoft.extensions.hosting.abstractions/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netcoreapp3.1/Microsoft.Extensions.Hosting.Abstractions.dll", + "lib/netcoreapp3.1/Microsoft.Extensions.Hosting.Abstractions.xml", + "lib/netstandard2.0/Microsoft.Extensions.Hosting.Abstractions.dll", + "lib/netstandard2.0/Microsoft.Extensions.Hosting.Abstractions.xml", + "microsoft.extensions.hosting.abstractions.3.1.0.nupkg.sha512", + "microsoft.extensions.hosting.abstractions.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.Logging/3.1.0": { + "sha512": "P+8sKQ8L4ooL79sxxqwFPxGGC3aBrUDLB/dZqhs4J0XjTyrkeeyJQ4D4nzJB6OnAhy78HIIgQ/RbD6upOXLynw==", + "type": "package", + "path": "microsoft.extensions.logging/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.dll", + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.xml", + "lib/netstandard2.0/Microsoft.Extensions.Logging.dll", + "lib/netstandard2.0/Microsoft.Extensions.Logging.xml", + "microsoft.extensions.logging.3.1.0.nupkg.sha512", + "microsoft.extensions.logging.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.Logging.Abstractions/3.1.0": { + "sha512": "jjo4YXRx6MIpv6DiRxJjSpl+sPP0+5VW0clMEdLyIAz44PPwrDTFrd5PZckIxIXl1kKZ2KK6IL2nkt0+ug2MQg==", + "type": "package", + "path": "microsoft.extensions.logging.abstractions/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netstandard2.0/Microsoft.Extensions.Logging.Abstractions.dll", + "lib/netstandard2.0/Microsoft.Extensions.Logging.Abstractions.xml", + "microsoft.extensions.logging.abstractions.3.1.0.nupkg.sha512", + "microsoft.extensions.logging.abstractions.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.Logging.Configuration/3.1.0": { + "sha512": "yW3nIoNM3T5iZg8bRViiCN4+vIU/02l+mlWSvKqWnr0Fd5Uk1zKdT9jBWKEcJhRIWKVWWSpFWXnM5yWoIAy1Eg==", + "type": "package", + "path": "microsoft.extensions.logging.configuration/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.Configuration.dll", + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.Configuration.xml", + "lib/netstandard2.0/Microsoft.Extensions.Logging.Configuration.dll", + "lib/netstandard2.0/Microsoft.Extensions.Logging.Configuration.xml", + "microsoft.extensions.logging.configuration.3.1.0.nupkg.sha512", + "microsoft.extensions.logging.configuration.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.Logging.Console/3.1.0": { + "sha512": "lkqVlnQqfqr8nmrpy7EnISXy192NEaIb0Xh4zaO8XS/QMiC3RqOAxxeq89JPSmjw+YfecwcikV8UB+NacdgRDg==", + "type": "package", + "path": "microsoft.extensions.logging.console/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.Console.dll", + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.Console.xml", + "lib/netstandard2.0/Microsoft.Extensions.Logging.Console.dll", + "lib/netstandard2.0/Microsoft.Extensions.Logging.Console.xml", + "microsoft.extensions.logging.console.3.1.0.nupkg.sha512", + "microsoft.extensions.logging.console.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.Logging.Debug/3.1.0": { + "sha512": "pTuUb46wKuZD2nuvzmlHQfbm9sUAiOg1x1pe1fzxDHaocXaZQDjKGYYZifnTLeJk35OSi8ouEIcbuKLVF16yfg==", + "type": "package", + "path": "microsoft.extensions.logging.debug/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.Debug.dll", + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.Debug.xml", + "lib/netstandard2.0/Microsoft.Extensions.Logging.Debug.dll", + "lib/netstandard2.0/Microsoft.Extensions.Logging.Debug.xml", + "microsoft.extensions.logging.debug.3.1.0.nupkg.sha512", + "microsoft.extensions.logging.debug.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.Logging.EventLog/3.1.0": { + "sha512": "9m5orA0YkzN6DGZIMqMi0SYel2LPhQitaUSMhA9Rocu6k6ZTYJvhqaRYACC4uhpymPyOf0fQaAGK13sqPWi9MA==", + "type": "package", + "path": "microsoft.extensions.logging.eventlog/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/net461/Microsoft.Extensions.Logging.EventLog.dll", + "lib/net461/Microsoft.Extensions.Logging.EventLog.xml", + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.EventLog.dll", + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.EventLog.xml", + "lib/netstandard2.0/Microsoft.Extensions.Logging.EventLog.dll", + "lib/netstandard2.0/Microsoft.Extensions.Logging.EventLog.xml", + "microsoft.extensions.logging.eventlog.3.1.0.nupkg.sha512", + "microsoft.extensions.logging.eventlog.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.Logging.EventSource/3.1.0": { + "sha512": "HT5UXDPIQFBZob4rF/jwErm/tawmThqhyDdlxLv+VFEAdsgq7/XwMqWLlF59aPvK+ypI0sneV2GUlB4KfWPuSA==", + "type": "package", + "path": "microsoft.extensions.logging.eventsource/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.EventSource.dll", + "lib/netcoreapp3.1/Microsoft.Extensions.Logging.EventSource.xml", + "lib/netstandard2.0/Microsoft.Extensions.Logging.EventSource.dll", + "lib/netstandard2.0/Microsoft.Extensions.Logging.EventSource.xml", + "microsoft.extensions.logging.eventsource.3.1.0.nupkg.sha512", + "microsoft.extensions.logging.eventsource.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.Options/3.1.0": { + "sha512": "9b6JHY7TAXrSfZ6EEGf+j8XnqKIiMPErfmaNXhJYSCb+BUW2H4RtzkNJvwLJzwgzqBP0wtTjyA6Uw4BPPdmkMw==", + "type": "package", + "path": "microsoft.extensions.options/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netcoreapp3.1/Microsoft.Extensions.Options.dll", + "lib/netcoreapp3.1/Microsoft.Extensions.Options.xml", + "lib/netstandard2.0/Microsoft.Extensions.Options.dll", + "lib/netstandard2.0/Microsoft.Extensions.Options.xml", + "microsoft.extensions.options.3.1.0.nupkg.sha512", + "microsoft.extensions.options.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.Options.ConfigurationExtensions/3.1.0": { + "sha512": "tx6gMKE3rDspA1YZT8SlQJmyt1BaBSl6mNjB3g0ZO6m3NnoavCifXkGeBuDk9Ae4XjW8C+dty52p+0u38jPRIQ==", + "type": "package", + "path": "microsoft.extensions.options.configurationextensions/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netcoreapp3.1/Microsoft.Extensions.Options.ConfigurationExtensions.dll", + "lib/netcoreapp3.1/Microsoft.Extensions.Options.ConfigurationExtensions.xml", + "lib/netstandard2.0/Microsoft.Extensions.Options.ConfigurationExtensions.dll", + "lib/netstandard2.0/Microsoft.Extensions.Options.ConfigurationExtensions.xml", + "microsoft.extensions.options.configurationextensions.3.1.0.nupkg.sha512", + "microsoft.extensions.options.configurationextensions.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.Extensions.Primitives/3.1.0": { + "sha512": "LEKAnX7lhUhSoIc2XraCTK3M4IU/LdVUzCe464Sa4+7F4ZJuXHHRzZli2mDbiT4xzAZhgqXbvfnb5+CNDcQFfg==", + "type": "package", + "path": "microsoft.extensions.primitives/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netcoreapp3.1/Microsoft.Extensions.Primitives.dll", + "lib/netcoreapp3.1/Microsoft.Extensions.Primitives.xml", + "lib/netstandard2.0/Microsoft.Extensions.Primitives.dll", + "lib/netstandard2.0/Microsoft.Extensions.Primitives.xml", + "microsoft.extensions.primitives.3.1.0.nupkg.sha512", + "microsoft.extensions.primitives.nuspec", + "packageIcon.png" + ] + }, + "Microsoft.NETCore.Platforms/3.1.0": { + "sha512": "z7aeg8oHln2CuNulfhiLYxCVMPEwBl3rzicjvIX+4sUuCwvXw5oXQEtbiU2c0z4qYL5L3Kmx0mMA/+t/SbY67w==", + "type": "package", + "path": "microsoft.netcore.platforms/3.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/netstandard1.0/_._", + "microsoft.netcore.platforms.3.1.0.nupkg.sha512", + "microsoft.netcore.platforms.nuspec", + "runtime.json", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "Microsoft.NETCore.Targets/1.1.0": { + "sha512": "aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg==", + "type": "package", + "path": "microsoft.netcore.targets/1.1.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/netstandard1.0/_._", + "microsoft.netcore.targets.1.1.0.nupkg.sha512", + "microsoft.netcore.targets.nuspec", + "runtime.json" + ] + }, + "Microsoft.Win32.Registry/4.7.0": { + "sha512": "KSrRMb5vNi0CWSGG1++id2ZOs/1QhRqROt+qgbEAdQuGjGrFcl4AOl4/exGPUYz2wUnU42nvJqon1T3U0kPXLA==", + "type": "package", + "path": "microsoft.win32.registry/4.7.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/net46/Microsoft.Win32.Registry.dll", + "lib/net461/Microsoft.Win32.Registry.dll", + "lib/net461/Microsoft.Win32.Registry.xml", + "lib/netstandard1.3/Microsoft.Win32.Registry.dll", + "lib/netstandard2.0/Microsoft.Win32.Registry.dll", + "lib/netstandard2.0/Microsoft.Win32.Registry.xml", + "microsoft.win32.registry.4.7.0.nupkg.sha512", + "microsoft.win32.registry.nuspec", + "ref/net46/Microsoft.Win32.Registry.dll", + "ref/net461/Microsoft.Win32.Registry.dll", + "ref/net461/Microsoft.Win32.Registry.xml", + "ref/net472/Microsoft.Win32.Registry.dll", + "ref/net472/Microsoft.Win32.Registry.xml", + "ref/netstandard1.3/Microsoft.Win32.Registry.dll", + "ref/netstandard1.3/Microsoft.Win32.Registry.xml", + "ref/netstandard1.3/de/Microsoft.Win32.Registry.xml", + "ref/netstandard1.3/es/Microsoft.Win32.Registry.xml", + "ref/netstandard1.3/fr/Microsoft.Win32.Registry.xml", + "ref/netstandard1.3/it/Microsoft.Win32.Registry.xml", + "ref/netstandard1.3/ja/Microsoft.Win32.Registry.xml", + "ref/netstandard1.3/ko/Microsoft.Win32.Registry.xml", + "ref/netstandard1.3/ru/Microsoft.Win32.Registry.xml", + "ref/netstandard1.3/zh-hans/Microsoft.Win32.Registry.xml", + "ref/netstandard1.3/zh-hant/Microsoft.Win32.Registry.xml", + "ref/netstandard2.0/Microsoft.Win32.Registry.dll", + "ref/netstandard2.0/Microsoft.Win32.Registry.xml", + "runtimes/unix/lib/netstandard2.0/Microsoft.Win32.Registry.dll", + "runtimes/unix/lib/netstandard2.0/Microsoft.Win32.Registry.xml", + "runtimes/win/lib/net46/Microsoft.Win32.Registry.dll", + "runtimes/win/lib/net461/Microsoft.Win32.Registry.dll", + "runtimes/win/lib/net461/Microsoft.Win32.Registry.xml", + "runtimes/win/lib/netstandard1.3/Microsoft.Win32.Registry.dll", + "runtimes/win/lib/netstandard2.0/Microsoft.Win32.Registry.dll", + "runtimes/win/lib/netstandard2.0/Microsoft.Win32.Registry.xml", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "System.Buffers/4.5.0": { + "sha512": "pL2ChpaRRWI/p4LXyy4RgeWlYF2sgfj/pnVMvBqwNFr5cXg7CXNnWZWxrOONLg8VGdFB8oB+EG2Qw4MLgTOe+A==", + "type": "package", + "path": "system.buffers/4.5.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/netcoreapp2.0/_._", + "lib/netstandard1.1/System.Buffers.dll", + "lib/netstandard1.1/System.Buffers.xml", + "lib/netstandard2.0/System.Buffers.dll", + "lib/netstandard2.0/System.Buffers.xml", + "lib/uap10.0.16299/_._", + "ref/net45/System.Buffers.dll", + "ref/net45/System.Buffers.xml", + "ref/netcoreapp2.0/_._", + "ref/netstandard1.1/System.Buffers.dll", + "ref/netstandard1.1/System.Buffers.xml", + "ref/netstandard2.0/System.Buffers.dll", + "ref/netstandard2.0/System.Buffers.xml", + "ref/uap10.0.16299/_._", + "system.buffers.4.5.0.nupkg.sha512", + "system.buffers.nuspec", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "System.Collections/4.3.0": { + "sha512": "3Dcj85/TBdVpL5Zr+gEEBUuFe2icOnLalmEh9hfck1PTYbbyWuZgh4fmm2ysCLTrqLQw6t3TgTyJ+VLp+Qb+Lw==", + "type": "package", + "path": "system.collections/4.3.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/portable-net45+win8+wp8+wpa81/_._", + "lib/win8/_._", + "lib/wp80/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/netcore50/System.Collections.dll", + "ref/netcore50/System.Collections.xml", + "ref/netcore50/de/System.Collections.xml", + "ref/netcore50/es/System.Collections.xml", + "ref/netcore50/fr/System.Collections.xml", + "ref/netcore50/it/System.Collections.xml", + "ref/netcore50/ja/System.Collections.xml", + "ref/netcore50/ko/System.Collections.xml", + "ref/netcore50/ru/System.Collections.xml", + "ref/netcore50/zh-hans/System.Collections.xml", + "ref/netcore50/zh-hant/System.Collections.xml", + "ref/netstandard1.0/System.Collections.dll", + "ref/netstandard1.0/System.Collections.xml", + "ref/netstandard1.0/de/System.Collections.xml", + "ref/netstandard1.0/es/System.Collections.xml", + "ref/netstandard1.0/fr/System.Collections.xml", + "ref/netstandard1.0/it/System.Collections.xml", + "ref/netstandard1.0/ja/System.Collections.xml", + "ref/netstandard1.0/ko/System.Collections.xml", + "ref/netstandard1.0/ru/System.Collections.xml", + "ref/netstandard1.0/zh-hans/System.Collections.xml", + "ref/netstandard1.0/zh-hant/System.Collections.xml", + "ref/netstandard1.3/System.Collections.dll", + "ref/netstandard1.3/System.Collections.xml", + "ref/netstandard1.3/de/System.Collections.xml", + "ref/netstandard1.3/es/System.Collections.xml", + "ref/netstandard1.3/fr/System.Collections.xml", + "ref/netstandard1.3/it/System.Collections.xml", + "ref/netstandard1.3/ja/System.Collections.xml", + "ref/netstandard1.3/ko/System.Collections.xml", + "ref/netstandard1.3/ru/System.Collections.xml", + "ref/netstandard1.3/zh-hans/System.Collections.xml", + "ref/netstandard1.3/zh-hant/System.Collections.xml", + "ref/portable-net45+win8+wp8+wpa81/_._", + "ref/win8/_._", + "ref/wp80/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.collections.4.3.0.nupkg.sha512", + "system.collections.nuspec" + ] + }, + "System.Collections.Concurrent/4.3.0": { + "sha512": "ztl69Xp0Y/UXCL+3v3tEU+lIy+bvjKNUmopn1wep/a291pVPK7dxBd6T7WnlQqRog+d1a/hSsgRsmFnIBKTPLQ==", + "type": "package", + "path": "system.collections.concurrent/4.3.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/netcore50/System.Collections.Concurrent.dll", + "lib/netstandard1.3/System.Collections.Concurrent.dll", + "lib/portable-net45+win8+wpa81/_._", + "lib/win8/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/netcore50/System.Collections.Concurrent.dll", + "ref/netcore50/System.Collections.Concurrent.xml", + "ref/netcore50/de/System.Collections.Concurrent.xml", + "ref/netcore50/es/System.Collections.Concurrent.xml", + "ref/netcore50/fr/System.Collections.Concurrent.xml", + "ref/netcore50/it/System.Collections.Concurrent.xml", + "ref/netcore50/ja/System.Collections.Concurrent.xml", + "ref/netcore50/ko/System.Collections.Concurrent.xml", + "ref/netcore50/ru/System.Collections.Concurrent.xml", + "ref/netcore50/zh-hans/System.Collections.Concurrent.xml", + "ref/netcore50/zh-hant/System.Collections.Concurrent.xml", + "ref/netstandard1.1/System.Collections.Concurrent.dll", + "ref/netstandard1.1/System.Collections.Concurrent.xml", + "ref/netstandard1.1/de/System.Collections.Concurrent.xml", + "ref/netstandard1.1/es/System.Collections.Concurrent.xml", + "ref/netstandard1.1/fr/System.Collections.Concurrent.xml", + "ref/netstandard1.1/it/System.Collections.Concurrent.xml", + "ref/netstandard1.1/ja/System.Collections.Concurrent.xml", + "ref/netstandard1.1/ko/System.Collections.Concurrent.xml", + "ref/netstandard1.1/ru/System.Collections.Concurrent.xml", + "ref/netstandard1.1/zh-hans/System.Collections.Concurrent.xml", + "ref/netstandard1.1/zh-hant/System.Collections.Concurrent.xml", + "ref/netstandard1.3/System.Collections.Concurrent.dll", + "ref/netstandard1.3/System.Collections.Concurrent.xml", + "ref/netstandard1.3/de/System.Collections.Concurrent.xml", + "ref/netstandard1.3/es/System.Collections.Concurrent.xml", + "ref/netstandard1.3/fr/System.Collections.Concurrent.xml", + "ref/netstandard1.3/it/System.Collections.Concurrent.xml", + "ref/netstandard1.3/ja/System.Collections.Concurrent.xml", + "ref/netstandard1.3/ko/System.Collections.Concurrent.xml", + "ref/netstandard1.3/ru/System.Collections.Concurrent.xml", + "ref/netstandard1.3/zh-hans/System.Collections.Concurrent.xml", + "ref/netstandard1.3/zh-hant/System.Collections.Concurrent.xml", + "ref/portable-net45+win8+wpa81/_._", + "ref/win8/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.collections.concurrent.4.3.0.nupkg.sha512", + "system.collections.concurrent.nuspec" + ] + }, + "System.Collections.Immutable/1.5.0": { + "sha512": "EXKiDFsChZW0RjrZ4FYHu9aW6+P4MCgEDCklsVseRfhoO0F+dXeMSsMRAlVXIo06kGJ/zv+2w1a2uc2+kxxSaQ==", + "type": "package", + "path": "system.collections.immutable/1.5.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/netstandard1.0/System.Collections.Immutable.dll", + "lib/netstandard1.0/System.Collections.Immutable.xml", + "lib/netstandard1.3/System.Collections.Immutable.dll", + "lib/netstandard1.3/System.Collections.Immutable.xml", + "lib/netstandard2.0/System.Collections.Immutable.dll", + "lib/netstandard2.0/System.Collections.Immutable.xml", + "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll", + "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml", + "system.collections.immutable.1.5.0.nupkg.sha512", + "system.collections.immutable.nuspec", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "System.Diagnostics.Debug/4.3.0": { + "sha512": "ZUhUOdqmaG5Jk3Xdb8xi5kIyQYAA4PnTNlHx1mu9ZY3qv4ELIdKbnL/akbGaKi2RnNUWaZsAs31rvzFdewTj2g==", + "type": "package", + "path": "system.diagnostics.debug/4.3.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/portable-net45+win8+wp8+wpa81/_._", + "lib/win8/_._", + "lib/wp80/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/netcore50/System.Diagnostics.Debug.dll", + "ref/netcore50/System.Diagnostics.Debug.xml", + "ref/netcore50/de/System.Diagnostics.Debug.xml", + "ref/netcore50/es/System.Diagnostics.Debug.xml", + "ref/netcore50/fr/System.Diagnostics.Debug.xml", + "ref/netcore50/it/System.Diagnostics.Debug.xml", + "ref/netcore50/ja/System.Diagnostics.Debug.xml", + "ref/netcore50/ko/System.Diagnostics.Debug.xml", + "ref/netcore50/ru/System.Diagnostics.Debug.xml", + "ref/netcore50/zh-hans/System.Diagnostics.Debug.xml", + "ref/netcore50/zh-hant/System.Diagnostics.Debug.xml", + "ref/netstandard1.0/System.Diagnostics.Debug.dll", + "ref/netstandard1.0/System.Diagnostics.Debug.xml", + "ref/netstandard1.0/de/System.Diagnostics.Debug.xml", + "ref/netstandard1.0/es/System.Diagnostics.Debug.xml", + "ref/netstandard1.0/fr/System.Diagnostics.Debug.xml", + "ref/netstandard1.0/it/System.Diagnostics.Debug.xml", + "ref/netstandard1.0/ja/System.Diagnostics.Debug.xml", + "ref/netstandard1.0/ko/System.Diagnostics.Debug.xml", + "ref/netstandard1.0/ru/System.Diagnostics.Debug.xml", + "ref/netstandard1.0/zh-hans/System.Diagnostics.Debug.xml", + "ref/netstandard1.0/zh-hant/System.Diagnostics.Debug.xml", + "ref/netstandard1.3/System.Diagnostics.Debug.dll", + "ref/netstandard1.3/System.Diagnostics.Debug.xml", + "ref/netstandard1.3/de/System.Diagnostics.Debug.xml", + "ref/netstandard1.3/es/System.Diagnostics.Debug.xml", + "ref/netstandard1.3/fr/System.Diagnostics.Debug.xml", + "ref/netstandard1.3/it/System.Diagnostics.Debug.xml", + "ref/netstandard1.3/ja/System.Diagnostics.Debug.xml", + "ref/netstandard1.3/ko/System.Diagnostics.Debug.xml", + "ref/netstandard1.3/ru/System.Diagnostics.Debug.xml", + "ref/netstandard1.3/zh-hans/System.Diagnostics.Debug.xml", + "ref/netstandard1.3/zh-hant/System.Diagnostics.Debug.xml", + "ref/portable-net45+win8+wp8+wpa81/_._", + "ref/win8/_._", + "ref/wp80/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.diagnostics.debug.4.3.0.nupkg.sha512", + "system.diagnostics.debug.nuspec" + ] + }, + "System.Diagnostics.EventLog/4.7.0": { + "sha512": "iDoKGQcRwX0qwY+eAEkaJGae0d/lHlxtslO+t8pJWAUxlvY3tqLtVOPnW2UU4cFjP0Y/L1QBqhkZfSyGqVMR2w==", + "type": "package", + "path": "system.diagnostics.eventlog/4.7.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/net461/System.Diagnostics.EventLog.dll", + "lib/net461/System.Diagnostics.EventLog.xml", + "lib/netstandard2.0/System.Diagnostics.EventLog.dll", + "lib/netstandard2.0/System.Diagnostics.EventLog.xml", + "ref/net461/System.Diagnostics.EventLog.dll", + "ref/net461/System.Diagnostics.EventLog.xml", + "ref/net472/System.Diagnostics.EventLog.dll", + "ref/net472/System.Diagnostics.EventLog.xml", + "ref/netstandard2.0/System.Diagnostics.EventLog.dll", + "ref/netstandard2.0/System.Diagnostics.EventLog.xml", + "runtimes/win/lib/netcoreapp2.0/System.Diagnostics.EventLog.dll", + "runtimes/win/lib/netcoreapp2.0/System.Diagnostics.EventLog.xml", + "system.diagnostics.eventlog.4.7.0.nupkg.sha512", + "system.diagnostics.eventlog.nuspec", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "System.Diagnostics.Tracing/4.3.0": { + "sha512": "rswfv0f/Cqkh78rA5S8eN8Neocz234+emGCtTF3lxPY96F+mmmUen6tbn0glN6PMvlKQb9bPAY5e9u7fgPTkKw==", + "type": "package", + "path": "system.diagnostics.tracing/4.3.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/net462/System.Diagnostics.Tracing.dll", + "lib/portable-net45+win8+wpa81/_._", + "lib/win8/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/net462/System.Diagnostics.Tracing.dll", + "ref/netcore50/System.Diagnostics.Tracing.dll", + "ref/netcore50/System.Diagnostics.Tracing.xml", + "ref/netcore50/de/System.Diagnostics.Tracing.xml", + "ref/netcore50/es/System.Diagnostics.Tracing.xml", + "ref/netcore50/fr/System.Diagnostics.Tracing.xml", + "ref/netcore50/it/System.Diagnostics.Tracing.xml", + "ref/netcore50/ja/System.Diagnostics.Tracing.xml", + "ref/netcore50/ko/System.Diagnostics.Tracing.xml", + "ref/netcore50/ru/System.Diagnostics.Tracing.xml", + "ref/netcore50/zh-hans/System.Diagnostics.Tracing.xml", + "ref/netcore50/zh-hant/System.Diagnostics.Tracing.xml", + "ref/netstandard1.1/System.Diagnostics.Tracing.dll", + "ref/netstandard1.1/System.Diagnostics.Tracing.xml", + "ref/netstandard1.1/de/System.Diagnostics.Tracing.xml", + "ref/netstandard1.1/es/System.Diagnostics.Tracing.xml", + "ref/netstandard1.1/fr/System.Diagnostics.Tracing.xml", + "ref/netstandard1.1/it/System.Diagnostics.Tracing.xml", + "ref/netstandard1.1/ja/System.Diagnostics.Tracing.xml", + "ref/netstandard1.1/ko/System.Diagnostics.Tracing.xml", + "ref/netstandard1.1/ru/System.Diagnostics.Tracing.xml", + "ref/netstandard1.1/zh-hans/System.Diagnostics.Tracing.xml", + "ref/netstandard1.1/zh-hant/System.Diagnostics.Tracing.xml", + "ref/netstandard1.2/System.Diagnostics.Tracing.dll", + "ref/netstandard1.2/System.Diagnostics.Tracing.xml", + "ref/netstandard1.2/de/System.Diagnostics.Tracing.xml", + "ref/netstandard1.2/es/System.Diagnostics.Tracing.xml", + "ref/netstandard1.2/fr/System.Diagnostics.Tracing.xml", + "ref/netstandard1.2/it/System.Diagnostics.Tracing.xml", + "ref/netstandard1.2/ja/System.Diagnostics.Tracing.xml", + "ref/netstandard1.2/ko/System.Diagnostics.Tracing.xml", + "ref/netstandard1.2/ru/System.Diagnostics.Tracing.xml", + "ref/netstandard1.2/zh-hans/System.Diagnostics.Tracing.xml", + "ref/netstandard1.2/zh-hant/System.Diagnostics.Tracing.xml", + "ref/netstandard1.3/System.Diagnostics.Tracing.dll", + "ref/netstandard1.3/System.Diagnostics.Tracing.xml", + "ref/netstandard1.3/de/System.Diagnostics.Tracing.xml", + "ref/netstandard1.3/es/System.Diagnostics.Tracing.xml", + "ref/netstandard1.3/fr/System.Diagnostics.Tracing.xml", + "ref/netstandard1.3/it/System.Diagnostics.Tracing.xml", + "ref/netstandard1.3/ja/System.Diagnostics.Tracing.xml", + "ref/netstandard1.3/ko/System.Diagnostics.Tracing.xml", + "ref/netstandard1.3/ru/System.Diagnostics.Tracing.xml", + "ref/netstandard1.3/zh-hans/System.Diagnostics.Tracing.xml", + "ref/netstandard1.3/zh-hant/System.Diagnostics.Tracing.xml", + "ref/netstandard1.5/System.Diagnostics.Tracing.dll", + "ref/netstandard1.5/System.Diagnostics.Tracing.xml", + "ref/netstandard1.5/de/System.Diagnostics.Tracing.xml", + "ref/netstandard1.5/es/System.Diagnostics.Tracing.xml", + "ref/netstandard1.5/fr/System.Diagnostics.Tracing.xml", + "ref/netstandard1.5/it/System.Diagnostics.Tracing.xml", + "ref/netstandard1.5/ja/System.Diagnostics.Tracing.xml", + "ref/netstandard1.5/ko/System.Diagnostics.Tracing.xml", + "ref/netstandard1.5/ru/System.Diagnostics.Tracing.xml", + "ref/netstandard1.5/zh-hans/System.Diagnostics.Tracing.xml", + "ref/netstandard1.5/zh-hant/System.Diagnostics.Tracing.xml", + "ref/portable-net45+win8+wpa81/_._", + "ref/win8/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.diagnostics.tracing.4.3.0.nupkg.sha512", + "system.diagnostics.tracing.nuspec" + ] + }, + "System.Globalization/4.3.0": { + "sha512": "kYdVd2f2PAdFGblzFswE4hkNANJBKRmsfa2X5LG2AcWE1c7/4t0pYae1L8vfZ5xvE2nK/R9JprtToA61OSHWIg==", + "type": "package", + "path": "system.globalization/4.3.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/portable-net45+win8+wp8+wpa81/_._", + "lib/win8/_._", + "lib/wp80/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/netcore50/System.Globalization.dll", + "ref/netcore50/System.Globalization.xml", + "ref/netcore50/de/System.Globalization.xml", + "ref/netcore50/es/System.Globalization.xml", + "ref/netcore50/fr/System.Globalization.xml", + "ref/netcore50/it/System.Globalization.xml", + "ref/netcore50/ja/System.Globalization.xml", + "ref/netcore50/ko/System.Globalization.xml", + "ref/netcore50/ru/System.Globalization.xml", + "ref/netcore50/zh-hans/System.Globalization.xml", + "ref/netcore50/zh-hant/System.Globalization.xml", + "ref/netstandard1.0/System.Globalization.dll", + "ref/netstandard1.0/System.Globalization.xml", + "ref/netstandard1.0/de/System.Globalization.xml", + "ref/netstandard1.0/es/System.Globalization.xml", + "ref/netstandard1.0/fr/System.Globalization.xml", + "ref/netstandard1.0/it/System.Globalization.xml", + "ref/netstandard1.0/ja/System.Globalization.xml", + "ref/netstandard1.0/ko/System.Globalization.xml", + "ref/netstandard1.0/ru/System.Globalization.xml", + "ref/netstandard1.0/zh-hans/System.Globalization.xml", + "ref/netstandard1.0/zh-hant/System.Globalization.xml", + "ref/netstandard1.3/System.Globalization.dll", + "ref/netstandard1.3/System.Globalization.xml", + "ref/netstandard1.3/de/System.Globalization.xml", + "ref/netstandard1.3/es/System.Globalization.xml", + "ref/netstandard1.3/fr/System.Globalization.xml", + "ref/netstandard1.3/it/System.Globalization.xml", + "ref/netstandard1.3/ja/System.Globalization.xml", + "ref/netstandard1.3/ko/System.Globalization.xml", + "ref/netstandard1.3/ru/System.Globalization.xml", + "ref/netstandard1.3/zh-hans/System.Globalization.xml", + "ref/netstandard1.3/zh-hant/System.Globalization.xml", + "ref/portable-net45+win8+wp8+wpa81/_._", + "ref/win8/_._", + "ref/wp80/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.globalization.4.3.0.nupkg.sha512", + "system.globalization.nuspec" + ] + }, + "System.IO/4.3.0": { + "sha512": "3qjaHvxQPDpSOYICjUoTsmoq5u6QJAFRUITgeT/4gqkF1bajbSmb1kwSxEA8AHlofqgcKJcM8udgieRNhaJ5Cg==", + "type": "package", + "path": "system.io/4.3.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/net462/System.IO.dll", + "lib/portable-net45+win8+wp8+wpa81/_._", + "lib/win8/_._", + "lib/wp80/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/net462/System.IO.dll", + "ref/netcore50/System.IO.dll", + "ref/netcore50/System.IO.xml", + "ref/netcore50/de/System.IO.xml", + "ref/netcore50/es/System.IO.xml", + "ref/netcore50/fr/System.IO.xml", + "ref/netcore50/it/System.IO.xml", + "ref/netcore50/ja/System.IO.xml", + "ref/netcore50/ko/System.IO.xml", + "ref/netcore50/ru/System.IO.xml", + "ref/netcore50/zh-hans/System.IO.xml", + "ref/netcore50/zh-hant/System.IO.xml", + "ref/netstandard1.0/System.IO.dll", + "ref/netstandard1.0/System.IO.xml", + "ref/netstandard1.0/de/System.IO.xml", + "ref/netstandard1.0/es/System.IO.xml", + "ref/netstandard1.0/fr/System.IO.xml", + "ref/netstandard1.0/it/System.IO.xml", + "ref/netstandard1.0/ja/System.IO.xml", + "ref/netstandard1.0/ko/System.IO.xml", + "ref/netstandard1.0/ru/System.IO.xml", + "ref/netstandard1.0/zh-hans/System.IO.xml", + "ref/netstandard1.0/zh-hant/System.IO.xml", + "ref/netstandard1.3/System.IO.dll", + "ref/netstandard1.3/System.IO.xml", + "ref/netstandard1.3/de/System.IO.xml", + "ref/netstandard1.3/es/System.IO.xml", + "ref/netstandard1.3/fr/System.IO.xml", + "ref/netstandard1.3/it/System.IO.xml", + "ref/netstandard1.3/ja/System.IO.xml", + "ref/netstandard1.3/ko/System.IO.xml", + "ref/netstandard1.3/ru/System.IO.xml", + "ref/netstandard1.3/zh-hans/System.IO.xml", + "ref/netstandard1.3/zh-hant/System.IO.xml", + "ref/netstandard1.5/System.IO.dll", + "ref/netstandard1.5/System.IO.xml", + "ref/netstandard1.5/de/System.IO.xml", + "ref/netstandard1.5/es/System.IO.xml", + "ref/netstandard1.5/fr/System.IO.xml", + "ref/netstandard1.5/it/System.IO.xml", + "ref/netstandard1.5/ja/System.IO.xml", + "ref/netstandard1.5/ko/System.IO.xml", + "ref/netstandard1.5/ru/System.IO.xml", + "ref/netstandard1.5/zh-hans/System.IO.xml", + "ref/netstandard1.5/zh-hant/System.IO.xml", + "ref/portable-net45+win8+wp8+wpa81/_._", + "ref/win8/_._", + "ref/wp80/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.io.4.3.0.nupkg.sha512", + "system.io.nuspec" + ] + }, + "System.Memory/4.5.3": { + "sha512": "3oDzvc/zzetpTKWMShs1AADwZjQ/36HnsufHRPcOjyRAAMLDlu2iD33MBI2opxnezcVUtXyqDXXjoFMOU9c7SA==", + "type": "package", + "path": "system.memory/4.5.3", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/netcoreapp2.1/_._", + "lib/netstandard1.1/System.Memory.dll", + "lib/netstandard1.1/System.Memory.xml", + "lib/netstandard2.0/System.Memory.dll", + "lib/netstandard2.0/System.Memory.xml", + "ref/netcoreapp2.1/_._", + "system.memory.4.5.3.nupkg.sha512", + "system.memory.nuspec", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "System.Reflection/4.3.0": { + "sha512": "KMiAFoW7MfJGa9nDFNcfu+FpEdiHpWgTcS2HdMpDvt9saK3y/G4GwprPyzqjFH9NTaGPQeWNHU+iDlDILj96aQ==", + "type": "package", + "path": "system.reflection/4.3.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/net462/System.Reflection.dll", + "lib/portable-net45+win8+wp8+wpa81/_._", + "lib/win8/_._", + "lib/wp80/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/net462/System.Reflection.dll", + "ref/netcore50/System.Reflection.dll", + "ref/netcore50/System.Reflection.xml", + "ref/netcore50/de/System.Reflection.xml", + "ref/netcore50/es/System.Reflection.xml", + "ref/netcore50/fr/System.Reflection.xml", + "ref/netcore50/it/System.Reflection.xml", + "ref/netcore50/ja/System.Reflection.xml", + "ref/netcore50/ko/System.Reflection.xml", + "ref/netcore50/ru/System.Reflection.xml", + "ref/netcore50/zh-hans/System.Reflection.xml", + "ref/netcore50/zh-hant/System.Reflection.xml", + "ref/netstandard1.0/System.Reflection.dll", + "ref/netstandard1.0/System.Reflection.xml", + "ref/netstandard1.0/de/System.Reflection.xml", + "ref/netstandard1.0/es/System.Reflection.xml", + "ref/netstandard1.0/fr/System.Reflection.xml", + "ref/netstandard1.0/it/System.Reflection.xml", + "ref/netstandard1.0/ja/System.Reflection.xml", + "ref/netstandard1.0/ko/System.Reflection.xml", + "ref/netstandard1.0/ru/System.Reflection.xml", + "ref/netstandard1.0/zh-hans/System.Reflection.xml", + "ref/netstandard1.0/zh-hant/System.Reflection.xml", + "ref/netstandard1.3/System.Reflection.dll", + "ref/netstandard1.3/System.Reflection.xml", + "ref/netstandard1.3/de/System.Reflection.xml", + "ref/netstandard1.3/es/System.Reflection.xml", + "ref/netstandard1.3/fr/System.Reflection.xml", + "ref/netstandard1.3/it/System.Reflection.xml", + "ref/netstandard1.3/ja/System.Reflection.xml", + "ref/netstandard1.3/ko/System.Reflection.xml", + "ref/netstandard1.3/ru/System.Reflection.xml", + "ref/netstandard1.3/zh-hans/System.Reflection.xml", + "ref/netstandard1.3/zh-hant/System.Reflection.xml", + "ref/netstandard1.5/System.Reflection.dll", + "ref/netstandard1.5/System.Reflection.xml", + "ref/netstandard1.5/de/System.Reflection.xml", + "ref/netstandard1.5/es/System.Reflection.xml", + "ref/netstandard1.5/fr/System.Reflection.xml", + "ref/netstandard1.5/it/System.Reflection.xml", + "ref/netstandard1.5/ja/System.Reflection.xml", + "ref/netstandard1.5/ko/System.Reflection.xml", + "ref/netstandard1.5/ru/System.Reflection.xml", + "ref/netstandard1.5/zh-hans/System.Reflection.xml", + "ref/netstandard1.5/zh-hant/System.Reflection.xml", + "ref/portable-net45+win8+wp8+wpa81/_._", + "ref/win8/_._", + "ref/wp80/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.reflection.4.3.0.nupkg.sha512", + "system.reflection.nuspec" + ] + }, + "System.Reflection.Emit/4.6.0": { + "sha512": "qAo4jyXtC9i71iElngX7P2r+zLaiHzxKwf66sc3X91tL5Ks6fnQ1vxL04o7ZSm3sYfLExySL7GN8aTpNYpU1qw==", + "type": "package", + "path": "system.reflection.emit/4.6.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/monoandroid10/_._", + "lib/net45/_._", + "lib/netcore50/System.Reflection.Emit.dll", + "lib/netcoreapp2.0/_._", + "lib/netstandard1.1/System.Reflection.Emit.dll", + "lib/netstandard1.1/System.Reflection.Emit.xml", + "lib/netstandard1.3/System.Reflection.Emit.dll", + "lib/netstandard2.0/System.Reflection.Emit.dll", + "lib/netstandard2.0/System.Reflection.Emit.xml", + "lib/netstandard2.1/_._", + "lib/xamarinmac20/_._", + "ref/monoandroid10/_._", + "ref/net45/_._", + "ref/netcoreapp2.0/_._", + "ref/netstandard1.1/System.Reflection.Emit.dll", + "ref/netstandard1.1/System.Reflection.Emit.xml", + "ref/netstandard1.1/de/System.Reflection.Emit.xml", + "ref/netstandard1.1/es/System.Reflection.Emit.xml", + "ref/netstandard1.1/fr/System.Reflection.Emit.xml", + "ref/netstandard1.1/it/System.Reflection.Emit.xml", + "ref/netstandard1.1/ja/System.Reflection.Emit.xml", + "ref/netstandard1.1/ko/System.Reflection.Emit.xml", + "ref/netstandard1.1/ru/System.Reflection.Emit.xml", + "ref/netstandard1.1/zh-hans/System.Reflection.Emit.xml", + "ref/netstandard1.1/zh-hant/System.Reflection.Emit.xml", + "ref/netstandard2.0/System.Reflection.Emit.dll", + "ref/netstandard2.0/System.Reflection.Emit.xml", + "ref/netstandard2.1/_._", + "ref/xamarinmac20/_._", + "runtimes/aot/lib/netcore50/System.Reflection.Emit.dll", + "runtimes/aot/lib/netcore50/System.Reflection.Emit.xml", + "system.reflection.emit.4.6.0.nupkg.sha512", + "system.reflection.emit.nuspec", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "System.Reflection.Emit.Lightweight/4.6.0": { + "sha512": "j/V5HVvxvBQ7uubYD0PptQW2KGsi1Pc2kZ9yfwLixv3ADdjL/4M78KyC5e+ymW612DY8ZE4PFoZmWpoNmN2mqg==", + "type": "package", + "path": "system.reflection.emit.lightweight/4.6.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/netcore50/System.Reflection.Emit.Lightweight.dll", + "lib/netcoreapp2.0/_._", + "lib/netstandard1.0/System.Reflection.Emit.Lightweight.dll", + "lib/netstandard1.0/System.Reflection.Emit.Lightweight.xml", + "lib/netstandard1.3/System.Reflection.Emit.Lightweight.dll", + "lib/netstandard2.0/System.Reflection.Emit.Lightweight.dll", + "lib/netstandard2.0/System.Reflection.Emit.Lightweight.xml", + "lib/netstandard2.1/_._", + "lib/portable-net45+wp8/_._", + "lib/wp80/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/netcoreapp2.0/_._", + "ref/netstandard1.0/System.Reflection.Emit.Lightweight.dll", + "ref/netstandard1.0/System.Reflection.Emit.Lightweight.xml", + "ref/netstandard1.0/de/System.Reflection.Emit.Lightweight.xml", + "ref/netstandard1.0/es/System.Reflection.Emit.Lightweight.xml", + "ref/netstandard1.0/fr/System.Reflection.Emit.Lightweight.xml", + "ref/netstandard1.0/it/System.Reflection.Emit.Lightweight.xml", + "ref/netstandard1.0/ja/System.Reflection.Emit.Lightweight.xml", + "ref/netstandard1.0/ko/System.Reflection.Emit.Lightweight.xml", + "ref/netstandard1.0/ru/System.Reflection.Emit.Lightweight.xml", + "ref/netstandard1.0/zh-hans/System.Reflection.Emit.Lightweight.xml", + "ref/netstandard1.0/zh-hant/System.Reflection.Emit.Lightweight.xml", + "ref/netstandard2.0/System.Reflection.Emit.Lightweight.dll", + "ref/netstandard2.0/System.Reflection.Emit.Lightweight.xml", + "ref/netstandard2.1/_._", + "ref/portable-net45+wp8/_._", + "ref/wp80/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "runtimes/aot/lib/netcore50/System.Reflection.Emit.Lightweight.dll", + "runtimes/aot/lib/netcore50/System.Reflection.Emit.Lightweight.xml", + "system.reflection.emit.lightweight.4.6.0.nupkg.sha512", + "system.reflection.emit.lightweight.nuspec", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "System.Reflection.Primitives/4.3.0": { + "sha512": "5RXItQz5As4xN2/YUDxdpsEkMhvw3e6aNveFXUn4Hl/udNTCNhnKp8lT9fnc3MhvGKh1baak5CovpuQUXHAlIA==", + "type": "package", + "path": "system.reflection.primitives/4.3.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/portable-net45+win8+wp8+wpa81/_._", + "lib/win8/_._", + "lib/wp80/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/netcore50/System.Reflection.Primitives.dll", + "ref/netcore50/System.Reflection.Primitives.xml", + "ref/netcore50/de/System.Reflection.Primitives.xml", + "ref/netcore50/es/System.Reflection.Primitives.xml", + "ref/netcore50/fr/System.Reflection.Primitives.xml", + "ref/netcore50/it/System.Reflection.Primitives.xml", + "ref/netcore50/ja/System.Reflection.Primitives.xml", + "ref/netcore50/ko/System.Reflection.Primitives.xml", + "ref/netcore50/ru/System.Reflection.Primitives.xml", + "ref/netcore50/zh-hans/System.Reflection.Primitives.xml", + "ref/netcore50/zh-hant/System.Reflection.Primitives.xml", + "ref/netstandard1.0/System.Reflection.Primitives.dll", + "ref/netstandard1.0/System.Reflection.Primitives.xml", + "ref/netstandard1.0/de/System.Reflection.Primitives.xml", + "ref/netstandard1.0/es/System.Reflection.Primitives.xml", + "ref/netstandard1.0/fr/System.Reflection.Primitives.xml", + "ref/netstandard1.0/it/System.Reflection.Primitives.xml", + "ref/netstandard1.0/ja/System.Reflection.Primitives.xml", + "ref/netstandard1.0/ko/System.Reflection.Primitives.xml", + "ref/netstandard1.0/ru/System.Reflection.Primitives.xml", + "ref/netstandard1.0/zh-hans/System.Reflection.Primitives.xml", + "ref/netstandard1.0/zh-hant/System.Reflection.Primitives.xml", + "ref/portable-net45+win8+wp8+wpa81/_._", + "ref/win8/_._", + "ref/wp80/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.reflection.primitives.4.3.0.nupkg.sha512", + "system.reflection.primitives.nuspec" + ] + }, + "System.Resources.ResourceManager/4.3.0": { + "sha512": "/zrcPkkWdZmI4F92gL/TPumP98AVDu/Wxr3CSJGQQ+XN6wbRZcyfSKVoPo17ilb3iOr0cCRqJInGwNMolqhS8A==", + "type": "package", + "path": "system.resources.resourcemanager/4.3.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/portable-net45+win8+wp8+wpa81/_._", + "lib/win8/_._", + "lib/wp80/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/netcore50/System.Resources.ResourceManager.dll", + "ref/netcore50/System.Resources.ResourceManager.xml", + "ref/netcore50/de/System.Resources.ResourceManager.xml", + "ref/netcore50/es/System.Resources.ResourceManager.xml", + "ref/netcore50/fr/System.Resources.ResourceManager.xml", + "ref/netcore50/it/System.Resources.ResourceManager.xml", + "ref/netcore50/ja/System.Resources.ResourceManager.xml", + "ref/netcore50/ko/System.Resources.ResourceManager.xml", + "ref/netcore50/ru/System.Resources.ResourceManager.xml", + "ref/netcore50/zh-hans/System.Resources.ResourceManager.xml", + "ref/netcore50/zh-hant/System.Resources.ResourceManager.xml", + "ref/netstandard1.0/System.Resources.ResourceManager.dll", + "ref/netstandard1.0/System.Resources.ResourceManager.xml", + "ref/netstandard1.0/de/System.Resources.ResourceManager.xml", + "ref/netstandard1.0/es/System.Resources.ResourceManager.xml", + "ref/netstandard1.0/fr/System.Resources.ResourceManager.xml", + "ref/netstandard1.0/it/System.Resources.ResourceManager.xml", + "ref/netstandard1.0/ja/System.Resources.ResourceManager.xml", + "ref/netstandard1.0/ko/System.Resources.ResourceManager.xml", + "ref/netstandard1.0/ru/System.Resources.ResourceManager.xml", + "ref/netstandard1.0/zh-hans/System.Resources.ResourceManager.xml", + "ref/netstandard1.0/zh-hant/System.Resources.ResourceManager.xml", + "ref/portable-net45+win8+wp8+wpa81/_._", + "ref/win8/_._", + "ref/wp80/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.resources.resourcemanager.4.3.0.nupkg.sha512", + "system.resources.resourcemanager.nuspec" + ] + }, + "System.Runtime/4.3.0": { + "sha512": "JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==", + "type": "package", + "path": "system.runtime/4.3.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/net462/System.Runtime.dll", + "lib/portable-net45+win8+wp80+wpa81/_._", + "lib/win8/_._", + "lib/wp80/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/net462/System.Runtime.dll", + "ref/netcore50/System.Runtime.dll", + "ref/netcore50/System.Runtime.xml", + "ref/netcore50/de/System.Runtime.xml", + "ref/netcore50/es/System.Runtime.xml", + "ref/netcore50/fr/System.Runtime.xml", + "ref/netcore50/it/System.Runtime.xml", + "ref/netcore50/ja/System.Runtime.xml", + "ref/netcore50/ko/System.Runtime.xml", + "ref/netcore50/ru/System.Runtime.xml", + "ref/netcore50/zh-hans/System.Runtime.xml", + "ref/netcore50/zh-hant/System.Runtime.xml", + "ref/netstandard1.0/System.Runtime.dll", + "ref/netstandard1.0/System.Runtime.xml", + "ref/netstandard1.0/de/System.Runtime.xml", + "ref/netstandard1.0/es/System.Runtime.xml", + "ref/netstandard1.0/fr/System.Runtime.xml", + "ref/netstandard1.0/it/System.Runtime.xml", + "ref/netstandard1.0/ja/System.Runtime.xml", + "ref/netstandard1.0/ko/System.Runtime.xml", + "ref/netstandard1.0/ru/System.Runtime.xml", + "ref/netstandard1.0/zh-hans/System.Runtime.xml", + "ref/netstandard1.0/zh-hant/System.Runtime.xml", + "ref/netstandard1.2/System.Runtime.dll", + "ref/netstandard1.2/System.Runtime.xml", + "ref/netstandard1.2/de/System.Runtime.xml", + "ref/netstandard1.2/es/System.Runtime.xml", + "ref/netstandard1.2/fr/System.Runtime.xml", + "ref/netstandard1.2/it/System.Runtime.xml", + "ref/netstandard1.2/ja/System.Runtime.xml", + "ref/netstandard1.2/ko/System.Runtime.xml", + "ref/netstandard1.2/ru/System.Runtime.xml", + "ref/netstandard1.2/zh-hans/System.Runtime.xml", + "ref/netstandard1.2/zh-hant/System.Runtime.xml", + "ref/netstandard1.3/System.Runtime.dll", + "ref/netstandard1.3/System.Runtime.xml", + "ref/netstandard1.3/de/System.Runtime.xml", + "ref/netstandard1.3/es/System.Runtime.xml", + "ref/netstandard1.3/fr/System.Runtime.xml", + "ref/netstandard1.3/it/System.Runtime.xml", + "ref/netstandard1.3/ja/System.Runtime.xml", + "ref/netstandard1.3/ko/System.Runtime.xml", + "ref/netstandard1.3/ru/System.Runtime.xml", + "ref/netstandard1.3/zh-hans/System.Runtime.xml", + "ref/netstandard1.3/zh-hant/System.Runtime.xml", + "ref/netstandard1.5/System.Runtime.dll", + "ref/netstandard1.5/System.Runtime.xml", + "ref/netstandard1.5/de/System.Runtime.xml", + "ref/netstandard1.5/es/System.Runtime.xml", + "ref/netstandard1.5/fr/System.Runtime.xml", + "ref/netstandard1.5/it/System.Runtime.xml", + "ref/netstandard1.5/ja/System.Runtime.xml", + "ref/netstandard1.5/ko/System.Runtime.xml", + "ref/netstandard1.5/ru/System.Runtime.xml", + "ref/netstandard1.5/zh-hans/System.Runtime.xml", + "ref/netstandard1.5/zh-hant/System.Runtime.xml", + "ref/portable-net45+win8+wp80+wpa81/_._", + "ref/win8/_._", + "ref/wp80/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.runtime.4.3.0.nupkg.sha512", + "system.runtime.nuspec" + ] + }, + "System.Runtime.CompilerServices.Unsafe/4.5.2": { + "sha512": "wprSFgext8cwqymChhrBLu62LMg/1u92bU+VOwyfBimSPVFXtsNqEWC92Pf9ofzJFlk4IHmJA75EDJn1b2goAQ==", + "type": "package", + "path": "system.runtime.compilerservices.unsafe/4.5.2", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/netcoreapp2.0/System.Runtime.CompilerServices.Unsafe.dll", + "lib/netcoreapp2.0/System.Runtime.CompilerServices.Unsafe.xml", + "lib/netstandard1.0/System.Runtime.CompilerServices.Unsafe.dll", + "lib/netstandard1.0/System.Runtime.CompilerServices.Unsafe.xml", + "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll", + "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.xml", + "ref/netstandard1.0/System.Runtime.CompilerServices.Unsafe.dll", + "ref/netstandard1.0/System.Runtime.CompilerServices.Unsafe.xml", + "ref/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll", + "ref/netstandard2.0/System.Runtime.CompilerServices.Unsafe.xml", + "system.runtime.compilerservices.unsafe.4.5.2.nupkg.sha512", + "system.runtime.compilerservices.unsafe.nuspec", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "System.Runtime.Extensions/4.3.0": { + "sha512": "guW0uK0fn5fcJJ1tJVXYd7/1h5F+pea1r7FLSOz/f8vPEqbR2ZAknuRDvTQ8PzAilDveOxNjSfr0CHfIQfFk8g==", + "type": "package", + "path": "system.runtime.extensions/4.3.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/net462/System.Runtime.Extensions.dll", + "lib/portable-net45+win8+wp8+wpa81/_._", + "lib/win8/_._", + "lib/wp80/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/net462/System.Runtime.Extensions.dll", + "ref/netcore50/System.Runtime.Extensions.dll", + "ref/netcore50/System.Runtime.Extensions.xml", + "ref/netcore50/de/System.Runtime.Extensions.xml", + "ref/netcore50/es/System.Runtime.Extensions.xml", + "ref/netcore50/fr/System.Runtime.Extensions.xml", + "ref/netcore50/it/System.Runtime.Extensions.xml", + "ref/netcore50/ja/System.Runtime.Extensions.xml", + "ref/netcore50/ko/System.Runtime.Extensions.xml", + "ref/netcore50/ru/System.Runtime.Extensions.xml", + "ref/netcore50/zh-hans/System.Runtime.Extensions.xml", + "ref/netcore50/zh-hant/System.Runtime.Extensions.xml", + "ref/netstandard1.0/System.Runtime.Extensions.dll", + "ref/netstandard1.0/System.Runtime.Extensions.xml", + "ref/netstandard1.0/de/System.Runtime.Extensions.xml", + "ref/netstandard1.0/es/System.Runtime.Extensions.xml", + "ref/netstandard1.0/fr/System.Runtime.Extensions.xml", + "ref/netstandard1.0/it/System.Runtime.Extensions.xml", + "ref/netstandard1.0/ja/System.Runtime.Extensions.xml", + "ref/netstandard1.0/ko/System.Runtime.Extensions.xml", + "ref/netstandard1.0/ru/System.Runtime.Extensions.xml", + "ref/netstandard1.0/zh-hans/System.Runtime.Extensions.xml", + "ref/netstandard1.0/zh-hant/System.Runtime.Extensions.xml", + "ref/netstandard1.3/System.Runtime.Extensions.dll", + "ref/netstandard1.3/System.Runtime.Extensions.xml", + "ref/netstandard1.3/de/System.Runtime.Extensions.xml", + "ref/netstandard1.3/es/System.Runtime.Extensions.xml", + "ref/netstandard1.3/fr/System.Runtime.Extensions.xml", + "ref/netstandard1.3/it/System.Runtime.Extensions.xml", + "ref/netstandard1.3/ja/System.Runtime.Extensions.xml", + "ref/netstandard1.3/ko/System.Runtime.Extensions.xml", + "ref/netstandard1.3/ru/System.Runtime.Extensions.xml", + "ref/netstandard1.3/zh-hans/System.Runtime.Extensions.xml", + "ref/netstandard1.3/zh-hant/System.Runtime.Extensions.xml", + "ref/netstandard1.5/System.Runtime.Extensions.dll", + "ref/netstandard1.5/System.Runtime.Extensions.xml", + "ref/netstandard1.5/de/System.Runtime.Extensions.xml", + "ref/netstandard1.5/es/System.Runtime.Extensions.xml", + "ref/netstandard1.5/fr/System.Runtime.Extensions.xml", + "ref/netstandard1.5/it/System.Runtime.Extensions.xml", + "ref/netstandard1.5/ja/System.Runtime.Extensions.xml", + "ref/netstandard1.5/ko/System.Runtime.Extensions.xml", + "ref/netstandard1.5/ru/System.Runtime.Extensions.xml", + "ref/netstandard1.5/zh-hans/System.Runtime.Extensions.xml", + "ref/netstandard1.5/zh-hant/System.Runtime.Extensions.xml", + "ref/portable-net45+win8+wp8+wpa81/_._", + "ref/win8/_._", + "ref/wp80/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.runtime.extensions.4.3.0.nupkg.sha512", + "system.runtime.extensions.nuspec" + ] + }, + "System.Security.AccessControl/4.7.0": { + "sha512": "JECvTt5aFF3WT3gHpfofL2MNNP6v84sxtXxpqhLBCcDRzqsPBmHhQ6shv4DwwN2tRlzsUxtb3G9M3763rbXKDg==", + "type": "package", + "path": "system.security.accesscontrol/4.7.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/net46/System.Security.AccessControl.dll", + "lib/net461/System.Security.AccessControl.dll", + "lib/net461/System.Security.AccessControl.xml", + "lib/netstandard1.3/System.Security.AccessControl.dll", + "lib/netstandard2.0/System.Security.AccessControl.dll", + "lib/netstandard2.0/System.Security.AccessControl.xml", + "lib/uap10.0.16299/_._", + "ref/net46/System.Security.AccessControl.dll", + "ref/net461/System.Security.AccessControl.dll", + "ref/net461/System.Security.AccessControl.xml", + "ref/netstandard1.3/System.Security.AccessControl.dll", + "ref/netstandard1.3/System.Security.AccessControl.xml", + "ref/netstandard1.3/de/System.Security.AccessControl.xml", + "ref/netstandard1.3/es/System.Security.AccessControl.xml", + "ref/netstandard1.3/fr/System.Security.AccessControl.xml", + "ref/netstandard1.3/it/System.Security.AccessControl.xml", + "ref/netstandard1.3/ja/System.Security.AccessControl.xml", + "ref/netstandard1.3/ko/System.Security.AccessControl.xml", + "ref/netstandard1.3/ru/System.Security.AccessControl.xml", + "ref/netstandard1.3/zh-hans/System.Security.AccessControl.xml", + "ref/netstandard1.3/zh-hant/System.Security.AccessControl.xml", + "ref/netstandard2.0/System.Security.AccessControl.dll", + "ref/netstandard2.0/System.Security.AccessControl.xml", + "ref/uap10.0.16299/_._", + "runtimes/win/lib/net46/System.Security.AccessControl.dll", + "runtimes/win/lib/net461/System.Security.AccessControl.dll", + "runtimes/win/lib/net461/System.Security.AccessControl.xml", + "runtimes/win/lib/netcoreapp2.0/System.Security.AccessControl.dll", + "runtimes/win/lib/netcoreapp2.0/System.Security.AccessControl.xml", + "runtimes/win/lib/netstandard1.3/System.Security.AccessControl.dll", + "runtimes/win/lib/uap10.0.16299/_._", + "system.security.accesscontrol.4.7.0.nupkg.sha512", + "system.security.accesscontrol.nuspec", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "System.Security.Principal.Windows/4.7.0": { + "sha512": "ojD0PX0XhneCsUbAZVKdb7h/70vyYMDYs85lwEI+LngEONe/17A0cFaRFqZU+sOEidcVswYWikYOQ9PPfjlbtQ==", + "type": "package", + "path": "system.security.principal.windows/4.7.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/net46/System.Security.Principal.Windows.dll", + "lib/net461/System.Security.Principal.Windows.dll", + "lib/net461/System.Security.Principal.Windows.xml", + "lib/netstandard1.3/System.Security.Principal.Windows.dll", + "lib/netstandard2.0/System.Security.Principal.Windows.dll", + "lib/netstandard2.0/System.Security.Principal.Windows.xml", + "lib/uap10.0.16299/_._", + "ref/net46/System.Security.Principal.Windows.dll", + "ref/net461/System.Security.Principal.Windows.dll", + "ref/net461/System.Security.Principal.Windows.xml", + "ref/netcoreapp3.0/System.Security.Principal.Windows.dll", + "ref/netcoreapp3.0/System.Security.Principal.Windows.xml", + "ref/netstandard1.3/System.Security.Principal.Windows.dll", + "ref/netstandard1.3/System.Security.Principal.Windows.xml", + "ref/netstandard1.3/de/System.Security.Principal.Windows.xml", + "ref/netstandard1.3/es/System.Security.Principal.Windows.xml", + "ref/netstandard1.3/fr/System.Security.Principal.Windows.xml", + "ref/netstandard1.3/it/System.Security.Principal.Windows.xml", + "ref/netstandard1.3/ja/System.Security.Principal.Windows.xml", + "ref/netstandard1.3/ko/System.Security.Principal.Windows.xml", + "ref/netstandard1.3/ru/System.Security.Principal.Windows.xml", + "ref/netstandard1.3/zh-hans/System.Security.Principal.Windows.xml", + "ref/netstandard1.3/zh-hant/System.Security.Principal.Windows.xml", + "ref/netstandard2.0/System.Security.Principal.Windows.dll", + "ref/netstandard2.0/System.Security.Principal.Windows.xml", + "ref/uap10.0.16299/_._", + "runtimes/unix/lib/netcoreapp2.0/System.Security.Principal.Windows.dll", + "runtimes/unix/lib/netcoreapp2.0/System.Security.Principal.Windows.xml", + "runtimes/unix/lib/netcoreapp2.1/System.Security.Principal.Windows.dll", + "runtimes/unix/lib/netcoreapp2.1/System.Security.Principal.Windows.xml", + "runtimes/win/lib/net46/System.Security.Principal.Windows.dll", + "runtimes/win/lib/net461/System.Security.Principal.Windows.dll", + "runtimes/win/lib/net461/System.Security.Principal.Windows.xml", + "runtimes/win/lib/netcoreapp2.0/System.Security.Principal.Windows.dll", + "runtimes/win/lib/netcoreapp2.0/System.Security.Principal.Windows.xml", + "runtimes/win/lib/netcoreapp2.1/System.Security.Principal.Windows.dll", + "runtimes/win/lib/netcoreapp2.1/System.Security.Principal.Windows.xml", + "runtimes/win/lib/netstandard1.3/System.Security.Principal.Windows.dll", + "runtimes/win/lib/uap10.0.16299/_._", + "system.security.principal.windows.4.7.0.nupkg.sha512", + "system.security.principal.windows.nuspec", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "System.Text.Encoding/4.3.0": { + "sha512": "BiIg+KWaSDOITze6jGQynxg64naAPtqGHBwDrLaCtixsa5bKiR8dpPOHA7ge3C0JJQizJE+sfkz1wV+BAKAYZw==", + "type": "package", + "path": "system.text.encoding/4.3.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/portable-net45+win8+wp8+wpa81/_._", + "lib/win8/_._", + "lib/wp80/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/netcore50/System.Text.Encoding.dll", + "ref/netcore50/System.Text.Encoding.xml", + "ref/netcore50/de/System.Text.Encoding.xml", + "ref/netcore50/es/System.Text.Encoding.xml", + "ref/netcore50/fr/System.Text.Encoding.xml", + "ref/netcore50/it/System.Text.Encoding.xml", + "ref/netcore50/ja/System.Text.Encoding.xml", + "ref/netcore50/ko/System.Text.Encoding.xml", + "ref/netcore50/ru/System.Text.Encoding.xml", + "ref/netcore50/zh-hans/System.Text.Encoding.xml", + "ref/netcore50/zh-hant/System.Text.Encoding.xml", + "ref/netstandard1.0/System.Text.Encoding.dll", + "ref/netstandard1.0/System.Text.Encoding.xml", + "ref/netstandard1.0/de/System.Text.Encoding.xml", + "ref/netstandard1.0/es/System.Text.Encoding.xml", + "ref/netstandard1.0/fr/System.Text.Encoding.xml", + "ref/netstandard1.0/it/System.Text.Encoding.xml", + "ref/netstandard1.0/ja/System.Text.Encoding.xml", + "ref/netstandard1.0/ko/System.Text.Encoding.xml", + "ref/netstandard1.0/ru/System.Text.Encoding.xml", + "ref/netstandard1.0/zh-hans/System.Text.Encoding.xml", + "ref/netstandard1.0/zh-hant/System.Text.Encoding.xml", + "ref/netstandard1.3/System.Text.Encoding.dll", + "ref/netstandard1.3/System.Text.Encoding.xml", + "ref/netstandard1.3/de/System.Text.Encoding.xml", + "ref/netstandard1.3/es/System.Text.Encoding.xml", + "ref/netstandard1.3/fr/System.Text.Encoding.xml", + "ref/netstandard1.3/it/System.Text.Encoding.xml", + "ref/netstandard1.3/ja/System.Text.Encoding.xml", + "ref/netstandard1.3/ko/System.Text.Encoding.xml", + "ref/netstandard1.3/ru/System.Text.Encoding.xml", + "ref/netstandard1.3/zh-hans/System.Text.Encoding.xml", + "ref/netstandard1.3/zh-hant/System.Text.Encoding.xml", + "ref/portable-net45+win8+wp8+wpa81/_._", + "ref/win8/_._", + "ref/wp80/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.text.encoding.4.3.0.nupkg.sha512", + "system.text.encoding.nuspec" + ] + }, + "System.Threading/4.3.0": { + "sha512": "VkUS0kOBcUf3Wwm0TSbrevDDZ6BlM+b/HRiapRFWjM5O0NS0LviG0glKmFK+hhPDd1XFeSdU1GmlLhb2CoVpIw==", + "type": "package", + "path": "system.threading/4.3.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/netcore50/System.Threading.dll", + "lib/netstandard1.3/System.Threading.dll", + "lib/portable-net45+win8+wp8+wpa81/_._", + "lib/win8/_._", + "lib/wp80/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/netcore50/System.Threading.dll", + "ref/netcore50/System.Threading.xml", + "ref/netcore50/de/System.Threading.xml", + "ref/netcore50/es/System.Threading.xml", + "ref/netcore50/fr/System.Threading.xml", + "ref/netcore50/it/System.Threading.xml", + "ref/netcore50/ja/System.Threading.xml", + "ref/netcore50/ko/System.Threading.xml", + "ref/netcore50/ru/System.Threading.xml", + "ref/netcore50/zh-hans/System.Threading.xml", + "ref/netcore50/zh-hant/System.Threading.xml", + "ref/netstandard1.0/System.Threading.dll", + "ref/netstandard1.0/System.Threading.xml", + "ref/netstandard1.0/de/System.Threading.xml", + "ref/netstandard1.0/es/System.Threading.xml", + "ref/netstandard1.0/fr/System.Threading.xml", + "ref/netstandard1.0/it/System.Threading.xml", + "ref/netstandard1.0/ja/System.Threading.xml", + "ref/netstandard1.0/ko/System.Threading.xml", + "ref/netstandard1.0/ru/System.Threading.xml", + "ref/netstandard1.0/zh-hans/System.Threading.xml", + "ref/netstandard1.0/zh-hant/System.Threading.xml", + "ref/netstandard1.3/System.Threading.dll", + "ref/netstandard1.3/System.Threading.xml", + "ref/netstandard1.3/de/System.Threading.xml", + "ref/netstandard1.3/es/System.Threading.xml", + "ref/netstandard1.3/fr/System.Threading.xml", + "ref/netstandard1.3/it/System.Threading.xml", + "ref/netstandard1.3/ja/System.Threading.xml", + "ref/netstandard1.3/ko/System.Threading.xml", + "ref/netstandard1.3/ru/System.Threading.xml", + "ref/netstandard1.3/zh-hans/System.Threading.xml", + "ref/netstandard1.3/zh-hant/System.Threading.xml", + "ref/portable-net45+win8+wp8+wpa81/_._", + "ref/win8/_._", + "ref/wp80/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "runtimes/aot/lib/netcore50/System.Threading.dll", + "system.threading.4.3.0.nupkg.sha512", + "system.threading.nuspec" + ] + }, + "System.Threading.Tasks/4.3.0": { + "sha512": "LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==", + "type": "package", + "path": "system.threading.tasks/4.3.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/portable-net45+win8+wp8+wpa81/_._", + "lib/win8/_._", + "lib/wp80/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/netcore50/System.Threading.Tasks.dll", + "ref/netcore50/System.Threading.Tasks.xml", + "ref/netcore50/de/System.Threading.Tasks.xml", + "ref/netcore50/es/System.Threading.Tasks.xml", + "ref/netcore50/fr/System.Threading.Tasks.xml", + "ref/netcore50/it/System.Threading.Tasks.xml", + "ref/netcore50/ja/System.Threading.Tasks.xml", + "ref/netcore50/ko/System.Threading.Tasks.xml", + "ref/netcore50/ru/System.Threading.Tasks.xml", + "ref/netcore50/zh-hans/System.Threading.Tasks.xml", + "ref/netcore50/zh-hant/System.Threading.Tasks.xml", + "ref/netstandard1.0/System.Threading.Tasks.dll", + "ref/netstandard1.0/System.Threading.Tasks.xml", + "ref/netstandard1.0/de/System.Threading.Tasks.xml", + "ref/netstandard1.0/es/System.Threading.Tasks.xml", + "ref/netstandard1.0/fr/System.Threading.Tasks.xml", + "ref/netstandard1.0/it/System.Threading.Tasks.xml", + "ref/netstandard1.0/ja/System.Threading.Tasks.xml", + "ref/netstandard1.0/ko/System.Threading.Tasks.xml", + "ref/netstandard1.0/ru/System.Threading.Tasks.xml", + "ref/netstandard1.0/zh-hans/System.Threading.Tasks.xml", + "ref/netstandard1.0/zh-hant/System.Threading.Tasks.xml", + "ref/netstandard1.3/System.Threading.Tasks.dll", + "ref/netstandard1.3/System.Threading.Tasks.xml", + "ref/netstandard1.3/de/System.Threading.Tasks.xml", + "ref/netstandard1.3/es/System.Threading.Tasks.xml", + "ref/netstandard1.3/fr/System.Threading.Tasks.xml", + "ref/netstandard1.3/it/System.Threading.Tasks.xml", + "ref/netstandard1.3/ja/System.Threading.Tasks.xml", + "ref/netstandard1.3/ko/System.Threading.Tasks.xml", + "ref/netstandard1.3/ru/System.Threading.Tasks.xml", + "ref/netstandard1.3/zh-hans/System.Threading.Tasks.xml", + "ref/netstandard1.3/zh-hant/System.Threading.Tasks.xml", + "ref/portable-net45+win8+wp8+wpa81/_._", + "ref/win8/_._", + "ref/wp80/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.threading.tasks.4.3.0.nupkg.sha512", + "system.threading.tasks.nuspec" + ] + }, + "System.Threading.Tasks.Extensions/4.5.3": { + "sha512": "+MvhNtcvIbqmhANyKu91jQnvIRVSTiaOiFNfKWwXGHG48YAb4I/TyH8spsySiPYla7gKal5ZnF3teJqZAximyQ==", + "type": "package", + "path": "system.threading.tasks.extensions/4.5.3", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/netcoreapp2.1/_._", + "lib/netstandard1.0/System.Threading.Tasks.Extensions.dll", + "lib/netstandard1.0/System.Threading.Tasks.Extensions.xml", + "lib/netstandard2.0/System.Threading.Tasks.Extensions.dll", + "lib/netstandard2.0/System.Threading.Tasks.Extensions.xml", + "lib/portable-net45+win8+wp8+wpa81/System.Threading.Tasks.Extensions.dll", + "lib/portable-net45+win8+wp8+wpa81/System.Threading.Tasks.Extensions.xml", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/netcoreapp2.1/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.threading.tasks.extensions.4.5.3.nupkg.sha512", + "system.threading.tasks.extensions.nuspec", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "System.Threading.Tasks.Parallel/4.3.0": { + "sha512": "cbjBNZHf/vQCfcdhzx7knsiygoCKgxL8mZOeocXZn5gWhCdzHIq6bYNKWX0LAJCWYP7bds4yBK8p06YkP0oa0g==", + "type": "package", + "path": "system.threading.tasks.parallel/4.3.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/netcore50/System.Threading.Tasks.Parallel.dll", + "lib/netstandard1.3/System.Threading.Tasks.Parallel.dll", + "lib/portable-net45+win8+wpa81/_._", + "lib/win8/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/netcore50/System.Threading.Tasks.Parallel.dll", + "ref/netcore50/System.Threading.Tasks.Parallel.xml", + "ref/netcore50/de/System.Threading.Tasks.Parallel.xml", + "ref/netcore50/es/System.Threading.Tasks.Parallel.xml", + "ref/netcore50/fr/System.Threading.Tasks.Parallel.xml", + "ref/netcore50/it/System.Threading.Tasks.Parallel.xml", + "ref/netcore50/ja/System.Threading.Tasks.Parallel.xml", + "ref/netcore50/ko/System.Threading.Tasks.Parallel.xml", + "ref/netcore50/ru/System.Threading.Tasks.Parallel.xml", + "ref/netcore50/zh-hans/System.Threading.Tasks.Parallel.xml", + "ref/netcore50/zh-hant/System.Threading.Tasks.Parallel.xml", + "ref/netstandard1.1/System.Threading.Tasks.Parallel.dll", + "ref/netstandard1.1/System.Threading.Tasks.Parallel.xml", + "ref/netstandard1.1/de/System.Threading.Tasks.Parallel.xml", + "ref/netstandard1.1/es/System.Threading.Tasks.Parallel.xml", + "ref/netstandard1.1/fr/System.Threading.Tasks.Parallel.xml", + "ref/netstandard1.1/it/System.Threading.Tasks.Parallel.xml", + "ref/netstandard1.1/ja/System.Threading.Tasks.Parallel.xml", + "ref/netstandard1.1/ko/System.Threading.Tasks.Parallel.xml", + "ref/netstandard1.1/ru/System.Threading.Tasks.Parallel.xml", + "ref/netstandard1.1/zh-hans/System.Threading.Tasks.Parallel.xml", + "ref/netstandard1.1/zh-hant/System.Threading.Tasks.Parallel.xml", + "ref/portable-net45+win8+wpa81/_._", + "ref/win8/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.threading.tasks.parallel.4.3.0.nupkg.sha512", + "system.threading.tasks.parallel.nuspec" + ] + }, + "Economy.Shared/1.0.0": { + "type": "project", + "path": "../Economy.Shared/Economy.Shared.csproj", + "msbuildProject": "../Economy.Shared/Economy.Shared.csproj" + } + }, + "projectFileDependencyGroups": { + ".NETCoreApp,Version=v3.1": [ + "Economy.Shared >= 1.0.0", + "MagicOnion.Hosting >= 3.0.9" + ] + }, + "packageFolders": { + "C:\\Users\\rwvens\\.nuget\\packages\\": {}, + "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder": {} + }, + "project": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Server\\Economy.Server.csproj", + "projectName": "Economy.Server", + "projectPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Server\\Economy.Server.csproj", + "packagesPath": "C:\\Users\\rwvens\\.nuget\\packages\\", + "outputPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Server\\obj\\", + "projectStyle": "PackageReference", + "fallbackFolders": [ + "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" + ], + "configFilePaths": [ + "C:\\Users\\rwvens\\AppData\\Roaming\\NuGet\\NuGet.Config" + ], + "originalTargetFrameworks": [ + "netcoreapp3.1" + ], + "sources": { + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "netcoreapp3.1": { + "projectReferences": { + "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj": { + "projectPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj" + } + } + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "netcoreapp3.1": { + "dependencies": { + "MagicOnion.Hosting": { + "target": "Package", + "version": "[3.0.9, )" + } + }, + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.102\\RuntimeIdentifierGraph.json" + } + } + } +} \ No newline at end of file diff --git a/Economy.Server/obj/project.packagespec.json b/Economy.Server/obj/project.packagespec.json new file mode 100644 index 000000000..c525cb385 --- /dev/null +++ b/Economy.Server/obj/project.packagespec.json @@ -0,0 +1,59 @@ +{ + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Server\\Economy.Server.csproj", + "projectName": "Economy.Server", + "projectPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Server\\Economy.Server.csproj", + "outputPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Server\\obj\\", + "projectStyle": "PackageReference", + "fallbackFolders": [ + "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" + ], + "originalTargetFrameworks": [ + "netcoreapp3.1" + ], + "sources": { + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "netcoreapp3.1": { + "projectReferences": { + "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj": { + "projectPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj" + } + } + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "netcoreapp3.1": { + "dependencies": { + "MagicOnion.Hosting": { + "target": "Package", + "version": "[3.0.9, )" + } + }, + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.102\\RuntimeIdentifierGraph.json" + } + } +} \ No newline at end of file diff --git a/Economy.Shared/bin/Debug/netstandard2.0/Economy.Shared.deps.json b/Economy.Shared/bin/Debug/netstandard2.0/Economy.Shared.deps.json new file mode 100644 index 000000000..3406d9f20 --- /dev/null +++ b/Economy.Shared/bin/Debug/netstandard2.0/Economy.Shared.deps.json @@ -0,0 +1,420 @@ +{ + "runtimeTarget": { + "name": ".NETStandard,Version=v2.0/", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETStandard,Version=v2.0": {}, + ".NETStandard,Version=v2.0/": { + "Economy.Shared/1.0.0": { + "dependencies": { + "MagicOnion.Abstractions": "3.0.0", + "MagicOnion.MSBuild.Tasks": "3.0.0", + "MessagePack.MSBuild.Tasks": "2.0.323", + "NETStandard.Library": "2.0.3" + }, + "runtime": { + "Economy.Shared.dll": {} + } + }, + "Grpc.Core.Api/2.25.0": { + "dependencies": { + "System.Memory": "4.5.3" + }, + "runtime": { + "lib/netstandard2.0/Grpc.Core.Api.dll": { + "assemblyVersion": "2.0.0.0", + "fileVersion": "2.25.0.0" + } + } + }, + "MagicOnion.Abstractions/3.0.0": { + "dependencies": { + "Grpc.Core.Api": "2.25.0", + "MessagePack": "2.0.323" + }, + "runtime": { + "lib/netstandard2.0/MagicOnion.Abstractions.dll": { + "assemblyVersion": "3.0.0.0", + "fileVersion": "3.0.0.0" + } + } + }, + "MagicOnion.MSBuild.Tasks/3.0.0": {}, + "MessagePack/2.0.323": { + "dependencies": { + "MessagePack.Annotations": "2.0.323", + "System.Memory": "4.5.3", + "System.Reflection.Emit": "4.6.0", + "System.Reflection.Emit.Lightweight": "4.6.0", + "System.Runtime.CompilerServices.Unsafe": "4.5.2", + "System.Runtime.Serialization.Primitives": "4.3.0", + "System.Threading.Tasks.Extensions": "4.5.3" + }, + "runtime": { + "lib/netstandard2.0/MessagePack.dll": { + "assemblyVersion": "2.0.0.0", + "fileVersion": "2.0.323.22911" + } + } + }, + "MessagePack.Annotations/2.0.323": { + "runtime": { + "lib/netstandard2.0/MessagePack.Annotations.dll": { + "assemblyVersion": "2.0.0.0", + "fileVersion": "2.0.323.22911" + } + } + }, + "MessagePack.MSBuild.Tasks/2.0.323": {}, + "Microsoft.NETCore.Platforms/1.1.0": {}, + "Microsoft.NETCore.Targets/1.1.0": {}, + "NETStandard.Library/2.0.3": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0" + } + }, + "System.Buffers/4.4.0": { + "runtime": { + "lib/netstandard2.0/System.Buffers.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.25519.3" + } + } + }, + "System.Globalization/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.IO/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "System.Memory/4.5.3": { + "dependencies": { + "System.Buffers": "4.4.0", + "System.Numerics.Vectors": "4.4.0", + "System.Runtime.CompilerServices.Unsafe": "4.5.2" + }, + "runtime": { + "lib/netstandard2.0/System.Memory.dll": { + "assemblyVersion": "4.0.1.1", + "fileVersion": "4.6.27617.2" + } + } + }, + "System.Numerics.Vectors/4.4.0": { + "runtime": { + "lib/netstandard2.0/System.Numerics.Vectors.dll": { + "assemblyVersion": "4.1.3.0", + "fileVersion": "4.6.25519.3" + } + } + }, + "System.Reflection/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.IO": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.Emit/4.6.0": { + "dependencies": { + "System.Reflection.Emit.ILGeneration": "4.6.0" + }, + "runtime": { + "lib/netstandard2.0/System.Reflection.Emit.dll": { + "assemblyVersion": "4.0.0.0", + "fileVersion": "4.700.19.46214" + } + } + }, + "System.Reflection.Emit.ILGeneration/4.6.0": { + "runtime": { + "lib/netstandard2.0/System.Reflection.Emit.ILGeneration.dll": { + "assemblyVersion": "4.0.0.0", + "fileVersion": "4.700.19.46214" + } + } + }, + "System.Reflection.Emit.Lightweight/4.6.0": { + "dependencies": { + "System.Reflection.Emit.ILGeneration": "4.6.0" + }, + "runtime": { + "lib/netstandard2.0/System.Reflection.Emit.Lightweight.dll": { + "assemblyVersion": "4.0.0.0", + "fileVersion": "4.700.19.46214" + } + } + }, + "System.Reflection.Primitives/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Resources.ResourceManager/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Globalization": "4.3.0", + "System.Reflection": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Runtime/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0" + } + }, + "System.Runtime.CompilerServices.Unsafe/4.5.2": { + "runtime": { + "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": { + "assemblyVersion": "4.0.4.1", + "fileVersion": "4.6.26919.2" + } + } + }, + "System.Runtime.Serialization.Primitives/4.3.0": { + "dependencies": { + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Runtime.Serialization.Primitives.dll": { + "assemblyVersion": "4.1.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Text.Encoding/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Threading.Tasks/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Threading.Tasks.Extensions/4.5.3": { + "dependencies": { + "System.Runtime.CompilerServices.Unsafe": "4.5.2" + }, + "runtime": { + "lib/netstandard2.0/System.Threading.Tasks.Extensions.dll": { + "assemblyVersion": "4.2.0.1", + "fileVersion": "4.6.27818.1" + } + } + } + } + }, + "libraries": { + "Economy.Shared/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "Grpc.Core.Api/2.25.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ax4qg0k4ZTlWf8PtZoU/hfbwWkgtCRIucVqqgXrRd9HYyieuilZtX6h55SwoFeW8sdNQs950gEkR5XHGStR0lQ==", + "path": "grpc.core.api/2.25.0", + "hashPath": "grpc.core.api.2.25.0.nupkg.sha512" + }, + "MagicOnion.Abstractions/3.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-dEsm+KFbH5qLqBS3BC9xELSMpqdcIQB/9jLkz82M37VRtjAR3I0wkglbsz5xrvD/kqWttB6YINz/4VVslbIOLA==", + "path": "magiconion.abstractions/3.0.0", + "hashPath": "magiconion.abstractions.3.0.0.nupkg.sha512" + }, + "MagicOnion.MSBuild.Tasks/3.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Mxb4ZkiLTeSXk5lYyqs4PvRNLrqJ98Aw3mL0+gsai+mqglPM28kLyTphjTgmQyOGN8cJiU40rAGL51BAu5PgUA==", + "path": "magiconion.msbuild.tasks/3.0.0", + "hashPath": "magiconion.msbuild.tasks.3.0.0.nupkg.sha512" + }, + "MessagePack/2.0.323": { + "type": "package", + "serviceable": true, + "sha512": "sha512-pGKZRAfjnHeIHk/isMQ9A42YjhXt4RrGjuwM4j6FwZOKZmISMZltk4WFdJDU7bQ3y5CEQXTjxJ/O3tdSrg+eEA==", + "path": "messagepack/2.0.323", + "hashPath": "messagepack.2.0.323.nupkg.sha512" + }, + "MessagePack.Annotations/2.0.323": { + "type": "package", + "serviceable": true, + "sha512": "sha512-b4fN2g9kbtC6ywNOBtx3pAmZQst6Dow7sQEGZYzaf45EVXU1WYiektoKdC9o4OIkyo1FejQ5JdiQo3C9CSufzg==", + "path": "messagepack.annotations/2.0.323", + "hashPath": "messagepack.annotations.2.0.323.nupkg.sha512" + }, + "MessagePack.MSBuild.Tasks/2.0.323": { + "type": "package", + "serviceable": true, + "sha512": "sha512-/VFfPPzO1x9uSBz7KpqX0mOJf6UKTRAN7Ozk5YOJ4vPNtgaFcacx2frxLACOgl0MoKUVC9oUn+G/KMeSc7NEPA==", + "path": "messagepack.msbuild.tasks/2.0.323", + "hashPath": "messagepack.msbuild.tasks.2.0.323.nupkg.sha512" + }, + "Microsoft.NETCore.Platforms/1.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==", + "path": "microsoft.netcore.platforms/1.1.0", + "hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512" + }, + "Microsoft.NETCore.Targets/1.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg==", + "path": "microsoft.netcore.targets/1.1.0", + "hashPath": "microsoft.netcore.targets.1.1.0.nupkg.sha512" + }, + "NETStandard.Library/2.0.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", + "path": "netstandard.library/2.0.3", + "hashPath": "netstandard.library.2.0.3.nupkg.sha512" + }, + "System.Buffers/4.4.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-AwarXzzoDwX6BgrhjoJsk6tUezZEozOT5Y9QKF94Gl4JK91I4PIIBkBco9068Y9/Dra8Dkbie99kXB8+1BaYKw==", + "path": "system.buffers/4.4.0", + "hashPath": "system.buffers.4.4.0.nupkg.sha512" + }, + "System.Globalization/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-kYdVd2f2PAdFGblzFswE4hkNANJBKRmsfa2X5LG2AcWE1c7/4t0pYae1L8vfZ5xvE2nK/R9JprtToA61OSHWIg==", + "path": "system.globalization/4.3.0", + "hashPath": "system.globalization.4.3.0.nupkg.sha512" + }, + "System.IO/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3qjaHvxQPDpSOYICjUoTsmoq5u6QJAFRUITgeT/4gqkF1bajbSmb1kwSxEA8AHlofqgcKJcM8udgieRNhaJ5Cg==", + "path": "system.io/4.3.0", + "hashPath": "system.io.4.3.0.nupkg.sha512" + }, + "System.Memory/4.5.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3oDzvc/zzetpTKWMShs1AADwZjQ/36HnsufHRPcOjyRAAMLDlu2iD33MBI2opxnezcVUtXyqDXXjoFMOU9c7SA==", + "path": "system.memory/4.5.3", + "hashPath": "system.memory.4.5.3.nupkg.sha512" + }, + "System.Numerics.Vectors/4.4.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-UiLzLW+Lw6HLed1Hcg+8jSRttrbuXv7DANVj0DkL9g6EnnzbL75EB7EWsw5uRbhxd/4YdG8li5XizGWepmG3PQ==", + "path": "system.numerics.vectors/4.4.0", + "hashPath": "system.numerics.vectors.4.4.0.nupkg.sha512" + }, + "System.Reflection/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-KMiAFoW7MfJGa9nDFNcfu+FpEdiHpWgTcS2HdMpDvt9saK3y/G4GwprPyzqjFH9NTaGPQeWNHU+iDlDILj96aQ==", + "path": "system.reflection/4.3.0", + "hashPath": "system.reflection.4.3.0.nupkg.sha512" + }, + "System.Reflection.Emit/4.6.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-qAo4jyXtC9i71iElngX7P2r+zLaiHzxKwf66sc3X91tL5Ks6fnQ1vxL04o7ZSm3sYfLExySL7GN8aTpNYpU1qw==", + "path": "system.reflection.emit/4.6.0", + "hashPath": "system.reflection.emit.4.6.0.nupkg.sha512" + }, + "System.Reflection.Emit.ILGeneration/4.6.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-z3r/uEhMj+1wUNUa/EA2bWxEL9M8bgFt/22xCOQivES28ex3zWxE+2j0gQF/mdRwzlr0jir64HVlwV5J4zTOfw==", + "path": "system.reflection.emit.ilgeneration/4.6.0", + "hashPath": "system.reflection.emit.ilgeneration.4.6.0.nupkg.sha512" + }, + "System.Reflection.Emit.Lightweight/4.6.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-j/V5HVvxvBQ7uubYD0PptQW2KGsi1Pc2kZ9yfwLixv3ADdjL/4M78KyC5e+ymW612DY8ZE4PFoZmWpoNmN2mqg==", + "path": "system.reflection.emit.lightweight/4.6.0", + "hashPath": "system.reflection.emit.lightweight.4.6.0.nupkg.sha512" + }, + "System.Reflection.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-5RXItQz5As4xN2/YUDxdpsEkMhvw3e6aNveFXUn4Hl/udNTCNhnKp8lT9fnc3MhvGKh1baak5CovpuQUXHAlIA==", + "path": "system.reflection.primitives/4.3.0", + "hashPath": "system.reflection.primitives.4.3.0.nupkg.sha512" + }, + "System.Resources.ResourceManager/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-/zrcPkkWdZmI4F92gL/TPumP98AVDu/Wxr3CSJGQQ+XN6wbRZcyfSKVoPo17ilb3iOr0cCRqJInGwNMolqhS8A==", + "path": "system.resources.resourcemanager/4.3.0", + "hashPath": "system.resources.resourcemanager.4.3.0.nupkg.sha512" + }, + "System.Runtime/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==", + "path": "system.runtime/4.3.0", + "hashPath": "system.runtime.4.3.0.nupkg.sha512" + }, + "System.Runtime.CompilerServices.Unsafe/4.5.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-wprSFgext8cwqymChhrBLu62LMg/1u92bU+VOwyfBimSPVFXtsNqEWC92Pf9ofzJFlk4IHmJA75EDJn1b2goAQ==", + "path": "system.runtime.compilerservices.unsafe/4.5.2", + "hashPath": "system.runtime.compilerservices.unsafe.4.5.2.nupkg.sha512" + }, + "System.Runtime.Serialization.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Wz+0KOukJGAlXjtKr+5Xpuxf8+c8739RI1C+A2BoQZT+wMCCoMDDdO8/4IRHfaVINqL78GO8dW8G2lW/e45Mcw==", + "path": "system.runtime.serialization.primitives/4.3.0", + "hashPath": "system.runtime.serialization.primitives.4.3.0.nupkg.sha512" + }, + "System.Text.Encoding/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-BiIg+KWaSDOITze6jGQynxg64naAPtqGHBwDrLaCtixsa5bKiR8dpPOHA7ge3C0JJQizJE+sfkz1wV+BAKAYZw==", + "path": "system.text.encoding/4.3.0", + "hashPath": "system.text.encoding.4.3.0.nupkg.sha512" + }, + "System.Threading.Tasks/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==", + "path": "system.threading.tasks/4.3.0", + "hashPath": "system.threading.tasks.4.3.0.nupkg.sha512" + }, + "System.Threading.Tasks.Extensions/4.5.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-+MvhNtcvIbqmhANyKu91jQnvIRVSTiaOiFNfKWwXGHG48YAb4I/TyH8spsySiPYla7gKal5ZnF3teJqZAximyQ==", + "path": "system.threading.tasks.extensions/4.5.3", + "hashPath": "system.threading.tasks.extensions.4.5.3.nupkg.sha512" + } + } +} \ No newline at end of file diff --git a/Economy.Shared/bin/Debug/netstandard2.0/Economy.Shared.dll b/Economy.Shared/bin/Debug/netstandard2.0/Economy.Shared.dll new file mode 100644 index 000000000..7b675e3a3 --- /dev/null +++ b/Economy.Shared/bin/Debug/netstandard2.0/Economy.Shared.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ca1d4c0c68f6b21705d37d36cb7dbb4003901104da6fc4d587423f0f2f441b4 +size 5632 diff --git a/Economy.Shared/obj/Debug/netstandard2.0/Economy.Shared.AssemblyInfo.cs b/Economy.Shared/obj/Debug/netstandard2.0/Economy.Shared.AssemblyInfo.cs new file mode 100644 index 000000000..5f8a76ebe --- /dev/null +++ b/Economy.Shared/obj/Debug/netstandard2.0/Economy.Shared.AssemblyInfo.cs @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("Economy.Shared")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyProductAttribute("Economy.Shared")] +[assembly: System.Reflection.AssemblyTitleAttribute("Economy.Shared")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Generated by the MSBuild WriteCodeFragment class. + diff --git a/Economy.Shared/obj/Debug/netstandard2.0/Economy.Shared.AssemblyInfoInputs.cache b/Economy.Shared/obj/Debug/netstandard2.0/Economy.Shared.AssemblyInfoInputs.cache new file mode 100644 index 000000000..1ec7c7bbc --- /dev/null +++ b/Economy.Shared/obj/Debug/netstandard2.0/Economy.Shared.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +ecad4115d1c4ba76d1858e8ed3f10aa2bfd108cd diff --git a/Economy.Shared/obj/Debug/netstandard2.0/Economy.Shared.assets.cache b/Economy.Shared/obj/Debug/netstandard2.0/Economy.Shared.assets.cache new file mode 100644 index 000000000..c7c1cec0a Binary files /dev/null and b/Economy.Shared/obj/Debug/netstandard2.0/Economy.Shared.assets.cache differ diff --git a/Economy.Shared/obj/Debug/netstandard2.0/Economy.Shared.csproj.FileListAbsolute.txt b/Economy.Shared/obj/Debug/netstandard2.0/Economy.Shared.csproj.FileListAbsolute.txt new file mode 100644 index 000000000..dfa3344bf --- /dev/null +++ b/Economy.Shared/obj/Debug/netstandard2.0/Economy.Shared.csproj.FileListAbsolute.txt @@ -0,0 +1,8 @@ +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Shared\bin\Debug\netstandard2.0\Economy.Shared.deps.json +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Shared\bin\Debug\netstandard2.0\Economy.Shared.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Shared\bin\Debug\netstandard2.0\Economy.Shared.pdb +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Shared\obj\Debug\netstandard2.0\Economy.Shared.csprojAssemblyReference.cache +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Shared\obj\Debug\netstandard2.0\Economy.Shared.AssemblyInfoInputs.cache +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Shared\obj\Debug\netstandard2.0\Economy.Shared.AssemblyInfo.cs +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Shared\obj\Debug\netstandard2.0\Economy.Shared.dll +C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Shared\obj\Debug\netstandard2.0\Economy.Shared.pdb diff --git a/Economy.Shared/obj/Debug/netstandard2.0/Economy.Shared.csprojAssemblyReference.cache b/Economy.Shared/obj/Debug/netstandard2.0/Economy.Shared.csprojAssemblyReference.cache new file mode 100644 index 000000000..c18410c26 Binary files /dev/null and b/Economy.Shared/obj/Debug/netstandard2.0/Economy.Shared.csprojAssemblyReference.cache differ diff --git a/Economy.Shared/obj/Debug/netstandard2.0/Economy.Shared.dll b/Economy.Shared/obj/Debug/netstandard2.0/Economy.Shared.dll new file mode 100644 index 000000000..7b675e3a3 --- /dev/null +++ b/Economy.Shared/obj/Debug/netstandard2.0/Economy.Shared.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ca1d4c0c68f6b21705d37d36cb7dbb4003901104da6fc4d587423f0f2f441b4 +size 5632 diff --git a/Economy.Shared/obj/Economy.Shared.csproj.nuget.cache b/Economy.Shared/obj/Economy.Shared.csproj.nuget.cache new file mode 100644 index 000000000..6e1809588 --- /dev/null +++ b/Economy.Shared/obj/Economy.Shared.csproj.nuget.cache @@ -0,0 +1,5 @@ +{ + "version": 1, + "dgSpecHash": "9rwWy0GH4uod4JZjbxUAf5k/InrGsG95PftCbjlR3Psjl8VJEF0wtFifNmJyDbe753R3KteGPEEwBs9sOiTuWA==", + "success": true +} \ No newline at end of file diff --git a/Economy.Shared/obj/Economy.Shared.csproj.nuget.dgspec.json b/Economy.Shared/obj/Economy.Shared.csproj.nuget.dgspec.json new file mode 100644 index 000000000..56241a0bb --- /dev/null +++ b/Economy.Shared/obj/Economy.Shared.csproj.nuget.dgspec.json @@ -0,0 +1,78 @@ +{ + "format": 1, + "restore": { + "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj": {} + }, + "projects": { + "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj", + "projectName": "Economy.Shared", + "projectPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj", + "packagesPath": "C:\\Users\\rwvens\\.nuget\\packages\\", + "outputPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\obj\\", + "projectStyle": "PackageReference", + "fallbackFolders": [ + "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" + ], + "configFilePaths": [ + "C:\\Users\\rwvens\\AppData\\Roaming\\NuGet\\NuGet.Config" + ], + "originalTargetFrameworks": [ + "netstandard2.0" + ], + "sources": { + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "netstandard2.0": { + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "netstandard2.0": { + "dependencies": { + "MagicOnion.Abstractions": { + "target": "Package", + "version": "[3.0.0, )" + }, + "MagicOnion.MSBuild.Tasks": { + "suppressParent": "All", + "target": "Package", + "version": "[3.0.0, )" + }, + "MessagePack.MSBuild.Tasks": { + "suppressParent": "All", + "target": "Package", + "version": "[2.0.323, )" + }, + "NETStandard.Library": { + "suppressParent": "All", + "target": "Package", + "version": "[2.0.3, )", + "autoReferenced": true + } + }, + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48" + ], + "assetTargetFallback": true, + "warn": true, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.102\\RuntimeIdentifierGraph.json" + } + } + } + } +} \ No newline at end of file diff --git a/Economy.Shared/obj/Economy.Shared.csproj.nuget.g.props b/Economy.Shared/obj/Economy.Shared.csproj.nuget.g.props new file mode 100644 index 000000000..57a7440fc --- /dev/null +++ b/Economy.Shared/obj/Economy.Shared.csproj.nuget.g.props @@ -0,0 +1,19 @@ + + + + True + NuGet + $(MSBuildThisFileDirectory)project.assets.json + $(UserProfile)\.nuget\packages\ + C:\Users\rwvens\.nuget\packages\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder + PackageReference + 5.3.0 + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + + + + + + \ No newline at end of file diff --git a/Economy.Shared/obj/Economy.Shared.csproj.nuget.g.targets b/Economy.Shared/obj/Economy.Shared.csproj.nuget.g.targets new file mode 100644 index 000000000..f09823b85 --- /dev/null +++ b/Economy.Shared/obj/Economy.Shared.csproj.nuget.g.targets @@ -0,0 +1,9 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + + + + + \ No newline at end of file diff --git a/Economy.Shared/obj/project.assets.json b/Economy.Shared/obj/project.assets.json new file mode 100644 index 000000000..1c1cb430c --- /dev/null +++ b/Economy.Shared/obj/project.assets.json @@ -0,0 +1,1745 @@ +{ + "version": 3, + "targets": { + ".NETStandard,Version=v2.0": { + "Grpc.Core.Api/2.25.0": { + "type": "package", + "dependencies": { + "System.Memory": "4.5.3" + }, + "compile": { + "lib/netstandard2.0/Grpc.Core.Api.dll": {} + }, + "runtime": { + "lib/netstandard2.0/Grpc.Core.Api.dll": {} + } + }, + "MagicOnion.Abstractions/3.0.0": { + "type": "package", + "dependencies": { + "Grpc.Core.Api": "2.25.0", + "MessagePack": "2.0.323" + }, + "compile": { + "lib/netstandard2.0/MagicOnion.Abstractions.dll": {} + }, + "runtime": { + "lib/netstandard2.0/MagicOnion.Abstractions.dll": {} + } + }, + "MagicOnion.MSBuild.Tasks/3.0.0": { + "type": "package", + "build": { + "build/MagicOnion.MSBuild.Tasks.props": {} + } + }, + "MessagePack/2.0.323": { + "type": "package", + "dependencies": { + "MessagePack.Annotations": "2.0.323", + "System.Memory": "4.5.3", + "System.Reflection.Emit": "4.6.0", + "System.Reflection.Emit.Lightweight": "4.6.0", + "System.Runtime.CompilerServices.Unsafe": "4.5.2", + "System.Runtime.Serialization.Primitives": "4.3.0", + "System.Threading.Tasks.Extensions": "4.5.3" + }, + "compile": { + "lib/netstandard2.0/MessagePack.dll": {} + }, + "runtime": { + "lib/netstandard2.0/MessagePack.dll": {} + } + }, + "MessagePack.Annotations/2.0.323": { + "type": "package", + "compile": { + "lib/netstandard2.0/MessagePack.Annotations.dll": {} + }, + "runtime": { + "lib/netstandard2.0/MessagePack.Annotations.dll": {} + } + }, + "MessagePack.MSBuild.Tasks/2.0.323": { + "type": "package", + "build": { + "build/MessagePack.MSBuild.Tasks.props": {} + } + }, + "Microsoft.NETCore.Platforms/1.1.0": { + "type": "package", + "compile": { + "lib/netstandard1.0/_._": {} + }, + "runtime": { + "lib/netstandard1.0/_._": {} + } + }, + "Microsoft.NETCore.Targets/1.1.0": { + "type": "package", + "compile": { + "lib/netstandard1.0/_._": {} + }, + "runtime": { + "lib/netstandard1.0/_._": {} + } + }, + "NETStandard.Library/2.0.3": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0" + }, + "compile": { + "lib/netstandard1.0/_._": {} + }, + "runtime": { + "lib/netstandard1.0/_._": {} + }, + "build": { + "build/netstandard2.0/NETStandard.Library.targets": {} + } + }, + "System.Buffers/4.4.0": { + "type": "package", + "compile": { + "ref/netstandard2.0/System.Buffers.dll": {} + }, + "runtime": { + "lib/netstandard2.0/System.Buffers.dll": {} + } + }, + "System.Globalization/4.3.0": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + }, + "compile": { + "ref/netstandard1.3/_._": {} + } + }, + "System.IO/4.3.0": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading.Tasks": "4.3.0" + }, + "compile": { + "ref/netstandard1.5/_._": {} + } + }, + "System.Memory/4.5.3": { + "type": "package", + "dependencies": { + "System.Buffers": "4.4.0", + "System.Numerics.Vectors": "4.4.0", + "System.Runtime.CompilerServices.Unsafe": "4.5.2" + }, + "compile": { + "lib/netstandard2.0/System.Memory.dll": {} + }, + "runtime": { + "lib/netstandard2.0/System.Memory.dll": {} + } + }, + "System.Numerics.Vectors/4.4.0": { + "type": "package", + "compile": { + "ref/netstandard2.0/System.Numerics.Vectors.dll": {} + }, + "runtime": { + "lib/netstandard2.0/System.Numerics.Vectors.dll": {} + } + }, + "System.Reflection/4.3.0": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.IO": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + }, + "compile": { + "ref/netstandard1.5/_._": {} + } + }, + "System.Reflection.Emit/4.6.0": { + "type": "package", + "dependencies": { + "System.Reflection.Emit.ILGeneration": "4.6.0" + }, + "compile": { + "ref/netstandard2.0/System.Reflection.Emit.dll": {} + }, + "runtime": { + "lib/netstandard2.0/System.Reflection.Emit.dll": {} + } + }, + "System.Reflection.Emit.ILGeneration/4.6.0": { + "type": "package", + "compile": { + "ref/netstandard2.0/System.Reflection.Emit.ILGeneration.dll": {} + }, + "runtime": { + "lib/netstandard2.0/System.Reflection.Emit.ILGeneration.dll": {} + } + }, + "System.Reflection.Emit.Lightweight/4.6.0": { + "type": "package", + "dependencies": { + "System.Reflection.Emit.ILGeneration": "4.6.0" + }, + "compile": { + "ref/netstandard2.0/System.Reflection.Emit.Lightweight.dll": {} + }, + "runtime": { + "lib/netstandard2.0/System.Reflection.Emit.Lightweight.dll": {} + } + }, + "System.Reflection.Primitives/4.3.0": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + }, + "compile": { + "ref/netstandard1.0/_._": {} + } + }, + "System.Resources.ResourceManager/4.3.0": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Globalization": "4.3.0", + "System.Reflection": "4.3.0", + "System.Runtime": "4.3.0" + }, + "compile": { + "ref/netstandard1.0/_._": {} + } + }, + "System.Runtime/4.3.0": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0" + }, + "compile": { + "ref/netstandard1.5/System.Runtime.dll": {} + } + }, + "System.Runtime.CompilerServices.Unsafe/4.5.2": { + "type": "package", + "compile": { + "ref/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": {} + }, + "runtime": { + "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": {} + } + }, + "System.Runtime.Serialization.Primitives/4.3.0": { + "type": "package", + "dependencies": { + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0" + }, + "compile": { + "ref/netstandard1.3/System.Runtime.Serialization.Primitives.dll": {} + }, + "runtime": { + "lib/netstandard1.3/System.Runtime.Serialization.Primitives.dll": {} + } + }, + "System.Text.Encoding/4.3.0": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + }, + "compile": { + "ref/netstandard1.3/_._": {} + } + }, + "System.Threading.Tasks/4.3.0": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + }, + "compile": { + "ref/netstandard1.3/_._": {} + } + }, + "System.Threading.Tasks.Extensions/4.5.3": { + "type": "package", + "dependencies": { + "System.Runtime.CompilerServices.Unsafe": "4.5.2" + }, + "compile": { + "lib/netstandard2.0/System.Threading.Tasks.Extensions.dll": {} + }, + "runtime": { + "lib/netstandard2.0/System.Threading.Tasks.Extensions.dll": {} + } + } + } + }, + "libraries": { + "Grpc.Core.Api/2.25.0": { + "sha512": "ax4qg0k4ZTlWf8PtZoU/hfbwWkgtCRIucVqqgXrRd9HYyieuilZtX6h55SwoFeW8sdNQs950gEkR5XHGStR0lQ==", + "type": "package", + "path": "grpc.core.api/2.25.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "grpc.core.api.2.25.0.nupkg.sha512", + "grpc.core.api.nuspec", + "lib/net45/Grpc.Core.Api.dll", + "lib/net45/Grpc.Core.Api.pdb", + "lib/net45/Grpc.Core.Api.xml", + "lib/netstandard1.5/Grpc.Core.Api.dll", + "lib/netstandard1.5/Grpc.Core.Api.pdb", + "lib/netstandard1.5/Grpc.Core.Api.xml", + "lib/netstandard2.0/Grpc.Core.Api.dll", + "lib/netstandard2.0/Grpc.Core.Api.pdb", + "lib/netstandard2.0/Grpc.Core.Api.xml" + ] + }, + "MagicOnion.Abstractions/3.0.0": { + "sha512": "dEsm+KFbH5qLqBS3BC9xELSMpqdcIQB/9jLkz82M37VRtjAR3I0wkglbsz5xrvD/kqWttB6YINz/4VVslbIOLA==", + "type": "package", + "path": "magiconion.abstractions/3.0.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netstandard2.0/MagicOnion.Abstractions.dll", + "lib/netstandard2.0/MagicOnion.Abstractions.xml", + "magiconion.abstractions.3.0.0.nupkg.sha512", + "magiconion.abstractions.nuspec" + ] + }, + "MagicOnion.MSBuild.Tasks/3.0.0": { + "sha512": "Mxb4ZkiLTeSXk5lYyqs4PvRNLrqJ98Aw3mL0+gsai+mqglPM28kLyTphjTgmQyOGN8cJiU40rAGL51BAu5PgUA==", + "type": "package", + "path": "magiconion.msbuild.tasks/3.0.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "build/MagicOnion.MSBuild.Tasks.props", + "magiconion.msbuild.tasks.3.0.0.nupkg.sha512", + "magiconion.msbuild.tasks.nuspec", + "tasks/netstandard2.0/MagicOnion.GeneratorCore.dll", + "tasks/netstandard2.0/MagicOnion.MSBuild.Tasks.dll", + "tasks/netstandard2.0/MagicOnion.MSBuild.Tasks.xml", + "tasks/netstandard2.0/Microsoft.Build.Framework.dll", + "tasks/netstandard2.0/Microsoft.Build.Utilities.Core.dll", + "tasks/netstandard2.0/Microsoft.CodeAnalysis.CSharp.Workspaces.dll", + "tasks/netstandard2.0/Microsoft.CodeAnalysis.CSharp.dll", + "tasks/netstandard2.0/Microsoft.CodeAnalysis.Workspaces.dll", + "tasks/netstandard2.0/Microsoft.CodeAnalysis.dll", + "tasks/netstandard2.0/Microsoft.Extensions.FileSystemGlobbing.dll", + "tasks/netstandard2.0/System.Buffers.dll", + "tasks/netstandard2.0/System.CodeDom.dll", + "tasks/netstandard2.0/System.Collections.Immutable.dll", + "tasks/netstandard2.0/System.Composition.AttributedModel.dll", + "tasks/netstandard2.0/System.Composition.Convention.dll", + "tasks/netstandard2.0/System.Composition.Hosting.dll", + "tasks/netstandard2.0/System.Composition.Runtime.dll", + "tasks/netstandard2.0/System.Composition.TypedParts.dll", + "tasks/netstandard2.0/System.Linq.Expressions.dll", + "tasks/netstandard2.0/System.Linq.dll", + "tasks/netstandard2.0/System.Memory.dll", + "tasks/netstandard2.0/System.Numerics.Vectors.dll", + "tasks/netstandard2.0/System.ObjectModel.dll", + "tasks/netstandard2.0/System.Reflection.Emit.ILGeneration.dll", + "tasks/netstandard2.0/System.Reflection.Emit.Lightweight.dll", + "tasks/netstandard2.0/System.Reflection.Emit.dll", + "tasks/netstandard2.0/System.Reflection.Metadata.dll", + "tasks/netstandard2.0/System.Reflection.TypeExtensions.dll", + "tasks/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll", + "tasks/netstandard2.0/System.Runtime.Serialization.Primitives.dll", + "tasks/netstandard2.0/System.Text.Encoding.CodePages.dll", + "tasks/netstandard2.0/System.Threading.Tasks.Extensions.dll", + "tasks/netstandard2.0/System.Threading.Thread.dll", + "tasks/netstandard2.0/System.Threading.dll", + "tasks/netstandard2.0/cs/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/cs/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/cs/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/cs/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/de/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/de/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/de/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/de/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/es/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/es/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/es/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/es/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/fr/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/fr/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/fr/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/fr/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/it/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/it/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/it/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/it/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/ja/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/ja/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/ja/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/ja/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/ko/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/ko/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/ko/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/ko/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/pl/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/pl/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/pl/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/pl/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/pt-BR/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/pt-BR/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/pt-BR/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/pt-BR/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/ru/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/ru/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/ru/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/ru/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/tr/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/tr/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/tr/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/tr/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/zh-Hans/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/zh-Hans/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/zh-Hans/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/zh-Hans/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/zh-Hant/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/zh-Hant/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/zh-Hant/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/zh-Hant/Microsoft.CodeAnalysis.resources.dll" + ] + }, + "MessagePack/2.0.323": { + "sha512": "pGKZRAfjnHeIHk/isMQ9A42YjhXt4RrGjuwM4j6FwZOKZmISMZltk4WFdJDU7bQ3y5CEQXTjxJ/O3tdSrg+eEA==", + "type": "package", + "path": "messagepack/2.0.323", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE", + "lib/netcoreapp2.1/MessagePack.dll", + "lib/netcoreapp2.1/MessagePack.xml", + "lib/netstandard2.0/MessagePack.dll", + "lib/netstandard2.0/MessagePack.xml", + "messagepack.2.0.323.nupkg.sha512", + "messagepack.nuspec" + ] + }, + "MessagePack.Annotations/2.0.323": { + "sha512": "b4fN2g9kbtC6ywNOBtx3pAmZQst6Dow7sQEGZYzaf45EVXU1WYiektoKdC9o4OIkyo1FejQ5JdiQo3C9CSufzg==", + "type": "package", + "path": "messagepack.annotations/2.0.323", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE", + "lib/netstandard2.0/MessagePack.Annotations.dll", + "lib/netstandard2.0/MessagePack.Annotations.xml", + "messagepack.annotations.2.0.323.nupkg.sha512", + "messagepack.annotations.nuspec" + ] + }, + "MessagePack.MSBuild.Tasks/2.0.323": { + "sha512": "/VFfPPzO1x9uSBz7KpqX0mOJf6UKTRAN7Ozk5YOJ4vPNtgaFcacx2frxLACOgl0MoKUVC9oUn+G/KMeSc7NEPA==", + "type": "package", + "path": "messagepack.msbuild.tasks/2.0.323", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE", + "build/MessagePack.MSBuild.Tasks.props", + "messagepack.msbuild.tasks.2.0.323.nupkg.sha512", + "messagepack.msbuild.tasks.nuspec", + "tasks/netstandard2.0/MessagePack.GeneratorCore.dll", + "tasks/netstandard2.0/MessagePack.MSBuild.Tasks.dll", + "tasks/netstandard2.0/MessagePack.MSBuild.Tasks.xml", + "tasks/netstandard2.0/Microsoft.Build.Framework.dll", + "tasks/netstandard2.0/Microsoft.Build.Utilities.Core.dll", + "tasks/netstandard2.0/Microsoft.CodeAnalysis.CSharp.Workspaces.dll", + "tasks/netstandard2.0/Microsoft.CodeAnalysis.CSharp.dll", + "tasks/netstandard2.0/Microsoft.CodeAnalysis.Workspaces.dll", + "tasks/netstandard2.0/Microsoft.CodeAnalysis.dll", + "tasks/netstandard2.0/Microsoft.Extensions.FileSystemGlobbing.dll", + "tasks/netstandard2.0/System.Buffers.dll", + "tasks/netstandard2.0/System.CodeDom.dll", + "tasks/netstandard2.0/System.Collections.Immutable.dll", + "tasks/netstandard2.0/System.Composition.AttributedModel.dll", + "tasks/netstandard2.0/System.Composition.Convention.dll", + "tasks/netstandard2.0/System.Composition.Hosting.dll", + "tasks/netstandard2.0/System.Composition.Runtime.dll", + "tasks/netstandard2.0/System.Composition.TypedParts.dll", + "tasks/netstandard2.0/System.Linq.Expressions.dll", + "tasks/netstandard2.0/System.Linq.dll", + "tasks/netstandard2.0/System.Memory.dll", + "tasks/netstandard2.0/System.Numerics.Vectors.dll", + "tasks/netstandard2.0/System.ObjectModel.dll", + "tasks/netstandard2.0/System.Reflection.Emit.ILGeneration.dll", + "tasks/netstandard2.0/System.Reflection.Emit.Lightweight.dll", + "tasks/netstandard2.0/System.Reflection.Emit.dll", + "tasks/netstandard2.0/System.Reflection.Metadata.dll", + "tasks/netstandard2.0/System.Reflection.TypeExtensions.dll", + "tasks/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll", + "tasks/netstandard2.0/System.Runtime.Serialization.Primitives.dll", + "tasks/netstandard2.0/System.Text.Encoding.CodePages.dll", + "tasks/netstandard2.0/System.Threading.Tasks.Extensions.dll", + "tasks/netstandard2.0/System.Threading.Thread.dll", + "tasks/netstandard2.0/System.Threading.dll", + "tasks/netstandard2.0/cs/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/cs/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/cs/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/cs/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/de/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/de/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/de/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/de/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/es/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/es/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/es/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/es/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/fr/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/fr/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/fr/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/fr/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/it/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/it/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/it/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/it/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/ja/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/ja/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/ja/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/ja/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/ko/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/ko/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/ko/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/ko/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/pl/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/pl/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/pl/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/pl/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/pt-BR/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/pt-BR/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/pt-BR/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/pt-BR/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/ru/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/ru/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/ru/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/ru/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/tr/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/tr/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/tr/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/tr/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/zh-Hans/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/zh-Hans/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/zh-Hans/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/zh-Hans/Microsoft.CodeAnalysis.resources.dll", + "tasks/netstandard2.0/zh-Hant/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", + "tasks/netstandard2.0/zh-Hant/Microsoft.CodeAnalysis.CSharp.resources.dll", + "tasks/netstandard2.0/zh-Hant/Microsoft.CodeAnalysis.Workspaces.resources.dll", + "tasks/netstandard2.0/zh-Hant/Microsoft.CodeAnalysis.resources.dll" + ] + }, + "Microsoft.NETCore.Platforms/1.1.0": { + "sha512": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==", + "type": "package", + "path": "microsoft.netcore.platforms/1.1.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/netstandard1.0/_._", + "microsoft.netcore.platforms.1.1.0.nupkg.sha512", + "microsoft.netcore.platforms.nuspec", + "runtime.json" + ] + }, + "Microsoft.NETCore.Targets/1.1.0": { + "sha512": "aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg==", + "type": "package", + "path": "microsoft.netcore.targets/1.1.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/netstandard1.0/_._", + "microsoft.netcore.targets.1.1.0.nupkg.sha512", + "microsoft.netcore.targets.nuspec", + "runtime.json" + ] + }, + "NETStandard.Library/2.0.3": { + "sha512": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", + "type": "package", + "path": "netstandard.library/2.0.3", + "files": [ + ".nupkg.metadata", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "build/netstandard2.0/NETStandard.Library.targets", + "build/netstandard2.0/ref/Microsoft.Win32.Primitives.dll", + "build/netstandard2.0/ref/System.AppContext.dll", + "build/netstandard2.0/ref/System.Collections.Concurrent.dll", + "build/netstandard2.0/ref/System.Collections.NonGeneric.dll", + "build/netstandard2.0/ref/System.Collections.Specialized.dll", + "build/netstandard2.0/ref/System.Collections.dll", + "build/netstandard2.0/ref/System.ComponentModel.Composition.dll", + "build/netstandard2.0/ref/System.ComponentModel.EventBasedAsync.dll", + "build/netstandard2.0/ref/System.ComponentModel.Primitives.dll", + "build/netstandard2.0/ref/System.ComponentModel.TypeConverter.dll", + "build/netstandard2.0/ref/System.ComponentModel.dll", + "build/netstandard2.0/ref/System.Console.dll", + "build/netstandard2.0/ref/System.Core.dll", + "build/netstandard2.0/ref/System.Data.Common.dll", + "build/netstandard2.0/ref/System.Data.dll", + "build/netstandard2.0/ref/System.Diagnostics.Contracts.dll", + "build/netstandard2.0/ref/System.Diagnostics.Debug.dll", + "build/netstandard2.0/ref/System.Diagnostics.FileVersionInfo.dll", + "build/netstandard2.0/ref/System.Diagnostics.Process.dll", + "build/netstandard2.0/ref/System.Diagnostics.StackTrace.dll", + "build/netstandard2.0/ref/System.Diagnostics.TextWriterTraceListener.dll", + "build/netstandard2.0/ref/System.Diagnostics.Tools.dll", + "build/netstandard2.0/ref/System.Diagnostics.TraceSource.dll", + "build/netstandard2.0/ref/System.Diagnostics.Tracing.dll", + "build/netstandard2.0/ref/System.Drawing.Primitives.dll", + "build/netstandard2.0/ref/System.Drawing.dll", + "build/netstandard2.0/ref/System.Dynamic.Runtime.dll", + "build/netstandard2.0/ref/System.Globalization.Calendars.dll", + "build/netstandard2.0/ref/System.Globalization.Extensions.dll", + "build/netstandard2.0/ref/System.Globalization.dll", + "build/netstandard2.0/ref/System.IO.Compression.FileSystem.dll", + "build/netstandard2.0/ref/System.IO.Compression.ZipFile.dll", + "build/netstandard2.0/ref/System.IO.Compression.dll", + "build/netstandard2.0/ref/System.IO.FileSystem.DriveInfo.dll", + "build/netstandard2.0/ref/System.IO.FileSystem.Primitives.dll", + "build/netstandard2.0/ref/System.IO.FileSystem.Watcher.dll", + "build/netstandard2.0/ref/System.IO.FileSystem.dll", + "build/netstandard2.0/ref/System.IO.IsolatedStorage.dll", + "build/netstandard2.0/ref/System.IO.MemoryMappedFiles.dll", + "build/netstandard2.0/ref/System.IO.Pipes.dll", + "build/netstandard2.0/ref/System.IO.UnmanagedMemoryStream.dll", + "build/netstandard2.0/ref/System.IO.dll", + "build/netstandard2.0/ref/System.Linq.Expressions.dll", + "build/netstandard2.0/ref/System.Linq.Parallel.dll", + "build/netstandard2.0/ref/System.Linq.Queryable.dll", + "build/netstandard2.0/ref/System.Linq.dll", + "build/netstandard2.0/ref/System.Net.Http.dll", + "build/netstandard2.0/ref/System.Net.NameResolution.dll", + "build/netstandard2.0/ref/System.Net.NetworkInformation.dll", + "build/netstandard2.0/ref/System.Net.Ping.dll", + "build/netstandard2.0/ref/System.Net.Primitives.dll", + "build/netstandard2.0/ref/System.Net.Requests.dll", + "build/netstandard2.0/ref/System.Net.Security.dll", + "build/netstandard2.0/ref/System.Net.Sockets.dll", + "build/netstandard2.0/ref/System.Net.WebHeaderCollection.dll", + "build/netstandard2.0/ref/System.Net.WebSockets.Client.dll", + "build/netstandard2.0/ref/System.Net.WebSockets.dll", + "build/netstandard2.0/ref/System.Net.dll", + "build/netstandard2.0/ref/System.Numerics.dll", + "build/netstandard2.0/ref/System.ObjectModel.dll", + "build/netstandard2.0/ref/System.Reflection.Extensions.dll", + "build/netstandard2.0/ref/System.Reflection.Primitives.dll", + "build/netstandard2.0/ref/System.Reflection.dll", + "build/netstandard2.0/ref/System.Resources.Reader.dll", + "build/netstandard2.0/ref/System.Resources.ResourceManager.dll", + "build/netstandard2.0/ref/System.Resources.Writer.dll", + "build/netstandard2.0/ref/System.Runtime.CompilerServices.VisualC.dll", + "build/netstandard2.0/ref/System.Runtime.Extensions.dll", + "build/netstandard2.0/ref/System.Runtime.Handles.dll", + "build/netstandard2.0/ref/System.Runtime.InteropServices.RuntimeInformation.dll", + "build/netstandard2.0/ref/System.Runtime.InteropServices.dll", + "build/netstandard2.0/ref/System.Runtime.Numerics.dll", + "build/netstandard2.0/ref/System.Runtime.Serialization.Formatters.dll", + "build/netstandard2.0/ref/System.Runtime.Serialization.Json.dll", + "build/netstandard2.0/ref/System.Runtime.Serialization.Primitives.dll", + "build/netstandard2.0/ref/System.Runtime.Serialization.Xml.dll", + "build/netstandard2.0/ref/System.Runtime.Serialization.dll", + "build/netstandard2.0/ref/System.Runtime.dll", + "build/netstandard2.0/ref/System.Security.Claims.dll", + "build/netstandard2.0/ref/System.Security.Cryptography.Algorithms.dll", + "build/netstandard2.0/ref/System.Security.Cryptography.Csp.dll", + "build/netstandard2.0/ref/System.Security.Cryptography.Encoding.dll", + "build/netstandard2.0/ref/System.Security.Cryptography.Primitives.dll", + "build/netstandard2.0/ref/System.Security.Cryptography.X509Certificates.dll", + "build/netstandard2.0/ref/System.Security.Principal.dll", + "build/netstandard2.0/ref/System.Security.SecureString.dll", + "build/netstandard2.0/ref/System.ServiceModel.Web.dll", + "build/netstandard2.0/ref/System.Text.Encoding.Extensions.dll", + "build/netstandard2.0/ref/System.Text.Encoding.dll", + "build/netstandard2.0/ref/System.Text.RegularExpressions.dll", + "build/netstandard2.0/ref/System.Threading.Overlapped.dll", + "build/netstandard2.0/ref/System.Threading.Tasks.Parallel.dll", + "build/netstandard2.0/ref/System.Threading.Tasks.dll", + "build/netstandard2.0/ref/System.Threading.Thread.dll", + "build/netstandard2.0/ref/System.Threading.ThreadPool.dll", + "build/netstandard2.0/ref/System.Threading.Timer.dll", + "build/netstandard2.0/ref/System.Threading.dll", + "build/netstandard2.0/ref/System.Transactions.dll", + "build/netstandard2.0/ref/System.ValueTuple.dll", + "build/netstandard2.0/ref/System.Web.dll", + "build/netstandard2.0/ref/System.Windows.dll", + "build/netstandard2.0/ref/System.Xml.Linq.dll", + "build/netstandard2.0/ref/System.Xml.ReaderWriter.dll", + "build/netstandard2.0/ref/System.Xml.Serialization.dll", + "build/netstandard2.0/ref/System.Xml.XDocument.dll", + "build/netstandard2.0/ref/System.Xml.XPath.XDocument.dll", + "build/netstandard2.0/ref/System.Xml.XPath.dll", + "build/netstandard2.0/ref/System.Xml.XmlDocument.dll", + "build/netstandard2.0/ref/System.Xml.XmlSerializer.dll", + "build/netstandard2.0/ref/System.Xml.dll", + "build/netstandard2.0/ref/System.dll", + "build/netstandard2.0/ref/mscorlib.dll", + "build/netstandard2.0/ref/netstandard.dll", + "build/netstandard2.0/ref/netstandard.xml", + "lib/netstandard1.0/_._", + "netstandard.library.2.0.3.nupkg.sha512", + "netstandard.library.nuspec" + ] + }, + "System.Buffers/4.4.0": { + "sha512": "AwarXzzoDwX6BgrhjoJsk6tUezZEozOT5Y9QKF94Gl4JK91I4PIIBkBco9068Y9/Dra8Dkbie99kXB8+1BaYKw==", + "type": "package", + "path": "system.buffers/4.4.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/netcoreapp2.0/_._", + "lib/netstandard1.1/System.Buffers.dll", + "lib/netstandard1.1/System.Buffers.xml", + "lib/netstandard2.0/System.Buffers.dll", + "lib/netstandard2.0/System.Buffers.xml", + "ref/netcoreapp2.0/_._", + "ref/netstandard1.1/System.Buffers.dll", + "ref/netstandard1.1/System.Buffers.xml", + "ref/netstandard2.0/System.Buffers.dll", + "ref/netstandard2.0/System.Buffers.xml", + "system.buffers.4.4.0.nupkg.sha512", + "system.buffers.nuspec", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "System.Globalization/4.3.0": { + "sha512": "kYdVd2f2PAdFGblzFswE4hkNANJBKRmsfa2X5LG2AcWE1c7/4t0pYae1L8vfZ5xvE2nK/R9JprtToA61OSHWIg==", + "type": "package", + "path": "system.globalization/4.3.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/portable-net45+win8+wp8+wpa81/_._", + "lib/win8/_._", + "lib/wp80/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/netcore50/System.Globalization.dll", + "ref/netcore50/System.Globalization.xml", + "ref/netcore50/de/System.Globalization.xml", + "ref/netcore50/es/System.Globalization.xml", + "ref/netcore50/fr/System.Globalization.xml", + "ref/netcore50/it/System.Globalization.xml", + "ref/netcore50/ja/System.Globalization.xml", + "ref/netcore50/ko/System.Globalization.xml", + "ref/netcore50/ru/System.Globalization.xml", + "ref/netcore50/zh-hans/System.Globalization.xml", + "ref/netcore50/zh-hant/System.Globalization.xml", + "ref/netstandard1.0/System.Globalization.dll", + "ref/netstandard1.0/System.Globalization.xml", + "ref/netstandard1.0/de/System.Globalization.xml", + "ref/netstandard1.0/es/System.Globalization.xml", + "ref/netstandard1.0/fr/System.Globalization.xml", + "ref/netstandard1.0/it/System.Globalization.xml", + "ref/netstandard1.0/ja/System.Globalization.xml", + "ref/netstandard1.0/ko/System.Globalization.xml", + "ref/netstandard1.0/ru/System.Globalization.xml", + "ref/netstandard1.0/zh-hans/System.Globalization.xml", + "ref/netstandard1.0/zh-hant/System.Globalization.xml", + "ref/netstandard1.3/System.Globalization.dll", + "ref/netstandard1.3/System.Globalization.xml", + "ref/netstandard1.3/de/System.Globalization.xml", + "ref/netstandard1.3/es/System.Globalization.xml", + "ref/netstandard1.3/fr/System.Globalization.xml", + "ref/netstandard1.3/it/System.Globalization.xml", + "ref/netstandard1.3/ja/System.Globalization.xml", + "ref/netstandard1.3/ko/System.Globalization.xml", + "ref/netstandard1.3/ru/System.Globalization.xml", + "ref/netstandard1.3/zh-hans/System.Globalization.xml", + "ref/netstandard1.3/zh-hant/System.Globalization.xml", + "ref/portable-net45+win8+wp8+wpa81/_._", + "ref/win8/_._", + "ref/wp80/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.globalization.4.3.0.nupkg.sha512", + "system.globalization.nuspec" + ] + }, + "System.IO/4.3.0": { + "sha512": "3qjaHvxQPDpSOYICjUoTsmoq5u6QJAFRUITgeT/4gqkF1bajbSmb1kwSxEA8AHlofqgcKJcM8udgieRNhaJ5Cg==", + "type": "package", + "path": "system.io/4.3.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/net462/System.IO.dll", + "lib/portable-net45+win8+wp8+wpa81/_._", + "lib/win8/_._", + "lib/wp80/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/net462/System.IO.dll", + "ref/netcore50/System.IO.dll", + "ref/netcore50/System.IO.xml", + "ref/netcore50/de/System.IO.xml", + "ref/netcore50/es/System.IO.xml", + "ref/netcore50/fr/System.IO.xml", + "ref/netcore50/it/System.IO.xml", + "ref/netcore50/ja/System.IO.xml", + "ref/netcore50/ko/System.IO.xml", + "ref/netcore50/ru/System.IO.xml", + "ref/netcore50/zh-hans/System.IO.xml", + "ref/netcore50/zh-hant/System.IO.xml", + "ref/netstandard1.0/System.IO.dll", + "ref/netstandard1.0/System.IO.xml", + "ref/netstandard1.0/de/System.IO.xml", + "ref/netstandard1.0/es/System.IO.xml", + "ref/netstandard1.0/fr/System.IO.xml", + "ref/netstandard1.0/it/System.IO.xml", + "ref/netstandard1.0/ja/System.IO.xml", + "ref/netstandard1.0/ko/System.IO.xml", + "ref/netstandard1.0/ru/System.IO.xml", + "ref/netstandard1.0/zh-hans/System.IO.xml", + "ref/netstandard1.0/zh-hant/System.IO.xml", + "ref/netstandard1.3/System.IO.dll", + "ref/netstandard1.3/System.IO.xml", + "ref/netstandard1.3/de/System.IO.xml", + "ref/netstandard1.3/es/System.IO.xml", + "ref/netstandard1.3/fr/System.IO.xml", + "ref/netstandard1.3/it/System.IO.xml", + "ref/netstandard1.3/ja/System.IO.xml", + "ref/netstandard1.3/ko/System.IO.xml", + "ref/netstandard1.3/ru/System.IO.xml", + "ref/netstandard1.3/zh-hans/System.IO.xml", + "ref/netstandard1.3/zh-hant/System.IO.xml", + "ref/netstandard1.5/System.IO.dll", + "ref/netstandard1.5/System.IO.xml", + "ref/netstandard1.5/de/System.IO.xml", + "ref/netstandard1.5/es/System.IO.xml", + "ref/netstandard1.5/fr/System.IO.xml", + "ref/netstandard1.5/it/System.IO.xml", + "ref/netstandard1.5/ja/System.IO.xml", + "ref/netstandard1.5/ko/System.IO.xml", + "ref/netstandard1.5/ru/System.IO.xml", + "ref/netstandard1.5/zh-hans/System.IO.xml", + "ref/netstandard1.5/zh-hant/System.IO.xml", + "ref/portable-net45+win8+wp8+wpa81/_._", + "ref/win8/_._", + "ref/wp80/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.io.4.3.0.nupkg.sha512", + "system.io.nuspec" + ] + }, + "System.Memory/4.5.3": { + "sha512": "3oDzvc/zzetpTKWMShs1AADwZjQ/36HnsufHRPcOjyRAAMLDlu2iD33MBI2opxnezcVUtXyqDXXjoFMOU9c7SA==", + "type": "package", + "path": "system.memory/4.5.3", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/netcoreapp2.1/_._", + "lib/netstandard1.1/System.Memory.dll", + "lib/netstandard1.1/System.Memory.xml", + "lib/netstandard2.0/System.Memory.dll", + "lib/netstandard2.0/System.Memory.xml", + "ref/netcoreapp2.1/_._", + "system.memory.4.5.3.nupkg.sha512", + "system.memory.nuspec", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "System.Numerics.Vectors/4.4.0": { + "sha512": "UiLzLW+Lw6HLed1Hcg+8jSRttrbuXv7DANVj0DkL9g6EnnzbL75EB7EWsw5uRbhxd/4YdG8li5XizGWepmG3PQ==", + "type": "package", + "path": "system.numerics.vectors/4.4.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net46/System.Numerics.Vectors.dll", + "lib/net46/System.Numerics.Vectors.xml", + "lib/netcoreapp2.0/_._", + "lib/netstandard1.0/System.Numerics.Vectors.dll", + "lib/netstandard1.0/System.Numerics.Vectors.xml", + "lib/netstandard2.0/System.Numerics.Vectors.dll", + "lib/netstandard2.0/System.Numerics.Vectors.xml", + "lib/portable-net45+win8+wp8+wpa81/System.Numerics.Vectors.dll", + "lib/portable-net45+win8+wp8+wpa81/System.Numerics.Vectors.xml", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net46/System.Numerics.Vectors.dll", + "ref/net46/System.Numerics.Vectors.xml", + "ref/netcoreapp2.0/_._", + "ref/netstandard1.0/System.Numerics.Vectors.dll", + "ref/netstandard1.0/System.Numerics.Vectors.xml", + "ref/netstandard2.0/System.Numerics.Vectors.dll", + "ref/netstandard2.0/System.Numerics.Vectors.xml", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.numerics.vectors.4.4.0.nupkg.sha512", + "system.numerics.vectors.nuspec", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "System.Reflection/4.3.0": { + "sha512": "KMiAFoW7MfJGa9nDFNcfu+FpEdiHpWgTcS2HdMpDvt9saK3y/G4GwprPyzqjFH9NTaGPQeWNHU+iDlDILj96aQ==", + "type": "package", + "path": "system.reflection/4.3.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/net462/System.Reflection.dll", + "lib/portable-net45+win8+wp8+wpa81/_._", + "lib/win8/_._", + "lib/wp80/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/net462/System.Reflection.dll", + "ref/netcore50/System.Reflection.dll", + "ref/netcore50/System.Reflection.xml", + "ref/netcore50/de/System.Reflection.xml", + "ref/netcore50/es/System.Reflection.xml", + "ref/netcore50/fr/System.Reflection.xml", + "ref/netcore50/it/System.Reflection.xml", + "ref/netcore50/ja/System.Reflection.xml", + "ref/netcore50/ko/System.Reflection.xml", + "ref/netcore50/ru/System.Reflection.xml", + "ref/netcore50/zh-hans/System.Reflection.xml", + "ref/netcore50/zh-hant/System.Reflection.xml", + "ref/netstandard1.0/System.Reflection.dll", + "ref/netstandard1.0/System.Reflection.xml", + "ref/netstandard1.0/de/System.Reflection.xml", + "ref/netstandard1.0/es/System.Reflection.xml", + "ref/netstandard1.0/fr/System.Reflection.xml", + "ref/netstandard1.0/it/System.Reflection.xml", + "ref/netstandard1.0/ja/System.Reflection.xml", + "ref/netstandard1.0/ko/System.Reflection.xml", + "ref/netstandard1.0/ru/System.Reflection.xml", + "ref/netstandard1.0/zh-hans/System.Reflection.xml", + "ref/netstandard1.0/zh-hant/System.Reflection.xml", + "ref/netstandard1.3/System.Reflection.dll", + "ref/netstandard1.3/System.Reflection.xml", + "ref/netstandard1.3/de/System.Reflection.xml", + "ref/netstandard1.3/es/System.Reflection.xml", + "ref/netstandard1.3/fr/System.Reflection.xml", + "ref/netstandard1.3/it/System.Reflection.xml", + "ref/netstandard1.3/ja/System.Reflection.xml", + "ref/netstandard1.3/ko/System.Reflection.xml", + "ref/netstandard1.3/ru/System.Reflection.xml", + "ref/netstandard1.3/zh-hans/System.Reflection.xml", + "ref/netstandard1.3/zh-hant/System.Reflection.xml", + "ref/netstandard1.5/System.Reflection.dll", + "ref/netstandard1.5/System.Reflection.xml", + "ref/netstandard1.5/de/System.Reflection.xml", + "ref/netstandard1.5/es/System.Reflection.xml", + "ref/netstandard1.5/fr/System.Reflection.xml", + "ref/netstandard1.5/it/System.Reflection.xml", + "ref/netstandard1.5/ja/System.Reflection.xml", + "ref/netstandard1.5/ko/System.Reflection.xml", + "ref/netstandard1.5/ru/System.Reflection.xml", + "ref/netstandard1.5/zh-hans/System.Reflection.xml", + "ref/netstandard1.5/zh-hant/System.Reflection.xml", + "ref/portable-net45+win8+wp8+wpa81/_._", + "ref/win8/_._", + "ref/wp80/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.reflection.4.3.0.nupkg.sha512", + "system.reflection.nuspec" + ] + }, + "System.Reflection.Emit/4.6.0": { + "sha512": "qAo4jyXtC9i71iElngX7P2r+zLaiHzxKwf66sc3X91tL5Ks6fnQ1vxL04o7ZSm3sYfLExySL7GN8aTpNYpU1qw==", + "type": "package", + "path": "system.reflection.emit/4.6.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/monoandroid10/_._", + "lib/net45/_._", + "lib/netcore50/System.Reflection.Emit.dll", + "lib/netcoreapp2.0/_._", + "lib/netstandard1.1/System.Reflection.Emit.dll", + "lib/netstandard1.1/System.Reflection.Emit.xml", + "lib/netstandard1.3/System.Reflection.Emit.dll", + "lib/netstandard2.0/System.Reflection.Emit.dll", + "lib/netstandard2.0/System.Reflection.Emit.xml", + "lib/netstandard2.1/_._", + "lib/xamarinmac20/_._", + "ref/monoandroid10/_._", + "ref/net45/_._", + "ref/netcoreapp2.0/_._", + "ref/netstandard1.1/System.Reflection.Emit.dll", + "ref/netstandard1.1/System.Reflection.Emit.xml", + "ref/netstandard1.1/de/System.Reflection.Emit.xml", + "ref/netstandard1.1/es/System.Reflection.Emit.xml", + "ref/netstandard1.1/fr/System.Reflection.Emit.xml", + "ref/netstandard1.1/it/System.Reflection.Emit.xml", + "ref/netstandard1.1/ja/System.Reflection.Emit.xml", + "ref/netstandard1.1/ko/System.Reflection.Emit.xml", + "ref/netstandard1.1/ru/System.Reflection.Emit.xml", + "ref/netstandard1.1/zh-hans/System.Reflection.Emit.xml", + "ref/netstandard1.1/zh-hant/System.Reflection.Emit.xml", + "ref/netstandard2.0/System.Reflection.Emit.dll", + "ref/netstandard2.0/System.Reflection.Emit.xml", + "ref/netstandard2.1/_._", + "ref/xamarinmac20/_._", + "runtimes/aot/lib/netcore50/System.Reflection.Emit.dll", + "runtimes/aot/lib/netcore50/System.Reflection.Emit.xml", + "system.reflection.emit.4.6.0.nupkg.sha512", + "system.reflection.emit.nuspec", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "System.Reflection.Emit.ILGeneration/4.6.0": { + "sha512": "z3r/uEhMj+1wUNUa/EA2bWxEL9M8bgFt/22xCOQivES28ex3zWxE+2j0gQF/mdRwzlr0jir64HVlwV5J4zTOfw==", + "type": "package", + "path": "system.reflection.emit.ilgeneration/4.6.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/netcore50/System.Reflection.Emit.ILGeneration.dll", + "lib/netcoreapp2.0/_._", + "lib/netstandard1.0/System.Reflection.Emit.ILGeneration.dll", + "lib/netstandard1.0/System.Reflection.Emit.ILGeneration.xml", + "lib/netstandard1.3/System.Reflection.Emit.ILGeneration.dll", + "lib/netstandard2.0/System.Reflection.Emit.ILGeneration.dll", + "lib/netstandard2.0/System.Reflection.Emit.ILGeneration.xml", + "lib/netstandard2.1/_._", + "lib/portable-net45+wp8/_._", + "lib/wp80/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/netcoreapp2.0/_._", + "ref/netstandard1.0/System.Reflection.Emit.ILGeneration.dll", + "ref/netstandard1.0/System.Reflection.Emit.ILGeneration.xml", + "ref/netstandard1.0/de/System.Reflection.Emit.ILGeneration.xml", + "ref/netstandard1.0/es/System.Reflection.Emit.ILGeneration.xml", + "ref/netstandard1.0/fr/System.Reflection.Emit.ILGeneration.xml", + "ref/netstandard1.0/it/System.Reflection.Emit.ILGeneration.xml", + "ref/netstandard1.0/ja/System.Reflection.Emit.ILGeneration.xml", + "ref/netstandard1.0/ko/System.Reflection.Emit.ILGeneration.xml", + "ref/netstandard1.0/ru/System.Reflection.Emit.ILGeneration.xml", + "ref/netstandard1.0/zh-hans/System.Reflection.Emit.ILGeneration.xml", + "ref/netstandard1.0/zh-hant/System.Reflection.Emit.ILGeneration.xml", + "ref/netstandard2.0/System.Reflection.Emit.ILGeneration.dll", + "ref/netstandard2.0/System.Reflection.Emit.ILGeneration.xml", + "ref/netstandard2.1/_._", + "ref/portable-net45+wp8/_._", + "ref/wp80/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "runtimes/aot/lib/netcore50/System.Reflection.Emit.ILGeneration.dll", + "runtimes/aot/lib/netcore50/System.Reflection.Emit.ILGeneration.xml", + "system.reflection.emit.ilgeneration.4.6.0.nupkg.sha512", + "system.reflection.emit.ilgeneration.nuspec", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "System.Reflection.Emit.Lightweight/4.6.0": { + "sha512": "j/V5HVvxvBQ7uubYD0PptQW2KGsi1Pc2kZ9yfwLixv3ADdjL/4M78KyC5e+ymW612DY8ZE4PFoZmWpoNmN2mqg==", + "type": "package", + "path": "system.reflection.emit.lightweight/4.6.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/netcore50/System.Reflection.Emit.Lightweight.dll", + "lib/netcoreapp2.0/_._", + "lib/netstandard1.0/System.Reflection.Emit.Lightweight.dll", + "lib/netstandard1.0/System.Reflection.Emit.Lightweight.xml", + "lib/netstandard1.3/System.Reflection.Emit.Lightweight.dll", + "lib/netstandard2.0/System.Reflection.Emit.Lightweight.dll", + "lib/netstandard2.0/System.Reflection.Emit.Lightweight.xml", + "lib/netstandard2.1/_._", + "lib/portable-net45+wp8/_._", + "lib/wp80/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/netcoreapp2.0/_._", + "ref/netstandard1.0/System.Reflection.Emit.Lightweight.dll", + "ref/netstandard1.0/System.Reflection.Emit.Lightweight.xml", + "ref/netstandard1.0/de/System.Reflection.Emit.Lightweight.xml", + "ref/netstandard1.0/es/System.Reflection.Emit.Lightweight.xml", + "ref/netstandard1.0/fr/System.Reflection.Emit.Lightweight.xml", + "ref/netstandard1.0/it/System.Reflection.Emit.Lightweight.xml", + "ref/netstandard1.0/ja/System.Reflection.Emit.Lightweight.xml", + "ref/netstandard1.0/ko/System.Reflection.Emit.Lightweight.xml", + "ref/netstandard1.0/ru/System.Reflection.Emit.Lightweight.xml", + "ref/netstandard1.0/zh-hans/System.Reflection.Emit.Lightweight.xml", + "ref/netstandard1.0/zh-hant/System.Reflection.Emit.Lightweight.xml", + "ref/netstandard2.0/System.Reflection.Emit.Lightweight.dll", + "ref/netstandard2.0/System.Reflection.Emit.Lightweight.xml", + "ref/netstandard2.1/_._", + "ref/portable-net45+wp8/_._", + "ref/wp80/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "runtimes/aot/lib/netcore50/System.Reflection.Emit.Lightweight.dll", + "runtimes/aot/lib/netcore50/System.Reflection.Emit.Lightweight.xml", + "system.reflection.emit.lightweight.4.6.0.nupkg.sha512", + "system.reflection.emit.lightweight.nuspec", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "System.Reflection.Primitives/4.3.0": { + "sha512": "5RXItQz5As4xN2/YUDxdpsEkMhvw3e6aNveFXUn4Hl/udNTCNhnKp8lT9fnc3MhvGKh1baak5CovpuQUXHAlIA==", + "type": "package", + "path": "system.reflection.primitives/4.3.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/portable-net45+win8+wp8+wpa81/_._", + "lib/win8/_._", + "lib/wp80/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/netcore50/System.Reflection.Primitives.dll", + "ref/netcore50/System.Reflection.Primitives.xml", + "ref/netcore50/de/System.Reflection.Primitives.xml", + "ref/netcore50/es/System.Reflection.Primitives.xml", + "ref/netcore50/fr/System.Reflection.Primitives.xml", + "ref/netcore50/it/System.Reflection.Primitives.xml", + "ref/netcore50/ja/System.Reflection.Primitives.xml", + "ref/netcore50/ko/System.Reflection.Primitives.xml", + "ref/netcore50/ru/System.Reflection.Primitives.xml", + "ref/netcore50/zh-hans/System.Reflection.Primitives.xml", + "ref/netcore50/zh-hant/System.Reflection.Primitives.xml", + "ref/netstandard1.0/System.Reflection.Primitives.dll", + "ref/netstandard1.0/System.Reflection.Primitives.xml", + "ref/netstandard1.0/de/System.Reflection.Primitives.xml", + "ref/netstandard1.0/es/System.Reflection.Primitives.xml", + "ref/netstandard1.0/fr/System.Reflection.Primitives.xml", + "ref/netstandard1.0/it/System.Reflection.Primitives.xml", + "ref/netstandard1.0/ja/System.Reflection.Primitives.xml", + "ref/netstandard1.0/ko/System.Reflection.Primitives.xml", + "ref/netstandard1.0/ru/System.Reflection.Primitives.xml", + "ref/netstandard1.0/zh-hans/System.Reflection.Primitives.xml", + "ref/netstandard1.0/zh-hant/System.Reflection.Primitives.xml", + "ref/portable-net45+win8+wp8+wpa81/_._", + "ref/win8/_._", + "ref/wp80/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.reflection.primitives.4.3.0.nupkg.sha512", + "system.reflection.primitives.nuspec" + ] + }, + "System.Resources.ResourceManager/4.3.0": { + "sha512": "/zrcPkkWdZmI4F92gL/TPumP98AVDu/Wxr3CSJGQQ+XN6wbRZcyfSKVoPo17ilb3iOr0cCRqJInGwNMolqhS8A==", + "type": "package", + "path": "system.resources.resourcemanager/4.3.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/portable-net45+win8+wp8+wpa81/_._", + "lib/win8/_._", + "lib/wp80/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/netcore50/System.Resources.ResourceManager.dll", + "ref/netcore50/System.Resources.ResourceManager.xml", + "ref/netcore50/de/System.Resources.ResourceManager.xml", + "ref/netcore50/es/System.Resources.ResourceManager.xml", + "ref/netcore50/fr/System.Resources.ResourceManager.xml", + "ref/netcore50/it/System.Resources.ResourceManager.xml", + "ref/netcore50/ja/System.Resources.ResourceManager.xml", + "ref/netcore50/ko/System.Resources.ResourceManager.xml", + "ref/netcore50/ru/System.Resources.ResourceManager.xml", + "ref/netcore50/zh-hans/System.Resources.ResourceManager.xml", + "ref/netcore50/zh-hant/System.Resources.ResourceManager.xml", + "ref/netstandard1.0/System.Resources.ResourceManager.dll", + "ref/netstandard1.0/System.Resources.ResourceManager.xml", + "ref/netstandard1.0/de/System.Resources.ResourceManager.xml", + "ref/netstandard1.0/es/System.Resources.ResourceManager.xml", + "ref/netstandard1.0/fr/System.Resources.ResourceManager.xml", + "ref/netstandard1.0/it/System.Resources.ResourceManager.xml", + "ref/netstandard1.0/ja/System.Resources.ResourceManager.xml", + "ref/netstandard1.0/ko/System.Resources.ResourceManager.xml", + "ref/netstandard1.0/ru/System.Resources.ResourceManager.xml", + "ref/netstandard1.0/zh-hans/System.Resources.ResourceManager.xml", + "ref/netstandard1.0/zh-hant/System.Resources.ResourceManager.xml", + "ref/portable-net45+win8+wp8+wpa81/_._", + "ref/win8/_._", + "ref/wp80/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.resources.resourcemanager.4.3.0.nupkg.sha512", + "system.resources.resourcemanager.nuspec" + ] + }, + "System.Runtime/4.3.0": { + "sha512": "JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==", + "type": "package", + "path": "system.runtime/4.3.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/net462/System.Runtime.dll", + "lib/portable-net45+win8+wp80+wpa81/_._", + "lib/win8/_._", + "lib/wp80/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/net462/System.Runtime.dll", + "ref/netcore50/System.Runtime.dll", + "ref/netcore50/System.Runtime.xml", + "ref/netcore50/de/System.Runtime.xml", + "ref/netcore50/es/System.Runtime.xml", + "ref/netcore50/fr/System.Runtime.xml", + "ref/netcore50/it/System.Runtime.xml", + "ref/netcore50/ja/System.Runtime.xml", + "ref/netcore50/ko/System.Runtime.xml", + "ref/netcore50/ru/System.Runtime.xml", + "ref/netcore50/zh-hans/System.Runtime.xml", + "ref/netcore50/zh-hant/System.Runtime.xml", + "ref/netstandard1.0/System.Runtime.dll", + "ref/netstandard1.0/System.Runtime.xml", + "ref/netstandard1.0/de/System.Runtime.xml", + "ref/netstandard1.0/es/System.Runtime.xml", + "ref/netstandard1.0/fr/System.Runtime.xml", + "ref/netstandard1.0/it/System.Runtime.xml", + "ref/netstandard1.0/ja/System.Runtime.xml", + "ref/netstandard1.0/ko/System.Runtime.xml", + "ref/netstandard1.0/ru/System.Runtime.xml", + "ref/netstandard1.0/zh-hans/System.Runtime.xml", + "ref/netstandard1.0/zh-hant/System.Runtime.xml", + "ref/netstandard1.2/System.Runtime.dll", + "ref/netstandard1.2/System.Runtime.xml", + "ref/netstandard1.2/de/System.Runtime.xml", + "ref/netstandard1.2/es/System.Runtime.xml", + "ref/netstandard1.2/fr/System.Runtime.xml", + "ref/netstandard1.2/it/System.Runtime.xml", + "ref/netstandard1.2/ja/System.Runtime.xml", + "ref/netstandard1.2/ko/System.Runtime.xml", + "ref/netstandard1.2/ru/System.Runtime.xml", + "ref/netstandard1.2/zh-hans/System.Runtime.xml", + "ref/netstandard1.2/zh-hant/System.Runtime.xml", + "ref/netstandard1.3/System.Runtime.dll", + "ref/netstandard1.3/System.Runtime.xml", + "ref/netstandard1.3/de/System.Runtime.xml", + "ref/netstandard1.3/es/System.Runtime.xml", + "ref/netstandard1.3/fr/System.Runtime.xml", + "ref/netstandard1.3/it/System.Runtime.xml", + "ref/netstandard1.3/ja/System.Runtime.xml", + "ref/netstandard1.3/ko/System.Runtime.xml", + "ref/netstandard1.3/ru/System.Runtime.xml", + "ref/netstandard1.3/zh-hans/System.Runtime.xml", + "ref/netstandard1.3/zh-hant/System.Runtime.xml", + "ref/netstandard1.5/System.Runtime.dll", + "ref/netstandard1.5/System.Runtime.xml", + "ref/netstandard1.5/de/System.Runtime.xml", + "ref/netstandard1.5/es/System.Runtime.xml", + "ref/netstandard1.5/fr/System.Runtime.xml", + "ref/netstandard1.5/it/System.Runtime.xml", + "ref/netstandard1.5/ja/System.Runtime.xml", + "ref/netstandard1.5/ko/System.Runtime.xml", + "ref/netstandard1.5/ru/System.Runtime.xml", + "ref/netstandard1.5/zh-hans/System.Runtime.xml", + "ref/netstandard1.5/zh-hant/System.Runtime.xml", + "ref/portable-net45+win8+wp80+wpa81/_._", + "ref/win8/_._", + "ref/wp80/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.runtime.4.3.0.nupkg.sha512", + "system.runtime.nuspec" + ] + }, + "System.Runtime.CompilerServices.Unsafe/4.5.2": { + "sha512": "wprSFgext8cwqymChhrBLu62LMg/1u92bU+VOwyfBimSPVFXtsNqEWC92Pf9ofzJFlk4IHmJA75EDJn1b2goAQ==", + "type": "package", + "path": "system.runtime.compilerservices.unsafe/4.5.2", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/netcoreapp2.0/System.Runtime.CompilerServices.Unsafe.dll", + "lib/netcoreapp2.0/System.Runtime.CompilerServices.Unsafe.xml", + "lib/netstandard1.0/System.Runtime.CompilerServices.Unsafe.dll", + "lib/netstandard1.0/System.Runtime.CompilerServices.Unsafe.xml", + "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll", + "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.xml", + "ref/netstandard1.0/System.Runtime.CompilerServices.Unsafe.dll", + "ref/netstandard1.0/System.Runtime.CompilerServices.Unsafe.xml", + "ref/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll", + "ref/netstandard2.0/System.Runtime.CompilerServices.Unsafe.xml", + "system.runtime.compilerservices.unsafe.4.5.2.nupkg.sha512", + "system.runtime.compilerservices.unsafe.nuspec", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "System.Runtime.Serialization.Primitives/4.3.0": { + "sha512": "Wz+0KOukJGAlXjtKr+5Xpuxf8+c8739RI1C+A2BoQZT+wMCCoMDDdO8/4IRHfaVINqL78GO8dW8G2lW/e45Mcw==", + "type": "package", + "path": "system.runtime.serialization.primitives/4.3.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/net46/System.Runtime.Serialization.Primitives.dll", + "lib/netcore50/System.Runtime.Serialization.Primitives.dll", + "lib/netstandard1.3/System.Runtime.Serialization.Primitives.dll", + "lib/portable-net45+win8+wp8+wpa81/_._", + "lib/win8/_._", + "lib/wp80/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/net46/System.Runtime.Serialization.Primitives.dll", + "ref/netcore50/System.Runtime.Serialization.Primitives.dll", + "ref/netcore50/System.Runtime.Serialization.Primitives.xml", + "ref/netcore50/de/System.Runtime.Serialization.Primitives.xml", + "ref/netcore50/es/System.Runtime.Serialization.Primitives.xml", + "ref/netcore50/fr/System.Runtime.Serialization.Primitives.xml", + "ref/netcore50/it/System.Runtime.Serialization.Primitives.xml", + "ref/netcore50/ja/System.Runtime.Serialization.Primitives.xml", + "ref/netcore50/ko/System.Runtime.Serialization.Primitives.xml", + "ref/netcore50/ru/System.Runtime.Serialization.Primitives.xml", + "ref/netcore50/zh-hans/System.Runtime.Serialization.Primitives.xml", + "ref/netcore50/zh-hant/System.Runtime.Serialization.Primitives.xml", + "ref/netstandard1.0/System.Runtime.Serialization.Primitives.dll", + "ref/netstandard1.0/System.Runtime.Serialization.Primitives.xml", + "ref/netstandard1.0/de/System.Runtime.Serialization.Primitives.xml", + "ref/netstandard1.0/es/System.Runtime.Serialization.Primitives.xml", + "ref/netstandard1.0/fr/System.Runtime.Serialization.Primitives.xml", + "ref/netstandard1.0/it/System.Runtime.Serialization.Primitives.xml", + "ref/netstandard1.0/ja/System.Runtime.Serialization.Primitives.xml", + "ref/netstandard1.0/ko/System.Runtime.Serialization.Primitives.xml", + "ref/netstandard1.0/ru/System.Runtime.Serialization.Primitives.xml", + "ref/netstandard1.0/zh-hans/System.Runtime.Serialization.Primitives.xml", + "ref/netstandard1.0/zh-hant/System.Runtime.Serialization.Primitives.xml", + "ref/netstandard1.3/System.Runtime.Serialization.Primitives.dll", + "ref/netstandard1.3/System.Runtime.Serialization.Primitives.xml", + "ref/netstandard1.3/de/System.Runtime.Serialization.Primitives.xml", + "ref/netstandard1.3/es/System.Runtime.Serialization.Primitives.xml", + "ref/netstandard1.3/fr/System.Runtime.Serialization.Primitives.xml", + "ref/netstandard1.3/it/System.Runtime.Serialization.Primitives.xml", + "ref/netstandard1.3/ja/System.Runtime.Serialization.Primitives.xml", + "ref/netstandard1.3/ko/System.Runtime.Serialization.Primitives.xml", + "ref/netstandard1.3/ru/System.Runtime.Serialization.Primitives.xml", + "ref/netstandard1.3/zh-hans/System.Runtime.Serialization.Primitives.xml", + "ref/netstandard1.3/zh-hant/System.Runtime.Serialization.Primitives.xml", + "ref/portable-net45+win8+wp8+wpa81/_._", + "ref/win8/_._", + "ref/wp80/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "runtimes/aot/lib/netcore50/System.Runtime.Serialization.Primitives.dll", + "system.runtime.serialization.primitives.4.3.0.nupkg.sha512", + "system.runtime.serialization.primitives.nuspec" + ] + }, + "System.Text.Encoding/4.3.0": { + "sha512": "BiIg+KWaSDOITze6jGQynxg64naAPtqGHBwDrLaCtixsa5bKiR8dpPOHA7ge3C0JJQizJE+sfkz1wV+BAKAYZw==", + "type": "package", + "path": "system.text.encoding/4.3.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/portable-net45+win8+wp8+wpa81/_._", + "lib/win8/_._", + "lib/wp80/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/netcore50/System.Text.Encoding.dll", + "ref/netcore50/System.Text.Encoding.xml", + "ref/netcore50/de/System.Text.Encoding.xml", + "ref/netcore50/es/System.Text.Encoding.xml", + "ref/netcore50/fr/System.Text.Encoding.xml", + "ref/netcore50/it/System.Text.Encoding.xml", + "ref/netcore50/ja/System.Text.Encoding.xml", + "ref/netcore50/ko/System.Text.Encoding.xml", + "ref/netcore50/ru/System.Text.Encoding.xml", + "ref/netcore50/zh-hans/System.Text.Encoding.xml", + "ref/netcore50/zh-hant/System.Text.Encoding.xml", + "ref/netstandard1.0/System.Text.Encoding.dll", + "ref/netstandard1.0/System.Text.Encoding.xml", + "ref/netstandard1.0/de/System.Text.Encoding.xml", + "ref/netstandard1.0/es/System.Text.Encoding.xml", + "ref/netstandard1.0/fr/System.Text.Encoding.xml", + "ref/netstandard1.0/it/System.Text.Encoding.xml", + "ref/netstandard1.0/ja/System.Text.Encoding.xml", + "ref/netstandard1.0/ko/System.Text.Encoding.xml", + "ref/netstandard1.0/ru/System.Text.Encoding.xml", + "ref/netstandard1.0/zh-hans/System.Text.Encoding.xml", + "ref/netstandard1.0/zh-hant/System.Text.Encoding.xml", + "ref/netstandard1.3/System.Text.Encoding.dll", + "ref/netstandard1.3/System.Text.Encoding.xml", + "ref/netstandard1.3/de/System.Text.Encoding.xml", + "ref/netstandard1.3/es/System.Text.Encoding.xml", + "ref/netstandard1.3/fr/System.Text.Encoding.xml", + "ref/netstandard1.3/it/System.Text.Encoding.xml", + "ref/netstandard1.3/ja/System.Text.Encoding.xml", + "ref/netstandard1.3/ko/System.Text.Encoding.xml", + "ref/netstandard1.3/ru/System.Text.Encoding.xml", + "ref/netstandard1.3/zh-hans/System.Text.Encoding.xml", + "ref/netstandard1.3/zh-hant/System.Text.Encoding.xml", + "ref/portable-net45+win8+wp8+wpa81/_._", + "ref/win8/_._", + "ref/wp80/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.text.encoding.4.3.0.nupkg.sha512", + "system.text.encoding.nuspec" + ] + }, + "System.Threading.Tasks/4.3.0": { + "sha512": "LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==", + "type": "package", + "path": "system.threading.tasks/4.3.0", + "files": [ + ".nupkg.metadata", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/net45/_._", + "lib/portable-net45+win8+wp8+wpa81/_._", + "lib/win8/_._", + "lib/wp80/_._", + "lib/wpa81/_._", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/net45/_._", + "ref/netcore50/System.Threading.Tasks.dll", + "ref/netcore50/System.Threading.Tasks.xml", + "ref/netcore50/de/System.Threading.Tasks.xml", + "ref/netcore50/es/System.Threading.Tasks.xml", + "ref/netcore50/fr/System.Threading.Tasks.xml", + "ref/netcore50/it/System.Threading.Tasks.xml", + "ref/netcore50/ja/System.Threading.Tasks.xml", + "ref/netcore50/ko/System.Threading.Tasks.xml", + "ref/netcore50/ru/System.Threading.Tasks.xml", + "ref/netcore50/zh-hans/System.Threading.Tasks.xml", + "ref/netcore50/zh-hant/System.Threading.Tasks.xml", + "ref/netstandard1.0/System.Threading.Tasks.dll", + "ref/netstandard1.0/System.Threading.Tasks.xml", + "ref/netstandard1.0/de/System.Threading.Tasks.xml", + "ref/netstandard1.0/es/System.Threading.Tasks.xml", + "ref/netstandard1.0/fr/System.Threading.Tasks.xml", + "ref/netstandard1.0/it/System.Threading.Tasks.xml", + "ref/netstandard1.0/ja/System.Threading.Tasks.xml", + "ref/netstandard1.0/ko/System.Threading.Tasks.xml", + "ref/netstandard1.0/ru/System.Threading.Tasks.xml", + "ref/netstandard1.0/zh-hans/System.Threading.Tasks.xml", + "ref/netstandard1.0/zh-hant/System.Threading.Tasks.xml", + "ref/netstandard1.3/System.Threading.Tasks.dll", + "ref/netstandard1.3/System.Threading.Tasks.xml", + "ref/netstandard1.3/de/System.Threading.Tasks.xml", + "ref/netstandard1.3/es/System.Threading.Tasks.xml", + "ref/netstandard1.3/fr/System.Threading.Tasks.xml", + "ref/netstandard1.3/it/System.Threading.Tasks.xml", + "ref/netstandard1.3/ja/System.Threading.Tasks.xml", + "ref/netstandard1.3/ko/System.Threading.Tasks.xml", + "ref/netstandard1.3/ru/System.Threading.Tasks.xml", + "ref/netstandard1.3/zh-hans/System.Threading.Tasks.xml", + "ref/netstandard1.3/zh-hant/System.Threading.Tasks.xml", + "ref/portable-net45+win8+wp8+wpa81/_._", + "ref/win8/_._", + "ref/wp80/_._", + "ref/wpa81/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.threading.tasks.4.3.0.nupkg.sha512", + "system.threading.tasks.nuspec" + ] + }, + "System.Threading.Tasks.Extensions/4.5.3": { + "sha512": "+MvhNtcvIbqmhANyKu91jQnvIRVSTiaOiFNfKWwXGHG48YAb4I/TyH8spsySiPYla7gKal5ZnF3teJqZAximyQ==", + "type": "package", + "path": "system.threading.tasks.extensions/4.5.3", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/MonoAndroid10/_._", + "lib/MonoTouch10/_._", + "lib/netcoreapp2.1/_._", + "lib/netstandard1.0/System.Threading.Tasks.Extensions.dll", + "lib/netstandard1.0/System.Threading.Tasks.Extensions.xml", + "lib/netstandard2.0/System.Threading.Tasks.Extensions.dll", + "lib/netstandard2.0/System.Threading.Tasks.Extensions.xml", + "lib/portable-net45+win8+wp8+wpa81/System.Threading.Tasks.Extensions.dll", + "lib/portable-net45+win8+wp8+wpa81/System.Threading.Tasks.Extensions.xml", + "lib/xamarinios10/_._", + "lib/xamarinmac20/_._", + "lib/xamarintvos10/_._", + "lib/xamarinwatchos10/_._", + "ref/MonoAndroid10/_._", + "ref/MonoTouch10/_._", + "ref/netcoreapp2.1/_._", + "ref/xamarinios10/_._", + "ref/xamarinmac20/_._", + "ref/xamarintvos10/_._", + "ref/xamarinwatchos10/_._", + "system.threading.tasks.extensions.4.5.3.nupkg.sha512", + "system.threading.tasks.extensions.nuspec", + "useSharedDesignerContext.txt", + "version.txt" + ] + } + }, + "projectFileDependencyGroups": { + ".NETStandard,Version=v2.0": [ + "MagicOnion.Abstractions >= 3.0.0", + "MagicOnion.MSBuild.Tasks >= 3.0.0", + "MessagePack.MSBuild.Tasks >= 2.0.323", + "NETStandard.Library >= 2.0.3" + ] + }, + "packageFolders": { + "C:\\Users\\rwvens\\.nuget\\packages\\": {}, + "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder": {} + }, + "project": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj", + "projectName": "Economy.Shared", + "projectPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj", + "packagesPath": "C:\\Users\\rwvens\\.nuget\\packages\\", + "outputPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\obj\\", + "projectStyle": "PackageReference", + "fallbackFolders": [ + "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" + ], + "configFilePaths": [ + "C:\\Users\\rwvens\\AppData\\Roaming\\NuGet\\NuGet.Config" + ], + "originalTargetFrameworks": [ + "netstandard2.0" + ], + "sources": { + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "netstandard2.0": { + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "netstandard2.0": { + "dependencies": { + "MagicOnion.Abstractions": { + "target": "Package", + "version": "[3.0.0, )" + }, + "MagicOnion.MSBuild.Tasks": { + "suppressParent": "All", + "target": "Package", + "version": "[3.0.0, )" + }, + "MessagePack.MSBuild.Tasks": { + "suppressParent": "All", + "target": "Package", + "version": "[2.0.323, )" + }, + "NETStandard.Library": { + "suppressParent": "All", + "target": "Package", + "version": "[2.0.3, )", + "autoReferenced": true + } + }, + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48" + ], + "assetTargetFallback": true, + "warn": true, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.102\\RuntimeIdentifierGraph.json" + } + } + } +} \ No newline at end of file diff --git a/Economy.Shared/obj/project.packagespec.json b/Economy.Shared/obj/project.packagespec.json new file mode 100644 index 000000000..ae7a6bfb2 --- /dev/null +++ b/Economy.Shared/obj/project.packagespec.json @@ -0,0 +1,66 @@ +{ + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj", + "projectName": "Economy.Shared", + "projectPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj", + "outputPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\obj\\", + "projectStyle": "PackageReference", + "fallbackFolders": [ + "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" + ], + "originalTargetFrameworks": [ + "netstandard2.0" + ], + "sources": { + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "netstandard2.0": { + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "netstandard2.0": { + "dependencies": { + "MagicOnion.Abstractions": { + "target": "Package", + "version": "[3.0.0, )" + }, + "MagicOnion.MSBuild.Tasks": { + "suppressParent": "All", + "target": "Package", + "version": "[3.0.0, )" + }, + "MessagePack.MSBuild.Tasks": { + "suppressParent": "All", + "target": "Package", + "version": "[2.0.323, )" + }, + "NETStandard.Library": { + "suppressParent": "All", + "target": "Package", + "version": "[2.0.3, )", + "autoReferenced": true + } + }, + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48" + ], + "assetTargetFallback": true, + "warn": true, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.102\\RuntimeIdentifierGraph.json" + } + } +} \ No newline at end of file diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 758d85461..413315f14 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b21e511c648612bdadabacd997e430d367ed4ebd6b276fa971e051d1df5cac2d -size 17278 +oid sha256:1ddee082ab5e93bd20912a25741b72ab3ea9c916a0c8556ea624f8a4bd8599f4 +size 17293