• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# AssemblyLoader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中AssemblyLoader的典型用法代码示例。如果您正苦于以下问题:C# AssemblyLoader类的具体用法?C# AssemblyLoader怎么用?C# AssemblyLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AssemblyLoader类属于命名空间,在下文中一共展示了AssemblyLoader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: LoadPackages

        public static void LoadPackages(Action<IPackageFacility> configuration, bool runActivators = true)
        {
            _packages.Clear();

            Diagnostics = new PackagingDiagnostics();
            var record = new PackageLoadingRecord();

            Diagnostics.LogExecution(record, () =>
            {
                var facility = new PackageFacility();
                var assemblyLoader = new AssemblyLoader(Diagnostics);
                var graph = new PackagingRuntimeGraph(Diagnostics, assemblyLoader, _packages);

                var codeLocation = findCallToLoadPackages();
                graph.PushProvenance(codeLocation);
                configuration(facility);
                facility.Configure(graph);


                graph.PopProvenance();
                graph.DiscoverAndLoadPackages(() =>
                {
                    _assemblies.Clear();
                    _assemblies.AddRange(assemblyLoader.Assemblies);
                }, runActivators);
            });

            record.Finished = DateTime.Now;

            //_packages.Clear();


        }
开发者ID:NTCoding,项目名称:FubuRaven.NTCoding.com,代码行数:33,代码来源:PackageRegistry.cs


示例2: Loader_returns_null_if_assembly_is_not_found_at_path

        public void Loader_returns_null_if_assembly_is_not_found_at_path()
        {
            var assemblyLoader = new AssemblyLoader();
            var assembly = assemblyLoader.LoadAssembly(@"c:\a\non\existent\path\assembly.dll");

            Assert.That(assembly, Is.Null);
        }
开发者ID:7digital,项目名称:SevenDigital.Tools.DependencyManager,代码行数:7,代码来源:AssemblyLoaderTests.cs


示例3: PluginContainerBuilder

 public PluginContainerBuilder(AssemblyLoader assemblyLoader, IPluginJudge pluginJudge, IContainerFactory containerFactory, ILogger logger)
 {
     _assemblyLoader = assemblyLoader;
     _pluginJudge = pluginJudge;
     _containerFactory = containerFactory;
     _logger = logger;
 }
开发者ID:TomPeters,项目名称:chooie,代码行数:7,代码来源:PluginContainerBuilder.cs


示例4: Init

 /// <summary>Initialises the assembly loader.</summary>
 internal static void Init()
 {
     if (instance == null)
     {
         instance = new AssemblyLoader();
     }
 }
开发者ID:stegru,项目名称:ExceptionExplorer,代码行数:8,代码来源:AssemblyLoader.cs


示例5: Run

        public void Run()
        {
            var assemblyLoader = new AssemblyLoader(this.assemblyPath);
            var assembly = assemblyLoader.Assembly;

            var testMethodLoader = new TestMethodLoader(assembly);
            var testContainers = testMethodLoader.LoadTestMethods();
            foreach (var testContainer in testContainers)
            {
                var instance = Activator.CreateInstance(testContainer.Key);
                var testMethods = testContainer.Value;
                foreach (MethodInfo testMethod in testMethods)
                {
                    var testType = this.GetTestType(testMethod);

                    var testRunner = TestRunnerFactory.GetTestRunner(
                        testType,
                        testMethod,
                        instance);

                    testRunner.RunTest();
                    this.LogTestResult(testRunner, testMethod);
                }
            }
        }
开发者ID:ivailojordanov,项目名称:Fundamental-Level,代码行数:25,代码来源:Engine.cs


示例6: Load_NullOrEmptyPath_ReturnsNull

        public void Load_NullOrEmptyPath_ReturnsNull(string path)
        {
            var subject = new AssemblyLoader(path);
            var result = subject.Load();

            Assert.AreEqual(null, result);
        }
开发者ID:gmf520,项目名称:Smocks,代码行数:7,代码来源:AssemblyLoaderTests.cs


示例7: ClassHierarchyImpl

        //parameterParsers are classes that extends from IExternalConstructor
        public ClassHierarchyImpl(string[] assemblies, Type[] parameterParsers)  
        {
            this.assemblies = assemblies;
            rootNode = NodeFactory.CreateRootPackageNode();
            loader = new AssemblyLoader(assemblies);
           
            foreach (Type p in parameterParsers) //p must be extend from IExternalConstructor
            {
                try 
                {
                    Parameterparser.AddParser(p);
                } 
                catch (BindException e)
                {
                    Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER);
                    Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(new ArgumentException("Could not register parameter parsers", e), LOGGER);
                }
            }

            foreach (var a in loader.Assemblies)
            {
                foreach (var t in a.GetTypes())
                {
                    RegisterType(t);
                }
            }
        }
开发者ID:jsryu21,项目名称:incubator-reef,代码行数:28,代码来源:ClassHierarchyImpl.cs


示例8: RunTests

        public static void RunTests()
        {
            var loader = new AssemblyLoader();
            var testMethods = loader.GatherTests();

            Console.LogDateTime = true;

            foreach (var untypedTest in testMethods)
            {
                var methodInfo = (MethodInfo)untypedTest;

                try
                {
                    methodInfo.Invoke(null, null);
                    Console.WriteLine(methodInfo.DeclaringType + "." + methodInfo.Name + " - Passed.");
                }
                catch(ControlledAssertionException controlledAssertionException)
                {
                    Log(methodInfo, controlledAssertionException.Message);
                }
                catch (Exception ex)
                {
                    Log(methodInfo, "Failed", ex);
                }
            }

            Console.WriteLine("End of test run.");
        }
开发者ID:davidwhitney,项目名称:BuildMonitorMicro,代码行数:28,代码来源:TestRunner.cs


示例9: TestRunner

 public TestRunner(Logger output, AssemblyLoader assemblyLoader)
 {
     AllPassed = true;
     this.output = output;
     this.assemblyLoader = assemblyLoader;
     processor = new StepProcessor(this);
 }
开发者ID:andypaxo,项目名称:Acceptance-Testing,代码行数:7,代码来源:TestRunner.cs


示例10: Main

        public static void Main()
        {
            var loader = new AssemblyLoader();

            var plugin = loader.LoadPlugInAppDomain("Plug.dll");

            plugin.Delay(TimeSpan.FromSeconds(2)).Subscribe(x => Console.WriteLine("Delayed: " + x));
            var isTrue = true;

            while (isTrue)
            {
                var text = Console.ReadLine();

                plugin.Push(text);

                if (string.IsNullOrEmpty(text))
                    isTrue = false;
            }

            plugin.Dispose();

            Console.WriteLine("Plugin disposed.");

            Console.ReadLine();
        }
开发者ID:stenis,项目名称:AppDomainTest,代码行数:25,代码来源:Program.cs


示例11: OperationExecutor

        public OperationExecutor(
            [NotNull] CommonOptions options,
            [CanBeNull] string environment)
        {
            var projectFile = Path.Combine(Directory.GetCurrentDirectory(), Project.FileName);
            var project = ProjectReader.GetProject(projectFile);

            var projectConfiguration = options.Configuration ?? Constants.DefaultConfiguration;
            var projectFramework = options.Framework;

            var projectContext = ProjectContext.Create(project.ProjectFilePath,
                projectFramework,
                RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers());

            var runtimeOutputPath = projectContext.GetOutputPaths(projectConfiguration)?.RuntimeOutputPath;
            if (!string.IsNullOrEmpty(runtimeOutputPath))
            {
                Reporter.Verbose.WriteLine(
                    ToolsCliStrings.LogDataDirectory(runtimeOutputPath));
                Environment.SetEnvironmentVariable(DataDirEnvName, runtimeOutputPath);
#if NET451
                AppDomain.CurrentDomain.SetData("DataDirectory", runtimeOutputPath);
#endif
            }

            var assemblyName = project.GetCompilerOptions(projectFramework, projectConfiguration).OutputName;
            var projectDir = project.ProjectDirectory;
            var rootNamespace = project.Name;

            var assemblyLoader = new AssemblyLoader(Assembly.Load);
            var projectAssembly = assemblyLoader.Load(assemblyName);

            _contextOperations = new LazyRef<DbContextOperations>(
                          () => new DbContextOperations(
                              new LoggerProvider(name => new ConsoleCommandLogger(name)),
                              projectAssembly,
                              projectAssembly,
                              environment,
                              projectDir));
            _databaseOperations = new LazyRef<DatabaseOperations>(
                () => new DatabaseOperations(
                    new LoggerProvider(name => new ConsoleCommandLogger(name)),
                    assemblyLoader,
                    projectAssembly,
                    environment,
                    projectDir,
                    projectDir,
                    rootNamespace));
            _migrationsOperations = new LazyRef<MigrationsOperations>(
                () => new MigrationsOperations(
                    new LoggerProvider(name => new ConsoleCommandLogger(name)),
                    projectAssembly,
                    assemblyLoader,
                    projectAssembly,
                    environment,
                    projectDir,
                    projectDir,
                    rootNamespace));
        }
开发者ID:ChuYuzhi,项目名称:EntityFramework,代码行数:59,代码来源:OperationExecutor.cs


示例12: PackageInstaller

 internal PackageInstaller(IFileSystem fileSystem, AssemblyLoader assemblyLoader)
 {
     _fileSystem = fileSystem;
     _assemblyLoader = assemblyLoader;
     _currentFramework = GetCurrentFramework();
     _settings = Settings.LoadDefaultSettings(fileSystem.RootPath.FullPath, null, new MachineWideSettings());
     _sourceRepositories = new SourceRepositoryProvider(_settings);
 }
开发者ID:ibebbs,项目名称:Wyam,代码行数:8,代码来源:PackageInstaller.cs


示例13: Try

 public static FrameworkAdapter Try(AssemblyLoader assemblyLoader) {
    foreach (var assemblyName in assemblyLoader.GetReferencedAssemblies()) {
       if (assemblyName.FullName.ToLower().Contains("nunit.framework,")) {
          return new NUnitAdapter();
       }
    }
    return null;
 }
开发者ID:ManfredLange,项目名称:csUnit,代码行数:8,代码来源:NUnitAdapter.cs


示例14: Try

 public static FrameworkAdapter Try(AssemblyLoader assemblyLoader) {
    foreach (var assemblyName in assemblyLoader.GetReferencedAssemblies()) {
       if (assemblyName.FullName.Contains("Microsoft.VisualStudio.QualityTools.UnitTestFramework,")) {
          return new MsUnitTestAdapter();
       }
    }
    return null;
 }
开发者ID:ManfredLange,项目名称:csUnit,代码行数:8,代码来源:MsUnitTestAdapter.cs


示例15: AssemblyLoaderMustLoadTargetAssemblyFromDisk

        public void AssemblyLoaderMustLoadTargetAssemblyFromDisk()
        {
            IAssemblyLoader loader = new AssemblyLoader();

            // The loader should return a valid assembly
            Assembly result = loader.Load(typeof(SampleClass).Assembly.Location);
            Assert.IsNotNull(result);
        }
开发者ID:sdether,项目名称:LinFu,代码行数:8,代码来源:ConfigurationTests.cs


示例16: ShouldBeAbleToGetTypes

 public void ShouldBeAbleToGetTypes()
 {
     var assemblyLoader = new AssemblyLoader();
     var types = assemblyLoader.GetTypes(@"C:\Source\Mike.AmqpSpike\EasyNetQ.Tests.Messages\bin\Debug\EasyNetQ.Tests.Messages.dll");
     foreach (var type in types)
     {
         Console.WriteLine(type);
     }
 }
开发者ID:sdhjl2000,项目名称:EasyNetQ,代码行数:9,代码来源:AssemblyLoader.cs


示例17: Main

        static void Main(string[] args)
        {
            var arguments = ParseCommandLine(args);

            var loader = new AssemblyLoader();
            var dbProvider = loader.CreateTypeFromAssembly<DbProvider>(arguments["dbp.provider"], arguments);
            var dbCodeFormatter = loader.CreateTypeFromAssembly<DbTraceCodeFormatter>(arguments["tcf.provider"], arguments);
            var codeHighlighter = loader.CreateTypeFromAssembly<HighlightCodeProvider>(arguments["hcp.provider"], arguments);
            var outputProvider = loader.CreateTypeFromAssembly<OutputProvider>(arguments["out.provider"], arguments);

            var command = arguments["app.command"].ToLower().Trim();

            // Get trace name from provided, last trace, or generate one.
            string traceName = null;
            if (arguments.ContainsKey("app.traceName"))
            {
                traceName = arguments["app.traceName"];
            }
            if (traceName == null && command != "start")
            {
                traceName = dbProvider.GetLastTraceName();
            }
            else if (traceName == null && command == "start")
            {
                traceName = DateTime.Now.ToString("yyyyMMddHHmmss");
            }

            // Get the specific database object name to run against, if specified (mainly used for testing).
            if (arguments.ContainsKey("test.objectname"))
            {
                var objectName = arguments["test.objectname"];
                dbProvider.SetSpecificObjectNameForTesting(objectName);
            }

            switch (command)
            {
                case "generate":
                    var generateCommand = new GenerateOutputCommand(dbProvider, dbCodeFormatter, codeHighlighter, outputProvider, traceName);
                    generateCommand.Execute();
                    break;

                case "start":
                    var startCommand = new StartCommand(outputProvider, dbProvider, traceName);
                    startCommand.Execute();
                    break;

                case "stop":
                    var stopCommand = new StopCommand(dbProvider, outputProvider, traceName);
                    stopCommand.Execute();
                    break;

                case "finish":
                    new GenerateOutputCommand(dbProvider, dbCodeFormatter, codeHighlighter, outputProvider, traceName).Execute();
                    new StopCommand(dbProvider, outputProvider, traceName).Execute();
                    break;
            }
        }
开发者ID:kmahon37,项目名称:sqlcc,代码行数:57,代码来源:Program.cs


示例18: Main

        static void Main(string[] args)
        {
            var arguments = new Dictionary<string, string>();

             // App.Config Settings
             var appSettingKeys = ConfigurationManager.AppSettings.Keys;
             for (var i = 0; i < appSettingKeys.Count; i++)
             {
            var key = appSettingKeys[i];
            arguments.AddOrUpdate(key, ConfigurationManager.AppSettings[key]);
             }

             // Manual override through CLI.
             var p = new OptionSet()
                    {
                       {
                          "<>", v =>
                                   {
                                      if (!v.StartsWith("--"))
                                         return;
                                      var split = v.Split(new[] { '=' }, 2);
                                      if (split.Length != 2)
                                         return;
                                      arguments.AddOrUpdate(split[0].TrimStart('-'), split[1]);
                                   }
                          }
                    };

             p.Parse(args);

             var loader = new AssemblyLoader();
             var dbProvider = loader.CreateTypeFromAssembly<DbProvider>(arguments["dbp.provider"], arguments);
             var dbCodeFormatter = loader.CreateTypeFromAssembly<DbTraceCodeFormatter>(arguments["tcf.provider"], arguments);
             var codeHighlighter = loader.CreateTypeFromAssembly<HighlightCodeProvider>(arguments["hcp.provider"], arguments);
             var outputProvider = loader.CreateTypeFromAssembly<OutputProvider>(arguments["out.provider"], arguments);

             switch (arguments["app.mode"].ToLower().Trim())
             {
            case "generate":
               var generateCommand = new GenerateOutputCommand(dbProvider, dbCodeFormatter, codeHighlighter, outputProvider, arguments["app.traceName"]);
               generateCommand.Execute();
               break;

            case "start":
               var startCommand = new StartCommand(outputProvider, dbProvider, arguments["app.traceName"]);
               startCommand.Execute();
               break;

            case "stop":
               {
                  var stopCommand = new StopCommand(dbProvider, outputProvider, arguments["app.traceName"]);
                  stopCommand.Execute();
               }
               break;
             }
        }
开发者ID:JakubLinhart,项目名称:sqlcc,代码行数:56,代码来源:Program.cs


示例19: Load_LoadsAssemblyFromExecutingDirectoryWhenOnlyTheAssemblyFileNameIsProvided

        public void Load_LoadsAssemblyFromExecutingDirectoryWhenOnlyTheAssemblyFileNameIsProvided()
        {
            var expected = GetType().Assembly;

            var sut = new AssemblyLoader(() => expected.GetName().Name + ".dll");

            var actual = sut.Load();

            Assert.Equal(expected, actual);
        }
开发者ID:modulexcite,项目名称:FluentInstallation,代码行数:10,代码来源:AssemblyLoaderTests.cs


示例20: Load_LoadsAssemblyFromFile

        public void Load_LoadsAssemblyFromFile()
        {
            var expected = GetType().Assembly;

            var sut = new AssemblyLoader(() => expected.Location);

            var actual = sut.Load();

            Assert.Equal(expected, actual);
        }
开发者ID:modulexcite,项目名称:FluentInstallation,代码行数:10,代码来源:AssemblyLoaderTests.cs



注:本文中的AssemblyLoader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AssemblyName类代码示例发布时间:2022-05-24
下一篇:
C# AssemblyInfo类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap