/// <summary> /// Initializes a new instance of the <see cref="KinesisTapServiceManager"/> class, using custom parameters. /// </summary> /// <param name="typeLoader">An implementation of the <see cref="ITypeLoader"/> interface.</param> /// <param name="parameterStore">An implementation of the <see cref="IParameterStore"/> interface.</param> /// <param name="logger">An implementation of the <see cref="ILogger"/> interface.</param> public KinesisTapServiceManager(ITypeLoader typeLoader, IParameterStore parameterStore, ILogger logger) : this() { this.typeLoader = typeLoader; this.parameterStore = parameterStore; this.logger = logger; }
/// <summary> /// Initializes a new instance of the DependencyMapLoader class. /// </summary> /// <param name="constructorResolver"></param> /// <param name="typeLoader">The type loader that will load the service types from each assembly.</param> /// <param name="serviceLoader">The service loader that will load services from a given assembly.</param> /// <param name="defaultServiceResolver">The resolver that will determine the default anonymous implementation for a particular service type.</param> public DependencyMapLoader(IConstructorResolver constructorResolver, ITypeLoader typeLoader, IServiceLoader serviceLoader, IDefaultServiceResolver defaultServiceResolver) { _constructorResolver = constructorResolver; _typeLoader = typeLoader; _serviceLoader = serviceLoader; _defaultServiceResolver = defaultServiceResolver; }
internal SessionManager(ISessionFactory sessionFactory, ITypeLoader typeLoader, IParameterStore parameterStore, INetworkStatusProvider defaultNetworkProvider, ILoggerFactory loggerFactory) { StackTraceMinimizerExceptionExtensions.DoCompressStackTrace = true; _typeLoader = typeLoader; _parameterStore = parameterStore; _sessionFactory = sessionFactory; _loggerFactory = loggerFactory; _defaultNetworkProvider = defaultNetworkProvider; _logger = _loggerFactory.CreateLogger <SessionManager>(); _configIdMap = new PersistentConfigFileIdMap(_parameterStore); Directory.CreateDirectory(ExtraConfigDirPath); _logger.LogInformation($"Default configuration file is '{DefaultConfigPath}'"); _logger.LogInformation($"Extra configuration directory is '{ExtraConfigDirPath}'"); _defaultConfigWatcher = new FileSystemWatcher(Path.GetDirectoryName(DefaultConfigPath)) { Filter = Path.GetFileName(DefaultConfigPath) }; _extraconfigWatcher = new FileSystemWatcher(ExtraConfigDirPath) { Filter = "*.json" }; HookFileWatcherEvents(_defaultConfigWatcher); HookFileWatcherEvents(_extraconfigWatcher); instance = this; }
public static PluginLoader <T> Create(string appName, IPluginPaths paths = null, IAppDomain appDomain = null, IPluginLoaderSettings settings = null, ITypeLoader <T> typeLoader = null, IAssemblyCache assemblyDictionary = null, IAssemblyNameReader assemblyNameReader = null, IAssemblyLoader assemblyLoader = null, IWaiter waiter = null, IPluginDependencyResolverObjectCreator pluginDependencyResolverObjectCreator = null, IPluginDependencyResolverCacheFactory pluginDependencyResolverCacheFactory = null, IPluginCacheFactory <T> pluginCacheFactory = null, IPluginLoaderLogger logger = null) { logger = logger ?? PluginLoaderLogger.Factory(new AppSettings()); appDomain = appDomain ?? new AppDomainWrapper(AppDomain.CurrentDomain, logger); paths = paths ?? new AppPluginPaths(appName, null, appDomain, logger); settings = settings ?? PluginLoaderSettings.Default; typeLoader = typeLoader ?? new TypeLoader <T>(settings, logger); assemblyNameReader = assemblyNameReader ?? new AssemblyNameReader(); assemblyDictionary = assemblyDictionary ?? new AssemblyCache(appDomain, assemblyNameReader, logger); assemblyLoader = assemblyLoader ?? new AssemblyLoader(appDomain, settings, assemblyDictionary, assemblyNameReader, logger); waiter = waiter ?? new Waiter(logger); pluginDependencyResolverObjectCreator = pluginDependencyResolverObjectCreator ?? new PluginDependencyResolverObjectCreator(appDomain, settings, assemblyLoader, waiter, new AssemblyResolveCache(), logger); pluginDependencyResolverCacheFactory = pluginDependencyResolverCacheFactory ?? new PluginDependencyResolverCacheFactory(pluginDependencyResolverObjectCreator, logger); pluginCacheFactory = pluginCacheFactory ?? new PluginCacheFactory <T>(typeLoader, pluginDependencyResolverCacheFactory, assemblyLoader, logger); return(new PluginLoader <T>(paths, pluginCacheFactory)); }
public MethodStateMachineFactory(IGCHeap gcHeap, ITypesHeap typesHeap, ITypeLoader typeLoader, IILOperationSet ilOperationSet) { _ilOperationSet = ilOperationSet; _gcHeap = gcHeap; _typeLoader = typeLoader; _typesHeap = typesHeap; }
/// <summary> /// Initializes a new instance of the DependencyMapLoader class. /// </summary> /// <param name="constructorResolver"></param> /// <param name="typeLoader">The type loader that will load the service types from each assembly.</param> /// <param name="serviceLoader">The service loader that will load services from a given assembly.</param> /// <param name="defaultServiceResolver">The resolver that will determine the default anonymous implementation for a particular service type.</param> public DependencyMapLoader(IConstructorResolver constructorResolver, ITypeLoader typeLoader, IServiceLoader serviceLoader, IDefaultServiceResolver defaultServiceResolver) { _constructorResolver = constructorResolver; _typeLoader = typeLoader; _serviceLoader = serviceLoader; _defaultServiceResolver = defaultServiceResolver; }
public LogManager(ITypeLoader typeLoader, IParameterStore parameterStore) { _typeLoader = typeLoader; _parameterStore = parameterStore; _loggerFactory = CreateLoggerFactory(); try { ConfigurationBuilder configurationBuilder = new ConfigurationBuilder(); _config = configurationBuilder .SetBasePath(Utility.GetKinesisTapConfigPath()) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .Build(); } catch (Exception ex) { var logger = _loggerFactory.CreateLogger <LogManager>(); logger.LogError($"Unable to load apsettings.json. {ex.ToMinimized()}"); throw; } ChangeToken.OnChange(() => _config.GetReloadToken(), OnConfigChanged); IServiceCollection serviceCollection = new ServiceCollection(); _serviceProvider = ConfigureServices(serviceCollection, _loggerFactory); _updateTimer = new Timer(CheckUpdate, null, Timeout.Infinite, Timeout.Infinite); _configTimer = new Timer(CheckConfig, null, Timeout.Infinite, Timeout.Infinite); }
public JobScheduler(IJobManager jobManager, IScheduler scheduler, IEventReporter eventReporter, ITypeLoader typeLoader) { this.JobManager = jobManager; this.Scheduler = scheduler; this.EventReporter = eventReporter; this.TypeLoader = typeLoader; }
public JobScheduler(IJobManager jobManager, IScheduler scheduler, IEventReporter eventReporter, ITypeLoader typeLoader) { this.JobManager = jobManager; this.Scheduler = scheduler; this.EventReporter = eventReporter; this.TypeLoader = typeLoader; }
public AzResourceTypeProvider(ITypeLoader typeLoader) { this.typeLoader = typeLoader; this.resourceTypeFactory = new AzResourceTypeFactory(); this.availableResourceTypes = GetAvailableResourceTypes(typeLoader); this.loadedTypeCache = new Dictionary <ResourceTypeReference, ResourceType>(ResourceTypeReferenceComparer.Instance); }
internal PencilMethod(ITypeLoader typeLoader, MethodBase method, IType returnType, PencilMethodBody body) { this.typeLoader = typeLoader; this.method = method; this.body = body; this.returnType = returnType; }
public StageBuilder(IBuilderProvider builderProvider, ITypeLoader typeLoader, ILogger logger, IPipelineCreationContext context) { this.builderProvider = builderProvider; this.typeLoader = typeLoader; this.logger = logger; this.context = context; }
public ActorFactory(IServiceProvider serviceProvider, ILogger <ActorFactory> logger, ITypeLoader typeLoader, ActorPropsRegistry actorPropsRegistry) { _serviceProvider = serviceProvider; _actorPropsRegistry = actorPropsRegistry; _logger = logger; _typeLoader = typeLoader; }
public VariableConverterService(ITypeLoader typeLoader) { foreach (Type type in typeLoader.LoadedTypes) { CheckInitLocalConverter(type); CheckInitCampaignConverter(type); } }
public AzResourceTypeLoader() { this.typeLoader = new TypeLoader(); this.resourceTypeFactory = new AzResourceTypeFactory(); this.availableTypes = typeLoader.GetIndexedTypes().Types.ToImmutableDictionary( kvp => ResourceTypeReference.Parse(kvp.Key), kvp => kvp.Value, ResourceTypeReferenceComparer.Instance); }
/// <summary> /// Initializes a new instance of the <see cref="KinesisTapServiceManager"/> class, using custom parameters. /// </summary> /// <param name="typeLoader">An implementation of the <see cref="ITypeLoader"/> interface.</param> /// <param name="parameterStore">An implementation of the <see cref="IParameterStore"/> interface.</param> /// <param name="logger">An implementation of the <see cref="ILogger"/> interface.</param> public KinesisTapServiceManager(ITypeLoader typeLoader, IParameterStore parameterStore, ILogger logger, INetworkStatusProvider networkStatusProvider) { this.typeLoader = typeLoader; this.parameterStore = parameterStore; this.logger = logger; this.networkStatusProvider = networkStatusProvider; this.loggerFactory = CreateSessionLoggerFactory(parameterStore); PluginContext.ServiceLogger = logger; }
public PluginCacheFactory(ITypeLoader <T> typeLoader, IPluginDependencyResolverCacheFactory dependencyResolverCacheFactory, IAssemblyLoader assemblyLoader, IPluginLoaderLogger logger) : base(null, logger) { _TypeLoader = typeLoader; _DependencyResolverCacheFactory = dependencyResolverCacheFactory; _AssemblyLoader = assemblyLoader; }
public IAssetLoader RegisterTypeLoader <T>(ITypeLoader <T> typeLoader) { if (typeLoader != null) { Logger.Write.Info("Registered asset type loader for \"{0}\"", typeof(T).Name); _typeLoaders[typeof(T)] = typeLoader; } return(this); }
public AzResourceTypeProvider(ITypeLoader typeLoader) { this.typeLoader = typeLoader; this.resourceTypeFactory = new AzResourceTypeFactory(); this.availableResourceTypes = typeLoader.ListAllAvailableTypes().ToDictionary( kvp => ResourceTypeReference.Parse(kvp.Key), kvp => kvp.Value, ResourceTypeReferenceComparer.Instance); this.loadedTypeCache = new Dictionary <ResourceTypeReference, ResourceType>(ResourceTypeReferenceComparer.Instance); }
public TokenResolver(ITypeLoader typeLoader, MethodBase method) { this.typeLoader = typeLoader; this.module = method.Module; var type = method.DeclaringType; if(type != null) this.typeArguments = type.GetGenericArguments(); if(!(method.IsConstructor || method.IsSpecialName) && method.IsGenericMethod) this.methodArguments = method.GetGenericArguments(); }
public EveTypes(ITypeStorage storage, ITypeLoader loader) { //TODO race condition on initial loading _storage = storage; _loader = loader; LoadTypes(); var isFirst = !_names.Any(); Task.Factory.StartNew(() => Update(isFirst), TaskCreationOptions.LongRunning); }
public AssemblyInspector(string assemblyPath, ITypeLoader typeLoader = null) { AssemblyDefinition = AssemblyDefinition.ReadAssembly(assemblyPath); TypeLoader = typeLoader; AssemblyQuery = new AssemblyQuery(AssemblyDefinition); if (TypeLoader == null) { TypeLoader = new TypeLoader(); } }
public Plugin(ITypeLoader <T> typeLoader, IPluginDependencyResolver dependencyResolver, IAssemblyLoader assemblyLoader) { _TypeLoader = typeLoader ?? throw new ArgumentNullException(nameof(typeLoader)); DependencyResolver = dependencyResolver ?? throw new ArgumentNullException(nameof(dependencyResolver)); if (DependencyResolver.Plugin == null) { DependencyResolver.Plugin = this; } _AssemblyLoader = assemblyLoader ?? throw new ArgumentNullException(nameof(assemblyLoader)); }
/// <summary> /// For testing /// </summary> /// <param name="configClassName"></param> /// <param name="typeLoader"></param> public EfConfigurationLoader(string configClassName, ITypeLoader typeLoader) { if (string.IsNullOrWhiteSpace(configClassName)) { throw new ArgumentNullException(nameof(configClassName)); } if (typeLoader == null) { throw new ArgumentNullException(nameof(typeLoader)); } _configClassName = configClassName; _typeLoader = typeLoader; }
public PipelineBuilder( IBuilderProvider builderProvider, IPipelineWorkspaceManagers workspaceManagers, string basePath, IFileSystem fileSystem, ITypeLoader typeLoader, ILogger logger) { this.builderProvider = builderProvider; this.workspaceManagers = workspaceManagers; this.basePath = basePath; this.fileSystem = fileSystem; this.typeLoader = typeLoader; this.logger = logger; }
public CodeGenerationPipelineLauncher( IWorkspaceManager initialWorkspaceManager, IWorkspaceManagerBase outputWorkspaceManager, IFileSystem fileSystem, ITypeLoader additionalTypeLoader = null, ICodeFileStorageHandler outputStorageHandler = null, ILogger logger = null) { this.initialWorkspaceManager = initialWorkspaceManager; this.outputWorkspaceManager = outputWorkspaceManager; this.fileSystem = fileSystem; this.additionalTypeLoader = additionalTypeLoader; this.outputStorageHandler = outputStorageHandler ?? outputWorkspaceManager; this.logger = logger ?? new TextLogger(this.fileSystem); }
/// <summary> /// Initializes a new instance of the <see cref="ConventionCatalog"/> class, using the /// provided part conventions and type loader. /// </summary> /// <param name="conventions">An <see cref="IEnumerable{T}"/> instance, containing part conventions.</param> /// <param name="typeLoader">An <see cref="ITypeLoader"/> instance.</param> /// <exception cref="ArgumentNullException">The <paramref name="conventions"/> or <paramref name="typeLoader"/> parameter was null.</exception> public ConventionCatalog(IEnumerable<IPartConvention> conventions, ITypeLoader typeLoader) { if (conventions == null) { throw new ArgumentNullException("conventions", "The conventions cannot be null."); } if (typeLoader == null) { throw new ArgumentNullException("typeLoader", "The type loader cannot be null."); } this.Conventions = conventions; this.TypeLoader = typeLoader; }
public ResourceSchema( ITypeLoader typeLoader, TypeLocation resourceTypeLocation, string providerNamespace, string providerName, string apiVersion) { _typeLoader = typeLoader; _resourceTypeLocation = resourceTypeLocation; _typeLazy = new Lazy <ResourceType>(LoadResourceType); _propertiesLazy = new Lazy <ResourcePropertyProfile>(CreatePropertyProfile); _dslDefinitionsLazy = new Lazy <ResourceDslDefinition>(CreateResourceDefinition); Name = providerName; Namespace = providerNamespace; ApiVersion = apiVersion; }
public AzResourceTypeLoader() { this.typeLoader = new TypeLoader(); this.resourceTypeFactory = new AzResourceTypeFactory(); this.availableTypes = typeLoader.GetIndexedTypes().Resources.ToImmutableDictionary( kvp => ResourceTypeReference.Parse(kvp.Key), kvp => kvp.Value, ResourceTypeReferenceComparer.Instance); this.availableFunctions = typeLoader.GetIndexedTypes().Functions.ToImmutableDictionary( kvp => kvp.Key, kvp => kvp.Value.ToImmutableDictionary( x => x.Key, x => x.Value.ToImmutableArray(), StringComparer.OrdinalIgnoreCase), StringComparer.OrdinalIgnoreCase); }
internal ServiceManager(ITypeLoader typeLoader, IBindingInstaller bindingInstaller) { Log.Info($"Using \"{bindingInstaller.GetType().FullName}\" to install service bindings."); coreContainer = new Container(); serviceContainer = new Container(); InstallerInfo installerInfo = new InstallerInfo { CoreContainer = coreContainer, ServiceContainer = serviceContainer, ServiceManager = this, TypeLoader = typeLoader }; bindingInstaller.ConfigureBindings(installerInfo); }
public ITurnamentorBuilder <Contestant, Score, ScoreBoard> AddContestants(ClassSource source, params string[] directories) { ITypeLoader loader = GetTypeLoader(source); if (directories.Length == 0) { directories = new string[] { "" } } ; //add at least work directory var loadedTypes = loader.LoadTypes <Contestant>(directories); roundSelectorConfig.Contestants.AddRange( loadedTypes.Where(type => !roundSelectorConfig.Contestants.Contains(type)) ); return(this); }
public ITurnamentorBuilder <Contestant, Score, ScoreBoard> SetGameEngine(ClassSource source, string directoryWithFile) { ITypeLoader loader = GetTypeLoader(source); var types = loader.LoadTypes <IGameEngine <Contestant, Score> >(new string[] { directoryWithFile }); if (types.Count == 0) { throw new NoInstanceOfGameEngineFoundException(); } if (types.Count > 1) { throw new AmbiguousGameEngine(); } turnamentor.EngineProvider = () => Activator.CreateInstance(types[0]); return(this); }
public LogManager(ITypeLoader typeLoader, IParameterStore parameterStore) { _typeLoader = typeLoader; _parameterStore = parameterStore; ConfigurationBuilder configurationBuilder = new ConfigurationBuilder(); _config = configurationBuilder .SetBasePath(Utility.GetKinesisTapConfigPath()) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .Build(); ChangeToken.OnChange(() => _config.GetReloadToken(), OnConfigChanged); IServiceCollection serviceCollection = new ServiceCollection(); _serviceProvider = ConfigureServices(serviceCollection, _config); _updateTimer = new Timer(CheckUpdate, null, Timeout.Infinite, Timeout.Infinite); _configTimer = new Timer(CheckConfig, null, Timeout.Infinite, Timeout.Infinite); }
public LogManager(int id, IConfiguration config, DateTime startTime, ITypeLoader typeLoader, IParameterStore parameterStore, ILoggerFactory loggerFactory, INetworkStatusProvider defaultNetworkStatusProvider, IConfigurationSection defaultCredentialsSection = null, bool validated = false) { Id = id; StartTime = startTime; _config = config; _loggerFactory = loggerFactory; _typeLoader = typeLoader; _parameterStore = parameterStore; _networkStatus = new NetworkStatus(defaultNetworkStatusProvider); _defaultCredentialsSection = defaultCredentialsSection; _descriptiveName = string.IsNullOrWhiteSpace(config[ConfigConstants.CONFIG_DESCRIPTIVE_NAME]) ? string.Empty : _config[ConfigConstants.CONFIG_DESCRIPTIVE_NAME]; _logger = _loggerFactory.CreateLogger($"session:{_descriptiveName}"); _validated = validated; _logger.LogDebug("Configuration is validated: {0}", _validated); }
/// <summary> /// Get the parameter types for a MethodReference. /// </summary> /// <param name="methodReference"></param> /// <param name="typeLoader"></param> /// <returns></returns> public static Type[] GetParameterTypes(this MethodReference methodReference, ITypeLoader typeLoader) { var typeReferences = methodReference.Parameters.Select(x => x.ParameterType); if (typeReferences.Any() == false) { return(new Type[0]); } var result = new List <Type>(); foreach (var typeReference in typeReferences) { var type = typeLoader.GetType(typeReference.FullName); if (type == null) { throw new Exception($"The Type \"{typeReference.FullName}\" is missing! Please add an assembly with this type to the application folder, source folder of the assembly which should be patched, or add an assembly search path!"); } result.Add(type); } return(result.ToArray()); }
public IEnumerable<Instruction> DecodeBody(ITypeLoader typeLoader) { var body = method.GetMethodBody(); if (body == null) return Empty; var tokens = new TokenResolver(typeLoader, method); var ir = new InstructionReader(tokens, body.GetILAsByteArray()); return ir.ReadToEnd(); }
/// <summary> /// Initializes a new instance of the ServiceLoader class. /// </summary> /// <param name="typeLoader">The type loader that will load types into memory.</param> /// <param name="typeFilter">The filter that will be used to determine which types should be loaded.</param> public ServiceLoader(ITypeLoader typeLoader, ITypeFilter typeFilter) { TypeLoader = typeLoader; TypeFilter = typeFilter; }
/// <summary> /// Initializes a new instance of the DependencyMapLoader class. /// </summary> /// <param name="typeLoader">The type loader that will load the service types from each assembly.</param> /// <param name="serviceLoader">The service loader that will load services from a given assembly.</param> /// <param name="defaultServiceResolver">The resolver that will determine the default anonymous implementation for a particular service type.</param> public DependencyMapLoader(ITypeLoader typeLoader, IServiceLoader serviceLoader, IDefaultServiceResolver defaultServiceResolver) : this(new ConstructorResolver(), typeLoader, serviceLoader, defaultServiceResolver) { }
public JobManager(IDocumentSession documentSession, IEventReporter eventReporter, ITypeLoader typeLoader) { this.DocumentSession = documentSession; this.EventReporter = eventReporter; this.TypeLoader = typeLoader; }
internal Assembly(ITypeLoader typeLoader, ReflectionAssembly assembly) { this.typeLoader = typeLoader; this.assembly = assembly; }
public DaemonMaster(ITypeLoader typeLoader) { this.typeLoader = typeLoader; }
/// <summary> /// Initializes a new instance of the <see cref="ConventionCatalog"/> class, using the /// provided part convention registries and type loader. /// </summary> /// <param name="registries">An <see cref="IEnumerable{T}"/> instance, containing part convention registries.</param> /// <param name="typeLoader">An <see cref="ITypeLoader"/> instance.</param> public ConventionCatalog(IEnumerable<IConventionRegistry<IPartConvention>> registries, ITypeLoader typeLoader) : this(registries.SelectMany(x => x.GetConventions()), typeLoader) { }
public IEnumerable<IMethod> Calls(ITypeLoader typeLoader) { return DecodeBody(typeLoader).Where(x => x.IsCall).Select(x => x.Operand as IMethod); }
public PencilField(ITypeLoader typeLoader, FieldInfo field) { this.typeLoader = typeLoader; this.field = field; }
public DaemonMaster() { typeLoader = new TypeLoader(); }
private static ConventionCatalog CreateConventionCatalog(IEnumerable<IPartConvention> conventions, ITypeLoader typeLoader) { return new ConventionCatalog(conventions, typeLoader); }
private static ConventionCatalog CreateDefaultConventionCatalogWithTypeLoader(ITypeLoader typeLoader) { var registry = new FakeConventionRegistry(); return CreateConventionCatalog(registry.GetConventions(), typeLoader); }
public DataObjectManager(IDocumentSession documentSession, ITypeLoader typeLoader) { this.DocumentSession = documentSession; this.TypeLoader = typeLoader; }
public PencilModule(ITypeLoader typeLoader, Module module) { this.typeLoader = typeLoader; this.module = module; }