本文整理汇总了C#中IAssemblyDefinition类的典型用法代码示例。如果您正苦于以下问题:C# IAssemblyDefinition类的具体用法?C# IAssemblyDefinition怎么用?C# IAssemblyDefinition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IAssemblyDefinition类属于命名空间,在下文中一共展示了IAssemblyDefinition类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NotImplementedException
bool ITypeDefinition.IsInternalAsPublic (IAssemblyDefinition assembly)
{
throw new NotImplementedException ();
}
示例2:
bool ITypeDefinition.IsInternalAsPublic (IAssemblyDefinition assembly)
{
return Module.DeclaringAssembly == assembly;
}
示例3:
bool ITypeDefinition.IsInternalAsPublic (IAssemblyDefinition assembly)
{
var a = importer.GetAssemblyDefinition (provider.Module.Assembly);
return a == assembly || a.IsFriendAssemblyTo (assembly);
}
示例4: IsFriendAssemblyTo
public bool IsFriendAssemblyTo (IAssemblyDefinition assembly)
{
if (internals_visible_to == null)
return false;
AssemblyName is_visible = null;
if (internals_visible_to_cache == null) {
internals_visible_to_cache = new Dictionary<IAssemblyDefinition, AssemblyName> ();
} else {
if (internals_visible_to_cache.TryGetValue (assembly, out is_visible))
return is_visible != null;
}
var token = assembly.GetPublicKeyToken ();
if (token != null && token.Length == 0)
token = null;
foreach (var internals in internals_visible_to) {
if (internals.Name != assembly.Name)
continue;
if (token == null && assembly is AssemblyDefinition) {
is_visible = internals;
break;
}
if (!ArrayComparer.IsEqual (token, internals.GetPublicKeyToken ()))
continue;
is_visible = internals;
break;
}
internals_visible_to_cache.Add (assembly, is_visible);
return is_visible != null;
}
示例5: GetAssemblyVisibleToName
public AssemblyName GetAssemblyVisibleToName (IAssemblyDefinition assembly)
{
return internals_visible_to_cache [assembly];
}
示例6: LoadBitmapsFromAssembly
public static Task<IList<BitmapContainer>> LoadBitmapsFromAssembly(IAssemblyDefinition assembly, Action<int> progressChangedCallback = null)
{
return Task.Factory.StartNew<IList<BitmapContainer>>(() =>
{
var bitmaps = new List<BitmapContainer>();
ICollection<IResource> resources = CollectResources(assembly);
int total = resources.Count;
int progressCount = 0;
//for (int i = 0; i < resources.Count; i++)
foreach (IResource resource in resources)
{
if (progressChangedCallback != null)
progressChangedCallback.Invoke((int)(100.0 * progressCount / total));
if (string.IsNullOrWhiteSpace(resource.Name)) continue;
if (resource.ResourceType != ResourceType.Embedded) continue;
IEmbeddedResource embeddedResource = resource as IEmbeddedResource;
if (embeddedResource == null) continue;
if (resource.Name.EndsWith(".resources"))
{
using (ResourceReader resourceReader = new ResourceReader(embeddedResource.GetResourceStream()))
{
var iterator = resourceReader.GetEnumerator();
while (iterator.MoveNext())
{
string rkey = iterator.Key as string;
if (string.IsNullOrWhiteSpace(rkey)) continue;
//Type rType = iterator.Value.GetType();
if (iterator.Value is string) continue;
Bitmap value = iterator.Value as Bitmap;
if (value != null)
{
bitmaps.Add(new BitmapContainer
{
Name = rkey,
Bitmap = Bitmap2BitmapImage(value)
});
continue;
}
try
{
BitmapSource bitmap = LoadBitmapImage(embeddedResource.GetResourceStream());
bitmaps.Add(new BitmapContainer
{
Name = rkey,
Bitmap = bitmap
});
}
catch
{
/*not a bitmap */
}
}
}
}
try
{
var bitmap = LoadBitmapImage(embeddedResource.GetResourceStream());
bitmaps.Add(new BitmapContainer
{
Name = resource.Name,
Bitmap = bitmap
});
}
catch
{
/*not a bitmap */
}
progressCount++;
}
return bitmaps;
});
}
示例7: CollectResources
private static ICollection<IResource> CollectResources(IAssemblyDefinition assembly)
{
List<IResource> result = new List<IResource>();
foreach (IResource resource in assembly.MainModule.Resources)
{
result.Add(resource);
}
return result;
}