private static PlugInConfigurationDto BuildConfigurationDto(Type plugInType, GameConfiguration gameConfiguration, PlugInConfiguration plugInConfiguration) { var plugInAttribute = plugInType.GetCustomAttribute <PlugInAttribute>(); var plugInPoint = plugInType.GetInterfaces().FirstOrDefault(i => i.GetCustomAttribute <PlugInPointAttribute>() != null)?.GetCustomAttribute <PlugInPointAttribute>(); var customPlugInContainer = plugInType.GetInterfaces().FirstOrDefault(i => i.GetCustomAttribute <CustomPlugInContainerAttribute>() != null)?.GetCustomAttribute <CustomPlugInContainerAttribute>(); var dto = new PlugInConfigurationDto { Id = plugInConfiguration.GetId(), GameConfigurationId = gameConfiguration.GetId(), CustomPlugInSource = plugInConfiguration.CustomPlugInSource, ExternalAssemblyName = plugInConfiguration.ExternalAssemblyName, IsActive = plugInConfiguration.IsActive, TypeId = plugInConfiguration.TypeId, TypeName = plugInType.FullName, PlugInName = plugInAttribute?.Name, PlugInDescription = plugInAttribute?.Description, }; if (plugInPoint != null) { dto.PlugInPointName = plugInPoint.Name; dto.PlugInPointDescription = plugInPoint.Description; } else if (customPlugInContainer != null) { var customPlugInInterface = plugInType.GetInterfaces().FirstOrDefault(intf => intf.GetInterfaces().Any(i => i.GetCustomAttribute <CustomPlugInContainerAttribute>() != null)); dto.PlugInPointName = customPlugInInterface == null ? customPlugInContainer.Name : $"{customPlugInContainer.Name} - {customPlugInInterface.Name}"; dto.PlugInPointDescription = customPlugInContainer.Description; } else { dto.PlugInPointName = "N/A"; dto.PlugInPointDescription = "N/A"; } return(dto); }