public static SnComponentInfo Create(ISnComponent component) { var asmVersion = TypeHandler.GetVersion(component.GetType().Assembly); if (component.SupportedVersion > asmVersion) { throw new ApplicationException($"Invalid component: {component.ComponentId}: supported version ({component.SupportedVersion}) cannot be greater than the assembly version ({asmVersion})."); } return(new SnComponentInfo { ComponentId = component.ComponentId, SupportedVersion = component.SupportedVersion ?? asmVersion, AssemblyVersion = asmVersion, IsComponentAllowed = component.IsComponentAllowed }); }
/// <summary> /// Loads and instantiates all available ISnComponent types and returns them /// in the same order as they were installed in the database. /// </summary> internal static SnComponentInfo[] GetAssemblyComponents() { return(TypeResolver.GetTypesByInterface(typeof(ISnComponent)).Where(vct => !vct.IsAbstract) .Select(t => { ISnComponent component = null; try { component = TypeResolver.CreateInstance(t.FullName) as ISnComponent; } catch (Exception ex) { SnLog.WriteException(ex, $"Error during instantiating the component type {t.FullName}."); } return component; }) .Where(c => c != null) .OrderBy(c => c.ComponentId, new SnComponentComparer()) .Select(SnComponentInfo.Create) .ToArray()); }
public PatchBuilder(ISnComponent component) { _component = component; }
internal PatchBuilder(ISnComponent component) { _component = component; }