修改协议工具

This commit is contained in:
2025-07-27 23:46:43 +08:00
parent 743c1d2baa
commit be33e12b35
112 changed files with 1021 additions and 1119 deletions

View File

@@ -1,40 +0,0 @@
namespace Fantasy.Tools.ProtocalExporter;
public static class NetworkProtocolTemplate
{
public static readonly string Template ="""
#if SERVER
using ProtoBuf;
(UsingNamespace)
using System.Collections.Generic;
using MongoDB.Bson.Serialization.Attributes;
using Fantasy;
using Fantasy.Network.Interface;
using Fantasy.Serialize;
// ReSharper disable InconsistentNaming
// ReSharper disable RedundantUsingDirective
// ReSharper disable RedundantOverriddenMember
// ReSharper disable PartialTypeWithSinglePart
// ReSharper disable UnusedAutoPropertyAccessor.Global
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable CheckNamespace
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
#pragma warning disable CS8618
namespace Fantasy
{
#else
using ProtoBuf;
(UsingNamespace)
using System.Collections.Generic;
using Fantasy;
using Fantasy.Network.Interface;
using Fantasy.Serialize;
#pragma warning disable CS8618
namespace Fantasy
{
#endif
(Content)}
""";
}

View File

@@ -4,6 +4,7 @@ using Fantasy.Helper;
using Fantasy.Network;
using OpCode = Fantasy.Network.OpCode;
using OpCodeType = Fantasy.Network.OpCodeType;
#pragma warning disable CS8600 // Converting null literal or possible null value to non-nullable type.
#pragma warning disable CS8602 // Dereference of a possibly null reference.
// ReSharper disable PossibleNullReferenceException
@@ -12,12 +13,14 @@ using OpCodeType = Fantasy.Network.OpCodeType;
#pragma warning disable CS8604 // Possible null reference argument.
namespace Fantasy.Tools.ProtocalExporter;
public enum NetworkProtocolOpCodeType
{
None = 0,
Outer = 1,
Inner = 2,
}
public sealed class OpcodeInfo
{
public uint Code;
@@ -35,12 +38,13 @@ public sealed class ProtocolExporter
private readonly string _networkProtocolServerDirectory;
private readonly string _networkProtocolDirectoryOuter;
private readonly string _networkProtocolDirectoryInner;
public ProtocolExporter()
{
Console.OutputEncoding = Encoding.UTF8;
if (ExporterSettingsHelper.NetworkProtocolDirectory == null || ExporterSettingsHelper.NetworkProtocolDirectory.Trim() == "")
if (ExporterSettingsHelper.NetworkProtocolDirectory == null ||
ExporterSettingsHelper.NetworkProtocolDirectory.Trim() == "")
{
Log.Info($"NetworkProtocolDirectory Can not be empty!");
return;
@@ -119,12 +123,12 @@ public sealed class ProtocolExporter
var errorCodeStr = new StringBuilder();
var usingNamespace = new HashSet<string>();
var saveDirectory = new Dictionary<string, string>();
OpcodeInfo opcodeInfo = null;
ProtocolOpCode protocolOpCode = null;
string[] protocolFiles = null;
_opcodes.Clear();
switch (opCodeType)
{
case NetworkProtocolOpCodeType.Outer:
@@ -133,12 +137,12 @@ public sealed class ProtocolExporter
{
saveDirectory.Add(_networkProtocolServerDirectory, _serverTemplate);
}
if (ExporterAges.Instance.ExportPlatform.HasFlag(ExportPlatform.Client))
{
saveDirectory.Add(_networkProtocolClientDirectory, _clientTemplate);
}
protocolOpCode = new ProtocolOpCode()
{
Message = OpCodeType.OuterMessage,
@@ -158,7 +162,8 @@ public sealed class ProtocolExporter
RoamingResponse = OpCodeType.OuterRoamingResponse,
};
opCodeName = "OuterOpcode";
protocolFiles = FileHelper.GetDirectoryFile(_networkProtocolDirectoryOuter, "*.proto", SearchOption.AllDirectories);
protocolFiles = FileHelper.GetDirectoryFile(_networkProtocolDirectoryOuter, "*.proto",
SearchOption.AllDirectories);
break;
}
case NetworkProtocolOpCodeType.Inner:
@@ -183,7 +188,8 @@ public sealed class ProtocolExporter
};
opCodeName = "InnerOpcode";
saveDirectory.Add(_networkProtocolServerDirectory, _serverTemplate);
protocolFiles = FileHelper.GetDirectoryFile(_networkProtocolDirectoryInner, "*.proto", SearchOption.AllDirectories);
protocolFiles = FileHelper.GetDirectoryFile(_networkProtocolDirectoryInner, "*.proto",
SearchOption.AllDirectories);
break;
}
}
@@ -192,7 +198,7 @@ public sealed class ProtocolExporter
{
return;
}
#region GenerateFiles
foreach (var filePath in protocolFiles)
@@ -221,7 +227,8 @@ public sealed class ProtocolExporter
if (currentLine.StartsWith("///"))
{
messageStr.AppendFormat(" /// <summary>\r\n" + " /// {0}\r\n" + " /// </summary>\r\n", currentLine.Substring("///".Length));
messageStr.AppendFormat(" /// <summary>\r\n" + " /// {0}\r\n" + " /// </summary>\r\n",
currentLine.Substring("///".Length));
continue;
}
@@ -256,6 +263,7 @@ public sealed class ProtocolExporter
Log.Error("Under Outer, /// does not support the Bson protocol!");
return;
}
protocolType = null;
protocolIgnore = "\t\t[BsonIgnore]";
protocolMember = null;
@@ -298,11 +306,12 @@ public sealed class ProtocolExporter
{
messageStr.AppendLine("\t[ProtoContract]");
}
if (splits.Length > 1)
{
hasOpCode = true;
var parameterArray = currentLine.Split(new[] { "//" }, StringSplitOptions.RemoveEmptyEntries)[1].Trim().Split(',');
var parameterArray = currentLine.Split(new[] { "//" }, StringSplitOptions.RemoveEmptyEntries)[1]
.Trim().Split(',');
parameter = parameterArray[0].Trim();
opcodeInfo = new OpcodeInfo()
{
@@ -330,12 +339,15 @@ public sealed class ProtocolExporter
break;
}
}
break;
}
case 3:
{
responseTypeStr = parameterArray[1].Trim();
customRouteType = parameter.Contains("IRoaming") ? $"Fantasy.RoamingType.{parameterArray[2].Trim()}" : $"Fantasy.RouteType.{parameterArray[2].Trim()}";
customRouteType = parameter.Contains("IRoaming")
? $"Fantasy.RoamingType.{parameterArray[2].Trim()}"
: $"Fantasy.RouteType.{parameterArray[2].Trim()}";
break;
}
}
@@ -353,6 +365,7 @@ public sealed class ProtocolExporter
{
messageStr.Append(", IProto");
}
continue;
}
@@ -367,15 +380,18 @@ public sealed class ProtocolExporter
{
messageStr.AppendLine("\n\t{");
messageStr.AppendLine($"\t\tpublic static {className} Create(Scene scene)");
messageStr.AppendLine($"\t\t{{\n\t\t\treturn scene.MessagePoolComponent.Rent<{className}>();\n\t\t}}");
messageStr.AppendLine(
$"\t\t{{\n\t\t\treturn scene.MessagePoolComponent.Rent<{className}>();\n\t\t}}");
messageStr.AppendLine($"\t\tpublic override void Dispose()");
messageStr.AppendLine($"\t\t{{");
messageStr.AppendLine($"<<<<Dispose>>>#if FANTASY_NET || FANTASY_UNITY\n\t\t\tGetScene().MessagePoolComponent.Return<{className}>(this);\n#endif");
messageStr.AppendLine(
$"<<<<Dispose>>>#if FANTASY_NET || FANTASY_UNITY\n\t\t\tGetScene().MessagePoolComponent.Return<{className}>(this);\n#endif");
messageStr.AppendLine($"\t\t}}");
if (parameter == "IMessage")
{
opcodeInfo.Code = OpCode.Create(protocolOpCodeType, protocolOpCode.Message, protocolOpCode.AMessage++);
opcodeInfo.Code = OpCode.Create(protocolOpCodeType, protocolOpCode.Message,
protocolOpCode.AMessage++);
messageStr.AppendLine($"\t\tpublic uint OpCode() {{ return {opCodeName}.{className}; }}");
}
else
@@ -397,7 +413,8 @@ public sealed class ProtocolExporter
if (hasOpCode)
{
messageStr.AppendLine($"\t\tpublic uint OpCode() {{ return {opCodeName}.{className}; }}");
messageStr.AppendLine(
$"\t\tpublic uint OpCode() {{ return {opCodeName}.{className}; }}");
}
if (customRouteType != null)
@@ -411,16 +428,19 @@ public sealed class ProtocolExporter
{
case "IRequest":
{
opcodeInfo.Code = OpCode.Create(protocolOpCodeType, protocolOpCode.Request, protocolOpCode.ARequest++);
opcodeInfo.Code = OpCode.Create(protocolOpCodeType, protocolOpCode.Request,
protocolOpCode.ARequest++);
break;
}
case "IResponse":
{
opcodeInfo.Code = OpCode.Create(protocolOpCodeType, protocolOpCode.Response, protocolOpCode.AResponse++);
opcodeInfo.Code = OpCode.Create(protocolOpCodeType, protocolOpCode.Response,
protocolOpCode.AResponse++);
if (!string.IsNullOrEmpty(protocolMember))
{
errorCodeStr.AppendLine($"\t\t[{protocolMember}(ErrorCodeKeyIndex)]");
}
errorCodeStr.AppendLine("\t\tpublic uint ErrorCode { get; set; }");
disposeStr.AppendLine($"\t\t\tErrorCode = default;");
break;
@@ -431,21 +451,28 @@ public sealed class ProtocolExporter
{
case "IAddressableRouteMessage":
{
opcodeInfo.Code = OpCode.Create(protocolOpCodeType, protocolOpCode.AddressableMessage, protocolOpCode.AAddressableMessage++);
opcodeInfo.Code = OpCode.Create(protocolOpCodeType,
protocolOpCode.AddressableMessage,
protocolOpCode.AAddressableMessage++);
break;
}
case "IAddressableRouteRequest":
{
opcodeInfo.Code = OpCode.Create(protocolOpCodeType, protocolOpCode.AddressableRequest, protocolOpCode.AAddressableRequest++);
opcodeInfo.Code = OpCode.Create(protocolOpCodeType,
protocolOpCode.AddressableRequest,
protocolOpCode.AAddressableRequest++);
break;
}
case "IAddressableRouteResponse":
{
opcodeInfo.Code = OpCode.Create(protocolOpCodeType, protocolOpCode.AddressableResponse, protocolOpCode.AAddressableResponse++);
opcodeInfo.Code = OpCode.Create(protocolOpCodeType,
protocolOpCode.AddressableResponse,
protocolOpCode.AAddressableResponse++);
if (!string.IsNullOrEmpty(protocolMember))
{
errorCodeStr.AppendLine($"\t\t[{protocolMember}(ErrorCodeKeyIndex)]");
}
errorCodeStr.AppendLine("\t\tpublic uint ErrorCode { get; set; }");
disposeStr.AppendLine($"\t\t\tErrorCode = default;");
break;
@@ -454,31 +481,44 @@ public sealed class ProtocolExporter
{
if (opCodeType == NetworkProtocolOpCodeType.Inner)
{
throw new NotSupportedException("Under Inner, /// does not support the ICustomRouteMessage!");
throw new NotSupportedException(
"Under Inner, /// does not support the ICustomRouteMessage!");
}
opcodeInfo.Code = OpCode.Create(protocolOpCodeType, protocolOpCode.CustomRouteMessage, protocolOpCode.ACustomRouteMessage++);
opcodeInfo.Code = OpCode.Create(protocolOpCodeType,
protocolOpCode.CustomRouteMessage,
protocolOpCode.ACustomRouteMessage++);
break;
}
case "ICustomRouteRequest":
{
if (opCodeType == NetworkProtocolOpCodeType.Inner)
{
throw new NotSupportedException("Under Inner, /// does not support the ICustomRouteMessage!");
throw new NotSupportedException(
"Under Inner, /// does not support the ICustomRouteMessage!");
}
opcodeInfo.Code = OpCode.Create(protocolOpCodeType, protocolOpCode.CustomRouteRequest, protocolOpCode.ACustomRouteRequest++);
opcodeInfo.Code = OpCode.Create(protocolOpCodeType,
protocolOpCode.CustomRouteRequest,
protocolOpCode.ACustomRouteRequest++);
break;
}
case "ICustomRouteResponse":
{
if (opCodeType == NetworkProtocolOpCodeType.Inner)
{
throw new NotSupportedException("Under Inner, /// does not support the ICustomRouteMessage!");
throw new NotSupportedException(
"Under Inner, /// does not support the ICustomRouteMessage!");
}
opcodeInfo.Code = OpCode.Create(protocolOpCodeType, protocolOpCode.CustomRouteResponse, protocolOpCode.ACustomRouteResponse++);
opcodeInfo.Code = OpCode.Create(protocolOpCodeType,
protocolOpCode.CustomRouteResponse,
protocolOpCode.ACustomRouteResponse++);
if (!string.IsNullOrEmpty(protocolMember))
{
errorCodeStr.AppendLine($"\t\t[{protocolMember}(ErrorCodeKeyIndex)]");
}
errorCodeStr.AppendLine("\t\tpublic uint ErrorCode { get; set; }");
disposeStr.AppendLine($"\t\t\tErrorCode = default;");
break;
@@ -489,7 +529,8 @@ public sealed class ProtocolExporter
// {
// throw new NotSupportedException("Under Inner, /// does not support the IRoamingMessage!");
// }
opcodeInfo.Code = OpCode.Create(protocolOpCodeType, protocolOpCode.RoamingMessage, protocolOpCode.ARoamingMessage++);
opcodeInfo.Code = OpCode.Create(protocolOpCodeType,
protocolOpCode.RoamingMessage, protocolOpCode.ARoamingMessage++);
break;
}
case "IRoamingRequest":
@@ -498,7 +539,8 @@ public sealed class ProtocolExporter
// {
// throw new NotSupportedException("Under Inner, /// does not support the IRoamingRequest!");
// }
opcodeInfo.Code = OpCode.Create(protocolOpCodeType, protocolOpCode.RoamingRequest, protocolOpCode.ARoamingRequest++);
opcodeInfo.Code = OpCode.Create(protocolOpCodeType,
protocolOpCode.RoamingRequest, protocolOpCode.ARoamingRequest++);
break;
}
case "IRoamingResponse":
@@ -507,11 +549,13 @@ public sealed class ProtocolExporter
// {
// throw new NotSupportedException("Under Inner, /// does not support the IRoamingResponse!");
// }
opcodeInfo.Code = OpCode.Create(protocolOpCodeType, protocolOpCode.RoamingResponse, protocolOpCode.ARoamingResponse++);
opcodeInfo.Code = OpCode.Create(protocolOpCodeType,
protocolOpCode.RoamingResponse, protocolOpCode.ARoamingResponse++);
if (!string.IsNullOrEmpty(protocolMember))
{
errorCodeStr.AppendLine($"\t\t[{protocolMember}(ErrorCodeKeyIndex)]");
}
errorCodeStr.AppendLine("\t\tpublic uint ErrorCode { get; set; }");
disposeStr.AppendLine($"\t\t\tErrorCode = default;");
break;
@@ -520,31 +564,41 @@ public sealed class ProtocolExporter
{
if (opCodeType == NetworkProtocolOpCodeType.Outer)
{
throw new NotSupportedException("Under Inner, /// does not support the ICustomRouteMessage!");
throw new NotSupportedException(
"Under Inner, /// does not support the ICustomRouteMessage!");
}
opcodeInfo.Code = OpCode.Create(protocolOpCodeType, protocolOpCode.RouteMessage, protocolOpCode.ARouteMessage++);
opcodeInfo.Code = OpCode.Create(protocolOpCodeType,
protocolOpCode.RouteMessage, protocolOpCode.ARouteMessage++);
break;
}
case "IRouteRequest":
{
if (opCodeType == NetworkProtocolOpCodeType.Outer)
{
throw new NotSupportedException("Under Inner, /// does not support the ICustomRouteMessage!");
throw new NotSupportedException(
"Under Inner, /// does not support the ICustomRouteMessage!");
}
opcodeInfo.Code = OpCode.Create(protocolOpCodeType, protocolOpCode.RouteRequest, protocolOpCode.ARouteRequest++);
opcodeInfo.Code = OpCode.Create(protocolOpCodeType,
protocolOpCode.RouteRequest, protocolOpCode.ARouteRequest++);
break;
}
case "IRouteResponse":
{
if (opCodeType == NetworkProtocolOpCodeType.Outer)
{
throw new NotSupportedException("Under Inner, /// does not support the ICustomRouteMessage!");
throw new NotSupportedException(
"Under Inner, /// does not support the ICustomRouteMessage!");
}
opcodeInfo.Code = OpCode.Create(protocolOpCodeType, protocolOpCode.RouteResponse, protocolOpCode.ARouteResponse++);
opcodeInfo.Code = OpCode.Create(protocolOpCodeType,
protocolOpCode.RouteResponse, protocolOpCode.ARouteResponse++);
if (!string.IsNullOrEmpty(protocolMember))
{
errorCodeStr.AppendLine($"\t\t[{protocolMember}(ErrorCodeKeyIndex)]");
}
errorCodeStr.AppendLine("\t\tpublic uint ErrorCode { get; set; }");
disposeStr.AppendLine($"\t\t\tErrorCode = default;");
break;
@@ -589,7 +643,8 @@ public sealed class ProtocolExporter
if (currentLine.StartsWith("//"))
{
messageStr.AppendFormat("\t\t///<summary>\r\n" + "\t\t/// {0}\r\n" + "\t\t///</summary>\r\n", currentLine.TrimStart('/', '/'));
messageStr.AppendFormat("\t\t///<summary>\r\n" + "\t\t/// {0}\r\n" + "\t\t///</summary>\r\n",
currentLine.TrimStart('/', '/'));
continue;
}
@@ -602,14 +657,14 @@ public sealed class ProtocolExporter
Members(messageStr, disposeStr, currentLine, protocolMember, ref keyIndex);
}
}
var namespaceBuilder = new StringBuilder();
foreach (var @namespace in usingNamespace)
{
namespaceBuilder.Append($"using {@namespace};\n");
}
var csName = $"{Path.GetFileNameWithoutExtension(filePath)}.cs";
foreach (var (directory, template) in saveDirectory)
{
@@ -618,9 +673,10 @@ public sealed class ProtocolExporter
content = content.Replace("(UsingNamespace)", namespaceBuilder.ToString());
await File.WriteAllTextAsync(csFile, content);
}
file.Clear();
}
#endregion
#region GenerateOpCode
@@ -635,7 +691,7 @@ public sealed class ProtocolExporter
{
file.AppendLine($"\t\t public const uint {opcode.Name} = {opcode.Code};");
}
_opcodes.Clear();
file.AppendLine("\t}");
file.AppendLine("}");
@@ -645,10 +701,12 @@ public sealed class ProtocolExporter
var csFile = Path.Combine(directory, $"{opCodeName}.cs");
await File.WriteAllTextAsync(csFile, file.ToString());
}
#endregion
}
private void Repeated(StringBuilder file, StringBuilder disposeStr, string newline, string protocolMember, ref int keyIndex)
private void Repeated(StringBuilder file, StringBuilder disposeStr, string newline, string protocolMember,
ref int keyIndex)
{
try
{
@@ -669,8 +727,9 @@ public sealed class ProtocolExporter
Log.Error($"{newline}\n {e}");
}
}
private void Members(StringBuilder file, StringBuilder disposeStr, string currentLine, string protocolMember, ref int keyIndex)
private void Members(StringBuilder file, StringBuilder disposeStr, string currentLine, string protocolMember,
ref int keyIndex)
{
try
{
@@ -685,6 +744,7 @@ public sealed class ProtocolExporter
{
file.AppendLine($"\t\t[{protocolMember}({keyIndex++})]");
}
file.AppendLine($"\t\tpublic {typeCs} {name} {{ get; set; }}");
disposeStr.AppendLine($"\t\t\t{name} = default;");
}
@@ -693,7 +753,7 @@ public sealed class ProtocolExporter
Log.Error($"{currentLine}\n {e}");
}
}
private string ConvertType(string type)
{
return type switch
@@ -763,9 +823,10 @@ public sealed class ProtocolExporter
{
roamingTypeFileSb.AppendLine($"\t\t\t\tyield return {roamingType};");
}
roamingTypeFileSb.AppendLine("\t\t\t}\n\t\t}");
}
roamingTypeFileSb.AppendLine("\t}\n}");
var file = roamingTypeFileSb.ToString();
@@ -780,7 +841,7 @@ public sealed class ProtocolExporter
await File.WriteAllTextAsync($"{_networkProtocolClientDirectory}RoamingType.cs", file);
}
}
private async Task RouteType()
{
var routeTypeFile = $"{_networkProtocolDirectory}RouteType.Config";
@@ -794,6 +855,7 @@ public sealed class ProtocolExporter
{
protoFileText = await File.ReadAllTextAsync(routeTypeFile);
}
var routeTypeFileSb = new StringBuilder();
routeTypeFileSb.AppendLine("namespace Fantasy\n{");
routeTypeFileSb.AppendLine("\t// Route协议定义(需要定义1000以上、因为1000以内的框架预留)\t");
@@ -835,10 +897,16 @@ public sealed class ProtocolExporter
await File.WriteAllTextAsync($"{_networkProtocolClientDirectory}RouteType.cs", file);
}
}
private void LoadTemplate()
{
string[] lines = NetworkProtocolTemplate.Template.Split(["\r\n", "\n"], StringSplitOptions.None);
// 获取当前运行根目录(即应用程序的工作目录)
string currentDirectory = Directory.GetCurrentDirectory();
string filePath = Path.Combine(currentDirectory, "Template.txt");
// 读取文件所有行
string[] lines = File.ReadAllLines(filePath);
StringBuilder serverSb = new StringBuilder();
StringBuilder clientSb = new StringBuilder();
@@ -853,12 +921,14 @@ public sealed class ProtocolExporter
flag = 1;
continue;
}
else if (trim.StartsWith("#else"))
if (trim.StartsWith("#else"))
{
flag = 2;
continue;
}
else if (trim.StartsWith($"#endif"))
if (trim.StartsWith($"#endif"))
{
flag = 0;
continue;

View File

@@ -1,15 +1,15 @@
{
"Export": {
"NetworkProtocolDirectory": {
"Value": "../../../Examples/Config/NetworkProtocol/",
"Value": "../../../Config/NetworkProtocol/",
"Comment": "ProtoBuf文件所在的文件夹位置"
},
"NetworkProtocolServerDirectory": {
"Value": "../../../Examples/Server/Entity/Generate/NetworkProtocol/",
"Value": "../../../Entity/Generate/NetworkProtocol/",
"Comment": "ProtoBuf生成到服务端的文件夹位置"
},
"NetworkProtocolClientDirectory": {
"Value": "../../../Examples/Client/Unity/Assets/Scripts/Hotfix/Generate/NetworkProtocol/",
"Value": "../../../../Fishing2/Assets/Scripts/Generate/NetworkProtocol/",
"Comment": "ProtoBuf生成到客户端的文件夹位置"
},
"Serializes": {

View File

@@ -32,16 +32,16 @@
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\Fantasy.Net\Fantasy.Net\Runtime\Core\Helper\FileHelper.cs">
<Compile Include="..\..\..\Fantasy\Fantasy.Net\Fantasy.Net\Runtime\Core\Helper\FileHelper.cs">
<Link>Core\FileHelper.cs</Link>
</Compile>
<Compile Include="..\..\..\Fantasy.Net\Fantasy.Net\Runtime\Core\Helper\HashCodeHelper.cs">
<Compile Include="..\..\..\Fantasy\Fantasy.Net\Fantasy.Net\Runtime\Core\Helper\HashCodeHelper.cs">
<Link>Core\HashCodeHelper.cs</Link>
</Compile>
<Compile Include="..\..\..\Fantasy.Net\Fantasy.Net\Runtime\Core\Helper\JsonHelper.cs">
<Compile Include="..\..\..\Fantasy\Fantasy.Net\Fantasy.Net\Runtime\Core\Helper\JsonHelper.cs">
<Link>Core\JsonHelper.cs</Link>
</Compile>
<Compile Include="..\..\..\Fantasy.Net\Fantasy.Net\Runtime\Core\Network\Message\PacketParser\OpCode.cs">
<Compile Include="..\..\..\Fantasy\Fantasy.Net\Fantasy.Net\Runtime\Core\Network\Message\PacketParser\OpCode.cs">
<Link>ProtocalExporter\OpCode.cs</Link>
</Compile>
<Compile Update="ExporterSettingsHelper.cs">
@@ -59,10 +59,9 @@
<None Update="Run.sh">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Fantasy\Fantasy.Net\Fantasy.Net\Fantasy.Net.csproj" />
<None Update="Template.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,33 @@
#if SERVER
using ProtoBuf;
(UsingNamespace)
using System.Collections.Generic;
using MongoDB.Bson.Serialization.Attributes;
using Fantasy;
using Fantasy.Network.Interface;
using Fantasy.Serialize;
// ReSharper disable InconsistentNaming
// ReSharper disable RedundantUsingDirective
// ReSharper disable RedundantOverriddenMember
// ReSharper disable PartialTypeWithSinglePart
// ReSharper disable UnusedAutoPropertyAccessor.Global
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable CheckNamespace
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
#pragma warning disable CS8618
namespace NBC
{
#else
using ProtoBuf;
(UsingNamespace)
using System.Collections.Generic;
using Fantasy;
using Fantasy.Network.Interface;
using Fantasy.Serialize;
#pragma warning disable CS8618
namespace Fantasy
{
#endif
(Content)}