//
#pragma warning disable 618
#pragma warning disable 612
#pragma warning disable 414
#pragma warning disable 219
#pragma warning disable 168
namespace MagicOnion
{
using global::System;
using global::System.Collections.Generic;
using global::System.Linq;
using global::MagicOnion;
using global::MagicOnion.Client;
public static partial class MagicOnionInitializer
{
static bool isRegistered = false;
[UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.BeforeSceneLoad)]
public static void Register()
{
if(isRegistered) return;
isRegistered = true;
MagicOnionClientRegistry.Register((x, y, z) => new ChatApp.Shared.Services.ChatServiceClient(x, y, z));
StreamingHubClientRegistry.Register((a, _, b, c, d, e) => new ChatApp.Shared.Hubs.ChatHubClient(a, b, c, d, e));
}
}
}
#pragma warning restore 168
#pragma warning restore 219
#pragma warning restore 414
#pragma warning restore 612
#pragma warning restore 618
#pragma warning disable 618
#pragma warning disable 612
#pragma warning disable 414
#pragma warning disable 219
#pragma warning disable 168
namespace MagicOnion.Resolvers
{
using System;
using MessagePack;
public class MagicOnionResolver : global::MessagePack.IFormatterResolver
{
public static readonly global::MessagePack.IFormatterResolver Instance = new MagicOnionResolver();
MagicOnionResolver()
{
}
public global::MessagePack.Formatters.IMessagePackFormatter GetFormatter()
{
return FormatterCache.formatter;
}
static class FormatterCache
{
public static readonly global::MessagePack.Formatters.IMessagePackFormatter formatter;
static FormatterCache()
{
var f = MagicOnionResolverGetFormatterHelper.GetFormatter(typeof(T));
if (f != null)
{
formatter = (global::MessagePack.Formatters.IMessagePackFormatter)f;
}
}
}
}
internal static class MagicOnionResolverGetFormatterHelper
{
static readonly global::System.Collections.Generic.Dictionary lookup;
static MagicOnionResolverGetFormatterHelper()
{
lookup = new global::System.Collections.Generic.Dictionary(3)
{
{typeof(global::MagicOnion.DynamicArgumentTuple, global::System.Collections.Generic.Dictionary>), 0 },
{typeof(global::System.Collections.Generic.Dictionary), 1 },
{typeof(global::System.Collections.Generic.List), 2 },
};
}
internal static object GetFormatter(Type t)
{
int key;
if (!lookup.TryGetValue(t, out key))
{
return null;
}
switch (key)
{
case 0: return new global::MagicOnion.DynamicArgumentTupleFormatter, global::System.Collections.Generic.Dictionary>(default(global::System.Collections.Generic.List), default(global::System.Collections.Generic.Dictionary));
case 1: return new global::MessagePack.Formatters.DictionaryFormatter();
case 2: return new global::MessagePack.Formatters.ListFormatter();
default: return null;
}
}
}
}
#pragma warning restore 168
#pragma warning restore 219
#pragma warning restore 414
#pragma warning restore 612
#pragma warning restore 618
#pragma warning disable 618
#pragma warning disable 612
#pragma warning disable 414
#pragma warning disable 219
#pragma warning disable 168
namespace ChatApp.Shared.Services {
using System;
using MagicOnion;
using MagicOnion.Client;
using Grpc.Core;
using MessagePack;
[Ignore]
public class ChatServiceClient : MagicOnionClientBase, global::ChatApp.Shared.Services.IChatService
{
static readonly Method GenerateExceptionMethod;
static readonly Func GenerateExceptionDelegate;
static readonly Method SendReportAsyncMethod;
static readonly Func SendReportAsyncDelegate;
static ChatServiceClient()
{
GenerateExceptionMethod = new Method(MethodType.Unary, "IChatService", "GenerateException", MagicOnionMarshallers.ThroughMarshaller, MagicOnionMarshallers.ThroughMarshaller);
GenerateExceptionDelegate = _GenerateException;
SendReportAsyncMethod = new Method(MethodType.Unary, "IChatService", "SendReportAsync", MagicOnionMarshallers.ThroughMarshaller, MagicOnionMarshallers.ThroughMarshaller);
SendReportAsyncDelegate = _SendReportAsync;
}
ChatServiceClient()
{
}
public ChatServiceClient(CallInvoker callInvoker, MessagePackSerializerOptions serializerOptions, IClientFilter[] filters)
: base(callInvoker, serializerOptions, filters)
{
}
protected override MagicOnionClientBase Clone()
{
var clone = new ChatServiceClient();
clone.host = this.host;
clone.option = this.option;
clone.callInvoker = this.callInvoker;
clone.serializerOptions = this.serializerOptions;
clone.filters = filters;
return clone;
}
public new IChatService WithHeaders(Metadata headers)
{
return base.WithHeaders(headers);
}
public new IChatService WithCancellationToken(System.Threading.CancellationToken cancellationToken)
{
return base.WithCancellationToken(cancellationToken);
}
public new IChatService WithDeadline(System.DateTime deadline)
{
return base.WithDeadline(deadline);
}
public new IChatService WithHost(string host)
{
return base.WithHost(host);
}
public new IChatService WithOptions(CallOptions option)
{
return base.WithOptions(option);
}
static ResponseContext _GenerateException(RequestContext __context)
{
return CreateResponseContext(__context, GenerateExceptionMethod);
}
public global::MagicOnion.UnaryResult GenerateException(string message)
{
return InvokeAsync("IChatService/GenerateException", message, GenerateExceptionDelegate);
}
static ResponseContext _SendReportAsync(RequestContext __context)
{
return CreateResponseContext(__context, SendReportAsyncMethod);
}
public global::MagicOnion.UnaryResult SendReportAsync(string message)
{
return InvokeAsync("IChatService/SendReportAsync", message, SendReportAsyncDelegate);
}
}
}
#pragma warning restore 168
#pragma warning restore 219
#pragma warning restore 414
#pragma warning restore 612
#pragma warning restore 618
#pragma warning disable 618
#pragma warning disable 612
#pragma warning disable 414
#pragma warning disable 219
#pragma warning disable 168
namespace ChatApp.Shared.Hubs {
using Grpc.Core;
using Grpc.Core.Logging;
using MagicOnion;
using MagicOnion.Client;
using MessagePack;
using System;
using System.Threading.Tasks;
[Ignore]
public class ChatHubClient : StreamingHubClientBase, global::ChatApp.Shared.Hubs.IChatHub
{
static readonly Method method = new Method(MethodType.DuplexStreaming, "IChatHub", "Connect", MagicOnionMarshallers.ThroughMarshaller, MagicOnionMarshallers.ThroughMarshaller);
protected override Method DuplexStreamingAsyncMethod { get { return method; } }
readonly global::ChatApp.Shared.Hubs.IChatHub __fireAndForgetClient;
public ChatHubClient(CallInvoker callInvoker, string host, CallOptions option, MessagePackSerializerOptions serializerOptions, ILogger logger)
: base(callInvoker, host, option, serializerOptions, logger)
{
this.__fireAndForgetClient = new FireAndForgetClient(this);
}
public global::ChatApp.Shared.Hubs.IChatHub FireAndForget()
{
return __fireAndForgetClient;
}
protected override void OnBroadcastEvent(int methodId, ArraySegment data)
{
switch (methodId)
{
case -1297457280: // OnJoin
{
var result = MessagePackSerializer.Deserialize(data, serializerOptions);
receiver.OnJoin(result); break;
}
case 532410095: // OnLeave
{
var result = MessagePackSerializer.Deserialize(data, serializerOptions);
receiver.OnLeave(result); break;
}
case -552695459: // OnSendMessage
{
var result = MessagePackSerializer.Deserialize(data, serializerOptions);
receiver.OnSendMessage(result); break;
}
default:
break;
}
}
protected override void OnResponseEvent(int methodId, object taskCompletionSource, ArraySegment data)
{
switch (methodId)
{
case -733403293: // JoinAsync
{
var result = MessagePackSerializer.Deserialize(data, serializerOptions);
((TaskCompletionSource)taskCompletionSource).TrySetResult(result);
break;
}
case 1368362116: // LeaveAsync
{
var result = MessagePackSerializer.Deserialize(data, serializerOptions);
((TaskCompletionSource)taskCompletionSource).TrySetResult(result);
break;
}
case -601690414: // SendMessageAsync
{
var result = MessagePackSerializer.Deserialize(data, serializerOptions);
((TaskCompletionSource)taskCompletionSource).TrySetResult(result);
break;
}
case 517938971: // GenerateException
{
var result = MessagePackSerializer.Deserialize(data, serializerOptions);
((TaskCompletionSource)taskCompletionSource).TrySetResult(result);
break;
}
case -852153394: // SampleMethod
{
var result = MessagePackSerializer.Deserialize(data, serializerOptions);
((TaskCompletionSource)taskCompletionSource).TrySetResult(result);
break;
}
default:
break;
}
}
public global::System.Threading.Tasks.Task JoinAsync(global::ChatApp.Shared.MessagePackObjects.JoinRequest request)
{
return WriteMessageWithResponseAsync(-733403293, request);
}
public global::System.Threading.Tasks.Task LeaveAsync()
{
return WriteMessageWithResponseAsync(1368362116, Nil.Default);
}
public global::System.Threading.Tasks.Task SendMessageAsync(string message)
{
return WriteMessageWithResponseAsync(-601690414, message);
}
public global::System.Threading.Tasks.Task GenerateException(string message)
{
return WriteMessageWithResponseAsync(517938971, message);
}
public global::System.Threading.Tasks.Task SampleMethod(global::System.Collections.Generic.List sampleList, global::System.Collections.Generic.Dictionary sampleDictionary)
{
return WriteMessageWithResponseAsync, global::System.Collections.Generic.Dictionary>, Nil>(-852153394, new DynamicArgumentTuple, global::System.Collections.Generic.Dictionary>(sampleList, sampleDictionary));
}
class FireAndForgetClient : global::ChatApp.Shared.Hubs.IChatHub
{
readonly ChatHubClient __parent;
public FireAndForgetClient(ChatHubClient parentClient)
{
this.__parent = parentClient;
}
public global::ChatApp.Shared.Hubs.IChatHub FireAndForget()
{
throw new NotSupportedException();
}
public Task DisposeAsync()
{
throw new NotSupportedException();
}
public Task WaitForDisconnect()
{
throw new NotSupportedException();
}
public global::System.Threading.Tasks.Task JoinAsync(global::ChatApp.Shared.MessagePackObjects.JoinRequest request)
{
return __parent.WriteMessageAsync(-733403293, request);
}
public global::System.Threading.Tasks.Task LeaveAsync()
{
return __parent.WriteMessageAsync(1368362116, Nil.Default);
}
public global::System.Threading.Tasks.Task SendMessageAsync(string message)
{
return __parent.WriteMessageAsync(-601690414, message);
}
public global::System.Threading.Tasks.Task GenerateException(string message)
{
return __parent.WriteMessageAsync(517938971, message);
}
public global::System.Threading.Tasks.Task SampleMethod(global::System.Collections.Generic.List sampleList, global::System.Collections.Generic.Dictionary sampleDictionary)
{
return __parent.WriteMessageAsync, global::System.Collections.Generic.Dictionary>>(-852153394, new DynamicArgumentTuple, global::System.Collections.Generic.Dictionary>(sampleList, sampleDictionary));
}
}
}
}
#pragma warning restore 168
#pragma warning restore 219
#pragma warning restore 414
#pragma warning restore 618
#pragma warning restore 612