bool ComputeStartableFor( IServiceDependentObject o, StartDependencyImpact impact ) { foreach( var s in o.GetIncludedServices( impact, false ) ) { if( s.Disabled ) return false; } foreach( var s in o.GetExcludedServices( impact ) ) { if( s.FinalConfigSolvedStatus == SolvedConfigurationStatus.Running ) return false; } return true; }
public FinalConfigStartableStatus( IServiceDependentObject o ) { Debug.Assert( o.FinalConfigSolvedStatus != SolvedConfigurationStatus.Disabled ); Debug.Assert( ComputeStartableFor( o, StartDependencyImpact.Minimal ) ); StartDependencyImpact config = o.ConfigSolvedImpact; Debug.Assert( ComputeStartableFor( o, config ) ); Debug.Assert( ComputeStartableFor( o, StartDependencyImpact.Minimal ) ); CanStartWithFullStop = config != StartDependencyImpact.FullStop ? ComputeStartableFor( o, StartDependencyImpact.FullStop ) : true; CallableWithStopOptionalAndRunnable = config != StartDependencyImpact.StopOptionalAndRunnable ? ComputeStartableFor( o, StartDependencyImpact.StopOptionalAndRunnable ) : true; CallableWithStartRecommended = config != StartDependencyImpact.StartRecommended ? ComputeStartableFor( o, StartDependencyImpact.StartRecommended ) : true; CallableWithFullStart = config != StartDependencyImpact.FullStart ? ComputeStartableFor( o, StartDependencyImpact.FullStart ) : true; }
public FinalConfigStartableStatus(IServiceDependentObject o) { Debug.Assert(o.FinalConfigSolvedStatus != SolvedConfigurationStatus.Disabled); Debug.Assert(ComputeStartableFor(o, StartDependencyImpact.Minimal)); StartDependencyImpact config = o.ConfigSolvedImpact; Debug.Assert(ComputeStartableFor(o, config)); Debug.Assert(ComputeStartableFor(o, StartDependencyImpact.Minimal)); CanStartWithFullStop = config != StartDependencyImpact.FullStop ? ComputeStartableFor(o, StartDependencyImpact.FullStop) : true; CallableWithStopOptionalAndRunnable = config != StartDependencyImpact.StopOptionalAndRunnable ? ComputeStartableFor(o, StartDependencyImpact.StopOptionalAndRunnable) : true; CallableWithStartRecommended = config != StartDependencyImpact.StartRecommended ? ComputeStartableFor(o, StartDependencyImpact.StartRecommended) : true; CallableWithFullStart = config != StartDependencyImpact.FullStart ? ComputeStartableFor(o, StartDependencyImpact.FullStart) : true; }
bool ComputeStartableFor(IServiceDependentObject o, StartDependencyImpact impact) { foreach (var s in o.GetIncludedServices(impact, false)) { if (s.Disabled) { return(false); } } foreach (var s in o.GetExcludedServices(impact)) { if (s.FinalConfigSolvedStatus == SolvedConfigurationStatus.Running) { return(false); } } return(true); }