public void CreatePacketActions()
 {
     foreach (var pair in RegisteredPacketTypes)
     {
         var packetAction = CreatePacketAction(pair.Value);
         PacketActions.Add(pair.Value.Type, packetAction);
     }
 }
 public Delegate GetPacketAction(Type packetType)
 {
     if (!PacketActions.TryGetValue(packetType, out var reader))
     {
         reader = CreatePacketAction(new PacketStructInfo(packetType));
         if (reader == null)
         {
             throw new InvalidOperationException("Failed to create packet action.");
         }
     }
     return(reader);
 }