#1 Followed the MagicOnion quickstart guide, borrowing code from the chat sample app to get something working
223 lines
8.4 KiB
C#
223 lines
8.4 KiB
C#
// <auto-generated>
|
|
// THIS (.cs) FILE IS GENERATED BY MPC(MessagePack-CSharp). DO NOT CHANGE IT.
|
|
// </auto-generated>
|
|
|
|
#pragma warning disable 618
|
|
#pragma warning disable 612
|
|
#pragma warning disable 414
|
|
#pragma warning disable 168
|
|
|
|
#pragma warning disable SA1200 // Using directives should be placed correctly
|
|
#pragma warning disable SA1312 // Variable names should begin with lower-case letter
|
|
#pragma warning disable SA1649 // File name should match first type name
|
|
|
|
namespace MessagePack.Resolvers
|
|
{
|
|
using System;
|
|
using System.Buffers;
|
|
using MessagePack;
|
|
|
|
public class GeneratedResolver : global::MessagePack.IFormatterResolver
|
|
{
|
|
public static readonly global::MessagePack.IFormatterResolver Instance = new GeneratedResolver();
|
|
|
|
private GeneratedResolver()
|
|
{
|
|
}
|
|
|
|
public global::MessagePack.Formatters.IMessagePackFormatter<T> GetFormatter<T>()
|
|
{
|
|
return FormatterCache<T>.Formatter;
|
|
}
|
|
|
|
private static class FormatterCache<T>
|
|
{
|
|
internal static readonly global::MessagePack.Formatters.IMessagePackFormatter<T> Formatter;
|
|
|
|
static FormatterCache()
|
|
{
|
|
var f = GeneratedResolverGetFormatterHelper.GetFormatter(typeof(T));
|
|
if (f != null)
|
|
{
|
|
Formatter = (global::MessagePack.Formatters.IMessagePackFormatter<T>)f;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
internal static class GeneratedResolverGetFormatterHelper
|
|
{
|
|
private static readonly global::System.Collections.Generic.Dictionary<Type, int> lookup;
|
|
|
|
static GeneratedResolverGetFormatterHelper()
|
|
{
|
|
lookup = new global::System.Collections.Generic.Dictionary<Type, int>(2)
|
|
{
|
|
{ typeof(global::ChatApp.Shared.MessagePackObjects.JoinRequest), 0 },
|
|
{ typeof(global::ChatApp.Shared.MessagePackObjects.MessageResponse), 1 },
|
|
};
|
|
}
|
|
|
|
internal static object GetFormatter(Type t)
|
|
{
|
|
int key;
|
|
if (!lookup.TryGetValue(t, out key))
|
|
{
|
|
return null;
|
|
}
|
|
|
|
switch (key)
|
|
{
|
|
case 0: return new MessagePack.Formatters.ChatApp.Shared.MessagePackObjects.JoinRequestFormatter();
|
|
case 1: return new MessagePack.Formatters.ChatApp.Shared.MessagePackObjects.MessageResponseFormatter();
|
|
default: return null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#pragma warning restore 168
|
|
#pragma warning restore 414
|
|
#pragma warning restore 618
|
|
#pragma warning restore 612
|
|
|
|
#pragma warning restore SA1312 // Variable names should begin with lower-case letter
|
|
#pragma warning restore SA1200 // Using directives should be placed correctly
|
|
#pragma warning restore SA1649 // File name should match first type name
|
|
|
|
|
|
|
|
|
|
// <auto-generated>
|
|
// THIS (.cs) FILE IS GENERATED BY MPC(MessagePack-CSharp). DO NOT CHANGE IT.
|
|
// </auto-generated>
|
|
|
|
#pragma warning disable 618
|
|
#pragma warning disable 612
|
|
#pragma warning disable 414
|
|
#pragma warning disable 168
|
|
|
|
#pragma warning disable SA1129 // Do not use default value type constructor
|
|
#pragma warning disable SA1200 // Using directives should be placed correctly
|
|
#pragma warning disable SA1309 // Field names should not begin with underscore
|
|
#pragma warning disable SA1312 // Variable names should begin with lower-case letter
|
|
#pragma warning disable SA1403 // File may only contain a single namespace
|
|
#pragma warning disable SA1649 // File name should match first type name
|
|
|
|
namespace MessagePack.Formatters.ChatApp.Shared.MessagePackObjects
|
|
{
|
|
using System;
|
|
using System.Buffers;
|
|
using MessagePack;
|
|
|
|
public sealed class JoinRequestFormatter : global::MessagePack.Formatters.IMessagePackFormatter<global::ChatApp.Shared.MessagePackObjects.JoinRequest>
|
|
{
|
|
|
|
|
|
public void Serialize(ref MessagePackWriter writer, global::ChatApp.Shared.MessagePackObjects.JoinRequest value, global::MessagePack.MessagePackSerializerOptions options)
|
|
{
|
|
IFormatterResolver formatterResolver = options.Resolver;
|
|
writer.WriteArrayHeader(2);
|
|
formatterResolver.GetFormatterWithVerify<string>().Serialize(ref writer, value.RoomName, options);
|
|
formatterResolver.GetFormatterWithVerify<string>().Serialize(ref writer, value.UserName, options);
|
|
}
|
|
|
|
public global::ChatApp.Shared.MessagePackObjects.JoinRequest Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
|
|
{
|
|
if (reader.TryReadNil())
|
|
{
|
|
throw new InvalidOperationException("typecode is null, struct not supported");
|
|
}
|
|
|
|
IFormatterResolver formatterResolver = options.Resolver;
|
|
var length = reader.ReadArrayHeader();
|
|
var __RoomName__ = default(string);
|
|
var __UserName__ = default(string);
|
|
|
|
for (int i = 0; i < length; i++)
|
|
{
|
|
var key = i;
|
|
|
|
switch (key)
|
|
{
|
|
case 0:
|
|
__RoomName__ = formatterResolver.GetFormatterWithVerify<string>().Deserialize(ref reader, options);
|
|
break;
|
|
case 1:
|
|
__UserName__ = formatterResolver.GetFormatterWithVerify<string>().Deserialize(ref reader, options);
|
|
break;
|
|
default:
|
|
reader.Skip();
|
|
break;
|
|
}
|
|
}
|
|
|
|
var ____result = new global::ChatApp.Shared.MessagePackObjects.JoinRequest();
|
|
____result.RoomName = __RoomName__;
|
|
____result.UserName = __UserName__;
|
|
return ____result;
|
|
}
|
|
}
|
|
|
|
public sealed class MessageResponseFormatter : global::MessagePack.Formatters.IMessagePackFormatter<global::ChatApp.Shared.MessagePackObjects.MessageResponse>
|
|
{
|
|
|
|
|
|
public void Serialize(ref MessagePackWriter writer, global::ChatApp.Shared.MessagePackObjects.MessageResponse value, global::MessagePack.MessagePackSerializerOptions options)
|
|
{
|
|
IFormatterResolver formatterResolver = options.Resolver;
|
|
writer.WriteArrayHeader(2);
|
|
formatterResolver.GetFormatterWithVerify<string>().Serialize(ref writer, value.UserName, options);
|
|
formatterResolver.GetFormatterWithVerify<string>().Serialize(ref writer, value.Message, options);
|
|
}
|
|
|
|
public global::ChatApp.Shared.MessagePackObjects.MessageResponse Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options)
|
|
{
|
|
if (reader.TryReadNil())
|
|
{
|
|
throw new InvalidOperationException("typecode is null, struct not supported");
|
|
}
|
|
|
|
IFormatterResolver formatterResolver = options.Resolver;
|
|
var length = reader.ReadArrayHeader();
|
|
var __UserName__ = default(string);
|
|
var __Message__ = default(string);
|
|
|
|
for (int i = 0; i < length; i++)
|
|
{
|
|
var key = i;
|
|
|
|
switch (key)
|
|
{
|
|
case 0:
|
|
__UserName__ = formatterResolver.GetFormatterWithVerify<string>().Deserialize(ref reader, options);
|
|
break;
|
|
case 1:
|
|
__Message__ = formatterResolver.GetFormatterWithVerify<string>().Deserialize(ref reader, options);
|
|
break;
|
|
default:
|
|
reader.Skip();
|
|
break;
|
|
}
|
|
}
|
|
|
|
var ____result = new global::ChatApp.Shared.MessagePackObjects.MessageResponse();
|
|
____result.UserName = __UserName__;
|
|
____result.Message = __Message__;
|
|
return ____result;
|
|
}
|
|
}
|
|
}
|
|
|
|
#pragma warning restore 168
|
|
#pragma warning restore 414
|
|
#pragma warning restore 618
|
|
#pragma warning restore 612
|
|
|
|
#pragma warning restore SA1129 // Do not use default value type constructor
|
|
#pragma warning restore SA1200 // Using directives should be placed correctly
|
|
#pragma warning restore SA1309 // Field names should not begin with underscore
|
|
#pragma warning restore SA1312 // Variable names should begin with lower-case letter
|
|
#pragma warning restore SA1403 // File may only contain a single namespace
|
|
#pragma warning restore SA1649 // File name should match first type name
|
|
|