本文整理汇总了C#中IAssemblyResolver.Resolve方法的典型用法代码示例。如果您正苦于以下问题:C# IAssemblyResolver.Resolve方法的具体用法?C# IAssemblyResolver.Resolve怎么用?C# IAssemblyResolver.Resolve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAssemblyResolver
的用法示例。
在下文中一共展示了IAssemblyResolver.Resolve方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReferenceContainer
public ReferenceContainer(ModuleDefinition moduleDefinition, IAssemblyResolver assemblyResolver)
{
var systemDefinition = assemblyResolver.Resolve("mscorlib");
var yalfDefinition = assemblyResolver.Resolve("Yalf");
var yalfTypes = yalfDefinition.MainModule.Types;
var logType = yalfTypes.Single(x => x.Name == "Log");
var iContextType = yalfTypes.Single(x => x.Name == "IContext");
var iDisposableType = systemDefinition.MainModule.Types.Single(x => x.Name == "IDisposable");
var exceptionType = systemDefinition.MainModule.Types.Single(x => x.Name == "Exception");
MethodContextMethod = moduleDefinition.Import(logType.Methods.Single(m => m.Name == "MethodContext"));
TraceExceptionMethod = moduleDefinition.Import(logType.Methods.Single(m => m.Name == "TraceException"));
CreateRecordReturnMethod = retType => {
var recordReturn = moduleDefinition.Import(iContextType.Methods.Single(m => m.Name == "RecordReturn"));
if (retType.IsGenericInstance)
{
return recordReturn.MakeGeneric(retType);
}
else
{
return recordReturn.MakeGeneric(retType);
}
};
DisposeMethod = moduleDefinition.Import(iDisposableType.Methods.Single(m => m.Name == "Dispose"));
LogType = moduleDefinition.Import(logType);
IContextType = moduleDefinition.Import(iContextType);
ExceptionType = moduleDefinition.Import(exceptionType);
PreserveStackTraceMethod = moduleDefinition.Import(iContextType.Methods.Single(m => m.Name == "PreserveStackTrace"));
}
示例2: FindReferences
public static void FindReferences(IAssemblyResolver assemblyResolver, ModuleDefinition moduleDefinition)
{
var baseLib = assemblyResolver.Resolve("mscorlib");
var baseLibTypes = baseLib.MainModule.Types;
var systemLib = assemblyResolver.Resolve("System");
var systemLibTypes = systemLib.MainModule.Types;
var winrt = !baseLibTypes.Any(type => type.Name == "Object");
if (winrt)
{
baseLib = assemblyResolver.Resolve("System.Runtime");
baseLibTypes = baseLib.MainModule.Types;
}
DateTime.TypeReference = moduleDefinition.Import( baseLibTypes.First( t => t.Name == "DateTime" ) );
DateTime.TypeReference.Resolve();
Boolean.TypeReference = moduleDefinition.Import(baseLibTypes.First(t => t.Name == "Boolean"));
Int32.TypeReference = moduleDefinition.Import(baseLibTypes.First(t => t.Name == "Int32"));
String.TypeReference = moduleDefinition.Import(baseLibTypes.First(t => t.Name == "String"));
Type.TypeReference = moduleDefinition.Import(baseLibTypes.First(t => t.Name == "Type"));
Type.GetTypeFromHandle = moduleDefinition.Import(Type.TypeReference.Resolve().FindMethod("GetTypeFromHandle", "RuntimeTypeHandle"));
Object.TypeReference = moduleDefinition.Import(baseLibTypes.First(t => t.Name == "Object"));
Object.GetHashcode = moduleDefinition.Import(Object.TypeReference.Resolve().FindMethod("GetHashCode"));
Object.GetType = moduleDefinition.Import(Object.TypeReference.Resolve().FindMethod("GetType"));
Object.StaticEquals = moduleDefinition.Import(Object.TypeReference.Resolve().FindMethod("Equals", "Object", "Object"));
Object.ReferenceEquals = moduleDefinition.Import(Object.TypeReference.Resolve().FindMethod("ReferenceEquals", "Object", "Object"));
IEnumerable.TypeReference = moduleDefinition.Import(baseLibTypes.First(t => t.Name == "IEnumerable"));
IEnumerable.GetEnumerator = moduleDefinition.Import(IEnumerable.TypeReference.Resolve().FindMethod("GetEnumerator"));
IEnumerator.TypeReference = moduleDefinition.Import(baseLibTypes.First(t => t.Name == "IEnumerator"));
IEnumerator.MoveNext = moduleDefinition.Import(IEnumerator.TypeReference.Resolve().FindMethod("MoveNext"));
IEnumerator.GetCurrent = moduleDefinition.Import(IEnumerator.TypeReference.Resolve().FindMethod("get_Current"));
IEquatable.TypeReference = moduleDefinition.Import(baseLibTypes.First(t => t.Name == "IEquatable`1"));
GeneratedCodeAttribute.TypeReference = moduleDefinition.Import(systemLibTypes.First(t => t.Name == "GeneratedCodeAttribute"));
GeneratedCodeAttribute.ConstructorStringString = moduleDefinition.Import(GeneratedCodeAttribute.TypeReference.Resolve().FindMethod(".ctor", "String", "String"));
DebuggerNonUserCodeAttribute.TypeReference = moduleDefinition.Import(baseLibTypes.First(t => t.Name == "DebuggerNonUserCodeAttribute"));
DebuggerNonUserCodeAttribute.Constructor = moduleDefinition.Import(DebuggerNonUserCodeAttribute.TypeReference.Resolve().FindMethod(".ctor"));
}
示例3: Resolve
public static TypeDefinition Resolve (IAssemblyResolver resolver, TypeReference type)
{
type = type.GetElementType ();
var scope = type.Scope;
switch (scope.MetadataScopeType) {
case MetadataScopeType.AssemblyNameReference:
var assembly = resolver.Resolve ((AssemblyNameReference) scope);
if (assembly == null)
return null;
return GetType (assembly.MainModule, type);
case MetadataScopeType.ModuleDefinition:
return GetType ((ModuleDefinition) scope, type);
case MetadataScopeType.ModuleReference:
var modules = type.Module.Assembly.Modules;
var module_ref = (ModuleReference) scope;
for (int i = 0; i < modules.Count; i++) {
var netmodule = modules [i];
if (netmodule.Name == module_ref.Name)
return GetType (netmodule, type);
}
break;
}
throw new NotSupportedException ();
}
示例4: ResolveType
public static TypeDefinition ResolveType(string type, ICustomAttributeProvider provider, IAssemblyResolver resolver)
{
if (provider == null)
throw new ArgumentException ("Type resolution support requires an AssemblyDefinition or TypeDefinition.", "provider");
if (resolver == null)
throw new ArgumentException ("Type resolution support requires a IAssemblyResolver.", "resolver");
// `type` is either a "bare" type "Foo.Bar", or an
// assembly-qualified type "Foo.Bar, AssemblyName [Version=...]?".
//
// Bare types are looked up via `provider`; assembly-qualified types are
// looked up via `resolver`
int c = type.IndexOf (',');
string typeName = c < 0 ? type : type.Substring (0, c);
string assmName = c < 0 ? null : type.Substring (c+1);
AssemblyDefinition assembly = assmName == null ? null : resolver.Resolve (assmName);
if (assembly == null) {
assembly = provider as AssemblyDefinition;
if (assembly == null) {
TypeDefinition decl = (TypeDefinition) provider;
assembly = decl.Module.Assembly;
}
}
var ret = assembly.Modules.Cast<ModuleDefinition> ()
.Select (md => md.Types.FirstOrDefault (t => t.FullName == typeName))
.FirstOrDefault (td => td != null);
if (ret == null)
throw new ArgumentException ("Type not found: " + type, "type");
return ret;
}
示例5: FindReferences
public static void FindReferences(IAssemblyResolver assemblyResolver, ModuleDefinition moduleDefinition)
{
var baseLib = assemblyResolver.Resolve("mscorlib");
var baseLibTypes = baseLib.MainModule.Types;
var winrt = baseLibTypes.All(type => type.Name != "Object");
if (winrt)
{
baseLib = assemblyResolver.Resolve("System.Runtime");
baseLibTypes = baseLib.MainModule.Types;
}
var argumentException = baseLibTypes.First(x => x.Name == "ArgumentException");
ArgumentExceptionConstructor = moduleDefinition.ImportReference(argumentException.Methods.First(x =>
x.IsConstructor &&
x.Parameters.Count == 2 &&
x.Parameters[0].ParameterType.Name == "String" &&
x.Parameters[1].ParameterType.Name == "String"));
var argumentNullException = baseLibTypes.First(x => x.Name == "ArgumentNullException");
ArgumentNullExceptionConstructor = moduleDefinition.ImportReference(argumentNullException.Methods.First(x =>
x.IsConstructor &&
x.Parameters.Count == 1 &&
x.Parameters[0].ParameterType.Name == "String"));
ArgumentNullExceptionWithMessageConstructor = moduleDefinition.ImportReference(argumentNullException.Methods.First(x =>
x.IsConstructor &&
x.Parameters.Count == 2 &&
x.Parameters[0].ParameterType.Name == "String" &&
x.Parameters[1].ParameterType.Name == "String"));
var invalidOperationException = baseLibTypes.First(x => x.Name == "InvalidOperationException");
InvalidOperationExceptionConstructor = moduleDefinition.ImportReference(invalidOperationException.Methods.First(x =>
x.IsConstructor &&
x.Parameters.Count == 1 &&
x.Parameters[0].ParameterType.Name == "String"));
var debugLib = !winrt ? assemblyResolver.Resolve("System") : assemblyResolver.Resolve("System.Diagnostics.Debug");
var debugLibTypes = debugLib.MainModule.Types;
var debug = debugLibTypes.First(x => x.Name == "Debug");
DebugAssertMethod = moduleDefinition.ImportReference(debug.Methods.First(x =>
x.IsStatic &&
x.Parameters.Count == 2 &&
x.Parameters[0].ParameterType.Name == "Boolean" &&
x.Parameters[1].ParameterType.Name == "String"));
}
示例6: FindReferences
public static void FindReferences(IAssemblyResolver assemblyResolver, ModuleDefinition moduleDefinition)
{
var baseLib = assemblyResolver.Resolve("mscorlib");
var baseLibTypes = baseLib.MainModule.Types;
var winrt = !baseLibTypes.Any(type => type.Name == "Object");
if (winrt)
{
baseLib = assemblyResolver.Resolve("System.Runtime");
baseLibTypes = baseLib.MainModule.Types;
}
var debugLib = !winrt ? baseLib : assemblyResolver.Resolve("System.Diagnostics.Debug");
var debugLibTypes = debugLib.MainModule.Types;
var collectionsLib = !winrt ? baseLib : assemblyResolver.Resolve("System.Collections");
var collectionsLibTypes = collectionsLib.MainModule.Types;
SystemType = moduleDefinition.Import(baseLibTypes.First(t => t.Name == "Type"));
DebuggerBrowsableStateType = moduleDefinition.Import(debugLibTypes.First(t => t.Name == "DebuggerBrowsableState"));
var listType = collectionsLibTypes.First(t => t.Name == "List`1");
ListCtor = moduleDefinition.Import(listType.Methods.First(m => m.IsConstructor && m.Parameters.Count == 1 && m.Parameters[0].ParameterType.Name.StartsWith("IEnumerable")));
ListToArray = moduleDefinition.Import(listType.Methods.First(m => m.Name == "ToArray"));
var debuggerBrowsableAttribute = debugLibTypes.First(t => t.Name == "DebuggerBrowsableAttribute");
DebuggerBrowsableAttributeCtor = moduleDefinition.Import(debuggerBrowsableAttribute.Methods.First(x => x.IsConstructor));
var debuggerDisplayAttribute = debugLibTypes.First(t => t.Name == "DebuggerDisplayAttribute");
DebuggerDisplayAttributeCtor = moduleDefinition.Import(debuggerDisplayAttribute.Methods.First(x => x.IsConstructor));
var debuggerTypeProxyAttribute = debugLibTypes.First(t => t.Name == "DebuggerTypeProxyAttribute");
DebuggerTypeProxyAttributeCtor = moduleDefinition.Import(debuggerTypeProxyAttribute.Methods.First(x => x.IsConstructor &&
x.Parameters[0].ParameterType.FullName == "System.Type"));
var compilerGeneratedAttribute = baseLibTypes.First(t => t.Name == "CompilerGeneratedAttribute");
CompilerGeneratedAttributeCtor = moduleDefinition.Import(compilerGeneratedAttribute.Methods.First(x => x.IsConstructor));
}
示例7: MarkAsProcessed
private void MarkAsProcessed(AssemblyDefinition assembly, IAssemblyResolver resolver)
{
TypeDefinition generatedCodeAttribute = resolver.Resolve("System").MainModule.GetType(typeof(GeneratedCodeAttribute).FullName);
MethodDefinition constructor = generatedCodeAttribute.Methods.Single(a => a.IsConstructor && a.Parameters.Count == 2);
TypeReference stringType = assembly.MainModule.TypeSystem.String;
assembly.CustomAttributes.Add(new CustomAttribute(assembly.MainModule.ImportReference(constructor))
{
ConstructorArguments =
{
new CustomAttributeArgument(stringType, "SignumTask"),
new CustomAttributeArgument(stringType, this.GetType().Assembly.GetName().Version.ToString()),
}
});
}
示例8: RegisterDefaultSerializationProfile
private static void RegisterDefaultSerializationProfile(IAssemblyResolver assemblyResolver, AssemblyDefinition assembly, ComplexSerializerCodeGenerator generator)
{
var mscorlibAssembly = CecilExtensions.FindCorlibAssembly(assembly);
if (mscorlibAssembly == null)
{
Console.WriteLine("Missing mscorlib.dll from assembly {0}", assembly.FullName);
throw new InvalidOperationException("Missing mscorlib.dll from assembly");
}
var coreSerializationAssembly = assemblyResolver.Resolve("SiliconStudio.Core");
// Register serializer factories (determine which type requires which serializer)
generator.SerializerFactories.Add(new CecilGenericSerializerFactory(typeof(IList<>), coreSerializationAssembly.MainModule.GetTypeResolved("SiliconStudio.Core.Serialization.Serializers.ListInterfaceSerializer`1")));
generator.SerializerFactories.Add(new CecilGenericSerializerFactory(typeof(List<>), coreSerializationAssembly.MainModule.GetTypeResolved("SiliconStudio.Core.Serialization.Serializers.ListSerializer`1")));
generator.SerializerFactories.Add(new CecilGenericSerializerFactory(typeof(KeyValuePair<,>), coreSerializationAssembly.MainModule.GetTypeResolved("SiliconStudio.Core.Serialization.Serializers.KeyValuePairSerializer`2")));
generator.SerializerFactories.Add(new CecilGenericSerializerFactory(typeof(IDictionary<,>), coreSerializationAssembly.MainModule.GetTypeResolved("SiliconStudio.Core.Serialization.Serializers.DictionaryInterfaceSerializer`2")));
generator.SerializerFactories.Add(new CecilGenericSerializerFactory(typeof(Dictionary<,>), coreSerializationAssembly.MainModule.GetTypeResolved("SiliconStudio.Core.Serialization.Serializers.DictionarySerializer`2")));
generator.SerializerFactories.Add(new CecilGenericSerializerFactory(typeof(Nullable<>), coreSerializationAssembly.MainModule.GetTypeResolved("SiliconStudio.Core.Serialization.Serializers.NullableSerializer`1")));
generator.SerializerFactories.Add(new CecilEnumSerializerFactory(coreSerializationAssembly.MainModule.GetTypeResolved("SiliconStudio.Core.Serialization.Serializers.EnumSerializer`1")));
generator.SerializerFactories.Add(new CecilArraySerializerFactory(coreSerializationAssembly.MainModule.GetTypeResolved("SiliconStudio.Core.Serialization.Serializers.ArraySerializer`1")));
// Iterate over tuple size
for (int i = 1; i <= 4; ++i)
{
generator.SerializerDependencies.Add(new CecilSerializerDependency(
string.Format("System.Tuple`{0}", i),
coreSerializationAssembly.MainModule.GetTypeResolved(string.Format("SiliconStudio.Core.Serialization.Serializers.TupleSerializer`{0}", i))));
generator.SerializerDependencies.Add(new CecilSerializerDependency(string.Format("SiliconStudio.Core.Serialization.Serializers.TupleSerializer`{0}", i)));
}
// Register serializer dependencies (determine which serializer serializes which sub-type)
generator.SerializerDependencies.Add(new CecilSerializerDependency("SiliconStudio.Core.Serialization.Serializers.ArraySerializer`1"));
generator.SerializerDependencies.Add(new CecilSerializerDependency("SiliconStudio.Core.Serialization.Serializers.KeyValuePairSerializer`2"));
generator.SerializerDependencies.Add(new CecilSerializerDependency("SiliconStudio.Core.Serialization.Serializers.ListSerializer`1"));
generator.SerializerDependencies.Add(new CecilSerializerDependency("SiliconStudio.Core.Serialization.Serializers.ListInterfaceSerializer`1"));
generator.SerializerDependencies.Add(new CecilSerializerDependency("SiliconStudio.Core.Serialization.Serializers.NullableSerializer`1"));
generator.SerializerDependencies.Add(new CecilSerializerDependency("SiliconStudio.Core.Serialization.Serializers.DictionarySerializer`2",
mscorlibAssembly.MainModule.GetTypeResolved(typeof(KeyValuePair<,>).FullName)));
generator.SerializerDependencies.Add(new CecilSerializerDependency("SiliconStudio.Core.Serialization.Serializers.DictionaryInterfaceSerializer`2",
mscorlibAssembly.MainModule.GetTypeResolved(typeof(KeyValuePair<,>).FullName)));
}
示例9: ResolveTypeReference
public static TypeDefinition ResolveTypeReference(TypeReference typeReference, IAssemblyResolver assemblyResolver, bool throwIfNotResolved)
{
TypeDefinition definition = typeReference as TypeDefinition;
if (definition != null)
{
return definition;
}
ArrayType arrayType = typeReference as ArrayType;
if (arrayType != null)
{
return ResolveTypeReference(arrayType, assemblyResolver, throwIfNotResolved);
}
// TODO: Use a weak reference cache here
IMetadataScope metadataScope = typeReference.Scope;
// check referenced assemblies
AssemblyNameReference assemblyNameReference = metadataScope as AssemblyNameReference;
if (assemblyNameReference != null)
{
AssemblyDefinition assemblyDefinition;
// module could be null, so check scope
if (typeReference.Module == null)
{
assemblyDefinition = assemblyResolver.Resolve(assemblyNameReference);
}
else
{
assemblyDefinition = typeReference.Module.Assembly.Resolver.Resolve(assemblyNameReference);
}
foreach (ModuleDefinition moduleDefinition in assemblyDefinition.Modules)
{
TypeDefinition ret = findTypeDefinition(typeReference, moduleDefinition.Types);
if (ret != null)
{
return ret;
}
}
}
ModuleDefinition moduleDefinition2 = metadataScope as ModuleDefinition;
if (moduleDefinition2 != null)
{
TypeDefinition ret = findTypeDefinition(typeReference, moduleDefinition2.Types);
if (ret != null)
{
return ret;
}
}
if (metadataScope == null)
{
// corlib?
moduleDefinition2 = CoreTypes.Corlib.MainModule;
TypeDefinition ret = findTypeDefinition(typeReference, moduleDefinition2.Types);
if (ret != null)
{
return ret;
}
}
if (throwIfNotResolved)
{
throw new CompilerException("Unable to resolve type reference: " + typeReference);
}
else
{
return null;
}
}
示例10: TypeFinder
public TypeFinder(IAssemblyResolver assemblyResolver, ModuleDefinition moduleDefinition)
{
this.moduleDefinition = moduleDefinition;
var msCoreLibDefinition = assemblyResolver.Resolve("mscorlib");
msCoreTypes = msCoreLibDefinition.MainModule.Types;
}
示例11: Create
/// <summary>
/// Resolves the common Stiletto assembly, loads it into memory, and
/// extracts types and methods so they can be imported into woven
/// modules.
/// </summary>
/// <param name="assemblyResolver">
/// The <see cref="IAssemblyResolver"/> instance provided by Fody.
/// </param>
/// <returns>
/// Returns a selection of relevant types and methods from Stiletto.
/// </returns>
public static StilettoReferences Create(IAssemblyResolver assemblyResolver)
{
var stiletto = assemblyResolver.Resolve("Stiletto").MainModule;
var types = stiletto
.GetAllTypes()
.Where(t => t.IsPublic)
.ToDictionary(t => t.FullName, t => t, StringComparer.Ordinal);
var tBinding = types["Stiletto.Internal.Binding"];
var tBinding_ctor = tBinding.GetMethod(".ctor");
var tBinding_GetDependencies = tBinding.GetMethod("GetDependencies");
var tBinding_Resolve = tBinding.GetMethod("Resolve");
var tBinding_Get = tBinding.GetMethod("Get");
var tBinding_InjectProperties = tBinding.GetMethod("InjectProperties");
var tBinding_RequiredBy_Getter = tBinding.GetProperty("RequiredBy").GetMethod;
var tBinding_IsLibrary_Setter = tBinding.GetProperty("IsLibrary").SetMethod;
var tProviderMethodBindingBase = types["Stiletto.Internal.ProviderMethodBindingBase"];
var tProviderMethodBingingBase_ctor = tProviderMethodBindingBase.GetMethod(".ctor");
var tRuntimeModule = types["Stiletto.Internal.RuntimeModule"];
var tRuntimeModule_ctor = tRuntimeModule.GetMethod(".ctor");
var tRuntimeModule_module_getter = tRuntimeModule.GetProperty("Module").GetMethod;
var tContainer = types["Stiletto.Container"];
var tContainer_Create = tContainer.GetMethod("Create");
var tContainer_CreateWithPlugins = tContainer.GetMethod("CreateWithPlugins");
var tPlugin = types["Stiletto.Internal.IPlugin"];
var tPlugin_GetInjectBinding = tPlugin.GetMethod("GetInjectBinding");
var tPlugin_GetLazyInjectBinding = tPlugin.GetMethod("GetLazyInjectBinding");
var tPlugin_GetProviderInjectBinding = tPlugin.GetMethod("GetIProviderInjectBinding");
var tPlugin_GetRuntimeModule = tPlugin.GetMethod("GetRuntimeModule");
var tResolver = types["Stiletto.Internal.Resolver"];
var tResolver_RequestBinding = tResolver.GetMethod("RequestBinding");
var tProviderOfT = types["Stiletto.IProvider`1"];
var tProviderOfT_Get = tProviderOfT.GetMethod("Get");
var tInjectAttribute = types["Stiletto.InjectAttribute"];
var tModuleAttribute = types["Stiletto.ModuleAttribute"];
var tProvidesAttribute = types["Stiletto.ProvidesAttribute"];
var tNamedAttribute = types["Stiletto.NamedAttribute"];
var tSingletonAttribute = types["Stiletto.SingletonAttribute"];
var tProcessedAssemblyAttribute = types["Stiletto.Internal.Plugins.Codegen.ProcessedAssemblyAttribute"];
var tProcessedAssemblyAttribute_Ctor = tProcessedAssemblyAttribute.GetDefaultConstructor();
return new StilettoReferences
{
Binding = tBinding,
Binding_Ctor = tBinding_ctor,
Binding_GetDependencies = tBinding_GetDependencies,
Binding_Resolve = tBinding_Resolve,
Binding_Get = tBinding_Get,
Binding_InjectProperties = tBinding_InjectProperties,
Binding_RequiredBy_Getter = tBinding_RequiredBy_Getter,
Binding_IsLibrary_Setter = tBinding_IsLibrary_Setter,
ProviderMethodBindingBase = tProviderMethodBindingBase,
ProviderMethodBindingBase_Ctor = tProviderMethodBingingBase_ctor,
RuntimeModule = tRuntimeModule,
RuntimeModule_Ctor = tRuntimeModule_ctor,
RuntimeModule_Module_Getter = tRuntimeModule_module_getter,
Container = tContainer,
Container_Create = tContainer_Create,
Container_CreateWithPlugins = tContainer_CreateWithPlugins,
IPlugin = tPlugin,
IPlugin_GetInjectBinding = tPlugin_GetInjectBinding,
IPlugin_GetLazyInjectBinding = tPlugin_GetLazyInjectBinding,
IPlugin_GetIProviderInjectBinding = tPlugin_GetProviderInjectBinding,
IPlugin_GetRuntimeModue = tPlugin_GetRuntimeModule,
Resolver = tResolver,
Resolver_RequestBinding = tResolver_RequestBinding,
IProviderOfT = tProviderOfT,
IProviderOfT_Get = tProviderOfT_Get,
InjectAttribute = tInjectAttribute,
ModuleAttribute = tModuleAttribute,
ProvidesAttribute = tProvidesAttribute,
NamedAttribute = tNamedAttribute,
SingletonAttribute = tSingletonAttribute,
//.........这里部分代码省略.........
示例12: SafeResolveBridge
private static AssemblyDefinition SafeResolveBridge(IAssemblyResolver resolver)
{
try
{
return resolver.Resolve("SyntaxTree.VisualStudio.Unity.Bridge", new ReaderParameters { AssemblyResolver = resolver });
}
catch (AssemblyResolutionException)
{
return null;
}
}