Example:
public partial class CPacketPlayerInfo : ClientPacket
{
public string Username { get; set; }
public Vector2 Position { get; set; }
}Source gen outputs:
public partial class CPacketPlayerInfo
{
public override void Write(PacketWriter writer)
{
writer.Write(Username);
writer.Write(Position);
}
public override void Read(PacketReader reader)
{
Username = reader.ReadString();
Position = reader.ReadVector2();
}
}Copy the .nupkg from bin\Debug to main project.
Add a file named NuGet.config to the main projects root folder with the following contents:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="LocalNugets" value="Framework/Libraries" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>The name for the key LocalNugets can be changed to anything you'd like. Change the Framework/Libraries path to point to the .nupkg package file.
Add the following to the main projects .csproj file:
<PackageReference Include="PacketGen" Version="*" />Replace * with the explicit latest version or keep it as is.