Bring legacy CultNet into the schema-v0 fold

This commit is contained in:
Meta Vens 2026-05-06 11:50:10 +01:00
commit 0277ca79d9
31 changed files with 2635 additions and 6 deletions

View file

@ -52,6 +52,7 @@ namespace GameCult.Caching.MessagePack.Generator
var sbFormatters = new StringBuilder();
sbResolvers.AppendLine("// <auto-generated/>");
sbResolvers.AppendLine("#nullable enable");
sbResolvers.AppendLine("using System;");
sbResolvers.AppendLine("using MessagePack.Formatters;");
sbResolvers.AppendLine("namespace GameCult.Caching.MessagePack");
@ -86,8 +87,9 @@ namespace GameCult.Caching.MessagePack.Generator
private static string Sanitize(ISymbol symbol)
{
var s = symbol.ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat);
var s = symbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);
return s.Replace(".", "_")
.Replace("global::", string.Empty)
.Replace("<", "_")
.Replace(">", "_")
.Replace(",", "_")
@ -99,14 +101,13 @@ namespace GameCult.Caching.MessagePack.Generator
{
var sb = new StringBuilder();
sb.AppendLine("// <auto-generated/>");
sb.AppendLine("#nullable enable");
sb.AppendLine("using System;");
sb.AppendLine("using MessagePack;");
sb.AppendLine("using MessagePack.Formatters;");
sb.AppendLine();
var ns = type.ContainingNamespace.IsGlobalNamespace
? "GameCult.Caching.Generated"
: type.ContainingNamespace.ToDisplayString();
var ns = "GameCult.Caching.MessagePack";
sb.AppendLine($"namespace {ns}");
sb.AppendLine("{");
@ -115,7 +116,7 @@ namespace GameCult.Caching.MessagePack.Generator
sb.AppendLine($" internal sealed class {formatterName} : IMessagePackFormatter<{typeFull}>");
sb.AppendLine(" {");
sb.AppendLine($" public static readonly {formatterName} Instance = new {formatterName}();");
sb.AppendLine(" private {formatterName}() { }");
sb.AppendLine($" private {formatterName}() {{ }}");
sb.AppendLine();
var members = CollectMembers(type);