internal static SubsystemInfo Create <TConcreteSubsystem>( SubsystemKind kind, bool allowUnregistration, bool allowMultipleRegistration) where TConcreteSubsystem : class, ISubsystem { return(new SubsystemInfoImpl <TConcreteSubsystem>(kind) { AllowUnregistration = allowUnregistration, AllowMultipleRegistration = allowMultipleRegistration, }); }
public static SubsystemInfo GetSubsystemInfo(SubsystemKind kind) { if (s_subSystemKindMap.TryGetValue(kind, out SubsystemInfo? subsystemInfo)) { return(subsystemInfo); } throw new ArgumentException( StringUtil.Format( SubsystemStrings.SubsystemKindUnknown, kind.ToString())); }
private protected SubsystemInfo(SubsystemKind kind, Type subsystemType) { _syncObj = new object(); _cachedImplInfos = Utils.EmptyReadOnlyCollection <ImplementationInfo>(); Kind = kind; SubsystemType = subsystemType; AllowUnregistration = false; AllowMultipleRegistration = false; RequiredCmdlets = Utils.EmptyReadOnlyCollection <string>(); RequiredFunctions = Utils.EmptyReadOnlyCollection <string>(); }
public static void RegisterSubsystem(SubsystemKind kind, ISubsystem proxy) { Requires.NotNull(proxy, nameof(proxy)); if (kind != proxy.Kind) { throw new ArgumentException( StringUtil.Format( SubsystemStrings.ImplementationMismatch, proxy.Kind.ToString(), kind.ToString()), nameof(proxy)); } RegisterSubsystem(GetSubsystemInfo(kind), proxy); }
internal static SubsystemInfo Create <TConcreteSubsystem>( SubsystemKind kind, bool allowUnregistration, bool allowMultipleRegistration, ReadOnlyCollection <string> requiredCmdlets, ReadOnlyCollection <string> requiredFunctions) where TConcreteSubsystem : class, ISubsystem { if (allowMultipleRegistration && (requiredCmdlets.Count > 0 || requiredFunctions.Count > 0)) { throw new ArgumentException( StringUtil.Format( SubsystemStrings.InvalidSubsystemInfo, kind.ToString())); } return(new SubsystemInfoImpl <TConcreteSubsystem>(kind) { AllowUnregistration = allowUnregistration, AllowMultipleRegistration = allowMultipleRegistration, RequiredCmdlets = requiredCmdlets, RequiredFunctions = requiredFunctions, }); }
public static void UnregisterSubsystem(SubsystemKind kind, Guid id) { UnregisterSubsystem(GetSubsystemInfo(kind), id); }
internal SubsystemInfoImpl(SubsystemKind kind) : base(kind, typeof(TConcreteSubsystem)) { _registeredImpls = Utils.EmptyReadOnlyCollection <TConcreteSubsystem>(); }
internal static SubsystemInfo Create <TConcreteSubsystem>(SubsystemKind kind) where TConcreteSubsystem : class, ISubsystem { return(new SubsystemInfoImpl <TConcreteSubsystem>(kind)); }