refactor: remove protobuf

This commit is contained in:
alyssa 2024-12-23 22:31:20 +00:00
parent f1685495eb
commit 4596d98670
31 changed files with 58 additions and 577 deletions

View file

@ -23,7 +23,6 @@
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
<PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="Dapper.Contrib" Version="2.0.78" />
<PackageReference Include="Google.Protobuf" Version="3.29.1" />
<PackageReference Include="ipnetwork2" Version="3.0.667" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0" />

View file

@ -1,22 +0,0 @@
using Google.Protobuf;
namespace PluralKit.Core;
public static class Proto
{
private static readonly Dictionary<string, MessageParser> _parser = new();
public static byte[] Marshal(this IMessage message) => message.ToByteArray();
public static T Unmarshal<T>(this byte[] message) where T : IMessage<T>, new()
{
var type = typeof(T).ToString();
if (_parser.ContainsKey(type))
{
return (T)_parser[type].ParseFrom(message);
}
_parser.Add(type, new MessageParser<T>(() => new T()));
return Unmarshal<T>(message);
}
}

View file

@ -66,12 +66,6 @@
"Dapper": "2.0.78"
}
},
"Google.Protobuf": {
"type": "Direct",
"requested": "[3.29.1, )",
"resolved": "3.29.1",
"contentHash": "kDFLP72bPu4GwquVN7HtFnfqxhQs4CLbUEyOc/0yV48HB0Pxf7tDK7zIx6ifaQwGp+RSoLY1sz1CXqoAEAu+AQ=="
},
"IPNetwork2": {
"type": "Direct",
"requested": "[3.0.667, )",