static Packet()
{
PacketTypes = new Dictionary<PacketType, Type>();
Assembly assembly = Assembly.GetCallingAssembly();
var types = assembly.GetExportedTypes().Where(type => type.IsSubclassOf(typeof(Packet)));
foreach (Type type in types)
{
Packet instance = (Packet)Activator.CreateInstance(type);
PacketTypes[instance.Type] = type;
}
}