コード例 #1
0
ファイル: CompilationRuntime.cs プロジェクト: hj1980/Mosa
 /// <summary>
 /// Initializes a new instance of <see cref="CompilationRuntime"/>.
 /// </summary>
 public CompilationRuntime()
 {
     _typeLoader = new DefaultTypeSystem();
     _assemblyLoader = new AssemblyLoader(_typeLoader);
     _memoryManager = new MockMemoryPageManager();
     _jitService = new MockJitService();
 }
コード例 #2
0
ファイル: Documentation.cs プロジェクト: adargel/documight
 public Documentation(IAssemblyLoader assemblyLoader, ICommentLoader commentLoader, IDocumentModelBuilder modelBuilder, IDocumentWriter documentWriter)
 {
     _assemblyLoader = assemblyLoader;
     _commentLoader = commentLoader;
     _modelBuilder = modelBuilder;
     _documentWriter = documentWriter;
 }
コード例 #3
0
ファイル: IBuildManager.cs プロジェクト: cmacri/Orchard
        public DefaultBuildManager(
            IVirtualPathProvider virtualPathProvider, 
            IAssemblyLoader assemblyLoader) {

            _virtualPathProvider = virtualPathProvider;
            _assemblyLoader = assemblyLoader;
        }
コード例 #4
0
        public IStartupService RegisterLoader(IAssemblyLoader loader)
        {
            Check.MustNotNull(loader, "loader");
            _loaders.Add(loader);

            return this;
        }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of <see cref="CompilationRuntime"/>.
 /// </summary>
 public CompilationRuntime()
 {
     this.typeLoader = new DefaultTypeSystem();
     this.assemblyLoader = new AssemblyLoader(this.typeLoader);
     this.memoryManager = new MockMemoryPageManager();
     this.jitService = new MockJitService();
 }
コード例 #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DefaultModulesRegistration" /> class.
        /// </summary>
        /// <param name="assemblyLoader">The assembly loader.</param>
        public DefaultModulesRegistration(IAssemblyLoader assemblyLoader)
        {
            this.assemblyLoader = assemblyLoader;

            knownModuleDescriptorTypes = new Dictionary<string, Type>();
            knownModules = new Dictionary<string, ModuleRegistrationContext>();
        }
コード例 #7
0
 public PluginsService(IAssemblyLoader assemblyLoader, IFileSystem fileSystem, IWindsorContainer container, IRepository<InstalledPlugin> repository)
 {
     this.assemblyLoader = assemblyLoader;
     this.fileSystem = fileSystem;
     this.container = container;
     this.repository = repository;
 }
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TestRuntime"/>.
 /// </summary>
 public TestRuntime()
 {
     _memoryPageManager = new Win32MemoryPageManager();
     _typeLoader = new DefaultTypeSystem();
     _assemblyLoader = new AssemblyLoader(_typeLoader);
     _jitService = new SimpleJitService();
 }
コード例 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultEmbeddedResourcesProvider" /> class.
 /// </summary>
 /// <param name="modulesRegistry">The modules registry.</param>
 /// <param name="assemblyLoader">The assembly loader contract.</param>
 public DefaultEmbeddedResourcesProvider(IWebModulesRegistration modulesRegistry, IAssemblyLoader assemblyLoader)
 {
     resourceNameEmbeddedResource = new ConcurrentDictionary<string, EmbeddedResourceDescriptor>();
     virtualPathResourceName = new ConcurrentDictionary<string, string>();
     this.modulesRegistry = modulesRegistry;
     this.assemblyLoader = assemblyLoader;            
 }
コード例 #10
0
        public DefaultAssemblyProbingFolder(IAppDataFolder appDataFolder, IAssemblyLoader assemblyLoader)
        {
            _appDataFolder = appDataFolder;
            _assemblyLoader = assemblyLoader;

            Logger = NullLogger.Instance;
        }
コード例 #11
0
        public CoreExtensionLoader(IDependenciesFolder dependenciesFolder, IAssemblyLoader assemblyLoader)
            : base(dependenciesFolder)
        {
            _assemblyLoader = assemblyLoader;

            Logger = NullLogger.Instance;
        }
コード例 #12
0
 public Bootstrapper(IAssemblyLoader assemblyLoader, IModuleLoader moduleLoader, IActivator activator, IModuleImporter moduleImporter)
 {
     this.assemblyLoader = assemblyLoader;
      this.moduleLoader = moduleLoader;
      this.activator = activator;
      this.moduleImporter = moduleImporter;
 }
コード例 #13
0
 public PackagingRuntimeGraph(IBottlingDiagnostics diagnostics, IAssemblyLoader assemblies,
     IList<IPackageInfo> packages)
 {
     _diagnostics = diagnostics;
     _assemblies = assemblies;
     _packages = packages;
 }
コード例 #14
0
 /// <summary>
 /// Initializes a new instance of the AssemblyResolver class. A default instance of this class will resolve
 /// assemblies into the LoadFrom context.
 /// </summary>
 /// <param name="loader">
 /// The loader to use when loading assemblies. Default is null, which will create and use an instance
 /// of the RemotableAssemblyLoader class.
 /// </param>
 /// <param name="loadMethod">
 /// The load method to use when loading assemblies. Defaults to LoadMethod.LoadFrom.
 /// </param>
 public PathBasedAssemblyResolver(
     IAssemblyLoader loader = null,
     LoadMethod loadMethod = LoadMethod.LoadFrom)
 {
     this.probePaths = new HashSet<string>();
     this.loader = loader == null ? new AssemblyLoader() : loader;
     this.LoadMethod = loadMethod;
 }
コード例 #15
0
 public AppHostCoreExtensionLoader(
     IDependenciesFolder dependenciesFolder,
     IAssemblyLoader assemblyLoader,
     IExtensionPathsProvider extensionPathsProvider)
     : base(dependenciesFolder, assemblyLoader)
 {
     _extensionPathsProvider = extensionPathsProvider;
 }
コード例 #16
0
        public DefaultBuildManager(
            IVirtualPathProvider virtualPathProvider, 
            IAssemblyLoader assemblyLoader)
        {
            _virtualPathProvider = virtualPathProvider;
            _assemblyLoader = assemblyLoader;

            Logger = NullLogger.Instance;
        }
コード例 #17
0
ファイル: Builder.cs プロジェクト: loudej/taco
 public Builder(IAssemblyLoader loader)
 {
     _loader = loader;
     _directives = new Dictionary<string, Action<string>> {
         {"Load ", DoLoad},
         {"Run ", DoRun},
         {"Use ", DoUse},
     };
 }
コード例 #18
0
        public DefaultAssemblyProbingFolder(IAppDataFolder appDataFolder, IAssemblyLoader assemblyLoader, IExtensionManager extensionManager, IApplicationFolder applicationFolder)
        {
            _appDataFolder = appDataFolder;
            _assemblyLoader = assemblyLoader;
            _extensionManager = extensionManager;
            _applicationFolder = applicationFolder;

            Logger = NullLogger.Instance;
        }
コード例 #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultAssemblyManager" /> class.
 /// </summary>
 /// <param name="workingDirectory">The working directory.</param>
 /// <param name="modulesRegistration">The module loader.</param>
 /// <param name="assemblyLoader">The assembly loader.</param>
 public DefaultAssemblyManager(
     IWorkingDirectory workingDirectory,
     IModulesRegistration modulesRegistration,
     IAssemblyLoader assemblyLoader)
 {
     this.workingDirectory = workingDirectory;
     this.modulesRegistration = modulesRegistration;
     this.assemblyLoader = assemblyLoader;
 }
コード例 #20
0
 public DocumentationGenerator(IAssemblyLoader assemblyLoader, IXmlLoader xmlLoader, IAssemblyXmlParser parser,
                               IBulkPageWriter writer, IUntransformableResourceManager resourceManager)
 {
     this.assemblyLoader = assemblyLoader;
     this.xmlLoader = xmlLoader;
     this.parser = parser;
     this.writer = writer;
     this.resourceManager = resourceManager;
 }
コード例 #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultAssemblyManager" /> class.
 /// </summary>
 /// <param name="workingDirectory">The working directory.</param>
 /// <param name="modulesRegistration">The module loader.</param>
 /// <param name="embeddedResourcesProvider">The embedded resources provider.</param>
 /// <param name="assemblyLoader">The assembly loader.</param>
 public DefaultAssemblyManager(
     IWorkingDirectory workingDirectory,
     IModulesRegistration modulesRegistration,
     IEmbeddedResourcesProvider embeddedResourcesProvider,
     IAssemblyLoader assemblyLoader)
 {
     this.workingDirectory = workingDirectory;
     this.modulesRegistration = modulesRegistration;
     this.assemblyLoader = assemblyLoader;
     this.embeddedResourcesProvider = embeddedResourcesProvider;
 }
コード例 #22
0
 public ProcessingContext(ObjectCache cache, CompositionContainer container, IEnumerable<IAssetFilter> filters, IAssemblyLoader assemblyLoader, IAssetResolver assetResolver, XElement element, HashSet<AssetIdentifier> references, int phase)
 {
     this._filters = filters.ToArray();
     this.AssetResolver = assetResolver;
     this.Element = element;
     this._references = references;
     Container = container;
     this.Phase = phase;
     this.Cache = cache;
     this.AssemblyLoader = assemblyLoader;
 }
コード例 #23
0
        public void CreateStubs()
        {
            StubWriter = MockRepository.GenerateStub<IBulkPageWriter>();
            StubParser = MockRepository.GenerateStub<IAssemblyXmlParser>();
            StubResourceManager = MockRepository.GenerateStub<IUntransformableResourceManager>();
            StubAssemblyLoader = MockRepository.GenerateStub<IAssemblyLoader>();
            StubXmlLoader = MockRepository.GenerateStub<IXmlLoader>();

            StubAssemblyLoader.Stub(x => x.LoadFrom(null))
                .IgnoreArguments()
                .Return(typeof(DocumentationGenerator).Assembly);
        }
コード例 #24
0
        public void SetUp()
        {
            const string tempDir = @"c:\temp";

            Directory.GetFiles(tempDir).ToList().ForEach(File.Delete);

            if (Directory.Exists(tempDir))
                Directory.Delete(tempDir);

            assemblyLoader = new AssemblyLoader();
            shadowAssemblies = assemblyLoader.GetShadowAssemblies();
        }
コード例 #25
0
ファイル: LoaderContainer.cs プロジェクト: rajeevkb/dnx
        public IDisposable AddLoader(IAssemblyLoader loader)
        {
            _loaders.Push(loader);

            return new DisposableAction(() =>
            {
                var removed = _loaders.Pop();
                if (!ReferenceEquals(loader, removed))
                {
                    throw new InvalidOperationException("TODO: Loader scopes being disposed in wrong order");
                }
            });
        }
コード例 #26
0
 public DefaultRazorCompilationEvents(
     IDependenciesFolder dependenciesFolder,
     IExtensionDependenciesManager extensionDependenciesManager,
     IBuildManager buildManager,
     IEnumerable<IExtensionLoader> loaders,
     IAssemblyLoader assemblyLoader)
 {
     _dependenciesFolder = dependenciesFolder;
     _extensionDependenciesManager = extensionDependenciesManager;
     _buildManager = buildManager;
     _loaders = loaders;
     _assemblyLoader = assemblyLoader;
     Logger = NullLogger.Instance;
 }
コード例 #27
0
 public RoslynAssemblyLoader(string rootPath,
                             IFileWatcher watcher,
                             IFrameworkReferenceResolver resolver,
                             IGlobalAssemblyCache globalAssemblyCache,
                             IAssemblyLoader dependencyLoader,
                             IResourceProvider resourceProvider)
 {
     _rootPath = rootPath;
     _watcher = watcher;
     _resolver = resolver;
     _globalAssemblyCache = globalAssemblyCache;
     _dependencyLoader = dependencyLoader;
     _resourceProvider = resourceProvider;
 }
コード例 #28
0
ファイル: Bootstrapper.cs プロジェクト: memedini/cfcommerce
        /// <summary>
        /// Starts the application and loads the assemblies with the given assembly loader
        /// </summary>
        public void StartApplication(IAssemblyLoader loader)
        {
            _loadedAssemblies = loader.LoadAssemblies();
            IList<Type> plugins = new List<Type>();

            foreach (var assembly in _loadedAssemblies)
            {
                OnAssembliesLoading(assembly, plugins);
            }

            OnDependencyLoading(_resolver);

            _pluginService.Store(plugins);
        }
コード例 #29
0
        public DefaultExtensionCompiler(
            IVirtualPathProvider virtualPathProvider,
            IProjectFileParser projectFileParser,
            IDependenciesFolder dependenciesFolder,
            IEnumerable<IExtensionLoader> loaders,
            IAssemblyLoader assemblyLoader) {

            _virtualPathProvider = virtualPathProvider;
            _projectFileParser = projectFileParser;
            _dependenciesFolder = dependenciesFolder;
            _loaders = loaders;
            _assemblyLoader = assemblyLoader;

            T = NullLocalizer.Instance;
            Logger = NullLogger.Instance;
        }
コード例 #30
0
 public ReflectionBasedPluginLoader(ReflectionBasedPluginLoaderSettings settings, IYarpSerializer serializer, IYarpActivator activator,
     IAssemblyLoader assemblyLoader, DirectoryBase directory, FileBase file)
 {
     if (settings == null) throw new ArgumentNullException(nameof(settings));
     if (serializer == null) throw new ArgumentNullException(nameof(serializer));
     if (activator == null) throw new ArgumentNullException(nameof(activator));
     if (assemblyLoader == null) throw new ArgumentNullException(nameof(assemblyLoader));
     if (directory == null) throw new ArgumentNullException(nameof(directory));
     if (file == null) throw new ArgumentNullException(nameof(file));
     _settings = settings;
     _serializer = serializer;
     _activator = activator;
     _assemblyLoader = assemblyLoader;
     _directory = directory;
     _file = file;
 }
コード例 #31
0
        /// <summary>
        /// Performs weaving of an assembly
        /// </summary>
        /// <param name="assemblyNameOrPath">Assembly name</param>
        /// <param name="tasks">Tasks to perform during the weaving</param>
        /// <param name="weavedAssemblyBytes">Weaved assembly in byte[] raw (COFF) form</param>
        /// <returns>True if weaving is successfull, false otherwise</returns>
        /// <exception cref="AssemblyNotFoundException">When assembly is not found</exception>
        /// <exception cref="Exception">When an error occurs that warrants more than returning false</exception>
        public bool PerformWeaving(string assemblyNameOrPath, object[] tasks, out byte[] weavedAssemblyBytes)
        {
            weavedAssemblyBytes = null;

            // Added by ziga to fix error!
            string          assemblyPath = string.Empty;
            IAssemblyLoader loader       = AssemblyLocator.GetLoader(assemblyPath);

            if (loader == null)
            {
                throw new AssemblyNotFoundException();
            }

            // FIXME: WE WANT THIS IN byte[] FORM
            Assembly assembly = loader.Load();

            // FIXME: SETUP PROJECT
            foreach (object task in tasks)
            {
            }

            return(true);
        }
コード例 #32
0
        /// <summary>
        /// Finds a matching <see cref="IMeasurementConfigurator{T}"/> type for a given type of <see cref="MeasurementAttribute"/>
        /// </summary>
        /// <param name="measurementType">A type of <see cref="MeasurementAttribute"/></param>
        /// <param name="specificAssembly">
        ///     Optional parameter. If an <see cref="Assembly"/> is provided, we limit our search
        ///     for <see cref="IMeasurementConfigurator{T}"/> definitions to just that target assembly.
        /// </param>
        /// <returns>A corresponding <see cref="IMeasurementConfigurator{T}"/> type</returns>
        public Type GetConfiguratorTypeForMeasurement(Type measurementType, IAssemblyLoader specificAssembly = null)
        {
            ValidateTypeIsMeasurementAttribute(measurementType);

            // served up the cached version if we already have it
            if (_measurementConfiguratorTypes.ContainsKey(measurementType))
            {
                return(_measurementConfiguratorTypes[measurementType]);
            }

            using (specificAssembly = specificAssembly ??
                                      AssemblyRuntimeLoader.WrapAssembly(measurementType.GetAssembly(), Output))
            {
                // search for a match
                var match = FindBestMatchingConfiguratorForMeasurement(measurementType,
                                                                       LoadAllTypeConfigurators(specificAssembly));

                // cache the result
                _measurementConfiguratorTypes[measurementType] = match;

                return(match);
            }
        }
コード例 #33
0
        public HookRegistry(IAssemblyLoader assemblyLoader)
        {
            /* Must use equality by full name because hook types (e.g. BeforeSuite) registered from sandbox side
             * MAY have different version than one in runner's domain.
             * Then trying to get key for BeforeSuite version 0.5.3 from runner will thrown key not found,
             * because HashSet was added for BeforeSuite version 0.5.1
             */
            _hooks = new Dictionary <Type, HashSet <HookMethod> > (new TypeEqualityComparerByFullName());
            _hooks.Add(typeof(BeforeSuite), new HashSet <HookMethod> ());
            _hooks.Add(typeof(AfterSuite), new HashSet <HookMethod>());
            _hooks.Add(typeof(BeforeSpec), new HashSet <HookMethod>());
            _hooks.Add(typeof(AfterSpec), new HashSet <HookMethod> ());
            _hooks.Add(typeof(BeforeScenario), new HashSet <HookMethod> ());
            _hooks.Add(typeof(AfterScenario), new HashSet <HookMethod> ());
            _hooks.Add(typeof(BeforeStep), new HashSet <HookMethod> ());
            _hooks.Add(typeof(AfterStep), new HashSet <HookMethod> ());

            _targetLibAssembly = assemblyLoader.GetTargetLibAssembly();
            foreach (var type in _hooks.Keys)
            {
                AddHookOfType(type, assemblyLoader.GetMethods(type));
            }
        }
コード例 #34
0
        public static IServiceProvider Create(
            ITestOutputHelper testOutput,
            IOmniSharpEnvironment environment,
            ILoggerFactory loggerFactory,
            IAssemblyLoader assemblyLoader,
            IAnalyzerAssemblyLoader analyzerAssemblyLoader,
            IMSBuildLocator msbuildLocator,
            IEnumerable <KeyValuePair <string, string> > configurationData = null,
            DotNetCliVersion dotNetCliVersion = DotNetCliVersion.Current,
            IEventEmitter eventEmitter        = null)
        {
            eventEmitter = eventEmitter ?? NullEventEmitter.Instance;

            var dotNetCliService = CreateDotNetCliService(dotNetCliVersion, loggerFactory, eventEmitter);
            var configuration    = CreateConfiguration(configurationData, dotNetCliService);
            var memoryCache      = CreateMemoryCache();
            var optionsMonitor   = CreateOptionsMonitor(configuration);
            var sharedTextWriter = CreateSharedTextWriter(testOutput);

            return(new TestServiceProvider(
                       environment, loggerFactory, assemblyLoader, analyzerAssemblyLoader, memoryCache, sharedTextWriter,
                       msbuildLocator, eventEmitter, dotNetCliService, configuration, optionsMonitor));
        }
コード例 #35
0
ファイル: AssemblyResolver.cs プロジェクト: witchdrash/Smocks
        /// <summary>
        /// Loads an assembly and all its references.
        /// </summary>
        /// <param name="assemblyName">Name of the assembly.</param>
        /// <returns>The assembly, or null if it could not be loaded.</returns>
        private Assembly LoadAssembly(AssemblyName assemblyName)
        {
            Assembly result = _loadedAssemblyFinder.Find(assemblyName);

            if (result != null || AssemblyLoaderFactory == null)
            {
                return(result);
            }

            IAssemblyLoader loader = AssemblyLoaderFactory.GetLoaderForAssembly(assemblyName);

            result = loader?.Load();

            if (result != null)
            {
                foreach (var reference in result.GetReferencedAssemblies())
                {
                    LoadAssembly(reference);
                }
            }

            return(result);
        }
コード例 #36
0
ファイル: RoslynScriptSession.cs プロジェクト: gitfool/cake
        public RoslynScriptSession(
            IScriptHost host,
            IAssemblyLoader loader,
            ICakeConfiguration configuration,
            ICakeLog log,
            IScriptHostSettings settings)
        {
            _host          = host;
            _fileSystem    = host.Context.FileSystem;
            _loader        = loader;
            _log           = log;
            _configuration = configuration;
            _settings      = settings;

            ReferencePaths = new HashSet <FilePath>(PathComparer.Default);
            References     = new HashSet <Assembly>();
            Namespaces     = new HashSet <string>(StringComparer.Ordinal);

            var cacheEnabled = configuration.GetValue(Constants.Settings.EnableScriptCache) ?? bool.FalseString;

            _scriptCacheEnabled = cacheEnabled.Equals(bool.TrueString, StringComparison.OrdinalIgnoreCase);
            _regenerateCache    = host.Context.Arguments.HasArgument(Constants.Cache.InvalidateScriptCache);
            _scriptCachePath    = configuration.GetScriptCachePath(settings.Script.GetDirectory(), host.Context.Environment);
        }
コード例 #37
0
ファイル: EdmParameterBag.cs プロジェクト: dotnet/ef6tools
 public EdmParameterBag(
     SynchronizationContext syncContext,
     IAssemblyLoader assemblyLoader,
     Version targetVersion,
     string providerInvariantName,
     string providerManifestToken,
     string providerConnectionString,
     string databaseSchemaName,
     string databaseName,
     string ddlTemplatePath,
     string edmxPath)
 {
     _parameterBag = new Dictionary <ParameterName, object>();
     _parameterBag.Add(ParameterName.SynchronizationContext, syncContext);
     _parameterBag.Add(ParameterName.AssemblyLoader, assemblyLoader);
     _parameterBag.Add(ParameterName.TargetVersion, targetVersion);
     _parameterBag.Add(ParameterName.ProviderInvariantName, providerInvariantName);
     _parameterBag.Add(ParameterName.ProviderManifestToken, providerManifestToken);
     _parameterBag.Add(ParameterName.ProviderConnectionString, providerConnectionString);
     _parameterBag.Add(ParameterName.DatabaseSchemaName, databaseSchemaName);
     _parameterBag.Add(ParameterName.DatabaseName, databaseName);
     _parameterBag.Add(ParameterName.DDLTemplatePath, ddlTemplatePath);
     _parameterBag.Add(ParameterName.EdmxPath, edmxPath);
 }
コード例 #38
0
 private MSBuildLocator(ILoggerFactory loggerFactory, IAssemblyLoader assemblyLoader, ImmutableArray <MSBuildInstanceProvider> providers)
 {
     _logger         = loggerFactory.CreateLogger <MSBuildLocator>();
     _assemblyLoader = assemblyLoader;
     _providers      = providers;
 }
コード例 #39
0
 public SpecDataStoreInitProcessor(IAssemblyLoader assemblyLoader) : base(assemblyLoader, DataStoreType.Spec)
 {
 }
コード例 #40
0
 public FixtureServices(ILoginServices loginServices, IRepository <Encounter> encounterRepository, IRepository <Sport> sportRepo, IRepository <Team> teamRepo, IAssemblyLoader assemblyLoader, IRepository <Comment> commentRepo)
 {
     this.adminValidator = new PermissionValidator(Role.Administrator, loginServices);
     mapper = new EncounterMapper(sportRepo, teamRepo, commentRepo);
     this.encounterRepository = encounterRepository;
     this.teamRepo            = teamRepo;
     this.assemblyLoader      = assemblyLoader;
     this.commentRepo         = commentRepo;
     SetupAssemblyLoader();
     this.sportRepo = sportRepo;
 }
コード例 #41
0
 protected HookExecutionProcessor(IExecutionOrchestrator executionOrchestrator, IAssemblyLoader assemblyLoader,
                                  IReflectionWrapper reflectionWrapper)
 {
     _assemblyLoader       = assemblyLoader;
     ExecutionOrchestrator = executionOrchestrator;
     _reflectionWrapper    = reflectionWrapper;
     Strategy = new HooksStrategy();
 }
コード例 #42
0
 public static string ExtractAssemblyShortName(this IAssemblyLoader assemblyLoader, string fullName)
 {
     return(ExtractAssemblyShortName(fullName));
 }
コード例 #43
0
ファイル: DualityApp.cs プロジェクト: raycrasher/duality
        /// <summary>
        /// Terminates this DualityApp. This does not end the current Process, but will instruct the engine to
        /// leave main loop and message processing as soon as possible.
        /// </summary>
        public static void Terminate()
        {
            if (!initialized)
            {
                return;
            }
            if (isUpdating)
            {
                terminateScheduled = true;
                return;
            }

            if (environment == ExecutionEnvironment.Editor && execContext == ExecutionContext.Game)
            {
                Scene.Current.Dispose();
                Logs.Core.Write("DualityApp terminated in sandbox mode.");
                terminateScheduled = false;
                return;
            }

            if (execContext != ExecutionContext.Editor)
            {
                OnTerminating();
                DualityApp.UserData.Save();
            }

            // Signal that the game simulation has ended.
            if (execContext == ExecutionContext.Game)
            {
                pluginManager.InvokeGameEnded();
            }

            // Dispose all content that is still loaded
            ContentProvider.ClearContent();

            // Discard plugin data (Resources, current Scene) ahead of time. Otherwise, it'll get shut down in ClearPlugins, after the backend is gone.
            pluginManager.DiscardPluginData();

            sound.Dispose();
            sound = null;
            ShutdownBackend(ref graphicsBack);
            ShutdownBackend(ref audioBack);
            pluginManager.ClearPlugins();

            // Since this performs file system operations, it needs to happen before shutting down the system backend.
            Profile.SaveTextReport(environment == ExecutionEnvironment.Editor ? "perflog_editor.txt" : "perflog.txt");

            ShutdownBackend(ref systemBack);

            // Shut down the plugin manager and plugin loader
            pluginManager.Terminate();
            pluginManager.PluginsRemoving -= pluginManager_PluginsRemoving;
            pluginManager.PluginsRemoved  -= pluginManager_PluginsRemoved;
            assemblyLoader.Terminate();
            assemblyLoader = null;

            Logs.Core.Write("DualityApp terminated");

            initialized = false;
            execContext = ExecutionContext.Terminated;
        }
コード例 #44
0
 private static IMSBuildLocator CreateMSBuildLocator(ILoggerFactory loggerFactory,
                                                     IAssemblyLoader assemblyLoader)
 => MSBuildLocator.CreateStandAlone(loggerFactory, assemblyLoader);
コード例 #45
0
 private void AddAssemblies(List <string> addedAssemblyNames, List <Assembly> assemblies, IAssemblyLoader loader)
 {
     foreach (Assembly assembly in loader.GetAssemblies())
     {
         StringMatch match = new StringMatch(RestrictToPattern, SkipPattern);
         if (match.Matches(assembly.FullName))
         {
             if (!addedAssemblyNames.Contains(assembly.FullName))
             {
                 assemblies.Add(assembly);
                 addedAssemblyNames.Add(assembly.FullName);
             }
         }
     }
 }
コード例 #46
0
ファイル: Resolver.cs プロジェクト: dongcd/vs-mef
        public Resolver(IAssemblyLoader assemblyLoader)
        {
            Requires.NotNull(assemblyLoader, nameof(assemblyLoader));

            this.AssemblyLoader = assemblyLoader;
        }
コード例 #47
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ScriptConventions"/> class.
 /// </summary>
 /// <param name="fileSystem">The file system.</param>
 /// <param name="loader">The assembly loader.</param>
 public ScriptConventions(IFileSystem fileSystem, IAssemblyLoader loader)
 {
     _fileSystem = fileSystem;
     _loader     = loader;
 }
コード例 #48
0
 public TableFormatter(IAssemblyLoader assemblyLoader, IActivatorWrapper activatorWrapper)
 {
     _assemblyLoader   = assemblyLoader;
     _activatorWrapper = activatorWrapper;
 }
コード例 #49
0
 public ExecutionEndingProcessor(IExecutionOrchestrator executionOrchestrator, IAssemblyLoader assemblyLoader,
                                 IReflectionWrapper reflectionWrapper)
     : base(executionOrchestrator, assemblyLoader, reflectionWrapper)
 {
 }
コード例 #50
0
 public DefaultMappingResolver(IModulesRegistration modulesRegistry, IAssemblyLoader assemblyLoader)
 {
     this.modulesRegistry = modulesRegistry;
     this.assemblyLoader  = assemblyLoader;
 }
コード例 #51
0
 public Help(IAssemblyLoader assemblyLoader, IOutputWriter outputWriter)
 {
     this.assemblyLoader = assemblyLoader;
     this.outputWriter   = outputWriter;
 }
コード例 #52
0
 public static MSBuildLocator CreateStandAlone(ILoggerFactory loggerFactory, IAssemblyLoader assemblyLoader)
 => new MSBuildLocator(loggerFactory, assemblyLoader,
                       ImmutableArray.Create <MSBuildInstanceProvider>(
                           new StandAloneInstanceProvider(loggerFactory)));
コード例 #53
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultWebAssemblyManager"/> class.
 /// </summary>
 /// <param name="workingDirectory">The working directory.</param>
 /// <param name="modulesRegistration">The modules registration.</param>
 /// <param name="embeddedResourcesProvider">The embedded resources provider.</param>
 /// <param name="assemblyLoader">The assembly loader.</param>
 public DefaultWebAssemblyManager(IWorkingDirectory workingDirectory, IModulesRegistration modulesRegistration,
                                  IEmbeddedResourcesProvider embeddedResourcesProvider, IAssemblyLoader assemblyLoader)
     : base(workingDirectory, modulesRegistration, assemblyLoader)
 {
     this.embeddedResourcesProvider = embeddedResourcesProvider;
 }
コード例 #54
0
 public PackagingRuntimeGraph(IPackagingDiagnostics diagnostics, IAssemblyLoader assemblies, IList <IPackageInfo> packages)
 {
     _diagnostics = diagnostics;
     _assemblies  = assemblies;
     _packages    = packages;
 }
コード例 #55
0
 public StepExecutionEndingProcessor(IMethodExecutor methodExecutor, IAssemblyLoader assemblyLoader, IReflectionWrapper reflectionWrapper)
     : base(methodExecutor, assemblyLoader, reflectionWrapper)
 {
 }
コード例 #56
0
ファイル: DualityApp.cs プロジェクト: raycrasher/duality
        /// <summary>
        /// Initializes this DualityApp. Should be called before performing any operations within Duality.
        /// </summary>
        /// <param name="env"></param>
        /// <param name="context">The <see cref="ExecutionContext"/> in which Duality runs.</param>
        /// <param name="plugins"></param>
        /// <param name="launcherArgs">
        /// Command line arguments to run this DualityApp with.
        /// Usually these are just the ones from the host application, passed on.
        /// </param>
        public static void Init(ExecutionEnvironment env, ExecutionContext context, IAssemblyLoader plugins, LauncherArgs launcherArgs)
        {
            if (initialized)
            {
                return;
            }

            // Process command line options
            if (launcherArgs.IsDebugging)
            {
                System.Diagnostics.Debugger.Launch();
            }
            // Run from editor
            if (launcherArgs.IsRunFromEditor)
            {
                runFromEditor = true;
            }

            // If the core was compiled in debug mode and a debugger is attached, log
            // to the Debug channel, so we can put the VS output window to good use.
#if DEBUG
            bool isDebugging = System.Diagnostics.Debugger.IsAttached;
            if (isDebugging)
            {
                // Only add a new Debug output if we don't already have one, and don't
                // log to a Console channel either. VS will automatically redirect Console
                // output to the Output window when debugging a non-Console application,
                // and we don't want to end up with double log entries.
                bool hasDebugOut   = Logs.GlobalOutput.OfType <DebugLogOutput>().Any();
                bool hasConsoleOut = Logs.GlobalOutput.OfType <TextWriterLogOutput>().Any(w => w.GetType().Name.Contains("Console"));
                if (!hasDebugOut && !hasConsoleOut)
                {
                    Logs.AddGlobalOutput(new DebugLogOutput());
                }
            }
                        #endif

            environment = env;
            execContext = context;

            // Initialize the plugin manager
            {
                assemblyLoader = plugins ?? new Duality.Backend.Dummy.DummyAssemblyLoader();
                Logs.Core.Write("Using '{0}' to load plugins.", assemblyLoader.GetType().Name);

                assemblyLoader.Init();

                // Log assembly loading data for diagnostic purposes
                {
                    Logs.Core.Write("Currently Loaded Assemblies:" + Environment.NewLine + "{0}",
                                    assemblyLoader.LoadedAssemblies.ToString(
                                        assembly => "  " + LogFormat.Assembly(assembly),
                                        Environment.NewLine));
                    Logs.Core.Write("Plugin Base Directories:" + Environment.NewLine + "{0}",
                                    assemblyLoader.BaseDirectories.ToString(
                                        path => "  " + path,
                                        Environment.NewLine));
                    Logs.Core.Write("Available Assembly Paths:" + Environment.NewLine + "{0}",
                                    assemblyLoader.AvailableAssemblyPaths.ToString(
                                        path => "  " + path,
                                        Environment.NewLine));
                }

                pluginManager.Init(assemblyLoader);
                pluginManager.PluginsRemoving += pluginManager_PluginsRemoving;
                pluginManager.PluginsRemoved  += pluginManager_PluginsRemoved;
            }

            // Load all plugins. This needs to be done first, so backends and Types can be located.
            pluginManager.LoadPlugins();

            // Initialize the system backend for system info and file system access
            InitBackend(out systemBack);

            // Load application and user data and submit a change event, so all settings are applied
            DualityApp.AppData.Load();
            DualityApp.UserData.Load();

            // Initialize the graphics backend
            InitBackend(out graphicsBack);

            // Initialize the audio backend
            InitBackend(out audioBack);
            sound = new SoundDevice();

            // Initialize all core plugins, this may allocate Resources or establish references between plugins
            pluginManager.InitPlugins();

            initialized = true;

            // Write environment specs as a debug log
            Logs.Core.Write(
                "DualityApp initialized" + Environment.NewLine +
                "Debug Mode: {0}" + Environment.NewLine +
                "Command line arguments: {1}",
                System.Diagnostics.Debugger.IsAttached,
                launcherArgs.ToString());
        }
コード例 #57
0
 public static Lazy <Assembly> LazyLoad(this IAssemblyLoader loader, string assemblyName)
 {
     return(new Lazy <Assembly>(() => loader.Load(assemblyName)));
 }
コード例 #58
0
 public AttributeSearch(IAssemblyLoader loader)
 {
     this.loader = loader;
 }
コード例 #59
0
        public DefaultRouteMap(IActionContextAccessor contextAccessor, ILogger <DefaultRouteMap> logger, IAssemblyLoader assemblyLoader)
        {
            if (assemblyLoader == null)
            {
                throw new ArgumentNullException(nameof(assemblyLoader));
            }

            this.contextAccessor = contextAccessor;
            this.logger          = logger;

            var assemblies = assemblyLoader.GetAssemblies();

            foreach (var asm in assemblies)
            {
                var controllers = asm.GetTypes()
                                  .Where(type => typeof(ControllerBase).IsAssignableFrom(type));

                var controllerMethods = controllers.SelectMany(c => c.GetMethods(BindingFlags.Public | BindingFlags.Instance)
                                                               .Where(m => m.IsDefined(typeof(HttpMethodAttribute)))
                                                               .SelectMany(m => m.GetCustomAttributes <HttpMethodAttribute>(), (m, attr) => new
                {
                    Controller    = c,
                    Method        = m,
                    HttpAttribute = attr
                }));

                foreach (var attr in controllerMethods.Where(a => !String.IsNullOrWhiteSpace(a.HttpAttribute.Name)))
                {
                    var method = ParseMethod(attr.HttpAttribute.HttpMethods);
                    RouteMap[attr.HttpAttribute.Name] = new RouteInfo(attr.HttpAttribute.Name, method, new ReflectionControllerMethodInfo(attr.Method));
                }
            }
        }
コード例 #60
0
ファイル: Resolver.cs プロジェクト: dongcd/vs-mef
 /// <summary>
 /// Initializes a new instance of the <see cref="AssemblyLoaderWrapper"/> class.
 /// </summary>
 /// <param name="resolver">The <see cref="Resolver"/> that created this instance.</param>
 /// <param name="inner">The inner <see cref="IAssemblyLoader"/> to use.</param>
 internal AssemblyLoaderWrapper(Resolver resolver, IAssemblyLoader inner)
 {
     this.resolver = resolver ?? throw new ArgumentNullException(nameof(resolver));
     this.inner    = inner ?? throw new ArgumentNullException(nameof(inner));
 }