You've already forked linux-packaging-mono
Imported Upstream version 5.0.0.42
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
parent
1190d13a04
commit
6bdd276d05
36
external/linker/tuner/Mono.Tuner/Extensions.cs
vendored
Normal file
36
external/linker/tuner/Mono.Tuner/Extensions.cs
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Mono.Cecil;
|
||||
|
||||
using Mono.Linker;
|
||||
|
||||
namespace Mono.Tuner {
|
||||
|
||||
public static partial class Extensions {
|
||||
|
||||
public static bool TryGetLinkedAssembly (this LinkContext context, string name, out AssemblyDefinition assembly)
|
||||
{
|
||||
assembly = GetAssembly (context, name);
|
||||
if (assembly == null)
|
||||
return false;
|
||||
|
||||
return context.Annotations.GetAction (assembly) == AssemblyAction.Link;
|
||||
}
|
||||
|
||||
public static AssemblyDefinition GetAssembly (this LinkContext context, string assembly_name)
|
||||
{
|
||||
foreach (var assembly in context.GetAssemblies ())
|
||||
if (assembly.Name.Name == assembly_name)
|
||||
return assembly;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// note: direct check, no inheritance
|
||||
public static bool Is (this TypeReference type, string @namespace, string name)
|
||||
{
|
||||
return ((type != null) && (type.Name == name) && (type.Namespace == @namespace));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user