当前位置: 首页>>代码示例>>C#>>正文


C# TypeInfoProvider类代码示例

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


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

示例1: ComparisonTest

        public ComparisonTest(string filename, string[] stubbedAssemblies = null, TypeInfoProvider typeInfo = null)
        {
            Filename = Path.Combine(TestSourceFolder, filename);

            var sourceCode = File.ReadAllText(Filename);
            switch (Path.GetExtension(filename).ToLower()) {
                case ".cs":
                    Assembly = CompilerUtil.CompileCS(sourceCode, out TemporaryFiles);
                    break;
                case ".vb":
                    Assembly = CompilerUtil.CompileVB(sourceCode, out TemporaryFiles);
                    break;
                default:
                    throw new ArgumentException("Unsupported source file type for test");
            }

            var program = Assembly.GetType("Program");
            if (program == null)
                throw new Exception("Test missing 'Program' main class");

            TestMethod = program.GetMethod("Main");
            if (TestMethod == null)
                throw new Exception("Test missing 'Main' method of 'Program' main class");

            StubbedAssemblies = stubbedAssemblies;
            TypeInfo = typeInfo;
        }
开发者ID:Caspeco,项目名称:JSIL,代码行数:27,代码来源:Util.cs

示例2: Analyze

        public void Analyze(TypeInfoProvider typeInfoProvider) {
            if (!Configuration.DeadCodeElimination.GetValueOrDefault(false))
                return;

            deadCodeInfo.TypeInfoProvider = typeInfoProvider;

            stopwatchElapsed = new Stopwatch();
            stopwatchElapsed.Start();

            var foundEntrypoints = from assembly in assemblyDefinitions
                                   from modules in assembly.Modules
                                   where modules.EntryPoint != null
                                   select modules.EntryPoint;

            deadCodeInfo.AddAssemblies(assemblyDefinitions);


            foreach (MethodDefinition method in foundEntrypoints)
            {
                deadCodeInfo.WalkMethod(method);
            }

            deadCodeInfo.ResolveVirtualMethodsCycle();

            stopwatchElapsed.Stop();
            Console.WriteLine("// Dead code analysis took {0} ms", stopwatchElapsed.ElapsedMilliseconds);
        }
开发者ID:Don191,项目名称:JSIL,代码行数:27,代码来源:DeadCodeAnalyzer.cs

示例3: MakeDefaultProvider

        protected TypeInfoProvider MakeDefaultProvider () {
            if (DefaultTypeInfoProvider == null)
                // Construct a type info provider with default proxies loaded (kind of a hack)
                DefaultTypeInfoProvider = (new AssemblyTranslator(MakeConfiguration())).GetTypeInfoProvider();

            return DefaultTypeInfoProvider.Clone();
        }
开发者ID:BrainSlugs83,项目名称:JSIL,代码行数:7,代码来源:GenericTestFixture.cs

示例4: Analyze

        public void Analyze (AssemblyTranslator translator, AssemblyDefinition[] assemblies, TypeInfoProvider typeInfoProvider) {
            if (!Configuration.DeadCodeElimination)
                return;

            assemblyDefinitions.Clear();
            assemblyDefinitions.AddRange(assemblies);

            deadCodeInfo.TypeInfoProvider = typeInfoProvider;

            stopwatchElapsed = new Stopwatch();
            stopwatchElapsed.Start();

            var foundEntrypoints = from assembly in assemblyDefinitions
                                   from modules in assembly.Modules
                                   where modules.EntryPoint != null
                                   select modules.EntryPoint;

            deadCodeInfo.AddAssemblies(assemblyDefinitions);


            foreach (MethodDefinition method in foundEntrypoints)
            {
                deadCodeInfo.WalkMethod(method);
            }

            deadCodeInfo.FinishProcessing();

            stopwatchElapsed.Stop();
            Console.WriteLine("// Dead code analysis took {0} ms", stopwatchElapsed.ElapsedMilliseconds);
        }
开发者ID:cbsistem,项目名称:JSIL,代码行数:30,代码来源:DeadCodeAnalyzer.cs

示例5: EmulateStructAssignment

 public EmulateStructAssignment(TypeSystem typeSystem, IFunctionSource functionSource, TypeInfoProvider typeInfo, CLRSpecialIdentifiers clr, bool optimizeCopies)
 {
     TypeSystem = typeSystem;
     FunctionSource = functionSource;
     TypeInfo = typeInfo;
     CLR = clr;
     OptimizeCopies = optimizeCopies;
 }
开发者ID:nateleroux,项目名称:JSIL,代码行数:8,代码来源:EmulateStructAssignment.cs

示例6: EmulateStructAssignment

 public EmulateStructAssignment(QualifiedMemberIdentifier member, IFunctionSource functionSource, TypeSystem typeSystem, TypeInfoProvider typeInfo, CLRSpecialIdentifiers clr, bool optimizeCopies)
     : base(member, functionSource)
 {
     TypeSystem = typeSystem;
     TypeInfo = typeInfo;
     CLR = clr;
     OptimizeCopies = optimizeCopies;
 }
开发者ID:simon-heinen,项目名称:JSIL,代码行数:8,代码来源:EmulateStructAssignment.cs

示例7: DecomposeMutationOperators

 public DecomposeMutationOperators (
     TypeSystem typeSystem, TypeInfoProvider typeInfo, 
     IFunctionSource functionSource, bool decomposeAllMutations
 ) {
     TypeSystem = typeSystem;
     TypeInfo = typeInfo;
     FunctionSource = functionSource;
     DecomposeAllMutations = decomposeAllMutations;
 }
开发者ID:cbsistem,项目名称:JSIL,代码行数:9,代码来源:DecomposeMutationOperators.cs

示例8: MakeTest

 protected ComparisonTest MakeTest (
     string filename, string[] stubbedAssemblies = null,
     TypeInfoProvider typeInfo = null,
     AssemblyCache assemblyCache = null
 ) {
     return new ComparisonTest(
         EvaluatorPool,
         Portability.NormalizeDirectorySeparators(filename), stubbedAssemblies,
         typeInfo, assemblyCache
     );
 }
开发者ID:cbsistem,项目名称:JSIL,代码行数:11,代码来源:GenericTestFixture.cs

示例9: Dispose

        public void Dispose () {
            if (EvaluatorPool != null) {
                EvaluatorPool.Dispose();
                EvaluatorPool = null;
            }

            if (DefaultTypeInfoProvider != null) {
                DefaultTypeInfoProvider.Dispose();
                DefaultTypeInfoProvider = null;
            }
        }
开发者ID:cbsistem,项目名称:JSIL,代码行数:11,代码来源:GenericTestFixture.cs

示例10: IntroduceEnumCasts

        public IntroduceEnumCasts(TypeSystem typeSystem, TypeInfoProvider typeInfo)
        {
            TypeSystem = typeSystem;
            TypeInfo = typeInfo;

            LogicalOperators = new HashSet<JSOperator>() {
                JSOperator.LogicalAnd,
                JSOperator.LogicalOr,
                JSOperator.LogicalNot
            };
        }
开发者ID:Caspeco,项目名称:JSIL,代码行数:11,代码来源:IntroduceEnumCasts.cs

示例11: ComparisonTest

        public ComparisonTest(string filename, Regex[] stubbedAssemblies = null, TypeInfoProvider typeInfo = null)
        {
            Filename = Path.Combine(TestSourceFolder, filename);

            var sourceCode = File.ReadAllText(Filename);
            Assembly = CSharpUtil.Compile(sourceCode, out TemporaryFiles);

            TestMethod = Assembly.GetType("Program").GetMethod("Main");

            StubbedAssemblies = stubbedAssemblies;
            TypeInfo = typeInfo;
        }
开发者ID:robashton,项目名称:JSIL,代码行数:12,代码来源:Util.cs

示例12: AssemblyTranslator

        public AssemblyTranslator(TypeInfoProvider typeInfoProvider = null)
        {
            // Important to avoid preserving the proxy list from previous translations in this process
            MemberIdentifier.ResetProxies();

            if (typeInfoProvider != null) {
                TypeInfoProvider = typeInfoProvider;
            } else {
                TypeInfoProvider = new JSIL.TypeInfoProvider();
                AddProxyAssembly(typeof(JSIL.Proxies.ObjectProxy).Assembly, false);
            }
        }
开发者ID:nowonu,项目名称:JSIL,代码行数:12,代码来源:AssemblyTranslator.cs

示例13: ComparisonTest

        public ComparisonTest(
            EvaluatorPool pool,
            IEnumerable<string> filenames, string outputPath, 
            string[] stubbedAssemblies = null, TypeInfoProvider typeInfo = null,
            AssemblyCache assemblyCache = null
        )
        {
            var started = DateTime.UtcNow.Ticks;
            OutputPath = outputPath;
            EvaluatorPool = pool;

            var extensions = (from f in filenames select Path.GetExtension(f).ToLower()).Distinct().ToArray();
            var absoluteFilenames = (from f in filenames select Path.Combine(TestSourceFolder, f));

            if (extensions.Length != 1)
                throw new InvalidOperationException("Mixture of different source languages provided.");

            var assemblyNamePrefix = Path.GetDirectoryName(outputPath).Split(new char[] { '\\', '/' }).Last();
            var assemblyName = Path.Combine(
                assemblyNamePrefix,
                Path.GetFileName(outputPath).Replace(".js", "")
            );

            switch (extensions[0]) {
                case ".cs":
                    Assembly = CompilerUtil.CompileCS(absoluteFilenames, assemblyName);
                    break;
                case ".vb":
                    Assembly = CompilerUtil.CompileVB(absoluteFilenames, assemblyName);
                    break;
                case ".exe":
                case ".dll":
                    var fns = absoluteFilenames.ToArray();
                    if (fns.Length > 1)
                        throw new InvalidOperationException("Multiple binary assemblies provided.");

                    Assembly = Assembly.LoadFile(fns[0]);
                    break;
                default:
                    throw new ArgumentException("Unsupported source file type for test");
            }

            if (typeInfo != null)
                typeInfo.ClearCaches();

            StubbedAssemblies = stubbedAssemblies;
            TypeInfo = typeInfo;
            AssemblyCache = assemblyCache;

            var ended = DateTime.UtcNow.Ticks;
            CompilationElapsed = TimeSpan.FromTicks(ended - started);
        }
开发者ID:xen2,项目名称:JSIL,代码行数:52,代码来源:TestUtil.cs

示例14: IntroduceEnumCasts

        public IntroduceEnumCasts (TypeSystem typeSystem, JSSpecialIdentifiers js, TypeInfoProvider typeInfo, MethodTypeFactory methodTypes) {
            TypeSystem = typeSystem;
            TypeInfo = typeInfo;
            MethodTypes = methodTypes;
            JS = js;

            LogicalOperators = new HashSet<JSOperator>() {
                JSOperator.LogicalAnd,
                JSOperator.LogicalOr,
                JSOperator.LogicalNot
            };

            BitwiseOperators = new HashSet<JSOperator>() {
                JSOperator.BitwiseAnd,
                JSOperator.BitwiseOr,
                JSOperator.BitwiseXor
            };
        }
开发者ID:Don191,项目名称:JSIL,代码行数:18,代码来源:IntroduceEnumCasts.cs

示例15: CreateTranslator

        static AssemblyTranslator CreateTranslator(
            Configuration configuration, AssemblyManifest manifest, AssemblyCache assemblyCache
        )
        {
            TypeInfoProvider typeInfoProvider = null;

            if (
                configuration.ReuseTypeInfoAcrossAssemblies.GetValueOrDefault(true) &&
                (CachedTypeInfoProvider != null)
            ) {
                if (CachedTypeInfoProviderConfiguration.Assemblies.Equals(configuration.Assemblies))
                    typeInfoProvider = CachedTypeInfoProvider;
            }

            var translator = new AssemblyTranslator(configuration, typeInfoProvider, manifest, assemblyCache);

            translator.Decompiling += MakeProgressHandler("Decompiling   ");
            translator.Optimizing += MakeProgressHandler ("Optimizing    ");
            translator.Writing += MakeProgressHandler    ("Generating JS ");

            translator.AssemblyLoaded += (fn) => {
                Console.Error.WriteLine("// Loaded {0}", ShortenPath(fn));
            };
            translator.CouldNotLoadSymbols += (fn, ex) => {
            };
            translator.CouldNotResolveAssembly += (fn, ex) => {
                Console.Error.WriteLine("// Could not load module {0}: {1}", fn, ex.Message);
            };
            translator.CouldNotDecompileMethod += (fn, ex) => {
                Console.Error.WriteLine("// Could not decompile method {0}: {1}", fn, ex.Message);
            };

            if (typeInfoProvider == null) {
                if (CachedTypeInfoProvider != null)
                    CachedTypeInfoProvider.Dispose();

                CachedTypeInfoProvider = translator.GetTypeInfoProvider();
                CachedTypeInfoProviderConfiguration = configuration;
            }

            return translator;
        }
开发者ID:snuderl,项目名称:JSIL,代码行数:42,代码来源:Program.cs


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