本文整理汇总了C#中IMetadataScope类的典型用法代码示例。如果您正苦于以下问题:C# IMetadataScope类的具体用法?C# IMetadataScope怎么用?C# IMetadataScope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMetadataScope类属于命名空间,在下文中一共展示了IMetadataScope类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StoreExportedType
internal void StoreExportedType(IMetadataScope scope, String fullName, TypeReference exportedTo)
{
if (scope != null)
{
exportMappings[GetTypeKey(scope, fullName)] = exportedTo;
}
}
示例2: Log
/// <summary>
/// Add the given message to the log.
/// </summary>
private void Log(MessageTypes type, string member, IMetadataScope scope, string msg)
{
if (IsDisposed) return;
if (InvokeRequired)
{
Invoke(new Action<MessageTypes, string, IMetadataScope, string>(Log), type, member, scope, msg);
}
else
{
if ((type >= MessageTypes.MissingFirst) && (type <= MessageTypes.MissingLast))
{
MemberNode node;
if (!nodes.TryGetValue(member, out node))
{
node = new MemberNode(member, scope, type);
node.ImageIndex = (int) type;
nodes.Add(member, node);
tvList.Nodes.Add(node);
}
node.Messages.Add(msg);
if (node == tvList.SelectedNode)
{
tvUsedIn.Nodes.Add(new TreeNode(msg));
}
}
else
{
tvLog.Nodes.Add(new TreeNode(msg) { ImageIndex = (int) type });
}
miCopy.Enabled = (tvList.Nodes.Count > 0);
}
}
示例3: ExportedType
public ExportedType(string @namespace, string name, ModuleDefinition module, IMetadataScope scope)
{
[email protected] = @namespace;
this.name = name;
this.scope = scope;
this.module = module;
}
示例4: GetScopeName
internal static string GetScopeName(IMetadataScope scope)
{
if (scope is AssemblyNameReference)
return ((AssemblyNameReference)scope).Name;
if (scope is ModuleDefinition)
return ((ModuleDefinition) scope).Assembly.Name.Name;
throw new Exception("Unsupported scope: " + scope);
}
示例5: FindProjectReference
public ProjectReference FindProjectReference(IMetadataScope scope)
{
if (scope == null)
return null;
string assemblyFullName = scope.AssemblyFullName();
return References.FirstOrDefault(
item => string.
Equals(item.FullName, assemblyFullName, StringComparison.InvariantCultureIgnoreCase));
}
示例6: FindType
public static TypeReference FindType(this ModuleDefinition currentModule, string @namespace, string typeName, IMetadataScope scope = null, params string[] typeParameters)
{
var result = new TypeReference(@namespace, typeName, currentModule, scope);
foreach (var typeParameter in typeParameters)
{
result.GenericParameters.Add(new GenericParameter(typeParameter, result));
}
return result;
}
示例7: getModule
public static MModule getModule(IMetadataScope scope)
{
if (scope is ModuleDefinition)
return getModule((ModuleDefinition)scope);
else if (scope is AssemblyNameReference)
return getModule((AssemblyNameReference)scope);
return null;
}
示例8: GetScopeName
internal static string GetScopeName(IMetadataScope scope)
{
string scopeStr = null;
if (scope is AssemblyNameReference)
scopeStr = ((AssemblyNameReference) scope).Name;
if (scope is ModuleDefinition)
scopeStr = ((ModuleDefinition) scope).Assembly.Name.Name;
return scopeStr;
}
示例9: GetReference
private static AssemblyNameReference GetReference(IMetadataScope scope)
{
ModuleDefinition definition = scope as ModuleDefinition;
if (definition != null)
{
return definition.Assembly.Name;
}
return (AssemblyNameReference) scope;
}
示例10: GetAssemblyNameReference
public static AssemblyNameReference GetAssemblyNameReference(IMetadataScope scope)
{
switch (scope.MetadataScopeType)
{
case MetadataScopeType.AssemblyNameReference:
return (AssemblyNameReference)scope;
case MetadataScopeType.ModuleDefinition:
return ((ModuleDefinition)scope).Assembly.Name;
default:
return null;
}
}
示例11: GetAssemblyFromScope
/// <summary>
/// Returns the <see cref="AssemblyNameReference"/> associated with the <see cref="IMetadataScope"/>
/// </summary>
/// <param name="scope">A <see cref="IMetadataScope"/></param>
/// <returns>The associated <see cref="AssemblyNameReference"/></returns>
private static AssemblyNameReference GetAssemblyFromScope(IMetadataScope scope)
{
switch (scope.MetadataScopeType)
{
case MetadataScopeType.AssemblyNameReference:
return (AssemblyNameReference)scope;
case MetadataScopeType.ModuleDefinition:
return ((ModuleDefinition) scope).Assembly.Name;
default:
throw new NotSupportedException();
}
}
示例12: AreSame
/// <summary>
/// Are the given scopes the same?
/// </summary>
public static bool AreSame(this IMetadataScope x, IMetadataScope y)
{
// Both null?
if ((x == null) && (y == null)) { return true; }
// One null, other not null
if ((x == null) || (y == null)) { return false; }
var nx = GetName(x);
var ny = GetName(y);
return (nx == ny);
}
示例13: GetAssemblyNameReference
static AssemblyNameReference GetAssemblyNameReference(IMetadataScope scope)
{
AssemblyNameReference reference;
if (scope is ModuleDefinition)
{
AssemblyDefinition asm = ((ModuleDefinition)scope).Assembly;
reference = asm.Name;
}
else
reference = (AssemblyNameReference)scope;
return reference;
}
示例14: ImportScope
IMetadataScope ImportScope(IMetadataScope scope)
{
switch (scope.MetadataScopeType)
{
case MetadataScopeType.AssemblyNameReference:
return ImportAssemblyName((AssemblyNameReference)scope);
case MetadataScopeType.ModuleDefinition:
return ImportAssemblyName(((ModuleDefinition)scope).Assembly.Name);
case MetadataScopeType.ModuleReference:
throw new NotImplementedException();
}
throw new NotSupportedException();
}
示例15: GetLoggerAdapterMetadataScope
public IMetadataScope GetLoggerAdapterMetadataScope()
{
if (_loggerScope == null)
{
//Check if reference to adapter assembly is present. If not, add it (we only look for the name, we assume that different versions are backward compatible)
var loggerReference = _moduleDefinition.AssemblyReferences.FirstOrDefault(assRef => assRef.Name.Equals(_configuration.AssemblyNameReference.Name));
if (loggerReference == null)
{
loggerReference = _configuration.AssemblyNameReference;
_moduleDefinition.AssemblyReferences.Add(loggerReference);
}
_loggerScope = loggerReference;
}
return _loggerScope;
}