fix: duplicate packet ids

This commit is contained in:
Timothy Schenk 2023-11-13 19:45:52 +01:00
parent 293b65a856
commit 7fec462a1d

View file

@ -76,6 +76,7 @@ public class PacketDistributorService : IHostedService
// ! : We are filtering if types that don't have an instance of the required Attribute
var packetsWithId = executingAssembly.GetTypes().AsParallel()
.Where(type => type.HasInterface(typeof(IPacket)) && type is { IsInterface: false, IsAbstract: false })
.Where(type => type.Namespace?.Contains("Incoming") ?? false)
.Select(type => new { Type = type, Attribute = type.GetCustomAttribute<PacketIdAttribute>() })
.Where(item => item.Attribute is not null)
.ToDictionary(item => item.Attribute!.Code, item => item.Type);