This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public sealed class MessagePipeDiagnosticsInfo | |
{ | |
/// <summary>Get current subscribed count.</summary> | |
public int SubscribeCount { get; } | |
| |
/// <summary> | |
/// When MessagePipeOptions.EnableCaptureStackTrace is enabled, list all stacktrace on subscribe. | |
/// </summary> | |
public StackTraceInfo[] GetCapturedStackTraces(bool ascending = true); | |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// keyless-sync | |
public interface IPublisher<TMessage> | |
{ | |
void Publish(TMessage message); | |
} | |
| |
public interface ISubscriber<TMessage> | |
{ | |
IDisposable Subscribe(IMessageHandler<TMessage> handler, params MessageHandlerFilter<TMessage>[] filters); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MagicOnion(similar as SignalR, realtime event framework for .NET and Unity) | |
public class UnityConnectionHub : StreamingHubBase<IUnityConnectionHub, IUnityConnectionHubReceiver>, IUnityConnectionHub | |
{ | |
readonly IPublisher<Guid, UnitEventData> eventPublisher; | |
readonly IPublisher<Guid, ConnectionClose> closePublisher; | |
Guid id; | |
| |
public UnityConnectionHub(IPublisher<Guid, UnitEventData> eventPublisher, IPublisher<Guid, ConnectionClose> closePublisher) | |
{ | |
this.eventPublisher = eventPublisher; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MessagePipe; | |
| |
public struct MyEvent { } | |
| |
public class SceneA | |
{ | |
readonly IPublisher<MyEvent> publisher; | |
public SceneA(IPublisher<MyEvent> publisher) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MessagePipe; | |
using Microsoft.Extensions.DependencyInjection; | |
Host.CreateDefaultBuilder() | |
.ConfigureServices((ctx, services) => | |
{ | |
services.AddMessagePipe(); // AddMessagePipe(options => { }) for configure options | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Extensions.DependencyInjection; | |
using PropertyInjection; | |
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics.CodeAnalysis; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Reflection; | |
using System.Runtime.CompilerServices; | |
using System.Runtime.InteropServices; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member | |
using System.Threading; | |
using UnityEngine; | |
using Cysharp.Threading.Tasks.Triggers; | |
using System; | |
using Cysharp.Threading.Tasks.Internal; | |
namespace Cysharp.Threading.Tasks | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class UniTaskObservableExtensions | |
{ | |
public static IObservable<TResult> SelectManyUniTask<TSource, TResult>(this IObservable<TSource> observable, | |
Func<TSource, IObserver<TResult>, CancellationToken, UniTask> observeAsync) | |
{ | |
return new SelectManyUniTaskObservable<TSource, TResult>(observable, observeAsync); | |
} | |
class SelectManyUniTaskObservable<TSource, TResult> : IObservable<TResult> | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StartAsync(string command, string? workingDirectory = null, IDictionary<string, string>? environmentVariable = null, Encoding? encoding = null) | |
StartAsync(string fileName, string? arguments, string? workingDirectory = null, IDictionary<string, string>? environmentVariable = null, Encoding? encoding = null) | |
StartAsync(ProcessStartInfo processStartInfo) | |
Task<string[]> ToTask(CancellationToken cancellationToken = default) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var cts = new CancellationTokenSource(TimeSpan.FromSeconds(1))) | |
{ | |
await foreach (var item in ProcessX.StartAsync("dotnet --info").WithCancellation(cts.Token)) | |
{ | |
Console.WriteLine(item); | |
} | |
} |