├── .gitignore ├── sandbox ├── BlazorApp1 │ ├── Message.cs │ ├── wwwroot │ │ ├── favicon.png │ │ └── app.css │ ├── appsettings.Development.json │ ├── appsettings.json │ ├── Components │ │ ├── Routes.razor │ │ ├── Layout │ │ │ ├── MainLayout.razor │ │ │ └── MainLayout.razor.css │ │ ├── Pages │ │ │ ├── Home.razor │ │ │ ├── Home.razor.cs │ │ │ └── Error.razor │ │ ├── _Imports.razor │ │ └── App.razor │ ├── BlazorApp1.csproj │ ├── LogService.cs │ ├── Program.cs │ └── Properties │ │ └── launchSettings.json ├── Benchmark │ ├── TestMessage.cs │ ├── Program.cs │ ├── PublishWithFilterBenchmark.cs │ ├── Benchmark.csproj │ ├── SubscribeDisposeBenchmark.cs │ ├── PublishBenchmark.cs │ └── .gitignore └── ConsoleApp1 │ ├── ConsoleApp1.csproj │ └── Program.cs ├── Icon.png ├── .gitattributes ├── docs ├── img_nugetforunity.png ├── img_benchmark_publish.png ├── img_benchmark_subscribe.png └── img_benchmark_publish_graph.png ├── src ├── ZeroMessenger.Unity │ ├── Packages │ │ ├── nuget-packages │ │ │ ├── InstalledPackages │ │ │ │ ├── System.Runtime.CompilerServices.Unsafe.6.0.0 │ │ │ │ │ ├── useSharedDesignerContext.txt │ │ │ │ │ ├── buildTransitive │ │ │ │ │ │ ├── netcoreapp3.1 │ │ │ │ │ │ │ ├── _._ │ │ │ │ │ │ │ └── _._.meta │ │ │ │ │ │ ├── netcoreapp2.0.meta │ │ │ │ │ │ ├── netcoreapp3.1.meta │ │ │ │ │ │ └── netcoreapp2.0 │ │ │ │ │ │ │ ├── System.Runtime.CompilerServices.Unsafe.targets.meta │ │ │ │ │ │ │ └── System.Runtime.CompilerServices.Unsafe.targets │ │ │ │ │ ├── Icon.png │ │ │ │ │ ├── .signature.p7s │ │ │ │ │ ├── LICENSE.TXT.meta │ │ │ │ │ ├── lib.meta │ │ │ │ │ ├── THIRD-PARTY-NOTICES.TXT.meta │ │ │ │ │ ├── useSharedDesignerContext.txt.meta │ │ │ │ │ ├── buildTransitive.meta │ │ │ │ │ ├── lib │ │ │ │ │ │ ├── netstandard2.0.meta │ │ │ │ │ │ └── netstandard2.0 │ │ │ │ │ │ │ ├── System.Runtime.CompilerServices.Unsafe.xml.meta │ │ │ │ │ │ │ ├── System.Runtime.CompilerServices.Unsafe.dll │ │ │ │ │ │ │ └── System.Runtime.CompilerServices.Unsafe.dll.meta │ │ │ │ │ ├── System.Runtime.CompilerServices.Unsafe.nuspec.meta │ │ │ │ │ ├── LICENSE.TXT │ │ │ │ │ ├── System.Runtime.CompilerServices.Unsafe.nuspec │ │ │ │ │ └── Icon.png.meta │ │ │ │ ├── ZeroMessenger.0.1.0 │ │ │ │ │ ├── README.md │ │ │ │ │ ├── Icon.png │ │ │ │ │ ├── .signature.p7s │ │ │ │ │ ├── README.md.meta │ │ │ │ │ ├── ZeroMessenger.nuspec.meta │ │ │ │ │ ├── lib.meta │ │ │ │ │ ├── lib │ │ │ │ │ │ ├── netstandard2.1 │ │ │ │ │ │ │ ├── ZeroMessenger.dll │ │ │ │ │ │ │ └── ZeroMessenger.dll.meta │ │ │ │ │ │ └── netstandard2.1.meta │ │ │ │ │ ├── ZeroMessenger.nuspec │ │ │ │ │ └── Icon.png.meta │ │ │ │ ├── ZeroMessenger.0.1.0.meta │ │ │ │ └── System.Runtime.CompilerServices.Unsafe.6.0.0.meta │ │ │ ├── package.json │ │ │ ├── package.json.meta │ │ │ ├── InstalledPackages.meta │ │ │ ├── packages.config │ │ │ ├── NuGet.config.meta │ │ │ ├── packages.config.meta │ │ │ └── NuGet.config │ │ ├── manifest.json │ │ └── packages-lock.json │ ├── ProjectSettings │ │ ├── ProjectVersion.txt │ │ ├── Packages │ │ │ └── com.unity.testtools.codecoverage │ │ │ │ └── Settings.json │ │ ├── ClusterInputManager.asset │ │ ├── PresetManager.asset │ │ ├── EditorBuildSettings.asset │ │ ├── XRSettings.asset │ │ ├── VersionControlSettings.asset │ │ ├── TimeManager.asset │ │ ├── VFXManager.asset │ │ ├── AudioManager.asset │ │ ├── TagManager.asset │ │ ├── PackageManagerSettings.asset │ │ ├── UnityConnectSettings.asset │ │ ├── DynamicsManager.asset │ │ ├── MemorySettings.asset │ │ ├── EditorSettings.asset │ │ ├── NavMeshAreas.asset │ │ ├── Physics2DSettings.asset │ │ ├── GraphicsSettings.asset │ │ ├── SceneTemplateSettings.json │ │ ├── InputManager.asset │ │ └── QualitySettings.asset │ ├── Assets │ │ ├── Sandbox │ │ │ ├── TestMessage.cs │ │ │ ├── SampleScene.unity.meta │ │ │ ├── TestMessage.cs.meta │ │ │ ├── PublisherTest.cs.meta │ │ │ ├── SubscriberTest.cs.meta │ │ │ ├── SandboxLifetimeScope.cs.meta │ │ │ ├── SandboxLifetimeScope.cs │ │ │ ├── SubscriberTest.cs │ │ │ └── PublisherTest.cs │ │ ├── Sandbox.meta │ │ ├── ZeroMessenger.VContainer │ │ │ ├── package.json.meta │ │ │ ├── Runtime.meta │ │ │ ├── Runtime │ │ │ │ ├── ZeroMessenger.VContainer.asmdef.meta │ │ │ │ ├── ContainerBuilderExtensions.cs.meta │ │ │ │ ├── ZeroMessenger.VContainer.asmdef │ │ │ │ └── ContainerBuilderExtensions.cs │ │ │ └── package.json │ │ └── ZeroMessenger.VContainer.meta │ └── .gitignore ├── ZeroMessenger │ ├── AsyncPublishStrategy.cs │ ├── Internal │ │ ├── PreserveAttribute.cs │ │ ├── TaskExtensions.cs │ │ ├── Shims │ │ │ └── CancellationTokenExtensions.cs │ │ ├── MessageFilterProvider.cs │ │ ├── MessageBrokerPublisherSubscriber.cs │ │ ├── LinkedPool.cs │ │ ├── PooledList.cs │ │ ├── ThrowHelper.cs │ │ ├── FastListCore.cs │ │ ├── MessageHandlerList.cs │ │ └── WhenAll.cs │ ├── IMessageFilter.cs │ ├── IMessageSubscriber.cs │ ├── MessageHandler.cs │ ├── IMessagePublisher.cs │ ├── AnonymousMessageFilter.cs │ ├── PredicateFilter.cs │ ├── AsyncMessageHandler.cs │ ├── AnonymousMessageHandler.cs │ ├── MessageHandlerNode.cs │ ├── FilteredMessageSubscriber.cs │ ├── MessageSubscriberExtensions.cs │ ├── ZeroMessenger.csproj │ ├── AsyncSubscribeStrategy.cs │ ├── MessageSubscriberFilterExtensions.cs │ ├── MessageSubscriberAsyncExtensions.cs │ ├── FilteredHandlers.cs │ ├── MessageBroker.cs │ └── .gitignore ├── ZeroMessenger.R3 │ ├── ZeroMessenger.R3.csproj │ └── MessageSubscriberR3Extensions.cs └── ZeroMessenger.DependencyInjection │ ├── ZeroMessenger.DependencyInjection.csproj │ └── ServiceCollectionExtensions.cs ├── Directory.Build.props ├── tests └── ZeroMessenger.Tests │ ├── TestMessageFilter.cs │ ├── ZeroMessenger.Tests.csproj │ ├── MessageBrokerTests.cs │ ├── DependencyInjectionTests.cs │ └── FilterTests.cs ├── LICENSE └── ZeroMessenger.sln /.gitignore: -------------------------------------------------------------------------------- 1 | *.DS_Store -------------------------------------------------------------------------------- /sandbox/BlazorApp1/Message.cs: -------------------------------------------------------------------------------- 1 | public record struct Message(string Text); -------------------------------------------------------------------------------- /Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/annulusgames/ZeroMessenger/HEAD/Icon.png -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /docs/img_nugetforunity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/annulusgames/ZeroMessenger/HEAD/docs/img_nugetforunity.png -------------------------------------------------------------------------------- /docs/img_benchmark_publish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/annulusgames/ZeroMessenger/HEAD/docs/img_benchmark_publish.png -------------------------------------------------------------------------------- /docs/img_benchmark_subscribe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/annulusgames/ZeroMessenger/HEAD/docs/img_benchmark_subscribe.png -------------------------------------------------------------------------------- /docs/img_benchmark_publish_graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/annulusgames/ZeroMessenger/HEAD/docs/img_benchmark_publish_graph.png -------------------------------------------------------------------------------- /sandbox/BlazorApp1/wwwroot/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/annulusgames/ZeroMessenger/HEAD/sandbox/BlazorApp1/wwwroot/favicon.png -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/useSharedDesignerContext.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/buildTransitive/netcoreapp3.1/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2022.3.44f1 2 | m_EditorVersionWithRevision: 2022.3.44f1 (c3ae09b9f03c) 3 | -------------------------------------------------------------------------------- /src/ZeroMessenger/AsyncPublishStrategy.cs: -------------------------------------------------------------------------------- 1 | namespace ZeroMessenger; 2 | 3 | public enum AsyncPublishStrategy 4 | { 5 | Parallel, 6 | Sequential, 7 | } 8 | -------------------------------------------------------------------------------- /sandbox/Benchmark/TestMessage.cs: -------------------------------------------------------------------------------- 1 | 2 | using MediatR; 3 | using VitalRouter; 4 | 5 | public class TestMessage : PubSubEvent, INotification, ICommand 6 | { 7 | } -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "m_Dictionary": { 3 | "m_DictionaryValues": [] 4 | } 5 | } -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Assets/Sandbox/TestMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Sandbox 2 | { 3 | public struct TestMessage 4 | { 5 | public string Message { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/package.json: -------------------------------------------------------------------------------- 1 | { "name": "nuget-packages","version": "1.0.0","displayName": "NuGetPackages", "description": "NuGetPackages", "dependencies": {}} -------------------------------------------------------------------------------- /sandbox/BlazorApp1/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/ZeroMessenger.0.1.0/README.md: -------------------------------------------------------------------------------- 1 | # Zero Messenger 2 | Zero-allocation, extremely fast in-memory messaging library for .NET and Unity. 3 | 4 | -------------------------------------------------------------------------------- /sandbox/BlazorApp1/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_DefaultPresets: {} 8 | -------------------------------------------------------------------------------- /src/ZeroMessenger/Internal/PreserveAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace ZeroMessenger.Internal; 2 | 3 | // Preserve for Unity IL2CPP 4 | 5 | [AttributeUsage(AttributeTargets.All)] 6 | internal sealed class PreserveAttribute : Attribute 7 | { 8 | } -------------------------------------------------------------------------------- /src/ZeroMessenger/Internal/TaskExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace ZeroMessenger.Internal; 2 | 3 | internal static class TaskExtensions 4 | { 5 | internal static async void Forget(this ValueTask task) 6 | { 7 | await task; 8 | } 9 | } -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Assets/Sandbox.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: db0f930a15d724b468019ee2857eb97e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Assets/Sandbox/SampleScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9fc0d4010bbf28b4594072e72b8655ab 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/ZeroMessenger.0.1.0/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/annulusgames/ZeroMessenger/HEAD/src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/ZeroMessenger.0.1.0/Icon.png -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fc02ab8af748f4a53abb62be8c29565b 3 | PackageManifestImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: [] 8 | m_configObjects: {} 9 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Assets/ZeroMessenger.VContainer/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dc27bb764c5c04ab3b892c7056148778 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/ZeroMessenger.0.1.0/.signature.p7s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/annulusgames/ZeroMessenger/HEAD/src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/ZeroMessenger.0.1.0/.signature.p7s -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Assets/ZeroMessenger.VContainer.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 98748907b0ffe498099de6088b3ccbd3 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Assets/ZeroMessenger.VContainer/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5d11e4ccf43b8442a84fc2e3c6f270f8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4ae546ff6ce5e47648bdf5c61ede4762 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/ZeroMessenger.0.1.0/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ea37bfe339f54ef5ac03daa8c85a6f2 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/ProjectSettings/VersionControlSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!890905787 &1 4 | VersionControlSettings: 5 | m_ObjectHideFlags: 0 6 | m_Mode: Visible Meta Files 7 | m_CollabEditorSettings: 8 | inProgressEnabled: 1 9 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Assets/ZeroMessenger.VContainer/Runtime/ZeroMessenger.VContainer.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 16126f82f7b274e4ea5e990a31f954c4 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/ZeroMessenger.0.1.0.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 91736454c95a84aa598264fdb7bb0c89 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/ZeroMessenger.0.1.0/ZeroMessenger.nuspec.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 40ebf7f4c8f1443e38df793c63f42b07 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/ZeroMessenger.0.1.0/lib.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9ec99498bbf1447fab9ca39ed9ab9687 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/annulusgames/ZeroMessenger/HEAD/src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/Icon.png -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/ZeroMessenger.0.1.0/lib/netstandard2.1/ZeroMessenger.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/annulusgames/ZeroMessenger/HEAD/src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/ZeroMessenger.0.1.0/lib/netstandard2.1/ZeroMessenger.dll -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/.signature.p7s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/annulusgames/ZeroMessenger/HEAD/src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/.signature.p7s -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/LICENSE.TXT.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba1eccdf6b1704ec9bc377ff4f468b2f 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/ZeroMessenger.0.1.0/lib/netstandard2.1.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4c3db735d52b44a1a9c409e5da99fcd4 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /sandbox/BlazorApp1/Components/Routes.razor: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 88298f4dc080d49b5b6d37ffd84f5f42 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/lib.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 237c17566f94a4dedac579f71574c3fc 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/THIRD-PARTY-NOTICES.TXT.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2d4dfac35688e4da3b5deb25202d6a95 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/buildTransitive/netcoreapp3.1/_._.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f4f1472e0f0a7438a9a6f22139e1257d 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/useSharedDesignerContext.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bb904f508c58e41d18cf8269b31d98b4 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/buildTransitive.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8663bbd1a7c744908b78428d2e61184c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/lib/netstandard2.0.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 695920858ed0f40449963fd6db9892cd 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/System.Runtime.CompilerServices.Unsafe.nuspec.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d69f7586b7aea417d9ec66f24c8a3bf6 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/buildTransitive/netcoreapp2.0.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8052bbf69973f4849b1959274f07e81d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/buildTransitive/netcoreapp3.1.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8445fe76b755d41e7999137d1667aa14 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Assets/Sandbox/TestMessage.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4cab8894332db48289fcebd3ef7ac2ba 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Assets/Sandbox/PublisherTest.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 64e1b10f910ce42c1899a0f0a997e6e6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Assets/Sandbox/SubscriberTest.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c1ceb254681694441b528113c3aa2f5f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.xml.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8e8eb68122ffd4ff98b7cddc27135911 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Assets/Sandbox/SandboxLifetimeScope.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bfcf65fab6a514531a72c8dce930b7d0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/buildTransitive/netcoreapp2.0/System.Runtime.CompilerServices.Unsafe.targets.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e49212a5f082f4e2ca8cc1b6178b2aa1 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /src/ZeroMessenger/IMessageFilter.cs: -------------------------------------------------------------------------------- 1 | using ZeroMessenger.Internal; 2 | 3 | namespace ZeroMessenger; 4 | 5 | public interface IMessageFilterBase 6 | { 7 | } 8 | 9 | [Preserve] 10 | public interface IMessageFilter : IMessageFilterBase 11 | { 12 | ValueTask InvokeAsync(T message, CancellationToken cancellationToken, Func next); 13 | } -------------------------------------------------------------------------------- /src/ZeroMessenger/IMessageSubscriber.cs: -------------------------------------------------------------------------------- 1 | using ZeroMessenger.Internal; 2 | 3 | namespace ZeroMessenger; 4 | 5 | [Preserve] 6 | public interface IMessageSubscriber 7 | { 8 | IDisposable Subscribe(MessageHandler handler); 9 | IDisposable SubscribeAwait(AsyncMessageHandler handler, AsyncSubscribeStrategy subscribeStrategy = AsyncSubscribeStrategy.Sequential); 10 | } -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Assets/ZeroMessenger.VContainer/Runtime/ContainerBuilderExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5c7323f30801a4da28ec0d4bd40fe6e2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/annulusgames/ZeroMessenger/HEAD/src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll -------------------------------------------------------------------------------- /src/ZeroMessenger/MessageHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | namespace ZeroMessenger; 4 | 5 | public abstract class MessageHandler : MessageHandlerNode 6 | { 7 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 8 | public void Handle(T message) 9 | { 10 | HandleCore(message); 11 | } 12 | 13 | protected virtual void HandleCore(T message) { } 14 | } -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Assets/Sandbox/SandboxLifetimeScope.cs: -------------------------------------------------------------------------------- 1 | using VContainer; 2 | using VContainer.Unity; 3 | using ZeroMessenger.VContainer; 4 | 5 | namespace Sandbox 6 | { 7 | public class SandboxLifetimeScope : LifetimeScope 8 | { 9 | protected override void Configure(IContainerBuilder builder) 10 | { 11 | builder.AddZeroMessenger(); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /sandbox/BlazorApp1/Components/Layout/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 |
4 |
5 |
6 | @Body 7 |
8 |
9 |
10 | 11 |
12 | An unhandled error has occurred. 13 | Reload 14 | 🗙 15 |
16 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_StripUpdateShader: {fileID: 0} 10 | m_RenderPipeSettingsPath: 11 | m_FixedTimeStep: 0.016666668 12 | m_MaxDeltaTime: 0.05 13 | -------------------------------------------------------------------------------- /src/ZeroMessenger/IMessagePublisher.cs: -------------------------------------------------------------------------------- 1 | using ZeroMessenger.Internal; 2 | 3 | namespace ZeroMessenger; 4 | 5 | [Preserve] 6 | public interface IMessagePublisher 7 | { 8 | void Publish(T message, CancellationToken cancellationToken = default); 9 | ValueTask PublishAsync(T message, AsyncPublishStrategy publishStrategy = AsyncPublishStrategy.Parallel, CancellationToken cancellationToken = default); 10 | } 11 | -------------------------------------------------------------------------------- /src/ZeroMessenger/AnonymousMessageFilter.cs: -------------------------------------------------------------------------------- 1 | namespace ZeroMessenger; 2 | 3 | internal sealed class AnonymousMessageFilter(Func, ValueTask> filter) : IMessageFilter 4 | { 5 | public ValueTask InvokeAsync(T message, CancellationToken cancellationToken, Func next) 6 | { 7 | return filter(message, cancellationToken, next); 8 | } 9 | } -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Assets/ZeroMessenger.VContainer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.annulusgames.zero-messenger.vcontainer", 3 | "version": "1.0.4", 4 | "displayName": "ZeroMessenger.VContainer", 5 | "description": "VContainer extensions for ZeroMessenger", 6 | "category": "Scripting", 7 | "dependencies": { 8 | }, 9 | "license": "MIT", 10 | "author": { 11 | "name": "Annulus Games" 12 | } 13 | } -------------------------------------------------------------------------------- /sandbox/BlazorApp1/Components/Pages/Home.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | 3 | Home 4 | 5 |

ZeroMessenger Test

6 | 7 |
8 | 9 |
10 | 13 |
14 |
15 | 16 |
17 | -------------------------------------------------------------------------------- /sandbox/BlazorApp1/Components/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using System.Net.Http.Json 3 | @using Microsoft.AspNetCore.Components.Forms 4 | @using Microsoft.AspNetCore.Components.Routing 5 | @using Microsoft.AspNetCore.Components.Web 6 | @using static Microsoft.AspNetCore.Components.Web.RenderMode 7 | @using Microsoft.AspNetCore.Components.Web.Virtualization 8 | @using Microsoft.JSInterop 9 | @using BlazorApp1 10 | @using BlazorApp1.Components 11 | -------------------------------------------------------------------------------- /sandbox/BlazorApp1/BlazorApp1.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/ZeroMessenger/Internal/Shims/CancellationTokenExtensions.cs: -------------------------------------------------------------------------------- 1 | #if NETSTANDARD2_0 || NETSTANDARD2_1 2 | 3 | namespace System.Threading; 4 | 5 | internal static class CancellationTokenExtensions 6 | { 7 | public static CancellationTokenRegistration UnsafeRegister(this CancellationToken cancellationToken, Action callback, object? state) 8 | { 9 | return cancellationToken.Register(callback, state, useSynchronizationContext: false); 10 | } 11 | } 12 | 13 | #endif -------------------------------------------------------------------------------- /sandbox/BlazorApp1/Components/Pages/Home.razor.cs: -------------------------------------------------------------------------------- 1 | 2 | using Microsoft.AspNetCore.Components; 3 | using ZeroMessenger; 4 | 5 | namespace BlazorApp1.Components.Pages; 6 | 7 | public partial class Home 8 | { 9 | [Inject] 10 | public required IMessagePublisher Publisher { get; init; } 11 | 12 | [SupplyParameterFromForm] 13 | public string TextInput { get; set; } = ""; 14 | 15 | public void OnSubmit() 16 | { 17 | Publisher.Publish(new Message(TextInput)); 18 | } 19 | } -------------------------------------------------------------------------------- /sandbox/Benchmark/Program.cs: -------------------------------------------------------------------------------- 1 | using BenchmarkDotNet.Configs; 2 | using BenchmarkDotNet.Diagnosers; 3 | using BenchmarkDotNet.Jobs; 4 | using BenchmarkDotNet.Running; 5 | using System.Reflection; 6 | 7 | BenchmarkSwitcher.FromAssembly(Assembly.GetEntryAssembly()!).Run(args); 8 | 9 | class BenchmarkConfig : ManualConfig 10 | { 11 | public BenchmarkConfig() 12 | { 13 | AddDiagnoser(MemoryDiagnoser.Default); 14 | AddJob(Job.ShortRun 15 | .WithWarmupCount(5) 16 | .WithIterationCount(50)); 17 | } 18 | } -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Volume: 1 8 | Rolloff Scale: 1 9 | Doppler Factor: 1 10 | Default Speaker Mode: 2 11 | m_SampleRate: 0 12 | m_DSPBufferSize: 1024 13 | m_VirtualVoiceCount: 512 14 | m_RealVoiceCount: 32 15 | m_SpatializerPlugin: 16 | m_AmbisonicDecoderPlugin: 17 | m_DisableAudio: 0 18 | m_VirtualizeEffects: 1 19 | m_RequestedDSPBufferSize: 1024 20 | -------------------------------------------------------------------------------- /src/ZeroMessenger/PredicateFilter.cs: -------------------------------------------------------------------------------- 1 | 2 | using ZeroMessenger.Internal; 3 | 4 | namespace ZeroMessenger; 5 | 6 | [method: Preserve] 7 | public sealed class PredicateFilter(Predicate predicate) : IMessageFilter 8 | { 9 | public ValueTask InvokeAsync(T message, CancellationToken cancellationToken, Func next) 10 | { 11 | if (predicate(message)) 12 | { 13 | return next(message, cancellationToken); 14 | } 15 | else 16 | { 17 | return default; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/NuGet.config.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 999e578752a4242e18222ff5d3b6895c 3 | labels: 4 | - NuGetForUnity 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | defineConstraints: [] 11 | isPreloaded: 0 12 | isOverridable: 0 13 | isExplicitlyReferenced: 0 14 | validateReferences: 1 15 | platformData: 16 | - first: 17 | Any: 18 | second: 19 | enabled: 1 20 | settings: {} 21 | userData: 22 | assetBundleName: 23 | assetBundleVariant: 24 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Assets/ZeroMessenger.VContainer/Runtime/ZeroMessenger.VContainer.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ZeroMessenger.VContainer", 3 | "rootNamespace": "", 4 | "references": [ 5 | "GUID:b0214a6008ed146ff8f122a6a9c2f6cc" 6 | ], 7 | "includePlatforms": [], 8 | "excludePlatforms": [], 9 | "allowUnsafeCode": false, 10 | "overrideReferences": true, 11 | "precompiledReferences": [ 12 | "ZeroMessenger.dll" 13 | ], 14 | "autoReferenced": true, 15 | "defineConstraints": [], 16 | "versionDefines": [], 17 | "noEngineReferences": false 18 | } -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/packages.config.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 31e1acdc1a0b94428aef92ac941f7437 3 | labels: 4 | - NuGetForUnity 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | defineConstraints: [] 11 | isPreloaded: 0 12 | isOverridable: 0 13 | isExplicitlyReferenced: 0 14 | validateReferences: 1 15 | platformData: 16 | - first: 17 | Any: 18 | second: 19 | enabled: 1 20 | settings: {} 21 | userData: 22 | assetBundleName: 23 | assetBundleVariant: 24 | -------------------------------------------------------------------------------- /src/ZeroMessenger/AsyncMessageHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | namespace ZeroMessenger; 4 | 5 | public abstract class AsyncMessageHandler : MessageHandlerNode 6 | { 7 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 8 | public ValueTask HandleAsync(T message, CancellationToken cancellationToken = default) 9 | { 10 | return HandleAsyncCore(message, cancellationToken); 11 | } 12 | 13 | protected virtual ValueTask HandleAsyncCore(T message, CancellationToken cancellationToken = default) 14 | { 15 | return default; 16 | } 17 | } -------------------------------------------------------------------------------- /src/ZeroMessenger/Internal/MessageFilterProvider.cs: -------------------------------------------------------------------------------- 1 | namespace ZeroMessenger.Internal; 2 | 3 | // for Dependency Injection 4 | 5 | [Preserve] 6 | [method: Preserve] 7 | public sealed class MessageFilterProvider(IEnumerable untypedFilters, IEnumerable> typedFilters) 8 | { 9 | readonly IMessageFilter[] filters = untypedFilters 10 | .OfType>() 11 | .Concat(typedFilters) 12 | .Distinct() 13 | .ToArray(); 14 | 15 | public IEnumerable> GetGlobalFilters() 16 | { 17 | return filters; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /sandbox/BlazorApp1/Components/App.razor: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/buildTransitive/netcoreapp2.0/System.Runtime.CompilerServices.Unsafe.targets: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 1.0.4 6 | yn01 7 | © yn01 8 | https://github.com/yn01/ZeroMessenger 9 | $(PackageProjectUrl) 10 | git 11 | MIT 12 | README.md 13 | Icon.png 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/ZeroMessenger.0.1.0/lib/netstandard2.1/ZeroMessenger.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4297a5ccdf42046a88aef9786d8dae10 3 | labels: 4 | - NuGetForUnity 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | defineConstraints: [] 11 | isPreloaded: 0 12 | isOverridable: 0 13 | isExplicitlyReferenced: 0 14 | validateReferences: 1 15 | platformData: 16 | - first: 17 | Any: 18 | second: 19 | enabled: 1 20 | settings: {} 21 | userData: 22 | assetBundleName: 23 | assetBundleVariant: 24 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Assets/Sandbox/SubscriberTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using VContainer; 4 | using ZeroMessenger; 5 | 6 | namespace Sandbox 7 | { 8 | public class SubscriberTest : MonoBehaviour 9 | { 10 | [Inject] public IMessageSubscriber Subscriber { get; set; } 11 | 12 | IDisposable disposable; 13 | 14 | void Start() 15 | { 16 | disposable = Subscriber.Subscribe(x => 17 | { 18 | Debug.Log(x.Message); 19 | }); 20 | } 21 | 22 | void OnDestroy() 23 | { 24 | disposable.Dispose(); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2eec439e59c0c4c9baf78d5de0ab2d17 3 | labels: 4 | - NuGetForUnity 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | defineConstraints: [] 11 | isPreloaded: 0 12 | isOverridable: 0 13 | isExplicitlyReferenced: 0 14 | validateReferences: 1 15 | platformData: 16 | - first: 17 | Any: 18 | second: 19 | enabled: 1 20 | settings: {} 21 | userData: 22 | assetBundleName: 23 | assetBundleVariant: 24 | -------------------------------------------------------------------------------- /tests/ZeroMessenger.Tests/TestMessageFilter.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace ZeroMessenger.Tests; 3 | 4 | public class TestMessageFilter(Func preprocess) : IMessageFilter 5 | { 6 | public async ValueTask InvokeAsync(T message, CancellationToken cancellationToken, Func next) 7 | { 8 | message = preprocess(message); 9 | await next(message, cancellationToken); 10 | } 11 | } 12 | 13 | public class IgnoreMessageFilter : IMessageFilter 14 | { 15 | public ValueTask InvokeAsync(T message, CancellationToken cancellationToken, Func next) 16 | { 17 | // ignore message 18 | return default; 19 | } 20 | } -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Assets/Sandbox/PublisherTest.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | using VContainer; 4 | using ZeroMessenger; 5 | 6 | namespace Sandbox 7 | { 8 | public class PublisherTest : MonoBehaviour 9 | { 10 | [Inject] public IMessagePublisher Publisher { get; set; } 11 | 12 | [SerializeField] Button button; 13 | [SerializeField] InputField inputField; 14 | 15 | void Start() 16 | { 17 | button.onClick.AddListener(() => 18 | { 19 | Publisher.Publish(new() 20 | { 21 | Message = inputField.text, 22 | }); 23 | }); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /sandbox/BlazorApp1/LogService.cs: -------------------------------------------------------------------------------- 1 | 2 | using ZeroMessenger; 3 | 4 | public class LogService(IMessageSubscriber subscriber) : IHostedService 5 | { 6 | IDisposable? subscription; 7 | 8 | public Task StartAsync(CancellationToken cancellationToken) 9 | { 10 | Console.WriteLine("Start:"); 11 | 12 | subscription = subscriber.Subscribe(x => 13 | { 14 | Console.WriteLine($"Received: {x.Text}"); 15 | }); 16 | 17 | return Task.CompletedTask; 18 | } 19 | 20 | public Task StopAsync(CancellationToken cancellationToken) 21 | { 22 | Console.WriteLine("Stop:"); 23 | 24 | subscription?.Dispose(); 25 | return Task.CompletedTask; 26 | } 27 | } -------------------------------------------------------------------------------- /sandbox/ConsoleApp1/ConsoleApp1.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Exe 15 | net8.0 16 | enable 17 | enable 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/NuGet.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/ZeroMessenger/AnonymousMessageHandler.cs: -------------------------------------------------------------------------------- 1 | namespace ZeroMessenger; 2 | 3 | internal sealed class AnonymousMessageHandler(Action handler) : MessageHandler 4 | { 5 | protected override void HandleCore(T message) 6 | { 7 | handler(message); 8 | } 9 | } 10 | 11 | internal sealed class AnonymousMessageHandler(TState state, Action handler) : MessageHandler 12 | { 13 | protected override void HandleCore(T message) 14 | { 15 | handler(message, state); 16 | } 17 | } 18 | 19 | internal sealed class AnonymousAsyncMessageHandler(Func handler) : AsyncMessageHandler 20 | { 21 | protected override ValueTask HandleAsyncCore(T message, CancellationToken cancellationToken = default) 22 | { 23 | return handler(message, cancellationToken); 24 | } 25 | } -------------------------------------------------------------------------------- /src/ZeroMessenger/MessageHandlerNode.cs: -------------------------------------------------------------------------------- 1 | using ZeroMessenger.Internal; 2 | 3 | namespace ZeroMessenger; 4 | 5 | public abstract class MessageHandlerNode : IDisposable 6 | { 7 | internal MessageHandlerList Parent = default!; 8 | internal MessageHandlerNode? PreviousNode; 9 | internal MessageHandlerNode? NextNode; 10 | internal ulong Version; 11 | 12 | bool disposed; 13 | public bool IsDisposed => disposed; 14 | 15 | public void Dispose() 16 | { 17 | ThrowHelper.ThrowObjectDisposedIf(IsDisposed, typeof(MessageHandlerNode)); 18 | 19 | if (Parent != null) 20 | { 21 | Parent.Remove(this); 22 | Volatile.Write(ref Parent!, null); 23 | } 24 | 25 | Volatile.Write(ref disposed, true); 26 | 27 | DisposeCore(); 28 | } 29 | 30 | protected virtual void DisposeCore() { } 31 | } 32 | -------------------------------------------------------------------------------- /src/ZeroMessenger/FilteredMessageSubscriber.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace ZeroMessenger; 3 | 4 | internal sealed class FilteredMessageSubscriber(IMessageSubscriber subscriber, IMessageFilter[] filters) : IMessageSubscriber 5 | { 6 | public IMessageSubscriber Subscriber { get; } = subscriber; 7 | public IMessageFilter[] Filters { get; } = filters; 8 | 9 | public IDisposable Subscribe(MessageHandler handler) 10 | { 11 | return Subscriber.SubscribeAwait(new FilteredMessageHandler(handler, Filters)); 12 | } 13 | 14 | public IDisposable SubscribeAwait(AsyncMessageHandler handler, AsyncSubscribeStrategy subscribeStrategy = AsyncSubscribeStrategy.Sequential) 15 | { 16 | return Subscriber.SubscribeAwait(new FilteredAsyncMessageHandler(handler, Filters), subscribeStrategy); 17 | } 18 | } -------------------------------------------------------------------------------- /sandbox/BlazorApp1/Program.cs: -------------------------------------------------------------------------------- 1 | using BlazorApp1.Components; 2 | using ZeroMessenger.DependencyInjection; 3 | 4 | var builder = WebApplication.CreateBuilder(args); 5 | 6 | // Add services to the container. 7 | builder.Services.AddRazorComponents() 8 | .AddInteractiveServerComponents(); 9 | 10 | builder.Services.AddZeroMessenger(); 11 | builder.Services.AddHostedService(); 12 | 13 | var app = builder.Build(); 14 | 15 | // Configure the HTTP request pipeline. 16 | if (!app.Environment.IsDevelopment()) 17 | { 18 | app.UseExceptionHandler("/Error", createScopeForErrors: true); 19 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 20 | app.UseHsts(); 21 | } 22 | 23 | app.UseHttpsRedirection(); 24 | 25 | app.UseStaticFiles(); 26 | app.UseAntiforgery(); 27 | 28 | app.MapRazorComponents() 29 | .AddInteractiveServerRenderMode(); 30 | 31 | app.Run(); 32 | -------------------------------------------------------------------------------- /src/ZeroMessenger.R3/ZeroMessenger.R3.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0;net6.0;netstandard2.1 5 | enable 6 | enable 7 | 12 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | pubsub;eventaggregator;R3; 22 | R3 extensions for ZeroMessenger. 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /sandbox/Benchmark/PublishWithFilterBenchmark.cs: -------------------------------------------------------------------------------- 1 | using BenchmarkDotNet.Attributes; 2 | using MessagePipe; 3 | using R3; 4 | using VitalRouter; 5 | using ZeroMessenger; 6 | 7 | [MemoryDiagnoser] 8 | [InvocationCount(10000)] 9 | public class PublishWithFilterBenchmark 10 | { 11 | const int SubscribeCount = 8; 12 | 13 | ZeroMessenger.MessageBroker zeroMessengerBroker = default!; 14 | TestMessage message = new(); 15 | 16 | [IterationSetup] 17 | public void Setup() 18 | { 19 | static void Method(int i) 20 | { 21 | 22 | } 23 | 24 | zeroMessengerBroker = new ZeroMessenger.MessageBroker(); 25 | zeroMessengerBroker.AddFilter(x => true); 26 | 27 | for (int i = 0; i < SubscribeCount; i++) 28 | { 29 | zeroMessengerBroker.Subscribe(i, (x, state) => Method(state)); 30 | } 31 | } 32 | 33 | [Benchmark(Description = "Publish (ZeroMessenger)")] 34 | public void Benchmark_ZeroMessenger() 35 | { 36 | zeroMessengerBroker.Publish(message); 37 | } 38 | } -------------------------------------------------------------------------------- /sandbox/Benchmark/Benchmark.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/ProjectSettings/PackageManagerSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_EnablePreReleasePackages: 0 16 | m_EnablePackageDependencies: 0 17 | m_AdvancedSettingsExpanded: 1 18 | m_ScopedRegistriesSettingsExpanded: 1 19 | m_SeeAllPackageVersions: 0 20 | oneTimeWarningShown: 0 21 | m_Registries: 22 | - m_Id: main 23 | m_Name: 24 | m_Url: https://packages.unity.com 25 | m_Scopes: [] 26 | m_IsDefault: 1 27 | m_Capabilities: 7 28 | m_UserSelectedRegistryName: 29 | m_UserAddingNewScopedRegistry: 0 30 | m_RegistryInfoDraft: 31 | m_Modified: 0 32 | m_ErrorMessage: 33 | m_UserModificationsInstanceId: -830 34 | m_OriginalInstanceId: -832 35 | m_LoadAssets: 0 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Annulus Games 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/ZeroMessenger.DependencyInjection/ZeroMessenger.DependencyInjection.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | net8.0;net6.0;netstandard2.1 13 | enable 14 | enable 15 | 12 16 | 17 | 18 | 19 | 20 | 21 | pubsub;eventaggregator;di;dependencyinjection 22 | Microsoft.Extensions.DependencyInjection extensions for ZeroMessenger 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_DashboardUrl: https://dashboard.unity3d.com 13 | m_TestInitMode: 0 14 | CrashReportingSettings: 15 | m_EventUrl: https://perf-events.cloud.unity3d.com 16 | m_Enabled: 0 17 | m_LogBufferSize: 10 18 | m_CaptureEditorExceptions: 1 19 | UnityPurchasingSettings: 20 | m_Enabled: 0 21 | m_TestMode: 0 22 | UnityAnalyticsSettings: 23 | m_Enabled: 0 24 | m_TestMode: 0 25 | m_InitializeOnStartup: 1 26 | m_PackageRequiringCoreStatsPresent: 0 27 | UnityAdsSettings: 28 | m_Enabled: 0 29 | m_InitializeOnStartup: 1 30 | m_TestMode: 0 31 | m_IosGameId: 32 | m_AndroidGameId: 33 | m_GameIds: {} 34 | m_GameId: 35 | PerformanceReportingSettings: 36 | m_Enabled: 0 37 | -------------------------------------------------------------------------------- /src/ZeroMessenger/MessageSubscriberExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | namespace ZeroMessenger; 4 | 5 | public static class MessageSubscriberExtensions 6 | { 7 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 8 | public static IDisposable Subscribe(this IMessageSubscriber subscriber, Action handler) 9 | { 10 | return subscriber.Subscribe(new AnonymousMessageHandler(handler)); 11 | } 12 | 13 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 14 | public static IDisposable Subscribe(this IMessageSubscriber subscriber, TState state, Action handler) 15 | { 16 | return subscriber.Subscribe(new AnonymousMessageHandler(state, handler)); 17 | } 18 | 19 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 20 | public static IDisposable SubscribeAwait(this IMessageSubscriber subscriber, Func handler, AsyncSubscribeStrategy subscribeStrategy = AsyncSubscribeStrategy.Sequential) 21 | { 22 | return subscriber.SubscribeAwait(new AnonymousAsyncMessageHandler(handler), subscribeStrategy); 23 | } 24 | } -------------------------------------------------------------------------------- /sandbox/ConsoleApp1/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using ZeroMessenger; 3 | using ZeroMessenger.DependencyInjection; 4 | 5 | var services = new ServiceCollection(); 6 | 7 | services.AddZeroMessenger(configure => 8 | { 9 | configure.AddFilter>(); 10 | }); 11 | 12 | var provider = services.BuildServiceProvider(); 13 | var publisher = provider.GetRequiredService>(); 14 | var subscriber = provider.GetRequiredService>(); 15 | 16 | var subscription = subscriber 17 | .Subscribe(x => 18 | { 19 | Console.WriteLine(x.Value); 20 | }); 21 | 22 | for (int i = 0; i < 10; i++) 23 | { 24 | publisher.Publish(new(i)); 25 | } 26 | 27 | subscription.Dispose(); 28 | 29 | public readonly record struct TestMessage(int Value); 30 | 31 | public class LoggingFilter : IMessageFilter 32 | { 33 | public async ValueTask InvokeAsync(T message, CancellationToken cancellationToken, Func next) 34 | { 35 | Console.WriteLine("Before"); 36 | await next(message, cancellationToken); 37 | Console.WriteLine("After"); 38 | } 39 | } -------------------------------------------------------------------------------- /tests/ZeroMessenger.Tests/ZeroMessenger.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | false 9 | true 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/ZeroMessenger/Internal/MessageBrokerPublisherSubscriber.cs: -------------------------------------------------------------------------------- 1 | namespace ZeroMessenger.Internal; 2 | 3 | [Preserve] 4 | [method: Preserve] 5 | public sealed class MessageBrokerPublisher(MessageBroker messageBroker) : IMessagePublisher 6 | { 7 | public void Publish(T message, CancellationToken cancellationToken = default) 8 | { 9 | messageBroker.Publish(message, cancellationToken); 10 | } 11 | 12 | public ValueTask PublishAsync(T message, AsyncPublishStrategy publishStrategy = AsyncPublishStrategy.Parallel, CancellationToken cancellationToken = default) 13 | { 14 | return messageBroker.PublishAsync(message, publishStrategy, cancellationToken); 15 | } 16 | } 17 | 18 | [Preserve] 19 | [method: Preserve] 20 | public sealed class MessageBrokerSubscriber(MessageBroker messageBroker) : IMessageSubscriber 21 | { 22 | public IDisposable Subscribe(MessageHandler handler) 23 | { 24 | return messageBroker.Subscribe(handler); 25 | } 26 | 27 | public IDisposable SubscribeAwait(AsyncMessageHandler handler, AsyncSubscribeStrategy subscribeStrategy = AsyncSubscribeStrategy.Sequential) 28 | { 29 | return messageBroker.SubscribeAwait(handler, subscribeStrategy); 30 | } 31 | } -------------------------------------------------------------------------------- /sandbox/BlazorApp1/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:17241", 8 | "sslPort": 44358 9 | } 10 | }, 11 | "profiles": { 12 | "http": { 13 | "commandName": "Project", 14 | "dotnetRunMessages": true, 15 | "launchBrowser": true, 16 | "applicationUrl": "http://localhost:5254", 17 | "environmentVariables": { 18 | "ASPNETCORE_ENVIRONMENT": "Development" 19 | } 20 | }, 21 | "https": { 22 | "commandName": "Project", 23 | "dotnetRunMessages": true, 24 | "launchBrowser": true, 25 | "applicationUrl": "https://localhost:7059;http://localhost:5254", 26 | "environmentVariables": { 27 | "ASPNETCORE_ENVIRONMENT": "Development" 28 | } 29 | }, 30 | "IIS Express": { 31 | "commandName": "IISExpress", 32 | "launchBrowser": true, 33 | "environmentVariables": { 34 | "ASPNETCORE_ENVIRONMENT": "Development" 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/ZeroMessenger.0.1.0/ZeroMessenger.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ZeroMessenger 5 | 0.1.0 6 | Annulus Games 7 | MIT 8 | https://licenses.nuget.org/MIT 9 | Icon.png 10 | README.md 11 | https://github.com/AnnulusGames/ZeroMessenger 12 | Zero-allocation, extremely fast in-memory messaging library for .NET and Unity. 13 | © Annulus Games 14 | pubsub eventaggregator 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/LICENSE.TXT: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) .NET Foundation and Contributors 4 | 5 | All rights reserved. 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | -------------------------------------------------------------------------------- /sandbox/BlazorApp1/Components/Pages/Error.razor: -------------------------------------------------------------------------------- 1 | @page "/Error" 2 | @using System.Diagnostics 3 | 4 | Error 5 | 6 |

Error.

7 |

An error occurred while processing your request.

8 | 9 | @if (ShowRequestId) 10 | { 11 |

12 | Request ID: @RequestId 13 |

14 | } 15 | 16 |

Development Mode

17 |

18 | Swapping to Development environment will display more detailed information about the error that occurred. 19 |

20 |

21 | The Development environment shouldn't be enabled for deployed applications. 22 | It can result in displaying sensitive information from exceptions to end users. 23 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 24 | and restarting the app. 25 |

26 | 27 | @code{ 28 | [CascadingParameter] 29 | private HttpContext? HttpContext { get; set; } 30 | 31 | private string? RequestId { get; set; } 32 | private bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 33 | 34 | protected override void OnInitialized() => 35 | RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier; 36 | } 37 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 11 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 0 23 | m_ReuseCollisionCallbacks: 1 24 | m_ClothInterCollisionSettingsToggle: 0 25 | m_ContactPairsMode: 0 26 | m_BroadphaseType: 0 27 | m_WorldBounds: 28 | m_Center: {x: 0, y: 0, z: 0} 29 | m_Extent: {x: 250, y: 250, z: 250} 30 | m_WorldSubdivisions: 8 31 | m_FrictionType: 0 32 | m_EnableEnhancedDeterminism: 0 33 | m_EnableUnifiedHeightmaps: 1 34 | m_DefaultMaxAngluarSpeed: 7 35 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/ProjectSettings/MemorySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!387306366 &1 4 | MemorySettings: 5 | m_ObjectHideFlags: 0 6 | m_EditorMemorySettings: 7 | m_MainAllocatorBlockSize: -1 8 | m_ThreadAllocatorBlockSize: -1 9 | m_MainGfxBlockSize: -1 10 | m_ThreadGfxBlockSize: -1 11 | m_CacheBlockSize: -1 12 | m_TypetreeBlockSize: -1 13 | m_ProfilerBlockSize: -1 14 | m_ProfilerEditorBlockSize: -1 15 | m_BucketAllocatorGranularity: -1 16 | m_BucketAllocatorBucketsCount: -1 17 | m_BucketAllocatorBlockSize: -1 18 | m_BucketAllocatorBlockCount: -1 19 | m_ProfilerBucketAllocatorGranularity: -1 20 | m_ProfilerBucketAllocatorBucketsCount: -1 21 | m_ProfilerBucketAllocatorBlockSize: -1 22 | m_ProfilerBucketAllocatorBlockCount: -1 23 | m_TempAllocatorSizeMain: -1 24 | m_JobTempAllocatorBlockSize: -1 25 | m_BackgroundJobTempAllocatorBlockSize: -1 26 | m_JobTempAllocatorReducedBlockSize: -1 27 | m_TempAllocatorSizeGIBakingWorker: -1 28 | m_TempAllocatorSizeNavMeshWorker: -1 29 | m_TempAllocatorSizeAudioWorker: -1 30 | m_TempAllocatorSizeCloudWorker: -1 31 | m_TempAllocatorSizeGfx: -1 32 | m_TempAllocatorSizeJobWorker: -1 33 | m_TempAllocatorSizeBackgroundWorker: -1 34 | m_TempAllocatorSizePreloadManager: -1 35 | m_PlatformMemorySettings: {} 36 | -------------------------------------------------------------------------------- /src/ZeroMessenger/ZeroMessenger.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0;net6.0;netstandard2.1 5 | 12 6 | enable 7 | enable 8 | true 9 | 10 | 11 | 12 | 13 | runtime; build; native; contentfiles; analyzers; buildtransitive 14 | all 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | pubsub;eventaggregator; 26 | Zero-allocation, extremely fast in-memory messaging library for .NET and Unity. 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /tests/ZeroMessenger.Tests/MessageBrokerTests.cs: -------------------------------------------------------------------------------- 1 | namespace ZeroMessenger.Tests; 2 | 3 | public class MessageBrokerTests 4 | { 5 | [Test] 6 | public void Test_PublishSubscribe() 7 | { 8 | using var broker = new MessageBroker(); 9 | var result = 0; 10 | 11 | var subscription = broker.Subscribe(x => 12 | { 13 | result = x; 14 | }); 15 | 16 | for (int i = 0; i < 10000; i++) 17 | { 18 | broker.Publish(i); 19 | Assert.That(result, Is.EqualTo(i)); 20 | } 21 | 22 | result = -1; 23 | subscription.Dispose(); 24 | 25 | broker.Publish(100); 26 | Assert.That(result, Is.EqualTo(-1)); 27 | } 28 | 29 | [Test] 30 | public async Task Test_PublishAsyncSubscribeAwait() 31 | { 32 | using var broker = new MessageBroker(); 33 | var result = 0; 34 | 35 | var subscription = broker.SubscribeAwait(async (x, ct) => 36 | { 37 | await Task.Delay(1, ct); 38 | result = x; 39 | }); 40 | 41 | for (int i = 0; i < 100; i++) 42 | { 43 | await broker.PublishAsync(i); 44 | Assert.That(result, Is.EqualTo(i)); 45 | } 46 | 47 | result = -1; 48 | subscription.Dispose(); 49 | 50 | await broker.PublishAsync(100); 51 | Assert.That(result, Is.EqualTo(-1)); 52 | } 53 | } -------------------------------------------------------------------------------- /src/ZeroMessenger.R3/MessageSubscriberR3Extensions.cs: -------------------------------------------------------------------------------- 1 | using R3; 2 | 3 | namespace ZeroMessenger.R3; 4 | 5 | public static class MessageSubscriberR3Extensions 6 | { 7 | public static Observable ToObservable(this IMessageSubscriber subscriber) 8 | { 9 | return new ObservableSubscriber(subscriber); 10 | } 11 | 12 | public static IDisposable SubscribeToPublish(this Observable source, IMessagePublisher publisher) 13 | { 14 | return source.Subscribe(publisher, (x, p) => p.Publish(x)); 15 | } 16 | 17 | public static IDisposable SubscribeAwaitToPublish(this Observable source, IMessagePublisher publisher, AwaitOperation awaitOperation = AwaitOperation.Sequential, AsyncPublishStrategy publishStrategy = AsyncPublishStrategy.Parallel) 18 | { 19 | return source.SubscribeAwait(async (x, ct) => await publisher.PublishAsync(x, publishStrategy, ct), awaitOperation); 20 | } 21 | } 22 | 23 | internal sealed class ObservableSubscriber(IMessageSubscriber subscriber) : Observable 24 | { 25 | protected override IDisposable SubscribeCore(Observer observer) 26 | { 27 | return subscriber.Subscribe(new ObserverMessageHandler(observer)); 28 | } 29 | } 30 | 31 | internal sealed class ObserverMessageHandler(Observer observer) : MessageHandler 32 | { 33 | protected override void HandleCore(T message) 34 | { 35 | observer.OnNext(message); 36 | } 37 | } -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/System.Runtime.CompilerServices.Unsafe.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | System.Runtime.CompilerServices.Unsafe 5 | 6.0.0 6 | Microsoft 7 | MIT 8 | https://licenses.nuget.org/MIT 9 | Icon.png 10 | https://dot.net/ 11 | Provides the System.Runtime.CompilerServices.Unsafe class, which provides generic, low-level functionality for manipulating pointers. 12 | 13 | Commonly Used Types: 14 | System.Runtime.CompilerServices.Unsafe 15 | https://go.microsoft.com/fwlink/?LinkID=799421 16 | © Microsoft Corporation. All rights reserved. 17 | true 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/ZeroMessenger.DependencyInjection/ServiceCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using ZeroMessenger.Internal; 3 | 4 | namespace ZeroMessenger.DependencyInjection; 5 | 6 | public static class ServiceCollectionExtensions 7 | { 8 | public static IServiceCollection AddZeroMessenger(this IServiceCollection services) 9 | { 10 | return AddZeroMessenger(services, _ => { }); 11 | } 12 | 13 | public static IServiceCollection AddZeroMessenger(this IServiceCollection services, Action configuration) 14 | { 15 | var builder = new MessageBrokerBuilder(services); 16 | configuration(builder); 17 | 18 | services.AddSingleton(typeof(MessageBroker<>)); 19 | services.AddSingleton(typeof(IMessagePublisher<>), typeof(MessageBrokerPublisher<>)); 20 | services.AddSingleton(typeof(IMessageSubscriber<>), typeof(MessageBrokerSubscriber<>)); 21 | services.AddSingleton(typeof(MessageFilterProvider<>)); 22 | 23 | return services; 24 | } 25 | } 26 | 27 | public readonly struct MessageBrokerBuilder(IServiceCollection services) 28 | { 29 | public void AddFilter() where TFilter : class, IMessageFilterBase 30 | { 31 | services.AddTransient(); 32 | } 33 | 34 | public void AddFilter(TFilter filter) where TFilter : class, IMessageFilterBase 35 | { 36 | services.AddSingleton(filter); 37 | } 38 | 39 | public void AddFilter(Type type) 40 | { 41 | services.AddTransient(typeof(IMessageFilter<>), type); 42 | } 43 | } -------------------------------------------------------------------------------- /src/ZeroMessenger/Internal/LinkedPool.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | namespace ZeroMessenger.Internal; 6 | 7 | internal interface ILinkedPoolNode 8 | where T : class 9 | { 10 | ref T NextNode { get; } 11 | } 12 | 13 | [StructLayout(LayoutKind.Auto)] 14 | internal struct LinkedPool where T : class, ILinkedPoolNode 15 | { 16 | int gate; 17 | int size; 18 | T root; 19 | 20 | public int Size => size; 21 | 22 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 23 | public bool TryPop([MaybeNullWhen(false)] out T result) 24 | { 25 | if (Interlocked.CompareExchange(ref gate, 1, 0) == 0) 26 | { 27 | var v = root; 28 | if (v is not null) 29 | { 30 | ref var nextNode = ref v.NextNode; 31 | root = nextNode; 32 | nextNode = null; 33 | size--; 34 | result = v; 35 | Volatile.Write(ref gate, 0); 36 | return true; 37 | } 38 | 39 | Volatile.Write(ref gate, 0); 40 | } 41 | 42 | result = default; 43 | return false; 44 | } 45 | 46 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 47 | public bool TryPush(T item) 48 | { 49 | if (Interlocked.CompareExchange(ref gate, 1, 0) == 0) 50 | { 51 | item.NextNode = root; 52 | root = item; 53 | size++; 54 | Volatile.Write(ref gate, 0); 55 | return true; 56 | } 57 | return false; 58 | } 59 | } -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 12 7 | m_SerializationMode: 2 8 | m_LineEndingsForNewScripts: 0 9 | m_DefaultBehaviorMode: 0 10 | m_PrefabRegularEnvironment: {fileID: 0} 11 | m_PrefabUIEnvironment: {fileID: 0} 12 | m_SpritePackerMode: 0 13 | m_SpritePackerCacheSize: 10 14 | m_SpritePackerPaddingPower: 1 15 | m_Bc7TextureCompressor: 0 16 | m_EtcTextureCompressorBehavior: 1 17 | m_EtcTextureFastCompressor: 1 18 | m_EtcTextureNormalCompressor: 2 19 | m_EtcTextureBestCompressor: 4 20 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp;asmref 21 | m_ProjectGenerationRootNamespace: 22 | m_EnableTextureStreamingInEditMode: 1 23 | m_EnableTextureStreamingInPlayMode: 1 24 | m_EnableEditorAsyncCPUTextureLoading: 0 25 | m_AsyncShaderCompilation: 1 26 | m_PrefabModeAllowAutoSave: 1 27 | m_EnterPlayModeOptionsEnabled: 1 28 | m_EnterPlayModeOptions: 3 29 | m_GameObjectNamingDigits: 1 30 | m_GameObjectNamingScheme: 0 31 | m_AssetNamingUsesSpace: 1 32 | m_InspectorUseIMGUIDefaultInspector: 0 33 | m_UseLegacyProbeSampleCount: 0 34 | m_SerializeInlineMappingsOnOneLine: 1 35 | m_DisableCookiesInLightmapper: 0 36 | m_AssetPipelineMode: 1 37 | m_RefreshImportMode: 0 38 | m_CacheServerMode: 0 39 | m_CacheServerEndpoint: 40 | m_CacheServerNamespacePrefix: default 41 | m_CacheServerEnableDownload: 1 42 | m_CacheServerEnableUpload: 1 43 | m_CacheServerEnableAuth: 0 44 | m_CacheServerEnableTls: 0 45 | m_CacheServerValidationMode: 2 46 | m_CacheServerDownloadBatchSize: 128 47 | m_EnableEnlightenBakedGI: 0 48 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/.gitignore: -------------------------------------------------------------------------------- 1 | # This .gitignore file should be placed at the root of your Unity project directory 2 | # 3 | # Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore 4 | # 5 | /[Ll]ibrary/ 6 | /[Tt]emp/ 7 | /[Oo]bj/ 8 | /[Bb]uild/ 9 | /[Bb]uilds/ 10 | /[Ll]ogs/ 11 | /[Uu]ser[Ss]ettings/ 12 | 13 | # MemoryCaptures can get excessive in size. 14 | # They also could contain extremely sensitive data 15 | /[Mm]emoryCaptures/ 16 | 17 | # Recordings can get excessive in size 18 | /[Rr]ecordings/ 19 | 20 | # Uncomment this line if you wish to ignore the asset store tools plugin 21 | /[Aa]ssets/AssetStoreTools* 22 | /[Pp]ackages/com.unity.asset-store-tools* 23 | 24 | # Autogenerated Jetbrains Rider plugin 25 | /[Aa]ssets/Plugins/Editor/JetBrains* 26 | 27 | # Visual Studio cache directory 28 | .vs/ 29 | 30 | # Visual Studio Code cache directory 31 | .vscode/ 32 | 33 | # Gradle cache directory 34 | .gradle/ 35 | 36 | # Autogenerated VS/MD/Consulo solution and project files 37 | ExportedObj/ 38 | .consulo/ 39 | *.csproj 40 | *.unityproj 41 | *.sln 42 | *.suo 43 | *.tmp 44 | *.user 45 | *.userprefs 46 | *.pidb 47 | *.booproj 48 | *.svd 49 | *.pdb 50 | *.mdb 51 | *.opendb 52 | *.VC.db 53 | 54 | # Unity3D generated meta files 55 | *.pidb.meta 56 | *.pdb.meta 57 | *.mdb.meta 58 | 59 | # Unity3D generated file on crash reports 60 | sysinfo.txt 61 | 62 | # Builds 63 | *.apk 64 | *.aab 65 | *.unitypackage 66 | *.app 67 | 68 | # Crashlytics generated file 69 | crashlytics-build.properties 70 | 71 | # Packed Addressables 72 | /[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin* 73 | 74 | # Temporary auto-generated Android Assets 75 | /[Aa]ssets/[Ss]treamingAssets/aa.meta 76 | /[Aa]ssets/[Ss]treamingAssets/aa/* 77 | 78 | # DS_Store 79 | *.DS_Store -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.github-glitchenzo.nugetforunity": "https://github.com/GlitchEnzo/NuGetForUnity.git?path=/src/NuGetForUnity", 4 | "com.unity.ide.rider": "3.0.34", 5 | "com.unity.ide.visualstudio": "2.0.22", 6 | "com.unity.ugui": "1.0.0", 7 | "jp.hadashikick.vcontainer": "https://github.com/hadashiA/VContainer.git?path=VContainer/Assets/VContainer", 8 | "com.unity.modules.ai": "1.0.0", 9 | "com.unity.modules.androidjni": "1.0.0", 10 | "com.unity.modules.animation": "1.0.0", 11 | "com.unity.modules.assetbundle": "1.0.0", 12 | "com.unity.modules.audio": "1.0.0", 13 | "com.unity.modules.cloth": "1.0.0", 14 | "com.unity.modules.director": "1.0.0", 15 | "com.unity.modules.imageconversion": "1.0.0", 16 | "com.unity.modules.imgui": "1.0.0", 17 | "com.unity.modules.jsonserialize": "1.0.0", 18 | "com.unity.modules.particlesystem": "1.0.0", 19 | "com.unity.modules.physics": "1.0.0", 20 | "com.unity.modules.physics2d": "1.0.0", 21 | "com.unity.modules.screencapture": "1.0.0", 22 | "com.unity.modules.terrain": "1.0.0", 23 | "com.unity.modules.terrainphysics": "1.0.0", 24 | "com.unity.modules.tilemap": "1.0.0", 25 | "com.unity.modules.ui": "1.0.0", 26 | "com.unity.modules.uielements": "1.0.0", 27 | "com.unity.modules.umbra": "1.0.0", 28 | "com.unity.modules.unityanalytics": "1.0.0", 29 | "com.unity.modules.unitywebrequest": "1.0.0", 30 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 31 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 32 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 33 | "com.unity.modules.unitywebrequestwww": "1.0.0", 34 | "com.unity.modules.vehicles": "1.0.0", 35 | "com.unity.modules.video": "1.0.0", 36 | "com.unity.modules.vr": "1.0.0", 37 | "com.unity.modules.wind": "1.0.0", 38 | "com.unity.modules.xr": "1.0.0" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Assets/ZeroMessenger.VContainer/Runtime/ContainerBuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using VContainer; 3 | using ZeroMessenger.Internal; 4 | 5 | namespace ZeroMessenger.VContainer 6 | { 7 | public static class ContainerBuilderExtensions 8 | { 9 | public static void AddZeroMessenger(this IContainerBuilder builder) 10 | { 11 | AddZeroMessenger(builder, _ => { }); 12 | } 13 | 14 | public static void AddZeroMessenger(this IContainerBuilder builder, Action configuration) 15 | { 16 | var brokerBuilder = new MessageBrokerBuilder(builder); 17 | configuration(brokerBuilder); 18 | 19 | builder.Register(typeof(MessageBroker<>), Lifetime.Singleton); 20 | builder.Register(typeof(IMessagePublisher<>), typeof(MessageBrokerPublisher<>), Lifetime.Singleton); 21 | builder.Register(typeof(IMessageSubscriber<>), typeof(MessageBrokerSubscriber<>), Lifetime.Singleton); 22 | builder.Register(typeof(MessageFilterProvider<>), Lifetime.Singleton); 23 | } 24 | } 25 | 26 | public readonly struct MessageBrokerBuilder 27 | { 28 | readonly IContainerBuilder builder; 29 | 30 | public MessageBrokerBuilder(IContainerBuilder builder) 31 | { 32 | this.builder = builder; 33 | } 34 | 35 | public void AddFilter() where TFilter : class, IMessageFilterBase 36 | { 37 | builder.Register(Lifetime.Transient); 38 | } 39 | 40 | public void AddFilter(TFilter filter) where TFilter : class, IMessageFilterBase 41 | { 42 | builder.RegisterInstance(filter); 43 | } 44 | 45 | public void AddFilter(Type type) 46 | { 47 | builder.Register(typeof(IMessageFilter<>), type, Lifetime.Transient); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /src/ZeroMessenger/Internal/PooledList.cs: -------------------------------------------------------------------------------- 1 | using System.Buffers; 2 | using System.Runtime.CompilerServices; 3 | 4 | namespace ZeroMessenger.Internal; 5 | 6 | internal struct PooledList : IDisposable 7 | { 8 | T[]? buffer; 9 | int tail; 10 | 11 | public PooledList(int sizeHint) 12 | { 13 | buffer = ArrayPool.Shared.Rent(sizeHint); 14 | } 15 | 16 | public bool IsDisposed => tail == -1; 17 | public int Count => tail; 18 | 19 | public void Add(in T item) 20 | { 21 | ThrowIfDisposed(); 22 | 23 | if (buffer == null) 24 | { 25 | buffer = ArrayPool.Shared.Rent(32); 26 | } 27 | else if (buffer.Length == tail) 28 | { 29 | var newArray = ArrayPool.Shared.Rent(tail * 2); 30 | buffer.AsSpan().CopyTo(newArray); 31 | ArrayPool.Shared.Return(buffer); 32 | buffer = newArray; 33 | } 34 | 35 | buffer[tail] = item; 36 | tail++; 37 | } 38 | 39 | public void Clear() 40 | { 41 | ThrowIfDisposed(); 42 | 43 | if (buffer != null) 44 | { 45 | new Span(buffer, 0, tail).Clear(); 46 | } 47 | 48 | tail = 0; 49 | } 50 | 51 | public void Dispose() 52 | { 53 | ThrowIfDisposed(); 54 | 55 | if (buffer != null) 56 | { 57 | ArrayPool.Shared.Return(buffer); 58 | buffer = null; 59 | } 60 | 61 | tail = -1; 62 | } 63 | 64 | public T this[int index] 65 | { 66 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 67 | get 68 | { 69 | return AsSpan()[index]; 70 | } 71 | } 72 | 73 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 74 | public ReadOnlySpan AsSpan() 75 | { 76 | return new ReadOnlySpan(buffer, 0, tail); 77 | } 78 | 79 | void ThrowIfDisposed() 80 | { 81 | if (tail == -1) throw new ObjectDisposedException(nameof(PooledList)); 82 | } 83 | } -------------------------------------------------------------------------------- /src/ZeroMessenger/AsyncSubscribeStrategy.cs: -------------------------------------------------------------------------------- 1 | namespace ZeroMessenger; 2 | 3 | public enum AsyncSubscribeStrategy 4 | { 5 | Sequential, 6 | Parallel, 7 | Switch, 8 | Drop, 9 | } 10 | 11 | internal sealed class SequentialAsyncMessageHandler(AsyncMessageHandler handler) : AsyncMessageHandler 12 | { 13 | readonly SemaphoreSlim publishLock = new(1, 1); 14 | 15 | protected override async ValueTask HandleAsyncCore(T message, CancellationToken cancellationToken = default) 16 | { 17 | await publishLock.WaitAsync(cancellationToken); 18 | try 19 | { 20 | await handler.HandleAsync(message, cancellationToken); 21 | } 22 | finally 23 | { 24 | publishLock.Release(); 25 | } 26 | } 27 | 28 | protected override void DisposeCore() 29 | { 30 | publishLock.Dispose(); 31 | } 32 | } 33 | 34 | internal sealed class DropAsyncMessageHandler(AsyncMessageHandler handler) : AsyncMessageHandler 35 | { 36 | int flag; 37 | 38 | protected override async ValueTask HandleAsyncCore(T message, CancellationToken cancellationToken = default) 39 | { 40 | if (Interlocked.CompareExchange(ref flag, 1, 0) == 0) 41 | { 42 | try 43 | { 44 | await handler.HandleAsync(message, cancellationToken); 45 | } 46 | finally 47 | { 48 | Interlocked.Exchange(ref flag, 0); 49 | } 50 | } 51 | } 52 | } 53 | 54 | internal sealed class SwitchAsyncMessageHandler(AsyncMessageHandler handler) : AsyncMessageHandler 55 | { 56 | CancellationTokenSource? cts; 57 | 58 | protected override ValueTask HandleAsyncCore(T message, CancellationToken cancellationToken = default) 59 | { 60 | if (cts != null) 61 | { 62 | cts.Cancel(); 63 | cts.Dispose(); 64 | } 65 | 66 | cts = new CancellationTokenSource(); 67 | var ct = CancellationTokenSource.CreateLinkedTokenSource(cts.Token, cancellationToken).Token; 68 | 69 | return handler.HandleAsync(message, ct); 70 | } 71 | } -------------------------------------------------------------------------------- /tests/ZeroMessenger.Tests/DependencyInjectionTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using ZeroMessenger.DependencyInjection; 3 | 4 | namespace ZeroMessenger.Tests; 5 | 6 | public class DependencyInjectionTests 7 | { 8 | ServiceProvider serviceProvider = default!; 9 | 10 | [SetUp] 11 | public void SetUp() 12 | { 13 | var services = new ServiceCollection(); 14 | services.AddZeroMessenger(); 15 | serviceProvider = services.BuildServiceProvider(); 16 | } 17 | 18 | [TearDown] 19 | public void TearDown() 20 | { 21 | serviceProvider.Dispose(); 22 | } 23 | 24 | [Test] 25 | public void Test_DI_PublishSubscribe() 26 | { 27 | var publisher = serviceProvider.GetRequiredService>(); 28 | var subscriber = serviceProvider.GetRequiredService>(); 29 | var result = 0; 30 | 31 | var subscription = subscriber.Subscribe(x => 32 | { 33 | result = x; 34 | }); 35 | 36 | for (int i = 0; i < 10000; i++) 37 | { 38 | publisher.Publish(i); 39 | Assert.That(result, Is.EqualTo(i)); 40 | } 41 | 42 | result = -1; 43 | subscription.Dispose(); 44 | 45 | publisher.Publish(100); 46 | Assert.That(result, Is.EqualTo(-1)); 47 | } 48 | 49 | [Test] 50 | public async Task Test_DI_PublishAsyncSubscribeAwait() 51 | { 52 | var publisher = serviceProvider.GetRequiredService>(); 53 | var subscriber = serviceProvider.GetRequiredService>(); 54 | var result = 0; 55 | 56 | var subscription = subscriber.SubscribeAwait(async (x, ct) => 57 | { 58 | await Task.Delay(1, ct); 59 | result = x; 60 | }); 61 | 62 | for (int i = 0; i < 100; i++) 63 | { 64 | await publisher.PublishAsync(i); 65 | Assert.That(result, Is.EqualTo(i)); 66 | } 67 | 68 | result = -1; 69 | subscription.Dispose(); 70 | 71 | await publisher.PublishAsync(100); 72 | Assert.That(result, Is.EqualTo(-1)); 73 | } 74 | } -------------------------------------------------------------------------------- /sandbox/BlazorApp1/Components/Layout/MainLayout.razor.css: -------------------------------------------------------------------------------- 1 | .page { 2 | position: relative; 3 | display: flex; 4 | flex-direction: column; 5 | } 6 | 7 | main { 8 | flex: 1; 9 | } 10 | 11 | .sidebar { 12 | background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); 13 | } 14 | 15 | .top-row { 16 | background-color: #f7f7f7; 17 | border-bottom: 1px solid #d6d5d5; 18 | justify-content: flex-end; 19 | height: 3.5rem; 20 | display: flex; 21 | align-items: center; 22 | } 23 | 24 | .top-row ::deep a, .top-row ::deep .btn-link { 25 | white-space: nowrap; 26 | margin-left: 1.5rem; 27 | text-decoration: none; 28 | } 29 | 30 | .top-row ::deep a:hover, .top-row ::deep .btn-link:hover { 31 | text-decoration: underline; 32 | } 33 | 34 | .top-row ::deep a:first-child { 35 | overflow: hidden; 36 | text-overflow: ellipsis; 37 | } 38 | 39 | @media (max-width: 640.98px) { 40 | .top-row { 41 | justify-content: space-between; 42 | } 43 | 44 | .top-row ::deep a, .top-row ::deep .btn-link { 45 | margin-left: 0; 46 | } 47 | } 48 | 49 | @media (min-width: 641px) { 50 | .page { 51 | flex-direction: row; 52 | } 53 | 54 | .sidebar { 55 | width: 250px; 56 | height: 100vh; 57 | position: sticky; 58 | top: 0; 59 | } 60 | 61 | .top-row { 62 | position: sticky; 63 | top: 0; 64 | z-index: 1; 65 | } 66 | 67 | .top-row.auth ::deep a:first-child { 68 | flex: 1; 69 | text-align: right; 70 | width: 0; 71 | } 72 | 73 | .top-row, article { 74 | padding-left: 2rem !important; 75 | padding-right: 1.5rem !important; 76 | } 77 | } 78 | 79 | #blazor-error-ui { 80 | background: lightyellow; 81 | bottom: 0; 82 | box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); 83 | display: none; 84 | left: 0; 85 | padding: 0.6rem 1.25rem 0.7rem 1.25rem; 86 | position: fixed; 87 | width: 100%; 88 | z-index: 1000; 89 | } 90 | 91 | #blazor-error-ui .dismiss { 92 | cursor: pointer; 93 | position: absolute; 94 | right: 0.75rem; 95 | top: 0.5rem; 96 | } 97 | -------------------------------------------------------------------------------- /src/ZeroMessenger/Internal/ThrowHelper.cs: -------------------------------------------------------------------------------- 1 | 2 | using System.Diagnostics.CodeAnalysis; 3 | using System.Runtime.CompilerServices; 4 | 5 | namespace ZeroMessenger.Internal; 6 | 7 | internal static class ThrowHelper 8 | { 9 | internal static void ThrowArgumentNullIfNull([NotNull] object? argument, [CallerArgumentExpression(nameof(argument))] string? paramName = null) 10 | { 11 | if (argument is null) 12 | { 13 | ThrowArgumentNullException(paramName); 14 | } 15 | } 16 | 17 | internal static void ThrowObjectDisposedIf([DoesNotReturnIf(true)] bool condition, Type type) 18 | { 19 | if (condition) 20 | { 21 | ThrowObjectDisposedException(type); 22 | } 23 | } 24 | 25 | [DoesNotReturn] 26 | internal static void ThrowArgumentNullException(string? paramName) => throw new ArgumentNullException(paramName); 27 | 28 | [DoesNotReturn] 29 | internal static void ThrowArgumentException(string? message) => throw new ArgumentException(message); 30 | 31 | [DoesNotReturn] 32 | internal static void ThrowObjectDisposedException(Type? type) => throw new ObjectDisposedException(type?.FullName); 33 | 34 | internal static void ThrowIfMessageHandlerIsAssigned(MessageHandler handler) 35 | { 36 | if (handler.Parent != null) 37 | { 38 | ThrowArgumentException("Message handler is already assigned."); 39 | } 40 | } 41 | 42 | internal static void ThrowIfMessageHandlerIsAssigned(AsyncMessageHandler handler) 43 | { 44 | if (handler.Parent != null) 45 | { 46 | ThrowArgumentException("Message handler is already assigned."); 47 | } 48 | } 49 | 50 | internal static void ThrowIfMessageHandlerIsNotAssigned(MessageHandler handler) 51 | { 52 | if (handler.Parent == null) 53 | { 54 | ThrowArgumentException("Message handler is not assigned."); 55 | } 56 | } 57 | 58 | internal static void ThrowIfMessageHandlerIsNotAssigned(AsyncMessageHandler handler) 59 | { 60 | if (handler.Parent == null) 61 | { 62 | ThrowArgumentException("Message handler is not assigned."); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_JobOptions: 23 | serializedVersion: 2 24 | useMultithreading: 0 25 | useConsistencySorting: 0 26 | m_InterpolationPosesPerJob: 100 27 | m_NewContactsPerJob: 30 28 | m_CollideContactsPerJob: 100 29 | m_ClearFlagsPerJob: 200 30 | m_ClearBodyForcesPerJob: 200 31 | m_SyncDiscreteFixturesPerJob: 50 32 | m_SyncContinuousFixturesPerJob: 50 33 | m_FindNearestContactsPerJob: 100 34 | m_UpdateTriggerContactsPerJob: 100 35 | m_IslandSolverCostThreshold: 100 36 | m_IslandSolverBodyCostScale: 1 37 | m_IslandSolverContactCostScale: 10 38 | m_IslandSolverJointCostScale: 10 39 | m_IslandSolverBodiesPerJob: 50 40 | m_IslandSolverContactsPerJob: 50 41 | m_AutoSimulation: 1 42 | m_QueriesHitTriggers: 1 43 | m_QueriesStartInColliders: 1 44 | m_CallbacksOnDisable: 1 45 | m_ReuseCollisionCallbacks: 1 46 | m_AutoSyncTransforms: 0 47 | m_AlwaysShowColliders: 0 48 | m_ShowColliderSleep: 1 49 | m_ShowColliderContacts: 0 50 | m_ShowColliderAABB: 0 51 | m_ContactArrowScale: 0.2 52 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 53 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 54 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 55 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 56 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 57 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 13 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | m_PreloadedShaders: [] 39 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 40 | type: 0} 41 | m_CustomRenderPipeline: {fileID: 0} 42 | m_TransparencySortMode: 0 43 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 44 | m_DefaultRenderingPath: 1 45 | m_DefaultMobileRenderingPath: 1 46 | m_TierSettings: [] 47 | m_LightmapStripping: 0 48 | m_FogStripping: 0 49 | m_InstancingStripping: 0 50 | m_LightmapKeepPlain: 1 51 | m_LightmapKeepDirCombined: 1 52 | m_LightmapKeepDynamicPlain: 1 53 | m_LightmapKeepDynamicDirCombined: 1 54 | m_LightmapKeepShadowMask: 1 55 | m_LightmapKeepSubtractive: 1 56 | m_FogKeepLinear: 1 57 | m_FogKeepExp: 1 58 | m_FogKeepExp2: 1 59 | m_AlbedoSwatchInfos: [] 60 | m_LightsUseLinearIntensity: 0 61 | m_LightsUseColorTemperature: 0 62 | m_LogWhenShaderIsCompiled: 0 63 | m_AllowEnlightenSupportForUpgradedProject: 0 64 | -------------------------------------------------------------------------------- /sandbox/BlazorApp1/wwwroot/app.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; 3 | } 4 | 5 | a, .btn-link { 6 | color: #006bb7; 7 | } 8 | 9 | .btn-primary { 10 | color: #fff; 11 | background-color: #1b6ec2; 12 | border-color: #1861ac; 13 | } 14 | 15 | .btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus { 16 | box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb; 17 | } 18 | 19 | .content { 20 | padding-top: 1.1rem; 21 | } 22 | 23 | h1:focus { 24 | outline: none; 25 | } 26 | 27 | .valid.modified:not([type=checkbox]) { 28 | outline: 1px solid #26b050; 29 | } 30 | 31 | .invalid { 32 | outline: 1px solid #e50000; 33 | } 34 | 35 | .validation-message { 36 | color: #e50000; 37 | } 38 | 39 | .blazor-error-boundary { 40 | background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121; 41 | padding: 1rem 1rem 1rem 3.7rem; 42 | color: white; 43 | } 44 | 45 | .blazor-error-boundary::after { 46 | content: "An error has occurred." 47 | } 48 | 49 | .darker-border-checkbox.form-check-input { 50 | border-color: #929292; 51 | } 52 | -------------------------------------------------------------------------------- /src/ZeroMessenger/MessageSubscriberFilterExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace ZeroMessenger; 2 | 3 | public static class MessageSubscriberFilterExtensions 4 | { 5 | public static IMessageSubscriber WithFilter(this IMessageSubscriber subscriber) 6 | where TFilter : IMessageFilter, new() 7 | { 8 | return WithFilter(subscriber, new TFilter()); 9 | } 10 | 11 | public static IMessageSubscriber WithFilter(this IMessageSubscriber subscriber, Func, ValueTask> filter) 12 | { 13 | return WithFilter(subscriber, new AnonymousMessageFilter(filter)); 14 | } 15 | 16 | public static IMessageSubscriber WithFilter(this IMessageSubscriber subscriber, Predicate predicate) 17 | { 18 | return WithFilter(subscriber, new PredicateFilter(predicate)); 19 | } 20 | 21 | public static IMessageSubscriber WithFilter(this IMessageSubscriber subscriber, TFilter filter) 22 | where TFilter : IMessageFilter 23 | { 24 | if (subscriber is FilteredMessageSubscriber filteredSubscriber) 25 | { 26 | var array = new IMessageFilter[filteredSubscriber.Filters.Length + 1]; 27 | filteredSubscriber.Filters.AsSpan().CopyTo(array); 28 | array[^1] = filter; 29 | return new FilteredMessageSubscriber(filteredSubscriber.Subscriber, array); 30 | } 31 | 32 | return new FilteredMessageSubscriber(subscriber, [filter]); 33 | } 34 | 35 | public static IMessageSubscriber WithFilters(this IMessageSubscriber subscriber, ReadOnlySpan> filters) 36 | { 37 | if (subscriber is FilteredMessageSubscriber filteredSubscriber) 38 | { 39 | var array = new IMessageFilter[filteredSubscriber.Filters.Length + 1]; 40 | filteredSubscriber.Filters.AsSpan().CopyTo(array); 41 | filters.CopyTo(array.AsSpan(filteredSubscriber.Filters.Length)); 42 | return new FilteredMessageSubscriber(filteredSubscriber.Subscriber, array); 43 | } 44 | 45 | return new FilteredMessageSubscriber(subscriber, filters.ToArray()); 46 | } 47 | 48 | public static IMessageSubscriber WithFilters(this IMessageSubscriber subscriber, params IMessageFilter[] filters) 49 | { 50 | if (subscriber is FilteredMessageSubscriber filteredSubscriber) 51 | { 52 | var array = new IMessageFilter[filteredSubscriber.Filters.Length + 1]; 53 | filteredSubscriber.Filters.AsSpan().CopyTo(array); 54 | filters.CopyTo(array.AsSpan(filteredSubscriber.Filters.Length)); 55 | return new FilteredMessageSubscriber(filteredSubscriber.Subscriber, array); 56 | } 57 | 58 | return new FilteredMessageSubscriber(subscriber, filters); 59 | } 60 | 61 | } -------------------------------------------------------------------------------- /src/ZeroMessenger/Internal/FastListCore.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace ZeroMessenger.Internal; 5 | 6 | [StructLayout(LayoutKind.Auto)] 7 | internal struct FastListCore 8 | { 9 | const int InitialCapacity = 8; 10 | 11 | public static readonly FastListCore Empty = default; 12 | 13 | T[]? array; 14 | int tailIndex; 15 | 16 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 17 | public void Add(T element) 18 | { 19 | if (array == null) 20 | { 21 | array = new T[InitialCapacity]; 22 | } 23 | else if (array.Length == tailIndex) 24 | { 25 | Array.Resize(ref array, tailIndex * 2); 26 | } 27 | 28 | array[tailIndex] = element; 29 | tailIndex++; 30 | } 31 | 32 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 33 | public void RemoveAtSwapback(int index) 34 | { 35 | if (array == null) throw new IndexOutOfRangeException(); 36 | CheckIndex(index); 37 | 38 | array![index] = array[tailIndex - 1]; 39 | array[tailIndex - 1] = default!; 40 | tailIndex--; 41 | } 42 | 43 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 44 | public void Shrink(int newSize) 45 | { 46 | if (newSize >= tailIndex) return; 47 | 48 | array.AsSpan(newSize).Clear(); 49 | tailIndex = newSize; 50 | } 51 | 52 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 53 | public void Clear(bool removeArray = false) 54 | { 55 | if (array == null) return; 56 | 57 | array.AsSpan().Clear(); 58 | tailIndex = 0; 59 | if (removeArray) array = null; 60 | } 61 | 62 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 63 | public void EnsureCapacity(int capacity) 64 | { 65 | if (array == null) 66 | { 67 | array = new T[InitialCapacity]; 68 | } 69 | 70 | while (array.Length < capacity) 71 | { 72 | Array.Resize(ref array, array.Length * 2); 73 | } 74 | } 75 | 76 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 77 | public void CopyTo(ref FastListCore destination) 78 | { 79 | destination.EnsureCapacity(tailIndex); 80 | destination.tailIndex = tailIndex; 81 | AsSpan().CopyTo(destination.AsSpan()); 82 | } 83 | 84 | public ref T this[int index] 85 | { 86 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 87 | get => ref array![index]; 88 | } 89 | 90 | public readonly int Length 91 | { 92 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 93 | get => tailIndex; 94 | } 95 | 96 | public readonly Span AsSpan() => array == null ? Span.Empty : array.AsSpan(0, tailIndex); 97 | public readonly T[]? AsArray() => array; 98 | 99 | readonly void CheckIndex(int index) 100 | { 101 | if (index < 0 || index > tailIndex) throw new IndexOutOfRangeException(); 102 | } 103 | } -------------------------------------------------------------------------------- /tests/ZeroMessenger.Tests/FilterTests.cs: -------------------------------------------------------------------------------- 1 | 2 | using Microsoft.Extensions.DependencyInjection; 3 | using ZeroMessenger.DependencyInjection; 4 | 5 | namespace ZeroMessenger.Tests; 6 | 7 | public class FilterTests 8 | { 9 | [Test] 10 | public void Test_MessgeBrokerAddFilter() 11 | { 12 | var broker = new MessageBroker(); 13 | var result = 0; 14 | broker.AddFilter(new TestMessageFilter(x => x * 2)); 15 | 16 | var subscription = broker.Subscribe(x => result = x); 17 | 18 | for (int i = 0; i < 10000; i++) 19 | { 20 | broker.Publish(i); 21 | Assert.That(result, Is.EqualTo(i * 2)); 22 | } 23 | 24 | subscription.Dispose(); 25 | 26 | result = -1; 27 | broker.Publish(100); 28 | Assert.That(result, Is.EqualTo(-1)); 29 | } 30 | 31 | [Test] 32 | public void Test_SubscribeWithFilter() 33 | { 34 | var broker = new MessageBroker(); 35 | var result = 0; 36 | 37 | var subscription = broker 38 | .WithFilter(new TestMessageFilter(x => x * 2)) 39 | .Subscribe(x => result = x); 40 | 41 | for (int i = 0; i < 10000; i++) 42 | { 43 | broker.Publish(i); 44 | Assert.That(result, Is.EqualTo(i * 2)); 45 | } 46 | 47 | subscription.Dispose(); 48 | 49 | result = -1; 50 | broker.Publish(100); 51 | Assert.That(result, Is.EqualTo(-1)); 52 | } 53 | 54 | [Test] 55 | public void Test_DI_Filter() 56 | { 57 | var services = new ServiceCollection(); 58 | services.AddZeroMessenger(x => 59 | { 60 | x.AddFilter(new TestMessageFilter(x => x * 2)); 61 | }); 62 | var serviceProvider = services.BuildServiceProvider(); 63 | 64 | var publisher = serviceProvider.GetRequiredService>(); 65 | var subscriber = serviceProvider.GetRequiredService>(); 66 | var result = 0; 67 | 68 | var subscription = subscriber.Subscribe(x => 69 | { 70 | result = x; 71 | }); 72 | 73 | for (int i = 0; i < 10000; i++) 74 | { 75 | publisher.Publish(i); 76 | Assert.That(result, Is.EqualTo(i * 2)); 77 | } 78 | 79 | result = -1; 80 | subscription.Dispose(); 81 | 82 | publisher.Publish(100); 83 | Assert.That(result, Is.EqualTo(-1)); 84 | } 85 | 86 | [Test] 87 | public void Test_DI_Filter_OpenGenerics() 88 | { 89 | var services = new ServiceCollection(); 90 | services.AddZeroMessenger(x => 91 | { 92 | x.AddFilter(typeof(IgnoreMessageFilter<>)); 93 | }); 94 | var serviceProvider = services.BuildServiceProvider(); 95 | 96 | var publisher = serviceProvider.GetRequiredService>(); 97 | var subscriber = serviceProvider.GetRequiredService>(); 98 | var result = -1; 99 | 100 | var subscription = subscriber.Subscribe(x => 101 | { 102 | result = x; 103 | }); 104 | 105 | publisher.Publish(100); 106 | Assert.That(result, Is.EqualTo(-1)); 107 | } 108 | } -------------------------------------------------------------------------------- /src/ZeroMessenger/MessageSubscriberAsyncExtensions.cs: -------------------------------------------------------------------------------- 1 | #if NET5_0_OR_GREATER 2 | using System.Threading.Channels; 3 | #endif 4 | 5 | namespace ZeroMessenger; 6 | 7 | public static class MessageSubscriberAsyncExtensions 8 | { 9 | public static Task FirstAsync(this IMessageSubscriber subscriber, CancellationToken cancellationToken = default) 10 | { 11 | var handler = new FirstAsyncMessageHandler(subscriber, cancellationToken); 12 | subscriber.Subscribe(handler); 13 | return handler.Task; 14 | } 15 | 16 | #if NET5_0_OR_GREATER 17 | public static IAsyncEnumerable ToAsyncEnumerable(this IMessageSubscriber subscriber, CancellationToken cancellationToken = default) 18 | { 19 | var channel = Channel.CreateUnbounded(new UnboundedChannelOptions 20 | { 21 | SingleWriter = true, 22 | SingleReader = true, 23 | AllowSynchronousContinuations = true 24 | }); 25 | 26 | var handler = new AsyncEnumerableMessageHandler(channel.Writer); 27 | var disposable = subscriber.Subscribe(handler); 28 | 29 | if (cancellationToken.CanBeCanceled) 30 | { 31 | handler.registration = cancellationToken.UnsafeRegister(state => 32 | { 33 | ((IDisposable)state!).Dispose(); 34 | }, disposable); 35 | } 36 | 37 | return channel.Reader.ReadAllAsync(cancellationToken); 38 | } 39 | #endif 40 | } 41 | 42 | internal sealed class FirstAsyncMessageHandler : MessageHandler 43 | { 44 | int handleCalled = 0; 45 | CancellationToken cancellationToken; 46 | CancellationTokenRegistration cancellationTokenRegistration; 47 | TaskCompletionSource source = new(); 48 | 49 | public Task Task => source.Task; 50 | 51 | public FirstAsyncMessageHandler(IMessageSubscriber subscriber, CancellationToken cancellationToken) 52 | { 53 | if (cancellationToken.IsCancellationRequested) 54 | { 55 | source.TrySetException(new OperationCanceledException(cancellationToken)); 56 | return; 57 | } 58 | 59 | try 60 | { 61 | subscriber.Subscribe(this); 62 | } 63 | catch (Exception ex) 64 | { 65 | source.TrySetException(ex); 66 | return; 67 | } 68 | 69 | if (handleCalled != 0) 70 | { 71 | Dispose(); 72 | return; 73 | } 74 | 75 | if (cancellationToken.CanBeCanceled) 76 | { 77 | this.cancellationToken = cancellationToken; 78 | 79 | cancellationTokenRegistration = cancellationToken.UnsafeRegister(static state => 80 | { 81 | var s = (FirstAsyncMessageHandler)state!; 82 | s.Dispose(); 83 | s.source.TrySetCanceled(s.cancellationToken); 84 | }, this); 85 | } 86 | } 87 | 88 | protected override void HandleCore(T message) 89 | { 90 | if (Interlocked.Increment(ref handleCalled) == 1) 91 | { 92 | try 93 | { 94 | source.TrySetResult(message); 95 | } 96 | finally 97 | { 98 | cancellationTokenRegistration.Dispose(); 99 | Dispose(); 100 | } 101 | } 102 | } 103 | } 104 | 105 | #if NET5_0_OR_GREATER 106 | 107 | internal class AsyncEnumerableMessageHandler(ChannelWriter writer) : MessageHandler 108 | { 109 | public CancellationTokenRegistration registration; 110 | 111 | protected override void HandleCore(T message) 112 | { 113 | writer.TryWrite(message); 114 | } 115 | 116 | protected override void DisposeCore() 117 | { 118 | registration.Dispose(); 119 | } 120 | } 121 | 122 | #endif -------------------------------------------------------------------------------- /sandbox/Benchmark/SubscribeDisposeBenchmark.cs: -------------------------------------------------------------------------------- 1 | using BenchmarkDotNet.Attributes; 2 | using MessagePipe; 3 | using Microsoft.Extensions.DependencyInjection; 4 | using R3; 5 | using VitalRouter; 6 | using ZeroMessenger; 7 | 8 | [MemoryDiagnoser] 9 | public class SubscribeDisposeBenchmark 10 | { 11 | const int Count = 10000; 12 | 13 | IDisposable[] disposables = default!; 14 | 15 | MessagePipe.ISubscriber messagePipeSubscriber = default!; 16 | ZeroMessenger.MessageBroker zeroMessageBroker = default!; 17 | R3.Subject r3Subject = default!; 18 | System.Reactive.Subjects.Subject rxNetSubject = default!; 19 | Prism.Events.PubSubEvent prismEvent = default!; 20 | VitalRouter.ICommandSubscribable vitalRouter = default!; 21 | 22 | [GlobalSetup] 23 | public void GlobalSetup() 24 | { 25 | var serviceCollection = new ServiceCollection(); 26 | serviceCollection.AddMessagePipe(); 27 | var provider = serviceCollection.BuildServiceProvider(); 28 | GlobalMessagePipe.SetProvider(provider); 29 | } 30 | 31 | [IterationSetup] 32 | public void Setup() 33 | { 34 | disposables = new IDisposable[Count]; 35 | zeroMessageBroker = new ZeroMessenger.MessageBroker(); 36 | messagePipeSubscriber = GlobalMessagePipe.GetSubscriber(); 37 | r3Subject = new(); 38 | rxNetSubject = new(); 39 | prismEvent = new EventAggregator().GetEvent(); 40 | vitalRouter = new Router(); 41 | } 42 | 43 | [Benchmark(Description = "Subscribe (ZeroMessenger)")] 44 | public void Benchmark_ZeroMessenger() 45 | { 46 | for (int i = 0; i < Count; i++) 47 | { 48 | disposables[i] = zeroMessageBroker.Subscribe(x => { }); 49 | } 50 | for (int i = 0; i < Count; i++) 51 | { 52 | disposables[i].Dispose(); 53 | } 54 | } 55 | 56 | [Benchmark(Description = "Subscribe (MessagePipe)")] 57 | public void Benchmark_MessagePipe() 58 | { 59 | for (int i = 0; i < Count; i++) 60 | { 61 | disposables[i] = messagePipeSubscriber.Subscribe(x => { }); 62 | } 63 | for (int i = 0; i < Count; i++) 64 | { 65 | disposables[i].Dispose(); 66 | } 67 | } 68 | 69 | [Benchmark(Description = "Subscribe (R3 Subject)")] 70 | public void Benchmark_R3Subject() 71 | { 72 | for (int i = 0; i < Count; i++) 73 | { 74 | disposables[i] = r3Subject.Subscribe(x => { }); 75 | } 76 | for (int i = 0; i < Count; i++) 77 | { 78 | disposables[i].Dispose(); 79 | } 80 | } 81 | 82 | [Benchmark(Description = "Subscribe (System.Reactive Subject)")] 83 | public void Benchmark_RxNetSubject() 84 | { 85 | for (int i = 0; i < Count; i++) 86 | { 87 | disposables[i] = rxNetSubject.Subscribe(x => { }); 88 | } 89 | for (int i = 0; i < Count; i++) 90 | { 91 | disposables[i].Dispose(); 92 | } 93 | } 94 | 95 | [Benchmark(Description = "Subscribe (Prism)")] 96 | public void Benchmark_Prism() 97 | { 98 | for (int i = 0; i < Count; i++) 99 | { 100 | disposables[i] = prismEvent.Subscribe(x => { }); 101 | } 102 | for (int i = 0; i < Count; i++) 103 | { 104 | disposables[i].Dispose(); 105 | } 106 | } 107 | 108 | [Benchmark(Description = "Subscribe (VitalRouter)")] 109 | public void Benchmark_VitalRouter() 110 | { 111 | for (int i = 0; i < Count; i++) 112 | { 113 | disposables[i] = vitalRouter.Subscribe((c, context) => { }); 114 | } 115 | for (int i = 0; i < Count; i++) 116 | { 117 | disposables[i].Dispose(); 118 | } 119 | } 120 | } -------------------------------------------------------------------------------- /src/ZeroMessenger/Internal/MessageHandlerList.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | namespace ZeroMessenger.Internal; 4 | 5 | /// 6 | /// MessageHandlerNode list 7 | /// 8 | internal sealed class MessageHandlerList(object gate) : IDisposable 9 | { 10 | MessageHandlerNode? root; 11 | ulong version; 12 | bool isDisposed; 13 | 14 | public MessageHandlerNode? Root => root; 15 | public bool IsDisposed => isDisposed; 16 | 17 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 18 | public void Add(MessageHandlerNode node) 19 | { 20 | lock (gate) 21 | { 22 | if (IsDisposed) return; 23 | 24 | node.Parent = this; 25 | node.Version = version; 26 | 27 | if (root == null) 28 | { 29 | root = node; 30 | node.NextNode = null; 31 | node.PreviousNode = null; 32 | } 33 | else 34 | { 35 | var lastNode = root.PreviousNode ?? root; 36 | 37 | lastNode.NextNode = node; 38 | node.PreviousNode = lastNode; 39 | root.PreviousNode = node; 40 | 41 | node.NextNode = null; 42 | } 43 | } 44 | } 45 | 46 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 47 | public void Remove(MessageHandlerNode node) 48 | { 49 | lock (gate) 50 | { 51 | if (IsDisposed) return; 52 | 53 | if (node == root) 54 | { 55 | if (node.PreviousNode == null || node.NextNode == null) 56 | { 57 | // case of single list 58 | root = null; 59 | } 60 | else 61 | { 62 | // otherwise, root is next node. 63 | var nextRoot = node.NextNode; 64 | 65 | // single list. 66 | if (nextRoot.NextNode == null) 67 | { 68 | nextRoot.PreviousNode = null; 69 | } 70 | else 71 | { 72 | nextRoot.PreviousNode = node.PreviousNode; // as last. 73 | } 74 | 75 | root = nextRoot; 76 | } 77 | } 78 | else 79 | { 80 | // node is not root, previous must exists 81 | node.PreviousNode!.NextNode = node.NextNode; 82 | 83 | if (node.NextNode != null) 84 | { 85 | node.NextNode.PreviousNode = node.PreviousNode; 86 | } 87 | else 88 | { 89 | // next does not exists, previous is last node so modify root 90 | root!.PreviousNode = node.PreviousNode; 91 | } 92 | } 93 | } 94 | } 95 | 96 | public void Dispose() 97 | { 98 | lock (gate) 99 | { 100 | ThrowHelper.ThrowObjectDisposedIf(IsDisposed, typeof(MessageHandlerList)); 101 | 102 | root = null; 103 | isDisposed = true; 104 | } 105 | } 106 | 107 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 108 | public ulong GetVersion() 109 | { 110 | lock (gate) 111 | { 112 | ulong currentVersion; 113 | if (version == ulong.MaxValue) 114 | { 115 | var node = root; 116 | while (node != null) 117 | { 118 | node.Version = 0; 119 | node = node.NextNode; 120 | } 121 | 122 | version = 1; // also reset version 123 | 124 | currentVersion = 0; 125 | } 126 | else 127 | { 128 | currentVersion = version++; 129 | } 130 | return currentVersion; 131 | } 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /sandbox/Benchmark/PublishBenchmark.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | using BenchmarkDotNet.Attributes; 3 | using MediatR; 4 | using MessagePipe; 5 | using Microsoft.Extensions.DependencyInjection; 6 | using R3; 7 | using VitalRouter; 8 | using ZeroMessenger; 9 | 10 | [MemoryDiagnoser] 11 | [InvocationCount(10000)] 12 | public class PublishBenchmark 13 | { 14 | const int SubscribeCount = 8; 15 | 16 | MessagePipe.IPublisher messagePipePublisher = default!; 17 | MessagePipe.ISubscriber messagePipeSubscriber = default!; 18 | 19 | ZeroMessenger.MessageBroker zeroMessengerBroker = default!; 20 | 21 | R3.Subject r3Subject = default!; 22 | System.Reactive.Subjects.Subject rxNetSubject = default!; 23 | 24 | PubSubEvent prismEvent = default!; 25 | VitalRouter.Router vitalRouter = default!; 26 | 27 | MediatR.IMediator mediatRMediator = default!; 28 | PubSub.Hub pubsubHub = default!; 29 | 30 | TestMessage message = new(); 31 | 32 | [IterationSetup] 33 | public void Setup() 34 | { 35 | static void Method(int i) 36 | { 37 | 38 | } 39 | 40 | zeroMessengerBroker = new ZeroMessenger.MessageBroker(); 41 | 42 | var serviceCollection = new ServiceCollection(); 43 | serviceCollection.AddMessagePipe(); 44 | serviceCollection.AddMediatR(x => x.RegisterServicesFromAssembly(GetType().Assembly)); 45 | var provider = serviceCollection.BuildServiceProvider(); 46 | GlobalMessagePipe.SetProvider(provider); 47 | 48 | messagePipePublisher = GlobalMessagePipe.GetPublisher(); 49 | messagePipeSubscriber = GlobalMessagePipe.GetSubscriber(); 50 | 51 | r3Subject = new(); 52 | rxNetSubject = new(); 53 | prismEvent = new Prism.Events.EventAggregator().GetEvent(); 54 | vitalRouter = new VitalRouter.Router(); 55 | mediatRMediator = provider.GetRequiredService(); 56 | pubsubHub = new(); 57 | 58 | for (int i = 0; i < SubscribeCount; i++) 59 | { 60 | zeroMessengerBroker.Subscribe(i, (x, state) => Method(state)); 61 | messagePipeSubscriber.Subscribe(x => Method(i)); 62 | rxNetSubject.Subscribe(x => Method(i)); 63 | r3Subject.Subscribe(i, (x, state) => Method(state)); 64 | prismEvent.Subscribe(x => Method(i)); 65 | vitalRouter.Subscribe((c, context) => Method(i)); 66 | pubsubHub.Subscribe(x => Method(i)); 67 | } 68 | } 69 | 70 | [Benchmark(Description = "Publish (ZeroMessenger)")] 71 | public void Benchmark_ZeroMessenger() 72 | { 73 | zeroMessengerBroker.Publish(message); 74 | } 75 | 76 | [Benchmark(Description = "Publish (MessagePipe)")] 77 | public void Benchmark_MessagePipe() 78 | { 79 | messagePipePublisher.Publish(message); 80 | } 81 | 82 | [Benchmark(Description = "Publish (System.Reactive Subject)")] 83 | public void Benchmark_RxNetSubject() 84 | { 85 | rxNetSubject.OnNext(message); 86 | } 87 | 88 | [Benchmark(Description = "Publish (R3 Subject)")] 89 | public void Benchmark_R3Subject() 90 | { 91 | r3Subject.OnNext(message); 92 | } 93 | 94 | [Benchmark(Description = "Publish (Prism)")] 95 | public void Benchmark_Prism() 96 | { 97 | prismEvent.Publish(message); 98 | } 99 | 100 | [Benchmark(Description = "Publish (VitalRouter)")] 101 | public void Benchmark_VitalRouter() 102 | { 103 | // sync subscribers only 104 | vitalRouter.PublishAsync(message); 105 | } 106 | 107 | [Benchmark(Description = "Publish (MediatR)")] 108 | public void Benchmark_MediatR() 109 | { 110 | mediatRMediator.Publish(message).Wait(); 111 | } 112 | 113 | [Benchmark(Description = "Publish (PubSub)")] 114 | public void Benchmark_PubSub() 115 | { 116 | pubsubHub.Publish(message); 117 | } 118 | } -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/ProjectSettings/SceneTemplateSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "templatePinStates": [], 3 | "dependencyTypeInfos": [ 4 | { 5 | "userAdded": false, 6 | "type": "UnityEngine.AnimationClip", 7 | "defaultInstantiationMode": 0 8 | }, 9 | { 10 | "userAdded": false, 11 | "type": "UnityEditor.Animations.AnimatorController", 12 | "defaultInstantiationMode": 0 13 | }, 14 | { 15 | "userAdded": false, 16 | "type": "UnityEngine.AnimatorOverrideController", 17 | "defaultInstantiationMode": 0 18 | }, 19 | { 20 | "userAdded": false, 21 | "type": "UnityEditor.Audio.AudioMixerController", 22 | "defaultInstantiationMode": 0 23 | }, 24 | { 25 | "userAdded": false, 26 | "type": "UnityEngine.ComputeShader", 27 | "defaultInstantiationMode": 1 28 | }, 29 | { 30 | "userAdded": false, 31 | "type": "UnityEngine.Cubemap", 32 | "defaultInstantiationMode": 0 33 | }, 34 | { 35 | "userAdded": false, 36 | "type": "UnityEngine.GameObject", 37 | "defaultInstantiationMode": 0 38 | }, 39 | { 40 | "userAdded": false, 41 | "type": "UnityEditor.LightingDataAsset", 42 | "defaultInstantiationMode": 0 43 | }, 44 | { 45 | "userAdded": false, 46 | "type": "UnityEngine.LightingSettings", 47 | "defaultInstantiationMode": 0 48 | }, 49 | { 50 | "userAdded": false, 51 | "type": "UnityEngine.Material", 52 | "defaultInstantiationMode": 0 53 | }, 54 | { 55 | "userAdded": false, 56 | "type": "UnityEditor.MonoScript", 57 | "defaultInstantiationMode": 1 58 | }, 59 | { 60 | "userAdded": false, 61 | "type": "UnityEngine.PhysicMaterial", 62 | "defaultInstantiationMode": 0 63 | }, 64 | { 65 | "userAdded": false, 66 | "type": "UnityEngine.PhysicsMaterial2D", 67 | "defaultInstantiationMode": 0 68 | }, 69 | { 70 | "userAdded": false, 71 | "type": "UnityEngine.Rendering.PostProcessing.PostProcessProfile", 72 | "defaultInstantiationMode": 0 73 | }, 74 | { 75 | "userAdded": false, 76 | "type": "UnityEngine.Rendering.PostProcessing.PostProcessResources", 77 | "defaultInstantiationMode": 0 78 | }, 79 | { 80 | "userAdded": false, 81 | "type": "UnityEngine.Rendering.VolumeProfile", 82 | "defaultInstantiationMode": 0 83 | }, 84 | { 85 | "userAdded": false, 86 | "type": "UnityEditor.SceneAsset", 87 | "defaultInstantiationMode": 1 88 | }, 89 | { 90 | "userAdded": false, 91 | "type": "UnityEngine.Shader", 92 | "defaultInstantiationMode": 1 93 | }, 94 | { 95 | "userAdded": false, 96 | "type": "UnityEngine.ShaderVariantCollection", 97 | "defaultInstantiationMode": 1 98 | }, 99 | { 100 | "userAdded": false, 101 | "type": "UnityEngine.Texture", 102 | "defaultInstantiationMode": 0 103 | }, 104 | { 105 | "userAdded": false, 106 | "type": "UnityEngine.Texture2D", 107 | "defaultInstantiationMode": 0 108 | }, 109 | { 110 | "userAdded": false, 111 | "type": "UnityEngine.Timeline.TimelineAsset", 112 | "defaultInstantiationMode": 0 113 | } 114 | ], 115 | "defaultDependencyTypeInfo": { 116 | "userAdded": false, 117 | "type": "", 118 | "defaultInstantiationMode": 1 119 | }, 120 | "newSceneOverride": 0 121 | } -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/ZeroMessenger.0.1.0/Icon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 32fd13bb3a1964890a16eb6a1ec92feb 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 13 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | flipGreenChannel: 0 24 | isReadable: 0 25 | streamingMipmaps: 0 26 | streamingMipmapsPriority: 0 27 | vTOnly: 0 28 | ignoreMipmapLimit: 0 29 | grayScaleToAlpha: 0 30 | generateCubemap: 6 31 | cubemapConvolution: 0 32 | seamlessCubemap: 0 33 | textureFormat: 1 34 | maxTextureSize: 2048 35 | textureSettings: 36 | serializedVersion: 2 37 | filterMode: 1 38 | aniso: 1 39 | mipBias: 0 40 | wrapU: 0 41 | wrapV: 0 42 | wrapW: 0 43 | nPOTScale: 1 44 | lightmap: 0 45 | compressionQuality: 50 46 | spriteMode: 0 47 | spriteExtrude: 1 48 | spriteMeshType: 1 49 | alignment: 0 50 | spritePivot: {x: 0.5, y: 0.5} 51 | spritePixelsToUnits: 100 52 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 53 | spriteGenerateFallbackPhysicsShape: 1 54 | alphaUsage: 1 55 | alphaIsTransparency: 0 56 | spriteTessellationDetail: -1 57 | textureType: 0 58 | textureShape: 1 59 | singleChannelComponent: 0 60 | flipbookRows: 1 61 | flipbookColumns: 1 62 | maxTextureSizeSet: 0 63 | compressionQualitySet: 0 64 | textureFormatSet: 0 65 | ignorePngGamma: 0 66 | applyGammaDecoding: 0 67 | swizzle: 50462976 68 | cookieLightType: 0 69 | platformSettings: 70 | - serializedVersion: 3 71 | buildTarget: DefaultTexturePlatform 72 | maxTextureSize: 2048 73 | resizeAlgorithm: 0 74 | textureFormat: -1 75 | textureCompression: 1 76 | compressionQuality: 50 77 | crunchedCompression: 0 78 | allowsAlphaSplitting: 0 79 | overridden: 0 80 | ignorePlatformSupport: 0 81 | androidETC2FallbackOverride: 0 82 | forceMaximumCompressionQuality_BC6H_BC7: 0 83 | - serializedVersion: 3 84 | buildTarget: Standalone 85 | maxTextureSize: 2048 86 | resizeAlgorithm: 0 87 | textureFormat: -1 88 | textureCompression: 1 89 | compressionQuality: 50 90 | crunchedCompression: 0 91 | allowsAlphaSplitting: 0 92 | overridden: 0 93 | ignorePlatformSupport: 0 94 | androidETC2FallbackOverride: 0 95 | forceMaximumCompressionQuality_BC6H_BC7: 0 96 | - serializedVersion: 3 97 | buildTarget: iPhone 98 | maxTextureSize: 2048 99 | resizeAlgorithm: 0 100 | textureFormat: -1 101 | textureCompression: 1 102 | compressionQuality: 50 103 | crunchedCompression: 0 104 | allowsAlphaSplitting: 0 105 | overridden: 0 106 | ignorePlatformSupport: 0 107 | androidETC2FallbackOverride: 0 108 | forceMaximumCompressionQuality_BC6H_BC7: 0 109 | - serializedVersion: 3 110 | buildTarget: WebGL 111 | maxTextureSize: 2048 112 | resizeAlgorithm: 0 113 | textureFormat: -1 114 | textureCompression: 1 115 | compressionQuality: 50 116 | crunchedCompression: 0 117 | allowsAlphaSplitting: 0 118 | overridden: 0 119 | ignorePlatformSupport: 0 120 | androidETC2FallbackOverride: 0 121 | forceMaximumCompressionQuality_BC6H_BC7: 0 122 | - serializedVersion: 3 123 | buildTarget: Android 124 | maxTextureSize: 2048 125 | resizeAlgorithm: 0 126 | textureFormat: -1 127 | textureCompression: 1 128 | compressionQuality: 50 129 | crunchedCompression: 0 130 | allowsAlphaSplitting: 0 131 | overridden: 0 132 | ignorePlatformSupport: 0 133 | androidETC2FallbackOverride: 0 134 | forceMaximumCompressionQuality_BC6H_BC7: 0 135 | spriteSheet: 136 | serializedVersion: 2 137 | sprites: [] 138 | outline: [] 139 | physicsShape: [] 140 | bones: [] 141 | spriteID: 142 | internalID: 0 143 | vertices: [] 144 | indices: 145 | edges: [] 146 | weights: [] 147 | secondaryTextures: [] 148 | nameFileIdTable: {} 149 | mipmapLimitGroupName: 150 | pSDRemoveMatte: 0 151 | userData: 152 | assetBundleName: 153 | assetBundleVariant: 154 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/nuget-packages/InstalledPackages/System.Runtime.CompilerServices.Unsafe.6.0.0/Icon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 31bd57de282ed4095b3a27cfc158b5ff 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 13 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | flipGreenChannel: 0 24 | isReadable: 0 25 | streamingMipmaps: 0 26 | streamingMipmapsPriority: 0 27 | vTOnly: 0 28 | ignoreMipmapLimit: 0 29 | grayScaleToAlpha: 0 30 | generateCubemap: 6 31 | cubemapConvolution: 0 32 | seamlessCubemap: 0 33 | textureFormat: 1 34 | maxTextureSize: 2048 35 | textureSettings: 36 | serializedVersion: 2 37 | filterMode: 1 38 | aniso: 1 39 | mipBias: 0 40 | wrapU: 0 41 | wrapV: 0 42 | wrapW: 0 43 | nPOTScale: 1 44 | lightmap: 0 45 | compressionQuality: 50 46 | spriteMode: 0 47 | spriteExtrude: 1 48 | spriteMeshType: 1 49 | alignment: 0 50 | spritePivot: {x: 0.5, y: 0.5} 51 | spritePixelsToUnits: 100 52 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 53 | spriteGenerateFallbackPhysicsShape: 1 54 | alphaUsage: 1 55 | alphaIsTransparency: 0 56 | spriteTessellationDetail: -1 57 | textureType: 0 58 | textureShape: 1 59 | singleChannelComponent: 0 60 | flipbookRows: 1 61 | flipbookColumns: 1 62 | maxTextureSizeSet: 0 63 | compressionQualitySet: 0 64 | textureFormatSet: 0 65 | ignorePngGamma: 0 66 | applyGammaDecoding: 0 67 | swizzle: 50462976 68 | cookieLightType: 0 69 | platformSettings: 70 | - serializedVersion: 3 71 | buildTarget: DefaultTexturePlatform 72 | maxTextureSize: 2048 73 | resizeAlgorithm: 0 74 | textureFormat: -1 75 | textureCompression: 1 76 | compressionQuality: 50 77 | crunchedCompression: 0 78 | allowsAlphaSplitting: 0 79 | overridden: 0 80 | ignorePlatformSupport: 0 81 | androidETC2FallbackOverride: 0 82 | forceMaximumCompressionQuality_BC6H_BC7: 0 83 | - serializedVersion: 3 84 | buildTarget: Standalone 85 | maxTextureSize: 2048 86 | resizeAlgorithm: 0 87 | textureFormat: -1 88 | textureCompression: 1 89 | compressionQuality: 50 90 | crunchedCompression: 0 91 | allowsAlphaSplitting: 0 92 | overridden: 0 93 | ignorePlatformSupport: 0 94 | androidETC2FallbackOverride: 0 95 | forceMaximumCompressionQuality_BC6H_BC7: 0 96 | - serializedVersion: 3 97 | buildTarget: iPhone 98 | maxTextureSize: 2048 99 | resizeAlgorithm: 0 100 | textureFormat: -1 101 | textureCompression: 1 102 | compressionQuality: 50 103 | crunchedCompression: 0 104 | allowsAlphaSplitting: 0 105 | overridden: 0 106 | ignorePlatformSupport: 0 107 | androidETC2FallbackOverride: 0 108 | forceMaximumCompressionQuality_BC6H_BC7: 0 109 | - serializedVersion: 3 110 | buildTarget: WebGL 111 | maxTextureSize: 2048 112 | resizeAlgorithm: 0 113 | textureFormat: -1 114 | textureCompression: 1 115 | compressionQuality: 50 116 | crunchedCompression: 0 117 | allowsAlphaSplitting: 0 118 | overridden: 0 119 | ignorePlatformSupport: 0 120 | androidETC2FallbackOverride: 0 121 | forceMaximumCompressionQuality_BC6H_BC7: 0 122 | - serializedVersion: 3 123 | buildTarget: Android 124 | maxTextureSize: 2048 125 | resizeAlgorithm: 0 126 | textureFormat: -1 127 | textureCompression: 1 128 | compressionQuality: 50 129 | crunchedCompression: 0 130 | allowsAlphaSplitting: 0 131 | overridden: 0 132 | ignorePlatformSupport: 0 133 | androidETC2FallbackOverride: 0 134 | forceMaximumCompressionQuality_BC6H_BC7: 0 135 | spriteSheet: 136 | serializedVersion: 2 137 | sprites: [] 138 | outline: [] 139 | physicsShape: [] 140 | bones: [] 141 | spriteID: 142 | internalID: 0 143 | vertices: [] 144 | indices: 145 | edges: [] 146 | weights: [] 147 | secondaryTextures: [] 148 | nameFileIdTable: {} 149 | mipmapLimitGroupName: 150 | pSDRemoveMatte: 0 151 | userData: 152 | assetBundleName: 153 | assetBundleVariant: 154 | -------------------------------------------------------------------------------- /ZeroMessenger.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.31903.59 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sandbox", "sandbox", "{1F8F748E-EBCF-4A78-BCFE-34F68E4EDE9E}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Benchmark", "sandbox\Benchmark\Benchmark.csproj", "{DD4F0801-7A28-4C2A-865A-6466BEA004B9}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "sandbox\ConsoleApp1\ConsoleApp1.csproj", "{70F992B7-E5DE-42A1-986E-D050DF6F3A92}" 11 | EndProject 12 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{AE3EE0E2-B855-4389-BA59-1B0823F1B578}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZeroMessenger", "src\ZeroMessenger\ZeroMessenger.csproj", "{D9A7CBEF-3912-41F4-BD59-078C568FC047}" 15 | EndProject 16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZeroMessenger.DependencyInjection", "src\ZeroMessenger.DependencyInjection\ZeroMessenger.DependencyInjection.csproj", "{EF7DEF5D-E74E-4AAF-857A-0E7B88924E92}" 17 | EndProject 18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZeroMessenger.R3", "src\ZeroMessenger.R3\ZeroMessenger.R3.csproj", "{1012E9FF-2C28-4A57-9DB8-FAB6EB8A94D5}" 19 | EndProject 20 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorApp1", "sandbox\BlazorApp1\BlazorApp1.csproj", "{944A9DC6-107E-4B03-B9F2-8BC5DC34E19D}" 21 | EndProject 22 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{E1A97E36-294F-46C2-BAF3-DC50BF5C5DE8}" 23 | EndProject 24 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZeroMessenger.Tests", "tests\ZeroMessenger.Tests\ZeroMessenger.Tests.csproj", "{AB690921-2BE0-42AC-BED5-B2D891B72BB2}" 25 | EndProject 26 | Global 27 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 28 | Debug|Any CPU = Debug|Any CPU 29 | Release|Any CPU = Release|Any CPU 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 35 | {DD4F0801-7A28-4C2A-865A-6466BEA004B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 36 | {DD4F0801-7A28-4C2A-865A-6466BEA004B9}.Debug|Any CPU.Build.0 = Debug|Any CPU 37 | {DD4F0801-7A28-4C2A-865A-6466BEA004B9}.Release|Any CPU.ActiveCfg = Release|Any CPU 38 | {DD4F0801-7A28-4C2A-865A-6466BEA004B9}.Release|Any CPU.Build.0 = Release|Any CPU 39 | {70F992B7-E5DE-42A1-986E-D050DF6F3A92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 40 | {70F992B7-E5DE-42A1-986E-D050DF6F3A92}.Debug|Any CPU.Build.0 = Debug|Any CPU 41 | {70F992B7-E5DE-42A1-986E-D050DF6F3A92}.Release|Any CPU.ActiveCfg = Release|Any CPU 42 | {70F992B7-E5DE-42A1-986E-D050DF6F3A92}.Release|Any CPU.Build.0 = Release|Any CPU 43 | {D9A7CBEF-3912-41F4-BD59-078C568FC047}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 44 | {D9A7CBEF-3912-41F4-BD59-078C568FC047}.Debug|Any CPU.Build.0 = Debug|Any CPU 45 | {D9A7CBEF-3912-41F4-BD59-078C568FC047}.Release|Any CPU.ActiveCfg = Release|Any CPU 46 | {D9A7CBEF-3912-41F4-BD59-078C568FC047}.Release|Any CPU.Build.0 = Release|Any CPU 47 | {EF7DEF5D-E74E-4AAF-857A-0E7B88924E92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 48 | {EF7DEF5D-E74E-4AAF-857A-0E7B88924E92}.Debug|Any CPU.Build.0 = Debug|Any CPU 49 | {EF7DEF5D-E74E-4AAF-857A-0E7B88924E92}.Release|Any CPU.ActiveCfg = Release|Any CPU 50 | {EF7DEF5D-E74E-4AAF-857A-0E7B88924E92}.Release|Any CPU.Build.0 = Release|Any CPU 51 | {1012E9FF-2C28-4A57-9DB8-FAB6EB8A94D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 52 | {1012E9FF-2C28-4A57-9DB8-FAB6EB8A94D5}.Debug|Any CPU.Build.0 = Debug|Any CPU 53 | {1012E9FF-2C28-4A57-9DB8-FAB6EB8A94D5}.Release|Any CPU.ActiveCfg = Release|Any CPU 54 | {1012E9FF-2C28-4A57-9DB8-FAB6EB8A94D5}.Release|Any CPU.Build.0 = Release|Any CPU 55 | {944A9DC6-107E-4B03-B9F2-8BC5DC34E19D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 56 | {944A9DC6-107E-4B03-B9F2-8BC5DC34E19D}.Debug|Any CPU.Build.0 = Debug|Any CPU 57 | {944A9DC6-107E-4B03-B9F2-8BC5DC34E19D}.Release|Any CPU.ActiveCfg = Release|Any CPU 58 | {944A9DC6-107E-4B03-B9F2-8BC5DC34E19D}.Release|Any CPU.Build.0 = Release|Any CPU 59 | {AB690921-2BE0-42AC-BED5-B2D891B72BB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 60 | {AB690921-2BE0-42AC-BED5-B2D891B72BB2}.Debug|Any CPU.Build.0 = Debug|Any CPU 61 | {AB690921-2BE0-42AC-BED5-B2D891B72BB2}.Release|Any CPU.ActiveCfg = Release|Any CPU 62 | {AB690921-2BE0-42AC-BED5-B2D891B72BB2}.Release|Any CPU.Build.0 = Release|Any CPU 63 | EndGlobalSection 64 | GlobalSection(NestedProjects) = preSolution 65 | {DD4F0801-7A28-4C2A-865A-6466BEA004B9} = {1F8F748E-EBCF-4A78-BCFE-34F68E4EDE9E} 66 | {70F992B7-E5DE-42A1-986E-D050DF6F3A92} = {1F8F748E-EBCF-4A78-BCFE-34F68E4EDE9E} 67 | {D9A7CBEF-3912-41F4-BD59-078C568FC047} = {AE3EE0E2-B855-4389-BA59-1B0823F1B578} 68 | {EF7DEF5D-E74E-4AAF-857A-0E7B88924E92} = {AE3EE0E2-B855-4389-BA59-1B0823F1B578} 69 | {1012E9FF-2C28-4A57-9DB8-FAB6EB8A94D5} = {AE3EE0E2-B855-4389-BA59-1B0823F1B578} 70 | {944A9DC6-107E-4B03-B9F2-8BC5DC34E19D} = {1F8F748E-EBCF-4A78-BCFE-34F68E4EDE9E} 71 | {AB690921-2BE0-42AC-BED5-B2D891B72BB2} = {E1A97E36-294F-46C2-BAF3-DC50BF5C5DE8} 72 | EndGlobalSection 73 | EndGlobal 74 | -------------------------------------------------------------------------------- /src/ZeroMessenger/FilteredHandlers.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Concurrent; 2 | using System.Runtime.CompilerServices; 3 | 4 | namespace ZeroMessenger; 5 | 6 | internal sealed class FilteredMessageHandler(MessageHandler handler, IMessageFilter[] filters) : AsyncMessageHandler 7 | { 8 | protected override async ValueTask HandleAsyncCore(T message, CancellationToken cancellationToken = default) 9 | { 10 | var iterator = FilterIterator.Rent(handler, filters); 11 | 12 | try 13 | { 14 | await iterator.InvokeRecursiveAsync(message, cancellationToken); 15 | } 16 | finally 17 | { 18 | FilterIterator.Return(iterator); 19 | } 20 | } 21 | 22 | protected override void DisposeCore() 23 | { 24 | handler.Dispose(); 25 | } 26 | 27 | sealed class FilterIterator 28 | { 29 | static readonly ConcurrentStack pool = new(); 30 | 31 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 32 | public static FilterIterator Rent(MessageHandler handler, IMessageFilter[] filters) 33 | { 34 | if (!pool.TryPop(out var iterator)) 35 | { 36 | iterator = new(); 37 | } 38 | 39 | iterator.handler = handler; 40 | iterator.filters = filters; 41 | 42 | return iterator; 43 | } 44 | 45 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 46 | public static void Return(FilterIterator iterator) 47 | { 48 | iterator.handler = null; 49 | iterator.filters = null; 50 | iterator.index = 0; 51 | pool.Push(iterator); 52 | } 53 | 54 | MessageHandler? handler; 55 | IMessageFilter[]? filters; 56 | int index; 57 | 58 | readonly Func invokeDelegate; 59 | 60 | public FilterIterator() 61 | { 62 | invokeDelegate = InvokeRecursiveAsync; 63 | } 64 | 65 | public ValueTask InvokeRecursiveAsync(T message, CancellationToken cancellationToken) 66 | { 67 | if (MoveNextFilter(out var filter)) 68 | { 69 | return filter.InvokeAsync(message, cancellationToken, invokeDelegate); 70 | } 71 | 72 | handler!.Handle(message); 73 | return default; 74 | } 75 | 76 | bool MoveNextFilter(out IMessageFilter next) 77 | { 78 | while (index < filters!.Length) 79 | { 80 | next = filters[index]; 81 | index++; 82 | return true; 83 | } 84 | 85 | next = default!; 86 | return false; 87 | } 88 | } 89 | } 90 | 91 | internal sealed class FilteredAsyncMessageHandler(AsyncMessageHandler handler, IMessageFilter[] filters) : AsyncMessageHandler 92 | { 93 | protected override async ValueTask HandleAsyncCore(T message, CancellationToken cancellationToken = default) 94 | { 95 | var iterator = FilterIterator.Rent(handler, filters); 96 | 97 | try 98 | { 99 | await iterator.InvokeRecursiveAsync(message, cancellationToken); 100 | } 101 | finally 102 | { 103 | FilterIterator.Return(iterator); 104 | } 105 | } 106 | 107 | sealed class FilterIterator 108 | { 109 | static readonly ConcurrentStack pool = new(); 110 | 111 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 112 | public static FilterIterator Rent(AsyncMessageHandler handler, IMessageFilter[] filters) 113 | { 114 | if (!pool.TryPop(out var iterator)) 115 | { 116 | iterator = new(); 117 | } 118 | 119 | iterator.handler = handler; 120 | iterator.filters = filters; 121 | 122 | return iterator; 123 | } 124 | 125 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 126 | public static void Return(FilterIterator iterator) 127 | { 128 | iterator.handler = null; 129 | iterator.filters = null; 130 | pool.Push(iterator); 131 | } 132 | 133 | AsyncMessageHandler? handler; 134 | IMessageFilter[]? filters; 135 | int index; 136 | 137 | readonly Func invokeDelegate; 138 | 139 | public FilterIterator() 140 | { 141 | invokeDelegate = InvokeRecursiveAsync; 142 | } 143 | 144 | public ValueTask InvokeRecursiveAsync(T message, CancellationToken cancellationToken) 145 | { 146 | if (MoveNextFilter(out var filter)) 147 | { 148 | return filter.InvokeAsync(message, cancellationToken, invokeDelegate); 149 | } 150 | 151 | return handler!.HandleAsync(message, cancellationToken); 152 | } 153 | 154 | bool MoveNextFilter(out IMessageFilter next) 155 | { 156 | while (index < filters!.Length) 157 | { 158 | next = filters[index]; 159 | index++; 160 | return true; 161 | } 162 | 163 | next = default!; 164 | return false; 165 | } 166 | } 167 | } -------------------------------------------------------------------------------- /src/ZeroMessenger/Internal/WhenAll.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | using System.Runtime.ExceptionServices; 3 | 4 | namespace ZeroMessenger.Internal 5 | { 6 | internal static class ContinuationSentinel 7 | { 8 | public static readonly Action AvailableContinuation = () => { }; 9 | public static readonly Action CompletedContinuation = () => { }; 10 | } 11 | 12 | internal partial class ValueTaskWhenAll : ICriticalNotifyCompletion 13 | { 14 | internal class AwaiterNode : ILinkedPoolNode 15 | { 16 | static LinkedPool pool; 17 | 18 | AwaiterNode nextNode = default!; 19 | public ref AwaiterNode NextNode => ref nextNode; 20 | 21 | ValueTaskWhenAll parent = default!; 22 | ValueTaskAwaiter awaiter; 23 | 24 | readonly Action continuation; 25 | 26 | public AwaiterNode() 27 | { 28 | continuation = OnCompleted; 29 | } 30 | 31 | public static void RegisterUnsafeOnCompleted(ValueTaskWhenAll parent, ValueTaskAwaiter awaiter) 32 | { 33 | if (!pool.TryPop(out var result)) 34 | { 35 | result = new AwaiterNode(); 36 | } 37 | result.parent = parent; 38 | result.awaiter = awaiter; 39 | 40 | result.awaiter.UnsafeOnCompleted(result.continuation); 41 | } 42 | 43 | void OnCompleted() 44 | { 45 | var p = parent; 46 | var a = awaiter; 47 | parent = null!; 48 | awaiter = default; 49 | 50 | pool.TryPush(this); 51 | 52 | try 53 | { 54 | a.GetResult(); 55 | } 56 | catch (Exception ex) 57 | { 58 | p.exception = ExceptionDispatchInfo.Capture(ex); 59 | p.TryInvokeContinuation(); 60 | return; 61 | } 62 | 63 | p.IncrementSuccessfully(); 64 | } 65 | } 66 | 67 | readonly int taskCount = 0; 68 | 69 | int completedCount = 0; 70 | ExceptionDispatchInfo? exception; 71 | Action continuation = ContinuationSentinel.AvailableContinuation; 72 | 73 | public ValueTaskWhenAll(AsyncMessageHandler?[] handlers, T message, CancellationToken cancellationtoken) 74 | { 75 | taskCount = handlers.Length; 76 | 77 | foreach (var item in handlers) 78 | { 79 | if (item == null) 80 | { 81 | IncrementSuccessfully(); 82 | } 83 | else 84 | { 85 | try 86 | { 87 | var awaiter = item.HandleAsync(message, cancellationtoken).GetAwaiter(); 88 | if (awaiter.IsCompleted) 89 | { 90 | awaiter.GetResult(); 91 | goto SUCCESSFULLY; 92 | } 93 | else 94 | { 95 | AwaiterNode.RegisterUnsafeOnCompleted(this, awaiter); 96 | continue; 97 | } 98 | } 99 | catch (Exception ex) 100 | { 101 | exception = ExceptionDispatchInfo.Capture(ex); 102 | TryInvokeContinuation(); 103 | return; 104 | } 105 | 106 | SUCCESSFULLY: 107 | IncrementSuccessfully(); 108 | } 109 | } 110 | } 111 | 112 | void IncrementSuccessfully() 113 | { 114 | if (Interlocked.Increment(ref completedCount) == taskCount) 115 | { 116 | TryInvokeContinuation(); 117 | } 118 | } 119 | 120 | void TryInvokeContinuation() 121 | { 122 | var c = Interlocked.Exchange(ref continuation, ContinuationSentinel.CompletedContinuation); // register completed. 123 | if (c != ContinuationSentinel.AvailableContinuation && c != ContinuationSentinel.CompletedContinuation) 124 | { 125 | c(); 126 | } 127 | } 128 | 129 | public ValueTaskWhenAll GetAwaiter() 130 | { 131 | return this; 132 | } 133 | 134 | public bool IsCompleted => exception != null || completedCount == taskCount; 135 | 136 | public void GetResult() 137 | { 138 | exception?.Throw(); 139 | } 140 | 141 | public void OnCompleted(Action continuation) 142 | { 143 | UnsafeOnCompleted(continuation); 144 | } 145 | 146 | public void UnsafeOnCompleted(Action continuation) 147 | { 148 | var c = Interlocked.CompareExchange(ref this.continuation, continuation, ContinuationSentinel.AvailableContinuation); 149 | if (c == ContinuationSentinel.CompletedContinuation) // registered TryInvokeContinuation first. 150 | { 151 | continuation(); 152 | return; 153 | } 154 | } 155 | } 156 | } -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | streamingMipmapsActive: 0 33 | streamingMipmapsAddAllCameras: 1 34 | streamingMipmapsMemoryBudget: 512 35 | streamingMipmapsRenderersPerFrame: 512 36 | streamingMipmapsMaxLevelReduction: 2 37 | streamingMipmapsMaxFileIORequests: 1024 38 | particleRaycastBudget: 4 39 | asyncUploadTimeSlice: 2 40 | asyncUploadBufferSize: 16 41 | asyncUploadPersistentBuffer: 1 42 | resolutionScalingFixedDPIFactor: 1 43 | excludedTargetPlatforms: [] 44 | - serializedVersion: 2 45 | name: Low 46 | pixelLightCount: 0 47 | shadows: 0 48 | shadowResolution: 0 49 | shadowProjection: 1 50 | shadowCascades: 1 51 | shadowDistance: 20 52 | shadowNearPlaneOffset: 3 53 | shadowCascade2Split: 0.33333334 54 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 55 | shadowmaskMode: 0 56 | blendWeights: 2 57 | textureQuality: 0 58 | anisotropicTextures: 0 59 | antiAliasing: 0 60 | softParticles: 0 61 | softVegetation: 0 62 | realtimeReflectionProbes: 0 63 | billboardsFaceCameraPosition: 0 64 | vSyncCount: 0 65 | lodBias: 0.4 66 | maximumLODLevel: 0 67 | streamingMipmapsActive: 0 68 | streamingMipmapsAddAllCameras: 1 69 | streamingMipmapsMemoryBudget: 512 70 | streamingMipmapsRenderersPerFrame: 512 71 | streamingMipmapsMaxLevelReduction: 2 72 | streamingMipmapsMaxFileIORequests: 1024 73 | particleRaycastBudget: 16 74 | asyncUploadTimeSlice: 2 75 | asyncUploadBufferSize: 16 76 | asyncUploadPersistentBuffer: 1 77 | resolutionScalingFixedDPIFactor: 1 78 | excludedTargetPlatforms: [] 79 | - serializedVersion: 2 80 | name: Medium 81 | pixelLightCount: 1 82 | shadows: 1 83 | shadowResolution: 0 84 | shadowProjection: 1 85 | shadowCascades: 1 86 | shadowDistance: 20 87 | shadowNearPlaneOffset: 3 88 | shadowCascade2Split: 0.33333334 89 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 90 | shadowmaskMode: 0 91 | blendWeights: 2 92 | textureQuality: 0 93 | anisotropicTextures: 1 94 | antiAliasing: 0 95 | softParticles: 0 96 | softVegetation: 0 97 | realtimeReflectionProbes: 0 98 | billboardsFaceCameraPosition: 0 99 | vSyncCount: 1 100 | lodBias: 0.7 101 | maximumLODLevel: 0 102 | streamingMipmapsActive: 0 103 | streamingMipmapsAddAllCameras: 1 104 | streamingMipmapsMemoryBudget: 512 105 | streamingMipmapsRenderersPerFrame: 512 106 | streamingMipmapsMaxLevelReduction: 2 107 | streamingMipmapsMaxFileIORequests: 1024 108 | particleRaycastBudget: 64 109 | asyncUploadTimeSlice: 2 110 | asyncUploadBufferSize: 16 111 | asyncUploadPersistentBuffer: 1 112 | resolutionScalingFixedDPIFactor: 1 113 | excludedTargetPlatforms: [] 114 | - serializedVersion: 2 115 | name: High 116 | pixelLightCount: 2 117 | shadows: 2 118 | shadowResolution: 1 119 | shadowProjection: 1 120 | shadowCascades: 2 121 | shadowDistance: 40 122 | shadowNearPlaneOffset: 3 123 | shadowCascade2Split: 0.33333334 124 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 125 | shadowmaskMode: 1 126 | blendWeights: 2 127 | textureQuality: 0 128 | anisotropicTextures: 1 129 | antiAliasing: 0 130 | softParticles: 0 131 | softVegetation: 1 132 | realtimeReflectionProbes: 1 133 | billboardsFaceCameraPosition: 1 134 | vSyncCount: 1 135 | lodBias: 1 136 | maximumLODLevel: 0 137 | streamingMipmapsActive: 0 138 | streamingMipmapsAddAllCameras: 1 139 | streamingMipmapsMemoryBudget: 512 140 | streamingMipmapsRenderersPerFrame: 512 141 | streamingMipmapsMaxLevelReduction: 2 142 | streamingMipmapsMaxFileIORequests: 1024 143 | particleRaycastBudget: 256 144 | asyncUploadTimeSlice: 2 145 | asyncUploadBufferSize: 16 146 | asyncUploadPersistentBuffer: 1 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Very High 151 | pixelLightCount: 3 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 2 156 | shadowDistance: 70 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 2 164 | antiAliasing: 2 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 1.5 171 | maximumLODLevel: 0 172 | streamingMipmapsActive: 0 173 | streamingMipmapsAddAllCameras: 1 174 | streamingMipmapsMemoryBudget: 512 175 | streamingMipmapsRenderersPerFrame: 512 176 | streamingMipmapsMaxLevelReduction: 2 177 | streamingMipmapsMaxFileIORequests: 1024 178 | particleRaycastBudget: 1024 179 | asyncUploadTimeSlice: 2 180 | asyncUploadBufferSize: 16 181 | asyncUploadPersistentBuffer: 1 182 | resolutionScalingFixedDPIFactor: 1 183 | excludedTargetPlatforms: [] 184 | - serializedVersion: 2 185 | name: Ultra 186 | pixelLightCount: 4 187 | shadows: 2 188 | shadowResolution: 2 189 | shadowProjection: 1 190 | shadowCascades: 4 191 | shadowDistance: 150 192 | shadowNearPlaneOffset: 3 193 | shadowCascade2Split: 0.33333334 194 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 195 | shadowmaskMode: 1 196 | blendWeights: 4 197 | textureQuality: 0 198 | anisotropicTextures: 2 199 | antiAliasing: 2 200 | softParticles: 1 201 | softVegetation: 1 202 | realtimeReflectionProbes: 1 203 | billboardsFaceCameraPosition: 1 204 | vSyncCount: 1 205 | lodBias: 2 206 | maximumLODLevel: 0 207 | streamingMipmapsActive: 0 208 | streamingMipmapsAddAllCameras: 1 209 | streamingMipmapsMemoryBudget: 512 210 | streamingMipmapsRenderersPerFrame: 512 211 | streamingMipmapsMaxLevelReduction: 2 212 | streamingMipmapsMaxFileIORequests: 1024 213 | particleRaycastBudget: 4096 214 | asyncUploadTimeSlice: 2 215 | asyncUploadBufferSize: 16 216 | asyncUploadPersistentBuffer: 1 217 | resolutionScalingFixedDPIFactor: 1 218 | excludedTargetPlatforms: [] 219 | m_PerPlatformDefaultQuality: 220 | Android: 2 221 | Lumin: 5 222 | GameCoreScarlett: 5 223 | GameCoreXboxOne: 5 224 | Nintendo 3DS: 5 225 | Nintendo Switch: 5 226 | PS4: 5 227 | PS5: 5 228 | Stadia: 5 229 | Standalone: 5 230 | WebGL: 3 231 | Windows Store Apps: 5 232 | XboxOne: 5 233 | iPhone: 2 234 | tvOS: 2 235 | -------------------------------------------------------------------------------- /src/ZeroMessenger/MessageBroker.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | using ZeroMessenger.Internal; 3 | 4 | namespace ZeroMessenger; 5 | 6 | [Preserve] 7 | public class MessageBroker : IMessagePublisher, IMessageSubscriber, IDisposable 8 | { 9 | public static readonly MessageBroker Default = new(); 10 | 11 | readonly object gate; 12 | readonly MessageHandlerList syncHandlers; 13 | readonly MessageHandlerList asyncHandlers; 14 | 15 | bool isDisposed; 16 | FastListCore> globalFilters; 17 | 18 | public bool IsDisposed => isDisposed; 19 | 20 | [Preserve] 21 | public MessageBroker(MessageFilterProvider? filterProvider = null) 22 | { 23 | gate = new(); 24 | syncHandlers = new(gate); 25 | asyncHandlers = new(gate); 26 | 27 | if (filterProvider != null) 28 | { 29 | foreach (var filter in filterProvider.GetGlobalFilters()) 30 | { 31 | globalFilters.Add(filter); 32 | } 33 | } 34 | } 35 | 36 | public void Publish(T message, CancellationToken cancellationToken = default) 37 | { 38 | { 39 | var node = syncHandlers.Root; 40 | var version = syncHandlers.GetVersion(); 41 | 42 | while (node != null) 43 | { 44 | if (node.Version > version) break; 45 | Unsafe.As>(node)!.Handle(message); 46 | node = node.NextNode; 47 | } 48 | } 49 | 50 | { 51 | var node = asyncHandlers.Root; 52 | var version = asyncHandlers.GetVersion(); 53 | 54 | while (node != null) 55 | { 56 | if (node.Version > version) break; 57 | Unsafe.As>(node)!.HandleAsync(message, cancellationToken).Forget(); 58 | node = node.NextNode; 59 | } 60 | } 61 | } 62 | 63 | public async ValueTask PublishAsync(T message, AsyncPublishStrategy publishStrategy = AsyncPublishStrategy.Parallel, CancellationToken cancellationToken = default) 64 | { 65 | { 66 | var node = syncHandlers.Root; 67 | var version = syncHandlers.GetVersion(); 68 | 69 | while (node != null) 70 | { 71 | if (node.Version > version) break; 72 | Unsafe.As>(node)!.Handle(message); 73 | node = node.NextNode; 74 | } 75 | } 76 | 77 | switch (publishStrategy) 78 | { 79 | case AsyncPublishStrategy.Parallel: 80 | { 81 | var list = new PooledList>(8); 82 | AsyncMessageHandler[]? result = null; 83 | 84 | try 85 | { 86 | var node = asyncHandlers.Root; 87 | var version = asyncHandlers.GetVersion(); 88 | 89 | while (node != null) 90 | { 91 | if (node.Version > version) break; 92 | list.Add(Unsafe.As>(node)); 93 | node = node.NextNode; 94 | } 95 | 96 | if (list.Count > 0) 97 | { 98 | result = list.AsSpan().ToArray(); 99 | } 100 | } 101 | finally 102 | { 103 | list.Dispose(); 104 | } 105 | 106 | if (result != null) 107 | { 108 | await new ValueTaskWhenAll(result, message, cancellationToken); 109 | } 110 | } 111 | break; 112 | case AsyncPublishStrategy.Sequential: 113 | { 114 | var node = asyncHandlers.Root; 115 | var version = asyncHandlers.GetVersion(); 116 | 117 | while (node != null) 118 | { 119 | if (node.Version > version) break; 120 | await Unsafe.As>(node)!.HandleAsync(message, cancellationToken); 121 | node = node.NextNode; 122 | } 123 | } 124 | break; 125 | } 126 | } 127 | 128 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 129 | public IDisposable Subscribe(MessageHandler handler) 130 | { 131 | ThrowHelper.ThrowArgumentNullIfNull(handler, nameof(handler)); 132 | ThrowHelper.ThrowObjectDisposedIf(handler.IsDisposed, typeof(AsyncMessageHandler)); 133 | ThrowHelper.ThrowIfMessageHandlerIsAssigned(handler); 134 | 135 | if (globalFilters.Length > 0) 136 | { 137 | return SubscribeAwaitCore(new FilteredMessageHandler(handler, globalFilters.AsSpan().ToArray()), AsyncSubscribeStrategy.Sequential); 138 | } 139 | 140 | return SubscribeCore(handler); 141 | } 142 | 143 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 144 | public IDisposable SubscribeAwait(AsyncMessageHandler handler, AsyncSubscribeStrategy subscribeStrategy = AsyncSubscribeStrategy.Sequential) 145 | { 146 | ThrowHelper.ThrowArgumentNullIfNull(handler, nameof(handler)); 147 | ThrowHelper.ThrowObjectDisposedIf(handler.IsDisposed, typeof(AsyncMessageHandler)); 148 | ThrowHelper.ThrowIfMessageHandlerIsAssigned(handler); 149 | 150 | if (globalFilters.Length > 0) 151 | { 152 | return SubscribeAwaitCore(new FilteredAsyncMessageHandler(handler, globalFilters.AsSpan().ToArray()), AsyncSubscribeStrategy.Sequential); 153 | } 154 | 155 | return SubscribeAwaitCore(handler, subscribeStrategy); 156 | } 157 | 158 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 159 | MessageHandler SubscribeCore(MessageHandler handler) 160 | { 161 | syncHandlers.Add(handler); 162 | return handler; 163 | } 164 | 165 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 166 | AsyncMessageHandler SubscribeAwaitCore(AsyncMessageHandler handler, AsyncSubscribeStrategy subscribeStrategy) 167 | { 168 | handler = subscribeStrategy switch 169 | { 170 | AsyncSubscribeStrategy.Sequential => new SequentialAsyncMessageHandler(handler), 171 | AsyncSubscribeStrategy.Switch => new SwitchAsyncMessageHandler(handler), 172 | AsyncSubscribeStrategy.Drop => new DropAsyncMessageHandler(handler), 173 | _ => handler, 174 | }; 175 | 176 | asyncHandlers.Add(handler); 177 | return handler; 178 | } 179 | 180 | public void AddFilter(TFilter filter) where TFilter : IMessageFilter 181 | { 182 | globalFilters.Add(filter); 183 | } 184 | 185 | public void AddFilter() where TFilter : IMessageFilter, new() 186 | { 187 | globalFilters.Add(new TFilter()); 188 | } 189 | 190 | public void AddFilter(Predicate predicate) 191 | { 192 | globalFilters.Add(new PredicateFilter(predicate)); 193 | } 194 | 195 | public void AddFilter(Func, ValueTask> filter) 196 | { 197 | globalFilters.Add(new AnonymousMessageFilter(filter)); 198 | } 199 | 200 | public void Dispose() 201 | { 202 | lock (gate) 203 | { 204 | ThrowHelper.ThrowObjectDisposedIf(IsDisposed, typeof(MessageBroker)); 205 | isDisposed = true; 206 | } 207 | 208 | syncHandlers.Dispose(); 209 | asyncHandlers.Dispose(); 210 | } 211 | } -------------------------------------------------------------------------------- /src/ZeroMessenger.Unity/Packages/packages-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.github-glitchenzo.nugetforunity": { 4 | "version": "https://github.com/GlitchEnzo/NuGetForUnity.git?path=/src/NuGetForUnity", 5 | "depth": 0, 6 | "source": "git", 7 | "dependencies": {}, 8 | "hash": "eceb6b9d4774e90dfb6b0a7200c8d1f2cceec025" 9 | }, 10 | "com.unity.ext.nunit": { 11 | "version": "1.0.6", 12 | "depth": 1, 13 | "source": "registry", 14 | "dependencies": {}, 15 | "url": "https://packages.unity.com" 16 | }, 17 | "com.unity.ide.rider": { 18 | "version": "3.0.34", 19 | "depth": 0, 20 | "source": "registry", 21 | "dependencies": { 22 | "com.unity.ext.nunit": "1.0.6" 23 | }, 24 | "url": "https://packages.unity.com" 25 | }, 26 | "com.unity.ide.visualstudio": { 27 | "version": "2.0.22", 28 | "depth": 0, 29 | "source": "registry", 30 | "dependencies": { 31 | "com.unity.test-framework": "1.1.9" 32 | }, 33 | "url": "https://packages.unity.com" 34 | }, 35 | "com.unity.test-framework": { 36 | "version": "1.1.33", 37 | "depth": 1, 38 | "source": "registry", 39 | "dependencies": { 40 | "com.unity.ext.nunit": "1.0.6", 41 | "com.unity.modules.imgui": "1.0.0", 42 | "com.unity.modules.jsonserialize": "1.0.0" 43 | }, 44 | "url": "https://packages.unity.com" 45 | }, 46 | "com.unity.ugui": { 47 | "version": "1.0.0", 48 | "depth": 0, 49 | "source": "builtin", 50 | "dependencies": { 51 | "com.unity.modules.ui": "1.0.0", 52 | "com.unity.modules.imgui": "1.0.0" 53 | } 54 | }, 55 | "jp.hadashikick.vcontainer": { 56 | "version": "https://github.com/hadashiA/VContainer.git?path=VContainer/Assets/VContainer", 57 | "depth": 0, 58 | "source": "git", 59 | "dependencies": {}, 60 | "hash": "931849c7a25d03784478550870ba53a2ee7c5c28" 61 | }, 62 | "nuget-packages": { 63 | "version": "file:nuget-packages", 64 | "depth": 0, 65 | "source": "embedded", 66 | "dependencies": {} 67 | }, 68 | "com.unity.modules.ai": { 69 | "version": "1.0.0", 70 | "depth": 0, 71 | "source": "builtin", 72 | "dependencies": {} 73 | }, 74 | "com.unity.modules.androidjni": { 75 | "version": "1.0.0", 76 | "depth": 0, 77 | "source": "builtin", 78 | "dependencies": {} 79 | }, 80 | "com.unity.modules.animation": { 81 | "version": "1.0.0", 82 | "depth": 0, 83 | "source": "builtin", 84 | "dependencies": {} 85 | }, 86 | "com.unity.modules.assetbundle": { 87 | "version": "1.0.0", 88 | "depth": 0, 89 | "source": "builtin", 90 | "dependencies": {} 91 | }, 92 | "com.unity.modules.audio": { 93 | "version": "1.0.0", 94 | "depth": 0, 95 | "source": "builtin", 96 | "dependencies": {} 97 | }, 98 | "com.unity.modules.cloth": { 99 | "version": "1.0.0", 100 | "depth": 0, 101 | "source": "builtin", 102 | "dependencies": { 103 | "com.unity.modules.physics": "1.0.0" 104 | } 105 | }, 106 | "com.unity.modules.director": { 107 | "version": "1.0.0", 108 | "depth": 0, 109 | "source": "builtin", 110 | "dependencies": { 111 | "com.unity.modules.audio": "1.0.0", 112 | "com.unity.modules.animation": "1.0.0" 113 | } 114 | }, 115 | "com.unity.modules.imageconversion": { 116 | "version": "1.0.0", 117 | "depth": 0, 118 | "source": "builtin", 119 | "dependencies": {} 120 | }, 121 | "com.unity.modules.imgui": { 122 | "version": "1.0.0", 123 | "depth": 0, 124 | "source": "builtin", 125 | "dependencies": {} 126 | }, 127 | "com.unity.modules.jsonserialize": { 128 | "version": "1.0.0", 129 | "depth": 0, 130 | "source": "builtin", 131 | "dependencies": {} 132 | }, 133 | "com.unity.modules.particlesystem": { 134 | "version": "1.0.0", 135 | "depth": 0, 136 | "source": "builtin", 137 | "dependencies": {} 138 | }, 139 | "com.unity.modules.physics": { 140 | "version": "1.0.0", 141 | "depth": 0, 142 | "source": "builtin", 143 | "dependencies": {} 144 | }, 145 | "com.unity.modules.physics2d": { 146 | "version": "1.0.0", 147 | "depth": 0, 148 | "source": "builtin", 149 | "dependencies": {} 150 | }, 151 | "com.unity.modules.screencapture": { 152 | "version": "1.0.0", 153 | "depth": 0, 154 | "source": "builtin", 155 | "dependencies": { 156 | "com.unity.modules.imageconversion": "1.0.0" 157 | } 158 | }, 159 | "com.unity.modules.subsystems": { 160 | "version": "1.0.0", 161 | "depth": 1, 162 | "source": "builtin", 163 | "dependencies": { 164 | "com.unity.modules.jsonserialize": "1.0.0" 165 | } 166 | }, 167 | "com.unity.modules.terrain": { 168 | "version": "1.0.0", 169 | "depth": 0, 170 | "source": "builtin", 171 | "dependencies": {} 172 | }, 173 | "com.unity.modules.terrainphysics": { 174 | "version": "1.0.0", 175 | "depth": 0, 176 | "source": "builtin", 177 | "dependencies": { 178 | "com.unity.modules.physics": "1.0.0", 179 | "com.unity.modules.terrain": "1.0.0" 180 | } 181 | }, 182 | "com.unity.modules.tilemap": { 183 | "version": "1.0.0", 184 | "depth": 0, 185 | "source": "builtin", 186 | "dependencies": { 187 | "com.unity.modules.physics2d": "1.0.0" 188 | } 189 | }, 190 | "com.unity.modules.ui": { 191 | "version": "1.0.0", 192 | "depth": 0, 193 | "source": "builtin", 194 | "dependencies": {} 195 | }, 196 | "com.unity.modules.uielements": { 197 | "version": "1.0.0", 198 | "depth": 0, 199 | "source": "builtin", 200 | "dependencies": { 201 | "com.unity.modules.ui": "1.0.0", 202 | "com.unity.modules.imgui": "1.0.0", 203 | "com.unity.modules.jsonserialize": "1.0.0" 204 | } 205 | }, 206 | "com.unity.modules.umbra": { 207 | "version": "1.0.0", 208 | "depth": 0, 209 | "source": "builtin", 210 | "dependencies": {} 211 | }, 212 | "com.unity.modules.unityanalytics": { 213 | "version": "1.0.0", 214 | "depth": 0, 215 | "source": "builtin", 216 | "dependencies": { 217 | "com.unity.modules.unitywebrequest": "1.0.0", 218 | "com.unity.modules.jsonserialize": "1.0.0" 219 | } 220 | }, 221 | "com.unity.modules.unitywebrequest": { 222 | "version": "1.0.0", 223 | "depth": 0, 224 | "source": "builtin", 225 | "dependencies": {} 226 | }, 227 | "com.unity.modules.unitywebrequestassetbundle": { 228 | "version": "1.0.0", 229 | "depth": 0, 230 | "source": "builtin", 231 | "dependencies": { 232 | "com.unity.modules.assetbundle": "1.0.0", 233 | "com.unity.modules.unitywebrequest": "1.0.0" 234 | } 235 | }, 236 | "com.unity.modules.unitywebrequestaudio": { 237 | "version": "1.0.0", 238 | "depth": 0, 239 | "source": "builtin", 240 | "dependencies": { 241 | "com.unity.modules.unitywebrequest": "1.0.0", 242 | "com.unity.modules.audio": "1.0.0" 243 | } 244 | }, 245 | "com.unity.modules.unitywebrequesttexture": { 246 | "version": "1.0.0", 247 | "depth": 0, 248 | "source": "builtin", 249 | "dependencies": { 250 | "com.unity.modules.unitywebrequest": "1.0.0", 251 | "com.unity.modules.imageconversion": "1.0.0" 252 | } 253 | }, 254 | "com.unity.modules.unitywebrequestwww": { 255 | "version": "1.0.0", 256 | "depth": 0, 257 | "source": "builtin", 258 | "dependencies": { 259 | "com.unity.modules.unitywebrequest": "1.0.0", 260 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 261 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 262 | "com.unity.modules.audio": "1.0.0", 263 | "com.unity.modules.assetbundle": "1.0.0", 264 | "com.unity.modules.imageconversion": "1.0.0" 265 | } 266 | }, 267 | "com.unity.modules.vehicles": { 268 | "version": "1.0.0", 269 | "depth": 0, 270 | "source": "builtin", 271 | "dependencies": { 272 | "com.unity.modules.physics": "1.0.0" 273 | } 274 | }, 275 | "com.unity.modules.video": { 276 | "version": "1.0.0", 277 | "depth": 0, 278 | "source": "builtin", 279 | "dependencies": { 280 | "com.unity.modules.audio": "1.0.0", 281 | "com.unity.modules.ui": "1.0.0", 282 | "com.unity.modules.unitywebrequest": "1.0.0" 283 | } 284 | }, 285 | "com.unity.modules.vr": { 286 | "version": "1.0.0", 287 | "depth": 0, 288 | "source": "builtin", 289 | "dependencies": { 290 | "com.unity.modules.jsonserialize": "1.0.0", 291 | "com.unity.modules.physics": "1.0.0", 292 | "com.unity.modules.xr": "1.0.0" 293 | } 294 | }, 295 | "com.unity.modules.wind": { 296 | "version": "1.0.0", 297 | "depth": 0, 298 | "source": "builtin", 299 | "dependencies": {} 300 | }, 301 | "com.unity.modules.xr": { 302 | "version": "1.0.0", 303 | "depth": 0, 304 | "source": "builtin", 305 | "dependencies": { 306 | "com.unity.modules.physics": "1.0.0", 307 | "com.unity.modules.jsonserialize": "1.0.0", 308 | "com.unity.modules.subsystems": "1.0.0" 309 | } 310 | } 311 | } 312 | } 313 | -------------------------------------------------------------------------------- /sandbox/Benchmark/.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from `dotnet new gitignore` 5 | 6 | # dotenv files 7 | .env 8 | 9 | # User-specific files 10 | *.rsuser 11 | *.suo 12 | *.user 13 | *.userosscache 14 | *.sln.docstates 15 | 16 | # User-specific files (MonoDevelop/Xamarin Studio) 17 | *.userprefs 18 | 19 | # Mono auto generated files 20 | mono_crash.* 21 | 22 | # Build results 23 | [Dd]ebug/ 24 | [Dd]ebugPublic/ 25 | [Rr]elease/ 26 | [Rr]eleases/ 27 | x64/ 28 | x86/ 29 | [Ww][Ii][Nn]32/ 30 | [Aa][Rr][Mm]/ 31 | [Aa][Rr][Mm]64/ 32 | bld/ 33 | [Bb]in/ 34 | [Oo]bj/ 35 | [Ll]og/ 36 | [Ll]ogs/ 37 | 38 | # Visual Studio 2015/2017 cache/options directory 39 | .vs/ 40 | # Uncomment if you have tasks that create the project's static files in wwwroot 41 | #wwwroot/ 42 | 43 | # Visual Studio 2017 auto generated files 44 | Generated\ Files/ 45 | 46 | # MSTest test Results 47 | [Tt]est[Rr]esult*/ 48 | [Bb]uild[Ll]og.* 49 | 50 | # NUnit 51 | *.VisualState.xml 52 | TestResult.xml 53 | nunit-*.xml 54 | 55 | # Build Results of an ATL Project 56 | [Dd]ebugPS/ 57 | [Rr]eleasePS/ 58 | dlldata.c 59 | 60 | # Benchmark Results 61 | BenchmarkDotNet.Artifacts/ 62 | 63 | # .NET 64 | project.lock.json 65 | project.fragment.lock.json 66 | artifacts/ 67 | 68 | # Tye 69 | .tye/ 70 | 71 | # ASP.NET Scaffolding 72 | ScaffoldingReadMe.txt 73 | 74 | # StyleCop 75 | StyleCopReport.xml 76 | 77 | # Files built by Visual Studio 78 | *_i.c 79 | *_p.c 80 | *_h.h 81 | *.ilk 82 | *.meta 83 | *.obj 84 | *.iobj 85 | *.pch 86 | *.pdb 87 | *.ipdb 88 | *.pgc 89 | *.pgd 90 | *.rsp 91 | *.sbr 92 | *.tlb 93 | *.tli 94 | *.tlh 95 | *.tmp 96 | *.tmp_proj 97 | *_wpftmp.csproj 98 | *.log 99 | *.tlog 100 | *.vspscc 101 | *.vssscc 102 | .builds 103 | *.pidb 104 | *.svclog 105 | *.scc 106 | 107 | # Chutzpah Test files 108 | _Chutzpah* 109 | 110 | # Visual C++ cache files 111 | ipch/ 112 | *.aps 113 | *.ncb 114 | *.opendb 115 | *.opensdf 116 | *.sdf 117 | *.cachefile 118 | *.VC.db 119 | *.VC.VC.opendb 120 | 121 | # Visual Studio profiler 122 | *.psess 123 | *.vsp 124 | *.vspx 125 | *.sap 126 | 127 | # Visual Studio Trace Files 128 | *.e2e 129 | 130 | # TFS 2012 Local Workspace 131 | $tf/ 132 | 133 | # Guidance Automation Toolkit 134 | *.gpState 135 | 136 | # ReSharper is a .NET coding add-in 137 | _ReSharper*/ 138 | *.[Rr]e[Ss]harper 139 | *.DotSettings.user 140 | 141 | # TeamCity is a build add-in 142 | _TeamCity* 143 | 144 | # DotCover is a Code Coverage Tool 145 | *.dotCover 146 | 147 | # AxoCover is a Code Coverage Tool 148 | .axoCover/* 149 | !.axoCover/settings.json 150 | 151 | # Coverlet is a free, cross platform Code Coverage Tool 152 | coverage*.json 153 | coverage*.xml 154 | coverage*.info 155 | 156 | # Visual Studio code coverage results 157 | *.coverage 158 | *.coveragexml 159 | 160 | # NCrunch 161 | _NCrunch_* 162 | .*crunch*.local.xml 163 | nCrunchTemp_* 164 | 165 | # MightyMoose 166 | *.mm.* 167 | AutoTest.Net/ 168 | 169 | # Web workbench (sass) 170 | .sass-cache/ 171 | 172 | # Installshield output folder 173 | [Ee]xpress/ 174 | 175 | # DocProject is a documentation generator add-in 176 | DocProject/buildhelp/ 177 | DocProject/Help/*.HxT 178 | DocProject/Help/*.HxC 179 | DocProject/Help/*.hhc 180 | DocProject/Help/*.hhk 181 | DocProject/Help/*.hhp 182 | DocProject/Help/Html2 183 | DocProject/Help/html 184 | 185 | # Click-Once directory 186 | publish/ 187 | 188 | # Publish Web Output 189 | *.[Pp]ublish.xml 190 | *.azurePubxml 191 | # Note: Comment the next line if you want to checkin your web deploy settings, 192 | # but database connection strings (with potential passwords) will be unencrypted 193 | *.pubxml 194 | *.publishproj 195 | 196 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 197 | # checkin your Azure Web App publish settings, but sensitive information contained 198 | # in these scripts will be unencrypted 199 | PublishScripts/ 200 | 201 | # NuGet Packages 202 | *.nupkg 203 | # NuGet Symbol Packages 204 | *.snupkg 205 | # The packages folder can be ignored because of Package Restore 206 | **/[Pp]ackages/* 207 | # except build/, which is used as an MSBuild target. 208 | !**/[Pp]ackages/build/ 209 | # Uncomment if necessary however generally it will be regenerated when needed 210 | #!**/[Pp]ackages/repositories.config 211 | # NuGet v3's project.json files produces more ignorable files 212 | *.nuget.props 213 | *.nuget.targets 214 | 215 | # Microsoft Azure Build Output 216 | csx/ 217 | *.build.csdef 218 | 219 | # Microsoft Azure Emulator 220 | ecf/ 221 | rcf/ 222 | 223 | # Windows Store app package directories and files 224 | AppPackages/ 225 | BundleArtifacts/ 226 | Package.StoreAssociation.xml 227 | _pkginfo.txt 228 | *.appx 229 | *.appxbundle 230 | *.appxupload 231 | 232 | # Visual Studio cache files 233 | # files ending in .cache can be ignored 234 | *.[Cc]ache 235 | # but keep track of directories ending in .cache 236 | !?*.[Cc]ache/ 237 | 238 | # Others 239 | ClientBin/ 240 | ~$* 241 | *~ 242 | *.dbmdl 243 | *.dbproj.schemaview 244 | *.jfm 245 | *.pfx 246 | *.publishsettings 247 | orleans.codegen.cs 248 | 249 | # Including strong name files can present a security risk 250 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 251 | #*.snk 252 | 253 | # Since there are multiple workflows, uncomment next line to ignore bower_components 254 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 255 | #bower_components/ 256 | 257 | # RIA/Silverlight projects 258 | Generated_Code/ 259 | 260 | # Backup & report files from converting an old project file 261 | # to a newer Visual Studio version. Backup files are not needed, 262 | # because we have git ;-) 263 | _UpgradeReport_Files/ 264 | Backup*/ 265 | UpgradeLog*.XML 266 | UpgradeLog*.htm 267 | ServiceFabricBackup/ 268 | *.rptproj.bak 269 | 270 | # SQL Server files 271 | *.mdf 272 | *.ldf 273 | *.ndf 274 | 275 | # Business Intelligence projects 276 | *.rdl.data 277 | *.bim.layout 278 | *.bim_*.settings 279 | *.rptproj.rsuser 280 | *- [Bb]ackup.rdl 281 | *- [Bb]ackup ([0-9]).rdl 282 | *- [Bb]ackup ([0-9][0-9]).rdl 283 | 284 | # Microsoft Fakes 285 | FakesAssemblies/ 286 | 287 | # GhostDoc plugin setting file 288 | *.GhostDoc.xml 289 | 290 | # Node.js Tools for Visual Studio 291 | .ntvs_analysis.dat 292 | node_modules/ 293 | 294 | # Visual Studio 6 build log 295 | *.plg 296 | 297 | # Visual Studio 6 workspace options file 298 | *.opt 299 | 300 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 301 | *.vbw 302 | 303 | # Visual Studio 6 auto-generated project file (contains which files were open etc.) 304 | *.vbp 305 | 306 | # Visual Studio 6 workspace and project file (working project files containing files to include in project) 307 | *.dsw 308 | *.dsp 309 | 310 | # Visual Studio 6 technical files 311 | *.ncb 312 | *.aps 313 | 314 | # Visual Studio LightSwitch build output 315 | **/*.HTMLClient/GeneratedArtifacts 316 | **/*.DesktopClient/GeneratedArtifacts 317 | **/*.DesktopClient/ModelManifest.xml 318 | **/*.Server/GeneratedArtifacts 319 | **/*.Server/ModelManifest.xml 320 | _Pvt_Extensions 321 | 322 | # Paket dependency manager 323 | .paket/paket.exe 324 | paket-files/ 325 | 326 | # FAKE - F# Make 327 | .fake/ 328 | 329 | # CodeRush personal settings 330 | .cr/personal 331 | 332 | # Python Tools for Visual Studio (PTVS) 333 | __pycache__/ 334 | *.pyc 335 | 336 | # Cake - Uncomment if you are using it 337 | # tools/** 338 | # !tools/packages.config 339 | 340 | # Tabs Studio 341 | *.tss 342 | 343 | # Telerik's JustMock configuration file 344 | *.jmconfig 345 | 346 | # BizTalk build output 347 | *.btp.cs 348 | *.btm.cs 349 | *.odx.cs 350 | *.xsd.cs 351 | 352 | # OpenCover UI analysis results 353 | OpenCover/ 354 | 355 | # Azure Stream Analytics local run output 356 | ASALocalRun/ 357 | 358 | # MSBuild Binary and Structured Log 359 | *.binlog 360 | 361 | # NVidia Nsight GPU debugger configuration file 362 | *.nvuser 363 | 364 | # MFractors (Xamarin productivity tool) working folder 365 | .mfractor/ 366 | 367 | # Local History for Visual Studio 368 | .localhistory/ 369 | 370 | # Visual Studio History (VSHistory) files 371 | .vshistory/ 372 | 373 | # BeatPulse healthcheck temp database 374 | healthchecksdb 375 | 376 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 377 | MigrationBackup/ 378 | 379 | # Ionide (cross platform F# VS Code tools) working folder 380 | .ionide/ 381 | 382 | # Fody - auto-generated XML schema 383 | FodyWeavers.xsd 384 | 385 | # VS Code files for those working on multiple tools 386 | .vscode/* 387 | !.vscode/settings.json 388 | !.vscode/tasks.json 389 | !.vscode/launch.json 390 | !.vscode/extensions.json 391 | *.code-workspace 392 | 393 | # Local History for Visual Studio Code 394 | .history/ 395 | 396 | # Windows Installer files from build outputs 397 | *.cab 398 | *.msi 399 | *.msix 400 | *.msm 401 | *.msp 402 | 403 | # JetBrains Rider 404 | *.sln.iml 405 | .idea 406 | 407 | ## 408 | ## Visual studio for Mac 409 | ## 410 | 411 | 412 | # globs 413 | Makefile.in 414 | *.userprefs 415 | *.usertasks 416 | config.make 417 | config.status 418 | aclocal.m4 419 | install-sh 420 | autom4te.cache/ 421 | *.tar.gz 422 | tarballs/ 423 | test-results/ 424 | 425 | # Mac bundle stuff 426 | *.dmg 427 | *.app 428 | 429 | # content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore 430 | # General 431 | .DS_Store 432 | .AppleDouble 433 | .LSOverride 434 | 435 | # Icon must end with two \r 436 | Icon 437 | 438 | 439 | # Thumbnails 440 | ._* 441 | 442 | # Files that might appear in the root of a volume 443 | .DocumentRevisions-V100 444 | .fseventsd 445 | .Spotlight-V100 446 | .TemporaryItems 447 | .Trashes 448 | .VolumeIcon.icns 449 | .com.apple.timemachine.donotpresent 450 | 451 | # Directories potentially created on remote AFP share 452 | .AppleDB 453 | .AppleDesktop 454 | Network Trash Folder 455 | Temporary Items 456 | .apdisk 457 | 458 | # content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore 459 | # Windows thumbnail cache files 460 | Thumbs.db 461 | ehthumbs.db 462 | ehthumbs_vista.db 463 | 464 | # Dump file 465 | *.stackdump 466 | 467 | # Folder config file 468 | [Dd]esktop.ini 469 | 470 | # Recycle Bin used on file shares 471 | $RECYCLE.BIN/ 472 | 473 | # Windows Installer files 474 | *.cab 475 | *.msi 476 | *.msix 477 | *.msm 478 | *.msp 479 | 480 | # Windows shortcuts 481 | *.lnk 482 | 483 | # Vim temporary swap files 484 | *.swp 485 | -------------------------------------------------------------------------------- /src/ZeroMessenger/.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from `dotnet new gitignore` 5 | 6 | # dotenv files 7 | .env 8 | 9 | # User-specific files 10 | *.rsuser 11 | *.suo 12 | *.user 13 | *.userosscache 14 | *.sln.docstates 15 | 16 | # User-specific files (MonoDevelop/Xamarin Studio) 17 | *.userprefs 18 | 19 | # Mono auto generated files 20 | mono_crash.* 21 | 22 | # Build results 23 | [Dd]ebug/ 24 | [Dd]ebugPublic/ 25 | [Rr]elease/ 26 | [Rr]eleases/ 27 | x64/ 28 | x86/ 29 | [Ww][Ii][Nn]32/ 30 | [Aa][Rr][Mm]/ 31 | [Aa][Rr][Mm]64/ 32 | bld/ 33 | [Bb]in/ 34 | [Oo]bj/ 35 | [Ll]og/ 36 | [Ll]ogs/ 37 | 38 | # Visual Studio 2015/2017 cache/options directory 39 | .vs/ 40 | # Uncomment if you have tasks that create the project's static files in wwwroot 41 | #wwwroot/ 42 | 43 | # Visual Studio 2017 auto generated files 44 | Generated\ Files/ 45 | 46 | # MSTest test Results 47 | [Tt]est[Rr]esult*/ 48 | [Bb]uild[Ll]og.* 49 | 50 | # NUnit 51 | *.VisualState.xml 52 | TestResult.xml 53 | nunit-*.xml 54 | 55 | # Build Results of an ATL Project 56 | [Dd]ebugPS/ 57 | [Rr]eleasePS/ 58 | dlldata.c 59 | 60 | # Benchmark Results 61 | BenchmarkDotNet.Artifacts/ 62 | 63 | # .NET 64 | project.lock.json 65 | project.fragment.lock.json 66 | artifacts/ 67 | 68 | # Tye 69 | .tye/ 70 | 71 | # ASP.NET Scaffolding 72 | ScaffoldingReadMe.txt 73 | 74 | # StyleCop 75 | StyleCopReport.xml 76 | 77 | # Files built by Visual Studio 78 | *_i.c 79 | *_p.c 80 | *_h.h 81 | *.ilk 82 | *.meta 83 | *.obj 84 | *.iobj 85 | *.pch 86 | *.pdb 87 | *.ipdb 88 | *.pgc 89 | *.pgd 90 | *.rsp 91 | *.sbr 92 | *.tlb 93 | *.tli 94 | *.tlh 95 | *.tmp 96 | *.tmp_proj 97 | *_wpftmp.csproj 98 | *.log 99 | *.tlog 100 | *.vspscc 101 | *.vssscc 102 | .builds 103 | *.pidb 104 | *.svclog 105 | *.scc 106 | 107 | # Chutzpah Test files 108 | _Chutzpah* 109 | 110 | # Visual C++ cache files 111 | ipch/ 112 | *.aps 113 | *.ncb 114 | *.opendb 115 | *.opensdf 116 | *.sdf 117 | *.cachefile 118 | *.VC.db 119 | *.VC.VC.opendb 120 | 121 | # Visual Studio profiler 122 | *.psess 123 | *.vsp 124 | *.vspx 125 | *.sap 126 | 127 | # Visual Studio Trace Files 128 | *.e2e 129 | 130 | # TFS 2012 Local Workspace 131 | $tf/ 132 | 133 | # Guidance Automation Toolkit 134 | *.gpState 135 | 136 | # ReSharper is a .NET coding add-in 137 | _ReSharper*/ 138 | *.[Rr]e[Ss]harper 139 | *.DotSettings.user 140 | 141 | # TeamCity is a build add-in 142 | _TeamCity* 143 | 144 | # DotCover is a Code Coverage Tool 145 | *.dotCover 146 | 147 | # AxoCover is a Code Coverage Tool 148 | .axoCover/* 149 | !.axoCover/settings.json 150 | 151 | # Coverlet is a free, cross platform Code Coverage Tool 152 | coverage*.json 153 | coverage*.xml 154 | coverage*.info 155 | 156 | # Visual Studio code coverage results 157 | *.coverage 158 | *.coveragexml 159 | 160 | # NCrunch 161 | _NCrunch_* 162 | .*crunch*.local.xml 163 | nCrunchTemp_* 164 | 165 | # MightyMoose 166 | *.mm.* 167 | AutoTest.Net/ 168 | 169 | # Web workbench (sass) 170 | .sass-cache/ 171 | 172 | # Installshield output folder 173 | [Ee]xpress/ 174 | 175 | # DocProject is a documentation generator add-in 176 | DocProject/buildhelp/ 177 | DocProject/Help/*.HxT 178 | DocProject/Help/*.HxC 179 | DocProject/Help/*.hhc 180 | DocProject/Help/*.hhk 181 | DocProject/Help/*.hhp 182 | DocProject/Help/Html2 183 | DocProject/Help/html 184 | 185 | # Click-Once directory 186 | publish/ 187 | 188 | # Publish Web Output 189 | *.[Pp]ublish.xml 190 | *.azurePubxml 191 | # Note: Comment the next line if you want to checkin your web deploy settings, 192 | # but database connection strings (with potential passwords) will be unencrypted 193 | *.pubxml 194 | *.publishproj 195 | 196 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 197 | # checkin your Azure Web App publish settings, but sensitive information contained 198 | # in these scripts will be unencrypted 199 | PublishScripts/ 200 | 201 | # NuGet Packages 202 | *.nupkg 203 | # NuGet Symbol Packages 204 | *.snupkg 205 | # The packages folder can be ignored because of Package Restore 206 | **/[Pp]ackages/* 207 | # except build/, which is used as an MSBuild target. 208 | !**/[Pp]ackages/build/ 209 | # Uncomment if necessary however generally it will be regenerated when needed 210 | #!**/[Pp]ackages/repositories.config 211 | # NuGet v3's project.json files produces more ignorable files 212 | *.nuget.props 213 | *.nuget.targets 214 | 215 | # Microsoft Azure Build Output 216 | csx/ 217 | *.build.csdef 218 | 219 | # Microsoft Azure Emulator 220 | ecf/ 221 | rcf/ 222 | 223 | # Windows Store app package directories and files 224 | AppPackages/ 225 | BundleArtifacts/ 226 | Package.StoreAssociation.xml 227 | _pkginfo.txt 228 | *.appx 229 | *.appxbundle 230 | *.appxupload 231 | 232 | # Visual Studio cache files 233 | # files ending in .cache can be ignored 234 | *.[Cc]ache 235 | # but keep track of directories ending in .cache 236 | !?*.[Cc]ache/ 237 | 238 | # Others 239 | ClientBin/ 240 | ~$* 241 | *~ 242 | *.dbmdl 243 | *.dbproj.schemaview 244 | *.jfm 245 | *.pfx 246 | *.publishsettings 247 | orleans.codegen.cs 248 | 249 | # Including strong name files can present a security risk 250 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 251 | #*.snk 252 | 253 | # Since there are multiple workflows, uncomment next line to ignore bower_components 254 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 255 | #bower_components/ 256 | 257 | # RIA/Silverlight projects 258 | Generated_Code/ 259 | 260 | # Backup & report files from converting an old project file 261 | # to a newer Visual Studio version. Backup files are not needed, 262 | # because we have git ;-) 263 | _UpgradeReport_Files/ 264 | Backup*/ 265 | UpgradeLog*.XML 266 | UpgradeLog*.htm 267 | ServiceFabricBackup/ 268 | *.rptproj.bak 269 | 270 | # SQL Server files 271 | *.mdf 272 | *.ldf 273 | *.ndf 274 | 275 | # Business Intelligence projects 276 | *.rdl.data 277 | *.bim.layout 278 | *.bim_*.settings 279 | *.rptproj.rsuser 280 | *- [Bb]ackup.rdl 281 | *- [Bb]ackup ([0-9]).rdl 282 | *- [Bb]ackup ([0-9][0-9]).rdl 283 | 284 | # Microsoft Fakes 285 | FakesAssemblies/ 286 | 287 | # GhostDoc plugin setting file 288 | *.GhostDoc.xml 289 | 290 | # Node.js Tools for Visual Studio 291 | .ntvs_analysis.dat 292 | node_modules/ 293 | 294 | # Visual Studio 6 build log 295 | *.plg 296 | 297 | # Visual Studio 6 workspace options file 298 | *.opt 299 | 300 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 301 | *.vbw 302 | 303 | # Visual Studio 6 auto-generated project file (contains which files were open etc.) 304 | *.vbp 305 | 306 | # Visual Studio 6 workspace and project file (working project files containing files to include in project) 307 | *.dsw 308 | *.dsp 309 | 310 | # Visual Studio 6 technical files 311 | *.ncb 312 | *.aps 313 | 314 | # Visual Studio LightSwitch build output 315 | **/*.HTMLClient/GeneratedArtifacts 316 | **/*.DesktopClient/GeneratedArtifacts 317 | **/*.DesktopClient/ModelManifest.xml 318 | **/*.Server/GeneratedArtifacts 319 | **/*.Server/ModelManifest.xml 320 | _Pvt_Extensions 321 | 322 | # Paket dependency manager 323 | .paket/paket.exe 324 | paket-files/ 325 | 326 | # FAKE - F# Make 327 | .fake/ 328 | 329 | # CodeRush personal settings 330 | .cr/personal 331 | 332 | # Python Tools for Visual Studio (PTVS) 333 | __pycache__/ 334 | *.pyc 335 | 336 | # Cake - Uncomment if you are using it 337 | # tools/** 338 | # !tools/packages.config 339 | 340 | # Tabs Studio 341 | *.tss 342 | 343 | # Telerik's JustMock configuration file 344 | *.jmconfig 345 | 346 | # BizTalk build output 347 | *.btp.cs 348 | *.btm.cs 349 | *.odx.cs 350 | *.xsd.cs 351 | 352 | # OpenCover UI analysis results 353 | OpenCover/ 354 | 355 | # Azure Stream Analytics local run output 356 | ASALocalRun/ 357 | 358 | # MSBuild Binary and Structured Log 359 | *.binlog 360 | 361 | # NVidia Nsight GPU debugger configuration file 362 | *.nvuser 363 | 364 | # MFractors (Xamarin productivity tool) working folder 365 | .mfractor/ 366 | 367 | # Local History for Visual Studio 368 | .localhistory/ 369 | 370 | # Visual Studio History (VSHistory) files 371 | .vshistory/ 372 | 373 | # BeatPulse healthcheck temp database 374 | healthchecksdb 375 | 376 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 377 | MigrationBackup/ 378 | 379 | # Ionide (cross platform F# VS Code tools) working folder 380 | .ionide/ 381 | 382 | # Fody - auto-generated XML schema 383 | FodyWeavers.xsd 384 | 385 | # VS Code files for those working on multiple tools 386 | .vscode/* 387 | !.vscode/settings.json 388 | !.vscode/tasks.json 389 | !.vscode/launch.json 390 | !.vscode/extensions.json 391 | *.code-workspace 392 | 393 | # Local History for Visual Studio Code 394 | .history/ 395 | 396 | # Windows Installer files from build outputs 397 | *.cab 398 | *.msi 399 | *.msix 400 | *.msm 401 | *.msp 402 | 403 | # JetBrains Rider 404 | *.sln.iml 405 | .idea 406 | 407 | ## 408 | ## Visual studio for Mac 409 | ## 410 | 411 | 412 | # globs 413 | Makefile.in 414 | *.userprefs 415 | *.usertasks 416 | config.make 417 | config.status 418 | aclocal.m4 419 | install-sh 420 | autom4te.cache/ 421 | *.tar.gz 422 | tarballs/ 423 | test-results/ 424 | 425 | # Mac bundle stuff 426 | *.dmg 427 | *.app 428 | 429 | # content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore 430 | # General 431 | .DS_Store 432 | .AppleDouble 433 | .LSOverride 434 | 435 | # Icon must end with two \r 436 | Icon 437 | 438 | 439 | # Thumbnails 440 | ._* 441 | 442 | # Files that might appear in the root of a volume 443 | .DocumentRevisions-V100 444 | .fseventsd 445 | .Spotlight-V100 446 | .TemporaryItems 447 | .Trashes 448 | .VolumeIcon.icns 449 | .com.apple.timemachine.donotpresent 450 | 451 | # Directories potentially created on remote AFP share 452 | .AppleDB 453 | .AppleDesktop 454 | Network Trash Folder 455 | Temporary Items 456 | .apdisk 457 | 458 | # content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore 459 | # Windows thumbnail cache files 460 | Thumbs.db 461 | ehthumbs.db 462 | ehthumbs_vista.db 463 | 464 | # Dump file 465 | *.stackdump 466 | 467 | # Folder config file 468 | [Dd]esktop.ini 469 | 470 | # Recycle Bin used on file shares 471 | $RECYCLE.BIN/ 472 | 473 | # Windows Installer files 474 | *.cab 475 | *.msi 476 | *.msix 477 | *.msm 478 | *.msp 479 | 480 | # Windows shortcuts 481 | *.lnk 482 | 483 | # Vim temporary swap files 484 | *.swp 485 | --------------------------------------------------------------------------------